summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2016-09-01 13:39:08 +0200
committerPale Moon <git-repo@palemoon.org>2016-09-01 13:39:08 +0200
commit3d8ce1a11a7347cc94a937719c4bc8df46fb8d14 (patch)
tree8c26ca375a6312751c00a27e1653fb6f189f0463 /build
parente449bdb1ec3a82f204bffdd9c3c54069d086eee3 (diff)
downloadpalemoon-gre-3d8ce1a11a7347cc94a937719c4bc8df46fb8d14.tar.gz
Base import of Tycho code (warning: huge commit)
Diffstat (limited to 'build')
-rw-r--r--build/.lldbinit.in2
-rw-r--r--build/ConfigStatus.py133
-rw-r--r--build/Makefile.in131
-rw-r--r--build/annotationProcessors/AnnotationInfo.java30
-rw-r--r--build/annotationProcessors/AnnotationProcessor.java154
-rw-r--r--build/annotationProcessors/CodeGenerator.java462
-rw-r--r--build/annotationProcessors/Makefile.in12
-rw-r--r--build/annotationProcessors/SDKProcessor.java237
-rw-r--r--build/annotationProcessors/classloader/AnnotatableEntity.java57
-rw-r--r--build/annotationProcessors/classloader/ClassWithOptions.java15
-rw-r--r--build/annotationProcessors/classloader/IterableJarLoadingURLClassLoader.java75
-rw-r--r--build/annotationProcessors/classloader/JarClassIterator.java61
-rw-r--r--build/annotationProcessors/moz.build20
-rw-r--r--build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java81
-rw-r--r--build/annotationProcessors/utils/GeneratableElementIterator.java164
-rw-r--r--build/annotationProcessors/utils/Utils.java247
-rw-r--r--build/appini_header.py20
-rw-r--r--build/application.ini7
-rw-r--r--build/autoconf/altoptions.m477
-rw-r--r--build/autoconf/android.m4272
-rw-r--r--build/autoconf/arch.m440
-rw-r--r--build/autoconf/ccache.m436
-rw-r--r--build/autoconf/check_debug_ranges.py60
-rw-r--r--build/autoconf/clang-plugin.m460
-rw-r--r--build/autoconf/compiler-opts.m4262
-rwxr-xr-xbuild/autoconf/config.guess641
-rw-r--r--build/autoconf/config.status.m4119
-rw-r--r--build/autoconf/config.sub293
-rw-r--r--build/autoconf/ffi.m4100
-rw-r--r--build/autoconf/frameptr.m47
-rw-r--r--build/autoconf/gcc-pr49911.m471
-rw-r--r--build/autoconf/hooks.m471
-rw-r--r--build/autoconf/hotfixes.m424
-rw-r--r--build/autoconf/icu.m4296
-rwxr-xr-xbuild/autoconf/libstdcxx.py77
-rw-r--r--build/autoconf/llvm-pr8927.m42
-rwxr-xr-xbuild/autoconf/match-dir.sh69
-rwxr-xr-xbuild/autoconf/mozconfig-find76
-rwxr-xr-xbuild/autoconf/mozconfig2client-mk80
-rwxr-xr-xbuild/autoconf/mozconfig2configure103
-rw-r--r--build/autoconf/moznbytetype.m4103
-rw-r--r--build/autoconf/nspr-build.m4263
-rw-r--r--build/autoconf/nspr.m422
-rw-r--r--build/autoconf/nss.m422
-rw-r--r--build/autoconf/pkg.m44
-rw-r--r--build/autoconf/python-virtualenv.m412
-rw-r--r--build/autoconf/toolchain.m4251
-rw-r--r--build/autoconf/winsdk.m429
-rw-r--r--build/autoconf/wrapper.m459
-rw-r--r--build/autoconf/zlib.m42
-rw-r--r--build/automation-build.mk24
-rw-r--r--build/automation.py.in596
-rw-r--r--build/automationutils.py736
-rw-r--r--build/binary-location.mk12
-rw-r--r--build/bloatcycle.html164
-rw-r--r--build/cl.py105
-rw-r--r--build/clang-plugin/Makefile.in54
-rw-r--r--build/clang-plugin/clang-plugin.cpp506
-rwxr-xr-xbuild/clang-plugin/configure48
-rw-r--r--build/clang-plugin/moz.build (renamed from build/unix/test/moz.build)12
-rw-r--r--build/clang-plugin/tests/Makefile.in15
-rw-r--r--build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp41
-rw-r--r--build/clang-plugin/tests/TestCustomHeap.cpp28
-rw-r--r--build/clang-plugin/tests/TestGlobalClass.cpp52
-rw-r--r--build/clang-plugin/tests/TestNANTestingExpr.cpp16
-rw-r--r--build/clang-plugin/tests/TestNANTestingExprC.c17
-rw-r--r--build/clang-plugin/tests/TestNoAddRefReleaseOnReturn.cpp65
-rw-r--r--build/clang-plugin/tests/TestNoArithmeticExprInArgument.cpp32
-rw-r--r--build/clang-plugin/tests/TestNonHeapClass.cpp2
-rw-r--r--build/clang-plugin/tests/TestStackClass.cpp2
-rw-r--r--build/clang-plugin/tests/TestTrivialCtorDtor.cpp58
-rw-r--r--build/clang-plugin/tests/moz.build22
-rw-r--r--build/compare-mozconfig/compare-mozconfigs-wrapper.py63
-rw-r--r--build/compare-mozconfig/compare-mozconfigs.py165
-rwxr-xr-xbuild/defines.sh2
-rw-r--r--build/docs/androideclipse.rst90
-rw-r--r--build/docs/build-overview.rst117
-rw-r--r--build/docs/build-targets.rst62
-rw-r--r--build/docs/cppeclipse.rst54
-rw-r--r--build/docs/defining-binaries.rst315
-rw-r--r--build/docs/environment-variables.rst31
-rw-r--r--build/docs/glossary.rst48
-rw-r--r--build/docs/index.rst46
-rw-r--r--build/docs/jar-manifests.rst81
-rw-r--r--build/docs/mozbuild-files.rst116
-rw-r--r--build/docs/mozbuild-symbols.rst7
-rw-r--r--build/docs/mozbuild/dumbmake.rst38
-rw-r--r--build/docs/mozbuild/index.rst41
-rw-r--r--build/docs/mozconfigs.rst70
-rw-r--r--build/docs/mozinfo.rst148
-rw-r--r--build/docs/pgo.rst40
-rw-r--r--build/docs/preprocessor.rst244
-rw-r--r--build/docs/python.rst178
-rw-r--r--build/docs/slow.rst179
-rw-r--r--build/docs/supported-configurations.rst55
-rw-r--r--build/docs/test_manifests.rst201
-rw-r--r--build/docs/visualstudio.rst100
-rw-r--r--build/dumbmake-dependencies16
-rw-r--r--build/dumpScreen.py30
-rw-r--r--build/gen_mach_buildprops.py123
-rw-r--r--build/gen_test_packages_manifest.py69
-rw-r--r--build/goanna_templates.mozbuild169
-rw-r--r--build/gyp.mozbuild126
-rw-r--r--build/leaktest.py.in50
-rw-r--r--build/link.py45
-rw-r--r--build/mach_bootstrap.py111
-rw-r--r--build/macosx/mozconfig.common18
-rw-r--r--build/macosx/universal/flight.mk45
-rw-r--r--build/macosx/universal/jenkins-build.sh18
-rw-r--r--build/macosx/universal/mozconfig (renamed from build/macosx/universal/mozconfig.debug)9
-rw-r--r--build/macosx/universal/mozconfig.common10
-rw-r--r--build/macosx/universal/mozconfig.gstreamer3
-rw-r--r--build/macosx/universal/mozconfig.release14
-rwxr-xr-xbuild/macosx/universal/unify8
-rw-r--r--build/mobile/b2gautomation.py93
-rw-r--r--build/mobile/remoteautomation.py293
-rw-r--r--build/mobile/robocop/Actions.java (renamed from build/mobile/robocop/Actions.java.in)30
-rw-r--r--build/mobile/robocop/AndroidManifest.xml.in28
-rw-r--r--build/mobile/robocop/Assert.java (renamed from build/mobile/robocop/Assert.java.in)11
-rw-r--r--build/mobile/robocop/Driver.java (renamed from build/mobile/robocop/Driver.java.in)8
-rw-r--r--build/mobile/robocop/Element.java (renamed from build/mobile/robocop/Element.java.in)3
-rw-r--r--build/mobile/robocop/FennecInstrumentationTestRunner.java (renamed from build/mobile/robocop/FennecInstrumentationTestRunner.java.in)7
-rw-r--r--build/mobile/robocop/FennecMochitestAssert.java (renamed from build/mobile/robocop/FennecMochitestAssert.java.in)125
-rw-r--r--build/mobile/robocop/FennecNativeActions.java385
-rw-r--r--build/mobile/robocop/FennecNativeActions.java.in483
-rw-r--r--build/mobile/robocop/FennecNativeDriver.java (renamed from build/mobile/robocop/FennecNativeDriver.java.in)273
-rw-r--r--build/mobile/robocop/FennecNativeElement.java (renamed from build/mobile/robocop/FennecNativeElement.java.in)32
-rw-r--r--build/mobile/robocop/FennecTalosAssert.java (renamed from build/mobile/robocop/FennecTalosAssert.java.in)23
-rw-r--r--build/mobile/robocop/Makefile.in110
-rw-r--r--build/mobile/robocop/PaintedSurface.java (renamed from build/mobile/robocop/PaintedSurface.java.in)45
-rw-r--r--build/mobile/robocop/README6
-rw-r--r--build/mobile/robocop/RoboCopException.java (renamed from build/mobile/robocop/RoboCopException.java.in)3
-rw-r--r--build/mobile/robocop/RobocopShare1.java17
-rw-r--r--build/mobile/robocop/RobocopShare2.java17
-rw-r--r--build/mobile/robocop/RobocopUtils.java58
-rw-r--r--build/mobile/robocop/RobocopUtils.java.in43
-rw-r--r--build/mobile/robocop/StructuredLogger.java188
-rw-r--r--build/mobile/robocop/moz.build14
-rw-r--r--build/mobile/robocop/robotium-solo-3.6.jarbin59067 -> 0 bytes
-rw-r--r--build/mobile/robocop/robotium-solo-4.3.1.jarbin0 -> 106789 bytes
-rw-r--r--build/mobile/sutagent/android/CmdWorkerThread.java4
-rw-r--r--build/mobile/sutagent/android/DataWorkerThread.java4
-rw-r--r--build/mobile/sutagent/android/DoCommand.java201
-rw-r--r--build/mobile/sutagent/android/Makefile.in55
-rw-r--r--build/mobile/sutagent/android/R.java37
-rw-r--r--build/mobile/sutagent/android/SUTAgentAndroid.java15
-rw-r--r--build/mobile/sutagent/android/WifiConfiguration.java2
-rw-r--r--build/mobile/sutagent/android/fencp/Makefile.in50
-rw-r--r--build/mobile/sutagent/android/fencp/R.java27
-rw-r--r--build/mobile/sutagent/android/fencp/moz.build3
-rw-r--r--build/mobile/sutagent/android/ffxcp/Makefile.in50
-rw-r--r--build/mobile/sutagent/android/ffxcp/R.java27
-rw-r--r--build/mobile/sutagent/android/ffxcp/moz.build3
-rw-r--r--build/mobile/sutagent/android/moz.build3
-rw-r--r--build/mobile/sutagent/android/watcher/Makefile.in54
-rw-r--r--build/mobile/sutagent/android/watcher/R.java29
-rw-r--r--build/mobile/sutagent/android/watcher/RedirOutputThread.java1
-rw-r--r--build/mobile/sutagent/android/watcher/WatcherService.java26
-rw-r--r--build/mobile/sutagent/android/watcher/moz.build3
-rw-r--r--build/moz-automation.mk124
-rw-r--r--build/moz.build29
-rw-r--r--build/mozconfig.automation32
-rw-r--r--build/mozconfig.cache80
-rw-r--r--build/mozconfig.common6
-rw-r--r--build/mozconfig.vs-common4
-rw-r--r--build/mozconfig.vs2010-common8
-rw-r--r--build/mozconfig.win-common11
-rw-r--r--build/package/Makefile.in77
-rwxr-xr-xbuild/package/mac_osx/pkg-dmg2
-rw-r--r--build/pgo/certs/alternateroot.ca18
-rw-r--r--build/pgo/certs/cert8.dbbin65536 -> 65536 bytes
-rw-r--r--build/pgo/certs/evroot.ca32
-rw-r--r--build/pgo/certs/key3.dbbin98304 -> 110592 bytes
-rw-r--r--build/pgo/index.html177
-rw-r--r--build/pgo/js-input/sunspider/3d-cube.html (renamed from build/pgo/js-input/3d-cube.html)0
-rw-r--r--build/pgo/js-input/sunspider/3d-morph.html (renamed from build/pgo/js-input/3d-morph.html)0
-rw-r--r--build/pgo/js-input/sunspider/3d-raytrace.html (renamed from build/pgo/js-input/3d-raytrace.html)0
-rw-r--r--build/pgo/js-input/sunspider/access-binary-trees.html (renamed from build/pgo/js-input/access-binary-trees.html)0
-rw-r--r--build/pgo/js-input/sunspider/access-fannkuch.html (renamed from build/pgo/js-input/access-fannkuch.html)0
-rw-r--r--build/pgo/js-input/sunspider/access-nbody.html (renamed from build/pgo/js-input/access-nbody.html)0
-rw-r--r--build/pgo/js-input/sunspider/access-nsieve.html (renamed from build/pgo/js-input/access-nsieve.html)0
-rw-r--r--build/pgo/js-input/sunspider/bitops-3bit-bits-in-byte.html (renamed from build/pgo/js-input/bitops-3bit-bits-in-byte.html)0
-rw-r--r--build/pgo/js-input/sunspider/bitops-bits-in-byte.html (renamed from build/pgo/js-input/bitops-bits-in-byte.html)0
-rw-r--r--build/pgo/js-input/sunspider/bitops-bitwise-and.html (renamed from build/pgo/js-input/bitops-bitwise-and.html)0
-rw-r--r--build/pgo/js-input/sunspider/bitops-nsieve-bits.html (renamed from build/pgo/js-input/bitops-nsieve-bits.html)0
-rw-r--r--build/pgo/js-input/sunspider/controlflow-recursive.html (renamed from build/pgo/js-input/controlflow-recursive.html)0
-rw-r--r--build/pgo/js-input/sunspider/crypto-aes.html (renamed from build/pgo/js-input/crypto-aes.html)0
-rw-r--r--build/pgo/js-input/sunspider/crypto-md5.html (renamed from build/pgo/js-input/crypto-md5.html)0
-rw-r--r--build/pgo/js-input/sunspider/crypto-sha1.html (renamed from build/pgo/js-input/crypto-sha1.html)0
-rw-r--r--build/pgo/js-input/sunspider/date-format-tofte.html (renamed from build/pgo/js-input/date-format-tofte.html)0
-rw-r--r--build/pgo/js-input/sunspider/date-format-xparb.html (renamed from build/pgo/js-input/date-format-xparb.html)0
-rw-r--r--build/pgo/js-input/sunspider/math-cordic.html (renamed from build/pgo/js-input/math-cordic.html)0
-rw-r--r--build/pgo/js-input/sunspider/math-partial-sums.html (renamed from build/pgo/js-input/math-partial-sums.html)0
-rw-r--r--build/pgo/js-input/sunspider/math-spectral-norm.html (renamed from build/pgo/js-input/math-spectral-norm.html)0
-rw-r--r--build/pgo/js-input/sunspider/regexp-dna.html (renamed from build/pgo/js-input/regexp-dna.html)0
-rw-r--r--build/pgo/js-input/sunspider/string-base64.html (renamed from build/pgo/js-input/string-base64.html)40
-rw-r--r--build/pgo/js-input/sunspider/string-fasta.html (renamed from build/pgo/js-input/string-fasta.html)0
-rw-r--r--build/pgo/js-input/sunspider/string-tagcloud.html (renamed from build/pgo/js-input/string-tagcloud.html)0
-rw-r--r--build/pgo/js-input/sunspider/string-unpack-code.html (renamed from build/pgo/js-input/string-unpack-code.html)0
-rw-r--r--build/pgo/js-input/sunspider/string-validate-input.html (renamed from build/pgo/js-input/string-validate-input.html)0
-rwxr-xr-xbuild/pgo/profileserver.py12
-rw-r--r--build/pgo/server-locations.txt47
-rwxr-xr-xbuild/pymake/make.py20
-rw-r--r--build/pymake/pymake/data.py34
-rw-r--r--build/pymake/pymake/functions.py6
-rw-r--r--build/pymake/pymake/parser.py31
-rw-r--r--build/pymake/pymake/parserdata.py13
-rw-r--r--build/pymake/pymake/process.py69
-rw-r--r--build/pymake/tests/cmd-stripdotslash.mk5
-rw-r--r--build/pymake/tests/empty-arg.mk2
-rw-r--r--build/pymake/tests/foreach-local-variable.mk8
-rw-r--r--build/pymake/tests/includedeps-stripdotslash.deps1
-rw-r--r--build/pymake/tests/includedeps-stripdotslash.mk8
-rw-r--r--build/pymake/tests/includedeps-variables.deps1
-rw-r--r--build/pymake/tests/includedeps-variables.mk10
-rw-r--r--build/pymake/tests/multiple-rules-prerequisite-merge.mk25
-rw-r--r--build/pymake/tests/native-command-delay-load.mk12
-rw-r--r--build/pymake/tests/pycmd.py3
-rw-r--r--build/pymake/tests/subdir/delayload.py1
-rw-r--r--build/release/info.py218
-rw-r--r--build/release/sanity.py124
-rw-r--r--build/sanitizers/lsan_suppressions.txt105
-rw-r--r--build/sanitizers/tsan_suppressions.txt21
-rw-r--r--build/sccache.mk18
-rw-r--r--build/stlport/Android.mk133
-rw-r--r--build/stlport/LICENSE27
-rw-r--r--build/stlport/MODULE_LICENSE_BSD_LIKE0
-rw-r--r--build/stlport/Makefile.in17
-rw-r--r--build/stlport/README69
-rw-r--r--build/stlport/README.android9
-rw-r--r--build/stlport/README.mozilla11
-rw-r--r--build/stlport/README.original64
-rw-r--r--build/stlport/android-mozilla-config.patch82
-rw-r--r--build/stlport/moz.build61
-rw-r--r--build/stlport/overrides/new65
-rw-r--r--build/stlport/src/_stdio_file.h117
-rw-r--r--build/stlport/src/acquire_release.h46
-rw-r--r--build/stlport/src/aligned_buffer.h21
-rw-r--r--build/stlport/src/allocators.cpp1121
-rw-r--r--build/stlport/src/bitset.cpp156
-rw-r--r--build/stlport/src/c_locale.c29
-rw-r--r--build/stlport/src/c_locale.h450
-rw-r--r--build/stlport/src/c_locale_dummy/c_locale_dummy.c531
-rw-r--r--build/stlport/src/c_locale_glibc/c_locale_glibc2.c705
-rw-r--r--build/stlport/src/c_locale_win32/c_locale_win32.c1786
-rw-r--r--build/stlport/src/c_locale_win32/c_wlocale_win32.c314
-rw-r--r--build/stlport/src/codecvt.cpp143
-rw-r--r--build/stlport/src/collate.cpp69
-rw-r--r--build/stlport/src/complex.cpp353
-rw-r--r--build/stlport/src/complex_io.cpp157
-rw-r--r--build/stlport/src/complex_trig.cpp192
-rw-r--r--build/stlport/src/ctype.cpp486
-rw-r--r--build/stlport/src/cxa.c198
-rw-r--r--build/stlport/src/details/fstream_stdio.cpp387
-rw-r--r--build/stlport/src/details/fstream_unistd.cpp347
-rw-r--r--build/stlport/src/details/fstream_win32io.cpp629
-rw-r--r--build/stlport/src/dll_main.cpp262
-rw-r--r--build/stlport/src/facets_byname.cpp1057
-rw-r--r--build/stlport/src/fstream.cpp114
-rw-r--r--build/stlport/src/ios.cpp320
-rw-r--r--build/stlport/src/iostream.cpp354
-rw-r--r--build/stlport/src/istream.cpp48
-rw-r--r--build/stlport/src/locale.cpp446
-rw-r--r--build/stlport/src/locale_catalog.cpp288
-rw-r--r--build/stlport/src/locale_impl.cpp765
-rw-r--r--build/stlport/src/locale_impl.h133
-rw-r--r--build/stlport/src/lock_free_slist.h307
-rw-r--r--build/stlport/src/message_facets.h152
-rw-r--r--build/stlport/src/messages.cpp247
-rw-r--r--build/stlport/src/monetary.cpp152
-rw-r--r--build/stlport/src/num_get.cpp120
-rw-r--r--build/stlport/src/num_get_float.cpp884
-rw-r--r--build/stlport/src/num_put.cpp183
-rw-r--r--build/stlport/src/num_put_float.cpp919
-rw-r--r--build/stlport/src/numpunct.cpp46
-rw-r--r--build/stlport/src/ostream.cpp47
-rw-r--r--build/stlport/src/sparc_atomic.s68
-rw-r--r--build/stlport/src/sparc_atomic64.s65
-rw-r--r--build/stlport/src/sstream.cpp45
-rw-r--r--build/stlport/src/stdio_streambuf.cpp239
-rw-r--r--build/stlport/src/stdio_streambuf.h102
-rw-r--r--build/stlport/src/stlport.rc96
-rw-r--r--build/stlport/src/stlport_prefix.h43
-rw-r--r--build/stlport/src/string.cpp93
-rw-r--r--build/stlport/src/strstream.cpp391
-rw-r--r--build/stlport/src/time_facets.cpp565
-rw-r--r--build/stlport/src/warning_disable.h61
-rw-r--r--build/stlport/stl/config/_android.h.in31
-rw-r--r--build/stlport/stlport/algorithm62
-rw-r--r--build/stlport/stlport/assert.h50
-rw-r--r--build/stlport/stlport/bitset70
-rw-r--r--build/stlport/stlport/cassert46
-rw-r--r--build/stlport/stlport/cctype47
-rw-r--r--build/stlport/stlport/cerrno55
-rw-r--r--build/stlport/stlport/cfloat45
-rw-r--r--build/stlport/stlport/ciso64645
-rw-r--r--build/stlport/stlport/climits53
-rw-r--r--build/stlport/stlport/clocale47
-rw-r--r--build/stlport/stlport/cmath53
-rw-r--r--build/stlport/stlport/complex57
-rw-r--r--build/stlport/stlport/csetjmp47
-rw-r--r--build/stlport/stlport/csignal47
-rw-r--r--build/stlport/stlport/cstdarg47
-rw-r--r--build/stlport/stlport/cstddef47
-rw-r--r--build/stlport/stlport/cstdio53
-rw-r--r--build/stlport/stlport/cstdlib54
-rw-r--r--build/stlport/stlport/cstring47
-rw-r--r--build/stlport/stlport/ctime53
-rw-r--r--build/stlport/stlport/ctype.h114
-rw-r--r--build/stlport/stlport/cwchar48
-rw-r--r--build/stlport/stlport/cwctype47
-rw-r--r--build/stlport/stlport/deque57
-rw-r--r--build/stlport/stlport/errno.h70
-rw-r--r--build/stlport/stlport/exception68
-rw-r--r--build/stlport/stlport/exception.h43
-rw-r--r--build/stlport/stlport/float.h52
-rw-r--r--build/stlport/stlport/fstream66
-rw-r--r--build/stlport/stlport/fstream.h42
-rw-r--r--build/stlport/stlport/functional148
-rw-r--r--build/stlport/stlport/hash_map49
-rw-r--r--build/stlport/stlport/hash_set49
-rw-r--r--build/stlport/stlport/iomanip53
-rw-r--r--build/stlport/stlport/iomanip.h53
-rw-r--r--build/stlport/stlport/ios53
-rw-r--r--build/stlport/stlport/ios.h39
-rw-r--r--build/stlport/stlport/iosfwd53
-rw-r--r--build/stlport/stlport/iostream104
-rw-r--r--build/stlport/stlport/iostream.h106
-rw-r--r--build/stlport/stlport/iso646.h39
-rw-r--r--build/stlport/stlport/istream53
-rw-r--r--build/stlport/stlport/istream.h50
-rw-r--r--build/stlport/stlport/iterator61
-rw-r--r--build/stlport/stlport/limits50
-rw-r--r--build/stlport/stlport/limits.h39
-rw-r--r--build/stlport/stlport/list57
-rw-r--r--build/stlport/stlport/locale156
-rw-r--r--build/stlport/stlport/locale.h43
-rw-r--r--build/stlport/stlport/map57
-rw-r--r--build/stlport/stlport/math.h53
-rw-r--r--build/stlport/stlport/mem.h58
-rw-r--r--build/stlport/stlport/memory130
-rw-r--r--build/stlport/stlport/new47
-rw-r--r--build/stlport/stlport/new.h50
-rw-r--r--build/stlport/stlport/numeric54
-rw-r--r--build/stlport/stlport/ostream52
-rw-r--r--build/stlport/stlport/ostream.h37
-rw-r--r--build/stlport/stlport/pthread.h46
-rw-r--r--build/stlport/stlport/pthread_alloc49
-rw-r--r--build/stlport/stlport/queue57
-rw-r--r--build/stlport/stlport/rlocks.h11
-rw-r--r--build/stlport/stlport/rope44
-rw-r--r--build/stlport/stlport/set57
-rw-r--r--build/stlport/stlport/setjmp.h52
-rw-r--r--build/stlport/stlport/signal.h39
-rw-r--r--build/stlport/stlport/slist54
-rw-r--r--build/stlport/stlport/sstream57
-rw-r--r--build/stlport/stlport/stack57
-rw-r--r--build/stlport/stlport/stdarg.h47
-rw-r--r--build/stlport/stlport/stddef.h44
-rw-r--r--build/stlport/stlport/stdexcept56
-rw-r--r--build/stlport/stlport/stdio.h57
-rw-r--r--build/stlport/stlport/stdiostream.h10
-rw-r--r--build/stlport/stlport/stdlib.h67
-rw-r--r--build/stlport/stlport/stl/_abbrevs.h77
-rw-r--r--build/stlport/stlport/stl/_algo.c2028
-rw-r--r--build/stlport/stlport/stl/_algo.h745
-rw-r--r--build/stlport/stlport/stl/_algobase.c483
-rw-r--r--build/stlport/stlport/stl/_algobase.h728
-rw-r--r--build/stlport/stlport/stl/_alloc.c87
-rw-r--r--build/stlport/stlport/stl/_alloc.h580
-rw-r--r--build/stlport/stlport/stl/_auto_ptr.h133
-rw-r--r--build/stlport/stlport/stl/_bitset.c235
-rw-r--r--build/stlport/stlport/stl/_bitset.h880
-rw-r--r--build/stlport/stlport/stl/_bvector.h841
-rw-r--r--build/stlport/stlport/stl/_carray.h61
-rw-r--r--build/stlport/stlport/stl/_cctype.h49
-rw-r--r--build/stlport/stlport/stl/_clocale.h43
-rw-r--r--build/stlport/stlport/stl/_cmath.h605
-rw-r--r--build/stlport/stlport/stl/_codecvt.h442
-rw-r--r--build/stlport/stlport/stl/_collate.h176
-rw-r--r--build/stlport/stlport/stl/_complex.c145
-rw-r--r--build/stlport/stlport/stl/_complex.h935
-rw-r--r--build/stlport/stlport/stl/_config_compat_post.h51
-rw-r--r--build/stlport/stlport/stl/_construct.h289
-rw-r--r--build/stlport/stlport/stl/_cprolog.h25
-rw-r--r--build/stlport/stlport/stl/_csetjmp.h68
-rw-r--r--build/stlport/stlport/stl/_csignal.h41
-rw-r--r--build/stlport/stlport/stl/_cstdarg.h34
-rw-r--r--build/stlport/stlport/stl/_cstddef.h44
-rw-r--r--build/stlport/stlport/stl/_cstdio.h127
-rw-r--r--build/stlport/stlport/stl/_cstdlib.h180
-rw-r--r--build/stlport/stlport/stl/_cstring.h35
-rw-r--r--build/stlport/stlport/stl/_ctime.h56
-rw-r--r--build/stlport/stlport/stl/_ctraits_fns.h91
-rw-r--r--build/stlport/stlport/stl/_ctype.h280
-rw-r--r--build/stlport/stlport/stl/_cwchar.h342
-rw-r--r--build/stlport/stlport/stl/_cwctype.h89
-rw-r--r--build/stlport/stlport/stl/_deque.c823
-rw-r--r--build/stlport/stlport/stl/_deque.h1115
-rw-r--r--build/stlport/stlport/stl/_epilog.h42
-rw-r--r--build/stlport/stlport/stl/_exception.h196
-rw-r--r--build/stlport/stlport/stl/_facets_fwd.h53
-rw-r--r--build/stlport/stlport/stl/_fstream.c766
-rw-r--r--build/stlport/stlport/stl/_fstream.h714
-rw-r--r--build/stlport/stlport/stl/_function.h433
-rw-r--r--build/stlport/stlport/stl/_function_adaptors.h783
-rw-r--r--build/stlport/stlport/stl/_function_base.h217
-rw-r--r--build/stlport/stlport/stl/_hash_fun.h146
-rw-r--r--build/stlport/stlport/stl/_hash_map.h500
-rw-r--r--build/stlport/stlport/stl/_hash_set.h495
-rw-r--r--build/stlport/stlport/stl/_hashtable.c553
-rw-r--r--build/stlport/stlport/stl/_hashtable.h658
-rw-r--r--build/stlport/stlport/stl/_heap.c246
-rw-r--r--build/stlport/stlport/stl/_heap.h125
-rw-r--r--build/stlport/stlport/stl/_iomanip.h165
-rw-r--r--build/stlport/stlport/stl/_ios.c127
-rw-r--r--build/stlport/stlport/stl/_ios.h187
-rw-r--r--build/stlport/stlport/stl/_ios_base.h347
-rw-r--r--build/stlport/stlport/stl/_ioserr.h12
-rw-r--r--build/stlport/stlport/stl/_iosfwd.h159
-rw-r--r--build/stlport/stlport/stl/_iostream_string.h140
-rw-r--r--build/stlport/stlport/stl/_istream.c1428
-rw-r--r--build/stlport/stlport/stl/_istream.h359
-rw-r--r--build/stlport/stlport/stl/_istreambuf_iterator.h161
-rw-r--r--build/stlport/stlport/stl/_iterator.h265
-rw-r--r--build/stlport/stlport/stl/_iterator_base.h525
-rw-r--r--build/stlport/stlport/stl/_iterator_old.h334
-rw-r--r--build/stlport/stlport/stl/_limits.c405
-rw-r--r--build/stlport/stlport/stl/_limits.h519
-rw-r--r--build/stlport/stlport/stl/_list.c250
-rw-r--r--build/stlport/stlport/stl/_list.h742
-rw-r--r--build/stlport/stlport/stl/_locale.h366
-rw-r--r--build/stlport/stlport/stl/_map.h435
-rw-r--r--build/stlport/stlport/stl/_mbstate_t.h43
-rw-r--r--build/stlport/stlport/stl/_messages_facets.h185
-rw-r--r--build/stlport/stlport/stl/_monetary.c527
-rw-r--r--build/stlport/stlport/stl/_monetary.h435
-rw-r--r--build/stlport/stlport/stl/_move_construct_fwk.h159
-rw-r--r--build/stlport/stlport/stl/_new.h145
-rw-r--r--build/stlport/stlport/stl/_num_get.c623
-rw-r--r--build/stlport/stlport/stl/_num_get.h237
-rw-r--r--build/stlport/stlport/stl/_num_put.c522
-rw-r--r--build/stlport/stlport/stl/_num_put.h187
-rw-r--r--build/stlport/stlport/stl/_numeric.c106
-rw-r--r--build/stlport/stlport/stl/_numeric.h191
-rw-r--r--build/stlport/stlport/stl/_numpunct.h176
-rw-r--r--build/stlport/stlport/stl/_ostream.c455
-rw-r--r--build/stlport/stlport/stl/_ostream.h387
-rw-r--r--build/stlport/stlport/stl/_ostreambuf_iterator.h102
-rw-r--r--build/stlport/stlport/stl/_pair.h186
-rw-r--r--build/stlport/stlport/stl/_prolog.h18
-rw-r--r--build/stlport/stlport/stl/_pthread_alloc.h461
-rw-r--r--build/stlport/stlport/stl/_ptrs_specialize.h83
-rw-r--r--build/stlport/stlport/stl/_queue.h268
-rw-r--r--build/stlport/stlport/stl/_range_errors.c84
-rw-r--r--build/stlport/stlport/stl/_range_errors.h60
-rw-r--r--build/stlport/stlport/stl/_raw_storage_iter.h80
-rw-r--r--build/stlport/stlport/stl/_relops_cont.h29
-rw-r--r--build/stlport/stlport/stl/_relops_hash_cont.h13
-rw-r--r--build/stlport/stlport/stl/_rope.c1407
-rw-r--r--build/stlport/stlport/stl/_rope.h2391
-rw-r--r--build/stlport/stlport/stl/_set.h412
-rw-r--r--build/stlport/stlport/stl/_slist.c230
-rw-r--r--build/stlport/stlport/stl/_slist.h914
-rw-r--r--build/stlport/stlport/stl/_slist_base.c104
-rw-r--r--build/stlport/stlport/stl/_slist_base.h90
-rw-r--r--build/stlport/stlport/stl/_sparc_atomic.h61
-rw-r--r--build/stlport/stlport/stl/_sstream.c465
-rw-r--r--build/stlport/stlport/stl/_sstream.h266
-rw-r--r--build/stlport/stlport/stl/_stack.h133
-rw-r--r--build/stlport/stlport/stl/_stdexcept.h109
-rw-r--r--build/stlport/stlport/stl/_stdexcept_base.c95
-rw-r--r--build/stlport/stlport/stl/_stdexcept_base.h97
-rw-r--r--build/stlport/stlport/stl/_stlport_version.h30
-rw-r--r--build/stlport/stlport/stl/_stream_iterator.h253
-rw-r--r--build/stlport/stlport/stl/_streambuf.c208
-rw-r--r--build/stlport/stlport/stl/_streambuf.h287
-rw-r--r--build/stlport/stlport/stl/_string.c673
-rw-r--r--build/stlport/stlport/stl/_string.h1182
-rw-r--r--build/stlport/stlport/stl/_string_base.h231
-rw-r--r--build/stlport/stlport/stl/_string_fwd.h60
-rw-r--r--build/stlport/stlport/stl/_string_hash.h71
-rw-r--r--build/stlport/stlport/stl/_string_io.c172
-rw-r--r--build/stlport/stlport/stl/_string_io.h77
-rw-r--r--build/stlport/stlport/stl/_string_npos.h27
-rw-r--r--build/stlport/stlport/stl/_string_operators.h602
-rw-r--r--build/stlport/stlport/stl/_string_sum.h414
-rw-r--r--build/stlport/stlport/stl/_string_sum_methods.h155
-rw-r--r--build/stlport/stlport/stl/_string_workaround.h599
-rw-r--r--build/stlport/stlport/stl/_strstream.h165
-rw-r--r--build/stlport/stlport/stl/_tempbuf.c57
-rw-r--r--build/stlport/stlport/stl/_tempbuf.h167
-rw-r--r--build/stlport/stlport/stl/_threads.c167
-rw-r--r--build/stlport/stlport/stl/_threads.h687
-rw-r--r--build/stlport/stlport/stl/_time_facets.c440
-rw-r--r--build/stlport/stlport/stl/_time_facets.h329
-rw-r--r--build/stlport/stlport/stl/_tree.c730
-rw-r--r--build/stlport/stlport/stl/_tree.h684
-rw-r--r--build/stlport/stlport/stl/_typeinfo.h79
-rw-r--r--build/stlport/stlport/stl/_uninitialized.h443
-rw-r--r--build/stlport/stlport/stl/_unordered_map.h443
-rw-r--r--build/stlport/stlport/stl/_unordered_set.h418
-rw-r--r--build/stlport/stlport/stl/_valarray.c191
-rw-r--r--build/stlport/stlport/stl/_valarray.h1684
-rw-r--r--build/stlport/stlport/stl/_vector.c242
-rw-r--r--build/stlport/stlport/stl/_vector.h773
-rw-r--r--build/stlport/stlport/stl/boost_type_traits.h150
-rw-r--r--build/stlport/stlport/stl/c_locale.h131
-rw-r--r--build/stlport/stlport/stl/char_traits.h278
-rw-r--r--build/stlport/stlport/stl/concept_checks.h810
-rw-r--r--build/stlport/stlport/stl/config/_aix.h3
-rw-r--r--build/stlport/stlport/stl/config/_android.h73
-rw-r--r--build/stlport/stlport/stl/config/_apcc.h30
-rw-r--r--build/stlport/stlport/stl/config/_apple.h118
-rw-r--r--build/stlport/stlport/stl/config/_as400.h55
-rw-r--r--build/stlport/stlport/stl/config/_auto_link.h61
-rw-r--r--build/stlport/stlport/stl/config/_bc.h138
-rw-r--r--build/stlport/stlport/stl/config/_como.h207
-rw-r--r--build/stlport/stlport/stl/config/_cray.h65
-rw-r--r--build/stlport/stlport/stl/config/_cygwin.h9
-rw-r--r--build/stlport/stlport/stl/config/_dec.h113
-rw-r--r--build/stlport/stlport/stl/config/_dec_vms.h89
-rw-r--r--build/stlport/stlport/stl/config/_detect_dll_or_lib.h74
-rw-r--r--build/stlport/stlport/stl/config/_dm.h121
-rw-r--r--build/stlport/stlport/stl/config/_epilog.h29
-rw-r--r--build/stlport/stlport/stl/config/_evc.h333
-rw-r--r--build/stlport/stlport/stl/config/_feedback.h43
-rw-r--r--build/stlport/stlport/stl/config/_freebsd.h3
-rw-r--r--build/stlport/stlport/stl/config/_fujitsu.h7
-rw-r--r--build/stlport/stlport/stl/config/_gcc.h198
-rw-r--r--build/stlport/stlport/stl/config/_hpacc.h129
-rw-r--r--build/stlport/stlport/stl/config/_hpux.h17
-rw-r--r--build/stlport/stlport/stl/config/_ibm.h144
-rw-r--r--build/stlport/stlport/stl/config/_icc.h44
-rw-r--r--build/stlport/stlport/stl/config/_intel.h72
-rw-r--r--build/stlport/stlport/stl/config/_kai.h43
-rw-r--r--build/stlport/stlport/stl/config/_linux.h126
-rw-r--r--build/stlport/stlport/stl/config/_mac.h6
-rw-r--r--build/stlport/stlport/stl/config/_macosx.h9
-rw-r--r--build/stlport/stlport/stl/config/_mlc.h7
-rw-r--r--build/stlport/stlport/stl/config/_msvc.h265
-rw-r--r--build/stlport/stlport/stl/config/_mwerks.h159
-rw-r--r--build/stlport/stlport/stl/config/_native_headers.h50
-rw-r--r--build/stlport/stlport/stl/config/_openbsd.h12
-rw-r--r--build/stlport/stlport/stl/config/_prolog.h43
-rw-r--r--build/stlport/stlport/stl/config/_sgi.h94
-rw-r--r--build/stlport/stlport/stl/config/_solaris.h77
-rw-r--r--build/stlport/stlport/stl/config/_sunprocc.h166
-rw-r--r--build/stlport/stlport/stl/config/_system.h174
-rw-r--r--build/stlport/stlport/stl/config/_warnings_off.h51
-rw-r--r--build/stlport/stlport/stl/config/_watcom.h151
-rw-r--r--build/stlport/stlport/stl/config/_windows.h291
-rw-r--r--build/stlport/stlport/stl/config/compat.h80
-rw-r--r--build/stlport/stlport/stl/config/features.h1079
-rw-r--r--build/stlport/stlport/stl/config/host.h342
-rw-r--r--build/stlport/stlport/stl/config/stl_confix.h97
-rw-r--r--build/stlport/stlport/stl/config/stl_mycomp.h282
-rw-r--r--build/stlport/stlport/stl/config/user_config.h326
-rw-r--r--build/stlport/stlport/stl/debug/_debug.c628
-rw-r--r--build/stlport/stlport/stl/debug/_debug.h473
-rw-r--r--build/stlport/stlport/stl/debug/_deque.h414
-rw-r--r--build/stlport/stlport/stl/debug/_hashtable.h340
-rw-r--r--build/stlport/stlport/stl/debug/_iterator.h457
-rw-r--r--build/stlport/stlport/stl/debug/_list.h495
-rw-r--r--build/stlport/stlport/stl/debug/_slist.h613
-rw-r--r--build/stlport/stlport/stl/debug/_string.h828
-rw-r--r--build/stlport/stlport/stl/debug/_string_sum_methods.h111
-rw-r--r--build/stlport/stlport/stl/debug/_tree.h317
-rw-r--r--build/stlport/stlport/stl/debug/_vector.h425
-rw-r--r--build/stlport/stlport/stl/msl_string.h47
-rw-r--r--build/stlport/stlport/stl/pointers/_deque.h390
-rw-r--r--build/stlport/stlport/stl/pointers/_list.h345
-rw-r--r--build/stlport/stlport/stl/pointers/_set.h564
-rw-r--r--build/stlport/stlport/stl/pointers/_slist.h427
-rw-r--r--build/stlport/stlport/stl/pointers/_tools.h474
-rw-r--r--build/stlport/stlport/stl/pointers/_vector.h243
-rw-r--r--build/stlport/stlport/stl/type_manips.h321
-rw-r--r--build/stlport/stlport/stl/type_traits.h626
-rw-r--r--build/stlport/stlport/streambuf52
-rw-r--r--build/stlport/stlport/streambuf.h53
-rw-r--r--build/stlport/stlport/string59
-rw-r--r--build/stlport/stlport/string.h66
-rw-r--r--build/stlport/stlport/strstream61
-rw-r--r--build/stlport/stlport/strstream.h55
-rw-r--r--build/stlport/stlport/time.h44
-rw-r--r--build/stlport/stlport/type_traits798
-rw-r--r--build/stlport/stlport/typeinfo53
-rw-r--r--build/stlport/stlport/typeinfo.h87
-rw-r--r--build/stlport/stlport/unordered_map39
-rw-r--r--build/stlport/stlport/unordered_set39
-rw-r--r--build/stlport/stlport/using/cstring60
-rw-r--r--build/stlport/stlport/using/export12
-rw-r--r--build/stlport/stlport/using/fstream19
-rw-r--r--build/stlport/stlport/using/h/fstream.h4
-rw-r--r--build/stlport/stlport/using/h/iomanip.h6
-rw-r--r--build/stlport/stlport/using/h/iostream.h24
-rw-r--r--build/stlport/stlport/using/h/ostream.h6
-rw-r--r--build/stlport/stlport/using/h/streambuf.h1
-rw-r--r--build/stlport/stlport/using/h/strstream.h4
-rw-r--r--build/stlport/stlport/using/iomanip6
-rw-r--r--build/stlport/stlport/using/ios41
-rw-r--r--build/stlport/stlport/using/iosfwd54
-rw-r--r--build/stlport/stlport/using/iostream14
-rw-r--r--build/stlport/stlport/using/istream16
-rw-r--r--build/stlport/stlport/using/locale65
-rw-r--r--build/stlport/stlport/using/ostream10
-rw-r--r--build/stlport/stlport/using/sstream16
-rw-r--r--build/stlport/stlport/using/streambuf5
-rw-r--r--build/stlport/stlport/using/strstream4
-rw-r--r--build/stlport/stlport/utility60
-rw-r--r--build/stlport/stlport/valarray51
-rw-r--r--build/stlport/stlport/vector59
-rw-r--r--build/stlport/stlport/wchar.h64
-rw-r--r--build/stlport/stlport/wctype.h47
-rw-r--r--build/stlport/test/.gitignore2
-rw-r--r--build/subconfigure.py422
-rw-r--r--build/templates.mozbuild118
-rw-r--r--build/unix/Makefile.in15
-rw-r--r--build/unix/abs2rel.pl35
-rwxr-xr-xbuild/unix/build-clang/build-clang.py194
-rw-r--r--build/unix/build-clang/clang-3.3.json11
-rw-r--r--build/unix/build-clang/clang-trunk.json11
-rw-r--r--build/unix/build-clang/llvm-debug-frame.patch4
-rw-r--r--build/unix/build-clang/no-sse-on-linux-trunk.patch13
-rw-r--r--build/unix/build-clang/no-sse-on-linux.patch22
-rwxr-xr-xbuild/unix/build-clang/tooltool.py5
-rw-r--r--build/unix/build-gcc/build-gcc.sh45
-rw-r--r--build/unix/build-gcc/gcc-bt.patch25
-rw-r--r--build/unix/build-gcc/gcc48-pr55650.patch52
-rw-r--r--build/unix/build-toolchain/binutils-deterministic.patch22
-rwxr-xr-xbuild/unix/build-toolchain/build-gcc.py315
-rw-r--r--build/unix/build-toolchain/gcc-fixinc.patch12
-rw-r--r--build/unix/build-toolchain/gcc-include.patch24
-rw-r--r--build/unix/build-toolchain/glibc-deterministic.patch115
-rw-r--r--build/unix/build-toolchain/libtool-74c8993c178a1386ea5e2363a01d919738402f30.patch12
-rw-r--r--build/unix/build-toolchain/plugin_finish_decl.diff179
-rw-r--r--build/unix/build-toolchain/pr49911.diff274
-rw-r--r--build/unix/build-toolchain/r159628-r163231-r171807.patch98
-rw-r--r--build/unix/elfhack/Makefile.in64
-rw-r--r--build/unix/elfhack/elf.cpp86
-rw-r--r--build/unix/elfhack/elfhack.cpp127
-rw-r--r--build/unix/elfhack/elfxx.h36
-rw-r--r--build/unix/elfhack/inject.c25
-rw-r--r--build/unix/elfhack/inject/Makefile.in (renamed from build/win32/crashinjectdll/Makefile.in)19
-rw-r--r--build/unix/elfhack/inject/moz.build24
-rw-r--r--build/unix/elfhack/moz.build24
-rw-r--r--build/unix/moz.build6
-rw-r--r--build/unix/mozconfig.asan6
-rw-r--r--build/unix/mozconfig.linux41
-rw-r--r--build/unix/mozconfig.linux321
-rwxr-xr-xbuild/unix/print-depth-path.sh56
-rw-r--r--build/unix/rewrite_asan_dylib.py60
-rw-r--r--build/unix/stdc++compat/Makefile.in18
-rw-r--r--build/unix/stdc++compat/moz.build17
-rw-r--r--build/unix/stdc++compat/stdc++compat.cpp32
-rw-r--r--build/unix/test/Makefile.in44
-rwxr-xr-xbuild/unix/test/runtest95
-rw-r--r--build/unix/test/uniq.tpl151
-rw-r--r--build/unix/uniq.pl91
-rw-r--r--build/unix/uniq.py (renamed from build/package/moz.build)8
-rwxr-xr-xbuild/upload.py21
-rw-r--r--build/util/hg.py611
-rw-r--r--build/valgrind/__init__.py0
-rw-r--r--build/valgrind/cross-architecture.sup257
-rw-r--r--build/valgrind/i386-redhat-linux-gnu.sup13
-rw-r--r--build/valgrind/mach_commands.py166
-rw-r--r--build/valgrind/output_handler.py105
-rw-r--r--build/valgrind/x86_64-redhat-linux-gnu.sup35
-rw-r--r--build/virtualenv/populate_virtualenv.py385
-rw-r--r--build/virtualenv_packages.txt (renamed from build/virtualenv/packages.txt)15
-rw-r--r--build/win32/Makefile.in59
-rwxr-xr-xbuild/win32/autobinscope.py3
-rw-r--r--build/win32/crashinject.cpp19
-rw-r--r--build/win32/crashinjectdll/crashinjectdll.cpp6
-rw-r--r--build/win32/crashinjectdll/moz.build7
-rw-r--r--build/win32/dumpenv4python.pl19
-rw-r--r--build/win32/moz.build7
-rw-r--r--build/win32/mozconfig.vs20102
-rw-r--r--build/win32/mozconfig.vs2010-win645
-rw-r--r--build/win32/mozconfig.vs2013-win6428
-rw-r--r--build/win32/procmem.py96
-rw-r--r--build/win32/vmwarerecordinghelper/Makefile.in19
-rw-r--r--build/win32/vmwarerecordinghelper/moz.build7
-rw-r--r--build/win64/mozconfig.vs20105
-rw-r--r--build/win64/mozconfig.vs201323
-rw-r--r--build/xpccheck.py78
686 files changed, 104117 insertions, 7531 deletions
diff --git a/build/.lldbinit.in b/build/.lldbinit.in
new file mode 100644
index 000000000..425ca0f09
--- /dev/null
+++ b/build/.lldbinit.in
@@ -0,0 +1,2 @@
+#filter substitution
+script topsrcdir = "@topsrcdir@"; lldb.debugger.HandleCommand("command source -s true '%s'" % os.path.join(topsrcdir, ".lldbinit"))
diff --git a/build/ConfigStatus.py b/build/ConfigStatus.py
deleted file mode 100644
index ffd1d1686..000000000
--- a/build/ConfigStatus.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# Combined with build/autoconf/config.status.m4, ConfigStatus is an almost
-# drop-in replacement for autoconf 2.13's config.status, with features
-# borrowed from autoconf > 2.5, and additional features.
-
-from __future__ import print_function
-
-import logging
-import os
-import sys
-
-from optparse import OptionParser
-
-from mach.logging import LoggingManager
-from mozbuild.backend.configenvironment import ConfigEnvironment
-from mozbuild.backend.recursivemake import RecursiveMakeBackend
-from mozbuild.frontend.emitter import TreeMetadataEmitter
-from mozbuild.frontend.reader import BuildReader
-
-from Preprocessor import Preprocessor
-
-
-log_manager = LoggingManager()
-
-
-def config_status(topobjdir = '.', topsrcdir = '.',
- defines = [], non_global_defines = [], substs = [],
- files = [], headers = []):
- '''Main function, providing config.status functionality.
-
- Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
- variables, but like config.status from autoconf 2.6, single files may be
- generated with the --file and --header options. Several such options can
- be given to generate several files at the same time.
-
- Without the -n option, this program acts as config.status and considers
- the current directory as the top object directory, even when config.status
- is in a different directory. It will, however, treat the directory
- containing config.status as the top object directory with the -n option,
- while files given to the --file and --header arguments are considered
- relative to the current directory.
-
- The --recheck option, like with the original config.status, runs configure
- again, with the options given in the "ac_configure_args" subst.
-
- The options to this function are passed when creating the
- ConfigEnvironment, except for files and headers, which contain the list
- of files and headers to be generated by default. These lists, as well as
- the actual wrapper script around this function, are meant to be generated
- by configure. See build/autoconf/config.status.m4.
-
- Unlike config.status behaviour with CONFIG_FILES and CONFIG_HEADERS,
- but like config.status behaviour with --file and --header, providing
- files or headers on the command line inhibits the default generation of
- files when given headers and headers when given files.
-
- Unlike config.status, the FILE:TEMPLATE syntax is not supported for
- files and headers. The template is always the filename suffixed with
- '.in', in the corresponding directory under the top source directory.
- '''
-
- if 'CONFIG_FILES' in os.environ:
- raise Exception, 'Using the CONFIG_FILES environment variable is not supported. Use --file instead.'
- if 'CONFIG_HEADERS' in os.environ:
- raise Exception, 'Using the CONFIG_HEADERS environment variable is not supported. Use --header instead.'
-
- parser = OptionParser()
- parser.add_option('--recheck', dest='recheck', action='store_true',
- help='update config.status by reconfiguring in the same conditions')
- parser.add_option('--file', dest='files', metavar='FILE', action='append',
- help='instantiate the configuration file FILE')
- parser.add_option('--header', dest='headers', metavar='FILE', action='append',
- help='instantiate the configuration header FILE')
- parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
- help='display verbose output')
- parser.add_option('-n', dest='not_topobjdir', action='store_true',
- help='do not consider current directory as top object directory')
- (options, args) = parser.parse_args()
-
- # Without -n, the current directory is meant to be the top object directory
- if not options.not_topobjdir:
- topobjdir = os.path.abspath('.')
-
- env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
- non_global_defines=non_global_defines, substs=substs)
-
- reader = BuildReader(env)
- emitter = TreeMetadataEmitter(env)
- backend = RecursiveMakeBackend(env)
- # This won't actually do anything because of the magic of generators.
- definitions = emitter.emit(reader.read_topsrcdir())
-
- if options.recheck:
- # Execute configure from the top object directory
- if not os.path.isabs(topsrcdir):
- topsrcdir = relpath(topsrcdir, topobjdir)
- os.chdir(topobjdir)
- os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
-
- if options.files:
- files = options.files
- headers = []
- if options.headers:
- headers = options.headers
- if not options.files:
- files = []
- # Default to display messages when giving --file or --headers on the
- # command line.
- log_level = logging.INFO
-
- if options.files or options.headers or options.verbose:
- log_level = logging.DEBUG
-
- log_manager.add_terminal_logging(level=log_level)
- log_manager.enable_unstructured()
-
- if not options.files and not options.headers:
- print('Checking for beer in the fridge...', file=sys.stderr)
- summary = backend.consume(definitions)
-
- for line in summary.summaries():
- print(line, file=sys.stderr)
-
- files = [os.path.join(topobjdir, f) for f in files]
- headers = [os.path.join(topobjdir, f) for f in headers]
-
- for file in files:
- env.create_config_file(file)
- for header in headers:
- env.create_config_header(header)
diff --git a/build/Makefile.in b/build/Makefile.in
index 3da5dda83..9e84d7253 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -3,12 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
USE_RCS_MK := 1
include $(topsrcdir)/config/makefiles/makeutils.mk
@@ -30,47 +24,20 @@ endif
APP_BUILDID := $(shell cat $(DEPTH)/config/buildid)
APP_INI_DEPS += $(DEPTH)/config/buildid
-DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DAPP_BUILDID=$(APP_BUILDID)
+DEFINES += -DAPP_BUILDID=$(APP_BUILDID)
-DEFINES += -DMOZ_APP_VERSION="$(MOZ_APP_VERSION)"
APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
-MOZ_SOURCE_STAMP := $(firstword $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg parent --template="{node|short}\n" 2>/dev/null))
+MOZ_SOURCE_STAMP := $(firstword $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg parent --template='{node|short}\n' 2>/dev/null))
ifdef MOZ_SOURCE_STAMP
-DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
+DEFINES += -DMOZ_SOURCE_STAMP='$(MOZ_SOURCE_STAMP)'
endif
+ifdef MOZ_INCLUDE_SOURCE_INFO
source_repo ?= $(call getSourceRepo,$(topsrcdir)/$(MOZ_BUILD_APP)/..)
ifneq (,$(source_repo))
- DEFINES += -DMOZ_SOURCE_REPO="$(source_repo)"
-endif
-
-DEFINES += \
- -DMOZ_APP_BASENAME="$(MOZ_APP_BASENAME)" \
- -DMOZ_APP_VENDOR="$(MOZ_APP_VENDOR)" \
- -DMOZ_APP_ID="$(MOZ_APP_ID)" \
- -DMAR_CHANNEL_ID="$(MAR_CHANNEL_ID)" \
- -DACCEPTED_MAR_CHANNEL_IDS="$(ACCEPTED_MAR_CHANNEL_IDS)" \
- $(NULL)
-
-ifeq ($(MOZ_BUILD_APP),browser)
-DEFINES += -DMOZ_BUILD_APP_IS_BROWSER
-endif
-
-ifdef MOZ_APP_PROFILE
-DEFINES += -DMOZ_APP_PROFILE="$(MOZ_APP_PROFILE)"
+ DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)'
endif
-
-ifdef MOZILLA_OFFICIAL
-DEFINES += -DMOZILLA_OFFICIAL
-endif
-
-ifdef MOZ_PROFILE_MIGRATOR
-DEFINES += -DMOZ_PROFILE_MIGRATOR
-endif
-
-ifdef MOZ_EXTENSION_MANAGER
-DEFINES += -DMOZ_EXTENSION_MANAGER
endif
endif
@@ -79,49 +46,57 @@ endif
# by GDB when we debug executables there.
# NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
GDBINIT_FILES := $(topsrcdir)/.gdbinit
+GDBINIT_OBJDIR_FILES = $(topsrcdir)/.gdbinit
GDBINIT_DEST = $(FINAL_TARGET)
-INSTALL_TARGETS += GDBINIT
+
+# needs to be absolute to be distinct from $(topsrcdir)/.gdbinit
+GDBINIT_OBJDIR_DEST = $(abspath $(DEPTH))
+INSTALL_TARGETS += GDBINIT GDBINIT_OBJDIR
+
+# Put a .lldbinit in the bin directory and the objdir, to be picked up
+# automatically by LLDB when we debug executables using either of those two
+# directories as the current working directory. The .lldbinit file will
+# load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are.
+LLDBINIT_OBJDIR := .lldbinit.in
+LLDBINIT_OBJDIR_PATH = $(DEPTH)
+LLDBINIT_OBJDIR_FLAGS += -Dtopsrcdir=$(abspath $(topsrcdir))
+PP_TARGETS += LLDBINIT_OBJDIR
+
+LLDBINIT_FINAL_TARGET_FILES := $(DEPTH)/.lldbinit
+LLDBINIT_FINAL_TARGET_DEST = $(FINAL_TARGET)
+INSTALL_TARGETS += LLDBINIT_FINAL_TARGET
+
+ifeq (1_1,$(MOZ_ASAN)_$(CLANG_CL))
+# Install the clang-cl runtime library for ASAN next to the binaries we produce.
+CLANG_RT_ASAN_FILES := $(MOZ_CLANG_RT_ASAN_LIB_PATH)
+CLANG_RT_ASAN_DEST = $(FINAL_TARGET)
+INSTALL_TARGETS += CLANG_RT_ASAN
+endif
+
+# Put the .ycm_extra_conf.py file at the root of the objdir. It is used by
+# the vim plugin YouCompleteMe.
+YCM_FILES := $(topsrcdir)/.ycm_extra_conf.py
+YCM_DEST := $(abspath $(DEPTH))
+YCM_TARGET := export
+INSTALL_TARGETS += YCM
+
+ifdef MOZTTDIR
+# Install the Firefox OS fonts.
+include $(MOZTTDIR)/fonts.mk
+MOZTT_DEST = $(FINAL_TARGET)/fonts
+MOZTT_FILES = $(patsubst external/moztt/%,$(MOZTTDIR)/%,$(filter external/moztt/%,$(subst :, ,$(PRODUCT_COPY_FILES))))
+INSTALL_TARGETS += MOZTT
+endif
include $(topsrcdir)/config/rules.mk
-# we install to _leaktest/
TARGET_DEPTH = ..
include $(srcdir)/automation-build.mk
-_LEAKTEST_DIR = $(DEPTH)/_leaktest
-
-_LEAKTEST_FILES = \
- automation.py \
- automationutils.py \
- $(topsrcdir)/testing/profiles/prefs_general.js \
- leaktest.py \
- bloatcycle.html \
- $(topsrcdir)/build/pgo/server-locations.txt \
- $(topsrcdir)/build/pgo/favicon.ico \
- $(topsrcdir)/build/pgo/blueprint/sample.html \
- $(topsrcdir)/build/pgo/blueprint/elements.html \
- $(topsrcdir)/build/pgo/blueprint/forms.html \
- $(topsrcdir)/build/pgo/blueprint/grid.html \
- $(topsrcdir)/build/pgo/blueprint/test.jpg \
- $(topsrcdir)/build/pgo/blueprint/test-small.jpg \
- $(topsrcdir)/build/pgo/blueprint/valid.png \
- $(topsrcdir)/build/pgo/blueprint/screen.css \
- $(topsrcdir)/build/pgo/blueprint/print.css \
- $(topsrcdir)/build/pgo/blueprint/grid.png \
- $(topsrcdir)/build/pgo/blueprint/fancytype-screen.css \
- $(NULL)
-
-leaktest.py: leaktest.py.in
- $(PYTHON) $(topsrcdir)/config/Preprocessor.py $^ > $@
- chmod +x $@
-GARBAGE += leaktest.py
-
ifdef MOZ_APP_BASENAME
$(FINAL_TARGET)/application.ini: $(APP_INI_DEPS)
ifdef MOZ_APP_STATIC_INI
-DEFINES += -DMOZ_APP_STATIC_INI
-
application.ini.h: appini_header.py $(FINAL_TARGET)/application.ini
$(PYTHON) $^ > $@
export:: application.ini.h
@@ -129,8 +104,7 @@ GARBAGE += application.ini.h
endif
endif
-libs:: $(_LEAKTEST_FILES)
- $(INSTALL) $^ $(_LEAKTEST_DIR)
+libs:: automation.py
ifdef MOZ_VALGRIND
_VALGRIND_DIR = $(DEPTH)/_valgrind
@@ -146,7 +120,7 @@ libs:: $(_VALGRIND_FILES)
$(INSTALL) $^ $(_VALGRIND_DIR)
endif
-ifdef ENABLE_TESTS
+ifneq (,$(ENABLE_TESTS)$(MOZ_DMD))
libs:: $(topsrcdir)/tools/rb/fix_stack_using_bpsyms.py
$(INSTALL) $< $(DIST)/bin
@@ -156,10 +130,17 @@ libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
endif
ifeq ($(OS_ARCH),Linux)
-libs:: $(topsrcdir)/tools/rb/fix-linux-stack.pl
+libs:: $(topsrcdir)/tools/rb/fix_linux_stack.py
$(INSTALL) $< $(DIST)/bin
endif
+endif # ENABLE_TESTS or MOZ_DMD
+ifdef ENABLE_TESTS
GARBAGE += $(srcdir)/automationutils.pyc
-
endif # ENABLE_TESTS
+
+ifdef MOZ_DMD
+libs:: $(topsrcdir)/memory/replace/dmd/dmd.py
+ $(INSTALL) $< $(DIST)/bin
+endif
+
diff --git a/build/annotationProcessors/AnnotationInfo.java b/build/annotationProcessors/AnnotationInfo.java
new file mode 100644
index 000000000..ae415ecb0
--- /dev/null
+++ b/build/annotationProcessors/AnnotationInfo.java
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors;
+
+/**
+ * Object holding annotation data. Used by GeneratableElementIterator.
+ */
+public class AnnotationInfo {
+ public final String wrapperName;
+ public final boolean isMultithreaded;
+ public final boolean noThrow;
+ public final boolean narrowChars;
+ public final boolean catchException;
+
+ public AnnotationInfo(String aWrapperName, boolean aIsMultithreaded,
+ boolean aNoThrow, boolean aNarrowChars, boolean aCatchException) {
+ wrapperName = aWrapperName;
+ isMultithreaded = aIsMultithreaded;
+ noThrow = aNoThrow;
+ narrowChars = aNarrowChars;
+ catchException = aCatchException;
+
+ if (noThrow && catchException) {
+ // It doesn't make sense to have these together
+ throw new IllegalArgumentException("noThrow and catchException are not allowed together");
+ }
+ }
+}
diff --git a/build/annotationProcessors/AnnotationProcessor.java b/build/annotationProcessors/AnnotationProcessor.java
new file mode 100644
index 000000000..6a0e80f06
--- /dev/null
+++ b/build/annotationProcessors/AnnotationProcessor.java
@@ -0,0 +1,154 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors;
+
+import org.mozilla.goanna.annotationProcessors.classloader.AnnotatableEntity;
+import org.mozilla.goanna.annotationProcessors.classloader.ClassWithOptions;
+import org.mozilla.goanna.annotationProcessors.classloader.IterableJarLoadingURLClassLoader;
+import org.mozilla.goanna.annotationProcessors.utils.GeneratableElementIterator;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class AnnotationProcessor {
+ public static final String OUTFILE = "GeneratedJNIWrappers.cpp";
+ public static final String HEADERFILE = "GeneratedJNIWrappers.h";
+
+ public static final String GENERATED_COMMENT =
+ "// GENERATED CODE\n" +
+ "// Generated by the Java program at /build/annotationProcessors at compile time\n" +
+ "// from annotations on Java methods. To update, change the annotations on the\n" +
+ "// corresponding Javamethods and rerun the build. Manually updating this file\n" +
+ "// will cause your build to fail.\n" +
+ "\n";
+
+ public static void main(String[] args) {
+ // We expect a list of jars on the commandline. If missing, whinge about it.
+ if (args.length <= 1) {
+ System.err.println("Usage: java AnnotationProcessor jarfiles ...");
+ System.exit(1);
+ }
+
+ System.out.println("Processing annotations...");
+
+ // We want to produce the same output as last time as often as possible. Ordering of
+ // generated statements, therefore, needs to be consistent.
+ Arrays.sort(args);
+
+ // Start the clock!
+ long s = System.currentTimeMillis();
+
+ // Get an iterator over the classes in the jar files given...
+ Iterator<ClassWithOptions> jarClassIterator = IterableJarLoadingURLClassLoader.getIteratorOverJars(args);
+
+ StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
+ headerFile.append(
+ "#ifndef GeneratedJNIWrappers_h__\n" +
+ "#define GeneratedJNIWrappers_h__\n" +
+ "\n" +
+ "#include \"mozilla/jni/Refs.h\"\n" +
+ "\n" +
+ "namespace mozilla {\n" +
+ "namespace widget {\n" +
+ "\n");
+
+ StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
+ implementationFile.append(
+ "#include \"GeneratedJNIWrappers.h\"\n" +
+ "#include \"mozilla/jni/Accessors.h\"\n" +
+ "\n" +
+ "namespace mozilla {\n" +
+ "namespace widget {\n" +
+ "\n");
+
+ while (jarClassIterator.hasNext()) {
+ ClassWithOptions aClassTuple = jarClassIterator.next();
+
+ CodeGenerator generatorInstance;
+
+ // Get an iterator over the appropriately generated methods of this class
+ Iterator<AnnotatableEntity> methodIterator = new GeneratableElementIterator(aClassTuple.wrappedClass);
+
+ if (!methodIterator.hasNext()) {
+ continue;
+ }
+ generatorInstance = new CodeGenerator(aClassTuple);
+
+ // Iterate all annotated members in this class..
+ while (methodIterator.hasNext()) {
+ AnnotatableEntity aElementTuple = methodIterator.next();
+ switch (aElementTuple.mEntityType) {
+ case METHOD:
+ generatorInstance.generateMethod(aElementTuple);
+ break;
+ case FIELD:
+ generatorInstance.generateField(aElementTuple);
+ break;
+ case CONSTRUCTOR:
+ generatorInstance.generateConstructor(aElementTuple);
+ break;
+ }
+ }
+
+ headerFile.append(generatorInstance.getHeaderFileContents());
+ implementationFile.append(generatorInstance.getWrapperFileContents());
+ }
+
+ implementationFile.append(
+ "\n" +
+ "} /* widget */\n" +
+ "} /* mozilla */\n");
+
+ headerFile.append(
+ "\n" +
+ "} /* widget */\n" +
+ "} /* mozilla */\n" +
+ "#endif // GeneratedJNIWrappers_h__\n");
+
+ writeOutputFiles(headerFile, implementationFile);
+ long e = System.currentTimeMillis();
+ System.out.println("Annotation processing complete in " + (e - s) + "ms");
+ }
+
+ private static void writeOutputFiles(StringBuilder aHeaderFile, StringBuilder aImplementationFile) {
+ FileOutputStream headerStream = null;
+ try {
+ headerStream = new FileOutputStream(OUTFILE);
+ headerStream.write(aImplementationFile.toString().getBytes());
+ } catch (IOException e) {
+ System.err.println("Unable to write " + OUTFILE + ". Perhaps a permissions issue?");
+ e.printStackTrace(System.err);
+ } finally {
+ if (headerStream != null) {
+ try {
+ headerStream.close();
+ } catch (IOException e) {
+ System.err.println("Unable to close headerStream due to "+e);
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+
+ FileOutputStream outStream = null;
+ try {
+ outStream = new FileOutputStream(HEADERFILE);
+ outStream.write(aHeaderFile.toString().getBytes());
+ } catch (IOException e) {
+ System.err.println("Unable to write " + HEADERFILE + ". Perhaps a permissions issue?");
+ e.printStackTrace(System.err);
+ } finally {
+ if (outStream != null) {
+ try {
+ outStream.close();
+ } catch (IOException e) {
+ System.err.println("Unable to close outStream due to "+e);
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+ }
+}
diff --git a/build/annotationProcessors/CodeGenerator.java b/build/annotationProcessors/CodeGenerator.java
new file mode 100644
index 000000000..635eb8a7f
--- /dev/null
+++ b/build/annotationProcessors/CodeGenerator.java
@@ -0,0 +1,462 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors;
+
+import org.mozilla.goanna.annotationProcessors.classloader.AnnotatableEntity;
+import org.mozilla.goanna.annotationProcessors.classloader.ClassWithOptions;
+import org.mozilla.goanna.annotationProcessors.utils.Utils;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+
+public class CodeGenerator {
+ private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
+
+ // Buffers holding the strings to ultimately be written to the output files.
+ private final StringBuilder cpp = new StringBuilder();
+ private final StringBuilder header = new StringBuilder();
+
+ private final Class<?> cls;
+ private final String clsName;
+
+ private final HashSet<String> takenMethodNames = new HashSet<String>();
+
+ public CodeGenerator(ClassWithOptions annotatedClass) {
+ this.cls = annotatedClass.wrappedClass;
+ this.clsName = annotatedClass.generatedName;
+
+ header.append(
+ "class " + clsName + " : public mozilla::jni::Class<" + clsName + "> {\n" +
+ "\n" +
+ "public:\n" +
+ " typedef mozilla::jni::Ref<" + clsName + "> Ref;\n" +
+ " typedef mozilla::jni::LocalRef<" + clsName + "> LocalRef;\n" +
+ " typedef mozilla::jni::GlobalRef<" + clsName + "> GlobalRef;\n" +
+ " typedef const typename mozilla::jni::Param<" + clsName + ">::Type& Param;\n" +
+ "\n" +
+ " static constexpr char name[] =\n" +
+ " \"" + cls.getName().replace('.', '/') + "\";\n" +
+ "\n" +
+ "protected:\n" +
+ " " + clsName + "(jobject instance) : Class(instance) {}\n" +
+ "\n");
+
+ cpp.append(
+ "constexpr char " + clsName + "::name[];\n" +
+ "\n");
+ }
+
+ private String getTraitsName(String uniqueName, boolean includeScope) {
+ return (includeScope ? clsName + "::" : "") + uniqueName + "_t";
+ }
+
+ private String getNativeParameterType(Class<?> type, AnnotationInfo info) {
+ if (type == cls) {
+ return clsName + "::Param";
+ }
+ return Utils.getNativeParameterType(type, info);
+ }
+
+ private String getNativeReturnType(Class<?> type, AnnotationInfo info) {
+ if (type == cls) {
+ return clsName + "::LocalRef";
+ }
+ return Utils.getNativeReturnType(type, info);
+ }
+
+ private void generateMember(AnnotationInfo info, Member member,
+ String uniqueName, Class<?> type) {
+ header.append(
+ "public:\n" +
+ " struct " + getTraitsName(uniqueName, /* includeScope */ false) + " {\n" +
+ " typedef " + clsName + " Owner;\n" +
+ " typedef " + getNativeReturnType(type, info) + " ReturnType;\n" +
+ " typedef " + getNativeParameterType(type, info) + " SetterType;\n" +
+ " static constexpr char name[] = \"" +
+ Utils.getMemberName(member) + "\";\n" +
+ " static constexpr char signature[] =\n" +
+ " \"" + Utils.getSignature(member) + "\";\n" +
+ " static const bool isStatic = " + Utils.isStatic(member) + ";\n" +
+ " static const bool isMultithreaded = " + info.isMultithreaded + ";\n" +
+ " static const mozilla::jni::ExceptionMode exceptionMode = " + (
+ info.catchException ? "mozilla::jni::ExceptionMode::NSRESULT" :
+ info.noThrow ? "mozilla::jni::ExceptionMode::IGNORE" :
+ "mozilla::jni::ExceptionMode::ABORT") + ";\n" +
+ " };\n" +
+ "\n");
+
+ cpp.append(
+ "constexpr char " + getTraitsName(uniqueName, /* includeScope */ true) +
+ "::name[];\n" +
+ "constexpr char " + getTraitsName(uniqueName, /* includeScope */ true) +
+ "::signature[];\n" +
+ "\n");
+ }
+
+ private String getUniqueMethodName(String basename) {
+ String newName = basename;
+ int index = 1;
+
+ while (takenMethodNames.contains(newName)) {
+ newName = basename + (++index);
+ }
+
+ takenMethodNames.add(newName);
+ return newName;
+ }
+
+ /**
+ * Generate a method prototype that includes return and argument types,
+ * without specifiers (static, const, etc.).
+ */
+ private String generatePrototype(String name, Class<?>[] argTypes,
+ Class<?> returnType, AnnotationInfo info,
+ boolean includeScope, boolean includeArgName) {
+
+ final StringBuilder proto = new StringBuilder();
+ int argIndex = 0;
+
+ if (info.catchException) {
+ proto.append("nsresult ");
+ } else {
+ proto.append(getNativeReturnType(returnType, info)).append(' ');
+ }
+
+ if (includeScope) {
+ proto.append(clsName).append("::");
+ }
+
+ proto.append(name).append('(');
+
+ for (Class<?> argType : argTypes) {
+ proto.append(getNativeParameterType(argType, info));
+ if (includeArgName) {
+ proto.append(" a").append(argIndex++);
+ }
+ proto.append(", ");
+ }
+
+ if (info.catchException && returnType != void.class) {
+ proto.append(getNativeReturnType(returnType, info)).append('*');
+ if (includeArgName) {
+ proto.append(" a").append(argIndex++);
+ }
+ proto.append(", ");
+ }
+
+ if (proto.substring(proto.length() - 2).equals(", ")) {
+ proto.setLength(proto.length() - 2);
+ }
+
+ return proto.append(')').toString();
+ }
+
+ /**
+ * Generate a method declaration that includes the prototype with specifiers,
+ * but without the method body.
+ */
+ private String generateDeclaration(String name, Class<?>[] argTypes,
+ Class<?> returnType, AnnotationInfo info,
+ boolean isStatic) {
+
+ return (isStatic ? "static " : "") +
+ generatePrototype(name, argTypes, returnType, info,
+ /* includeScope */ false, /* includeArgName */ false) +
+ (isStatic ? ";" : " const;");
+ }
+
+ /**
+ * Generate a method definition that includes the prototype with specifiers,
+ * and with the method body.
+ */
+ private String generateDefinition(String accessorName, String name, Class<?>[] argTypes,
+ Class<?> returnType, AnnotationInfo info, boolean isStatic) {
+
+ final StringBuilder def = new StringBuilder(
+ generatePrototype(name, argTypes, returnType, info,
+ /* includeScope */ true, /* includeArgName */ true));
+
+ if (!isStatic) {
+ def.append(" const");
+ }
+ def.append("\n{\n");
+
+
+ // Generate code to handle the return value, if needed.
+ // We initialize rv to NS_OK instead of NS_ERROR_* because loading NS_OK (0) uses
+ // fewer instructions. We are guaranteed to set rv to the correct value later.
+
+ if (info.catchException && returnType == void.class) {
+ def.append(
+ " nsresult rv = NS_OK;\n" +
+ " ");
+
+ } else if (info.catchException) {
+ // Non-void return type
+ final String resultArg = "a" + argTypes.length;
+ def.append(
+ " MOZ_ASSERT(" + resultArg + ");\n" +
+ " nsresult rv = NS_OK;\n" +
+ " *" + resultArg + " = ");
+
+ } else {
+ def.append(
+ " return ");
+ }
+
+
+ // Generate a call, e.g., Method<Traits>::Call(a0, a1, a2);
+
+ def.append(accessorName).append("(")
+ .append(isStatic ? "nullptr" : "this");
+
+ if (info.catchException) {
+ def.append(", &rv");
+ } else {
+ def.append(", nullptr");
+ }
+
+ // Generate the call argument list.
+ for (int argIndex = 0; argIndex < argTypes.length; argIndex++) {
+ def.append(", a").append(argIndex);
+ }
+
+ def.append(");\n");
+
+
+ if (info.catchException) {
+ def.append(" return rv;\n");
+ }
+
+ return def.append("}").toString();
+ }
+
+ /**
+ * Append the appropriate generated code to the buffers for the method provided.
+ *
+ * @param annotatedMethod The Java method, plus annotation data.
+ */
+ public void generateMethod(AnnotatableEntity annotatedMethod) {
+ // Unpack the tuple and extract some useful fields from the Method..
+ final Method method = annotatedMethod.getMethod();
+ final AnnotationInfo info = annotatedMethod.mAnnotationInfo;
+ final String uniqueName = getUniqueMethodName(info.wrapperName);
+ final Class<?> returnType = method.getReturnType();
+
+ if (method.isSynthetic()) {
+ return;
+ }
+
+ generateMember(info, method, uniqueName, returnType);
+
+ final Class<?>[] argTypes = method.getParameterTypes();
+ final boolean isStatic = Utils.isStatic(method);
+
+ header.append(
+ " " + generateDeclaration(info.wrapperName, argTypes,
+ returnType, info, isStatic) + "\n" +
+ "\n");
+
+ cpp.append(
+ generateDefinition(
+ "mozilla::jni::Method<" +
+ getTraitsName(uniqueName, /* includeScope */ false) + ">::Call",
+ info.wrapperName, argTypes, returnType, info, isStatic) + "\n" +
+ "\n");
+ }
+
+ private String getLiteral(Object val, AnnotationInfo info) {
+ final Class<?> type = val.getClass();
+
+ if (type == char.class || type == Character.class) {
+ final char c = (char) val;
+ if (c >= 0x20 && c < 0x7F) {
+ return "'" + c + '\'';
+ }
+ return "u'\\u" + Integer.toHexString(0x10000 | (int) c).substring(1) + '\'';
+
+ } else if (type == CharSequence.class || type == String.class) {
+ final CharSequence str = (CharSequence) val;
+ final StringBuilder out = new StringBuilder(info.narrowChars ? "u8\"" : "u\"");
+ for (int i = 0; i < str.length(); i++) {
+ final char c = str.charAt(i);
+ if (c >= 0x20 && c < 0x7F) {
+ out.append(c);
+ } else {
+ out.append("\\u").append(Integer.toHexString(0x10000 | (int) c).substring(1));
+ }
+ }
+ return out.append('"').toString();
+ }
+
+ return String.valueOf(val);
+ }
+
+ public void generateField(AnnotatableEntity annotatedField) {
+ final Field field = annotatedField.getField();
+ final AnnotationInfo info = annotatedField.mAnnotationInfo;
+ final String uniqueName = info.wrapperName;
+ final Class<?> type = field.getType();
+
+ // Handles a peculiar case when dealing with enum types. We don't care about this field.
+ // It just gets in the way and stops our code from compiling.
+ if (field.isSynthetic() || field.getName().equals("$VALUES")) {
+ return;
+ }
+
+ final boolean isStatic = Utils.isStatic(field);
+ final boolean isFinal = Utils.isFinal(field);
+
+ if (isStatic && isFinal && (type.isPrimitive() || type == String.class)) {
+ Object val = null;
+ try {
+ val = field.get(null);
+ } catch (final IllegalAccessException e) {
+ }
+
+ if (val != null && type.isPrimitive()) {
+ // For static final primitive fields, we can use a "static const" declaration.
+ header.append(
+ "public:\n" +
+ " static const " + Utils.getNativeReturnType(type, info) +
+ ' ' + info.wrapperName + " = " + getLiteral(val, info) + ";\n" +
+ "\n");
+ return;
+
+ } else if (val != null && type == String.class) {
+ final String nativeType = info.narrowChars ? "char" : "char16_t";
+
+ header.append(
+ "public:\n" +
+ " static const " + nativeType + ' ' + info.wrapperName + "[];\n" +
+ "\n");
+
+ cpp.append(
+ "const " + nativeType + ' ' + clsName + "::" + info.wrapperName +
+ "[] = " + getLiteral(val, info) + ";\n" +
+ "\n");
+ return;
+ }
+
+ // Fall back to using accessors if we encounter an exception.
+ }
+
+ generateMember(info, field, uniqueName, type);
+
+ final Class<?>[] getterArgs = EMPTY_CLASS_ARRAY;
+
+ header.append(
+ " " + generateDeclaration(info.wrapperName, getterArgs,
+ type, info, isStatic) + "\n" +
+ "\n");
+
+ cpp.append(
+ generateDefinition(
+ "mozilla::jni::Field<" +
+ getTraitsName(uniqueName, /* includeScope */ false) + ">::Get",
+ info.wrapperName, getterArgs, type, info, isStatic) + "\n" +
+ "\n");
+
+ if (isFinal) {
+ return;
+ }
+
+ final Class<?>[] setterArgs = new Class<?>[] { type };
+
+ header.append(
+ " " + generateDeclaration(info.wrapperName, setterArgs,
+ void.class, info, isStatic) + "\n" +
+ "\n");
+
+ cpp.append(
+ generateDefinition(
+ "mozilla::jni::Field<" +
+ getTraitsName(uniqueName, /* includeScope */ false) + ">::Set",
+ info.wrapperName, setterArgs, void.class, info, isStatic) + "\n" +
+ "\n");
+ }
+
+ public void generateConstructor(AnnotatableEntity annotatedConstructor) {
+ // Unpack the tuple and extract some useful fields from the Method..
+ final Constructor<?> method = annotatedConstructor.getConstructor();
+ final AnnotationInfo info = annotatedConstructor.mAnnotationInfo;
+ final String wrapperName = "New";
+ final String uniqueName = getUniqueMethodName(wrapperName);
+ final Class<?> returnType = cls;
+
+ if (method.isSynthetic()) {
+ return;
+ }
+
+ generateMember(info, method, uniqueName, returnType);
+
+ final Class<?>[] argTypes = method.getParameterTypes();
+
+ header.append(
+ " " + generateDeclaration(wrapperName, argTypes,
+ returnType, info, /* isStatic */ true) + "\n" +
+ "\n");
+
+ cpp.append(
+ generateDefinition(
+ "mozilla::jni::Constructor<" +
+ getTraitsName(uniqueName, /* includeScope */ false) + ">::Call",
+ wrapperName, argTypes, returnType, info, /* isStatic */ true) + "\n" +
+ "\n");
+ }
+
+ public void generateMembers(Member[] members) {
+ for (Member m : members) {
+ if (!Modifier.isPublic(m.getModifiers())) {
+ continue;
+ }
+
+ String name = Utils.getMemberName(m);
+ name = name.substring(0, 1).toUpperCase() + name.substring(1);
+
+ final AnnotationInfo info = new AnnotationInfo(name,
+ /* multithread */ true, /* nothrow */ false,
+ /* narrow */ false, /* catchException */ true);
+ final AnnotatableEntity entity = new AnnotatableEntity(m, info);
+
+ if (m instanceof Constructor) {
+ generateConstructor(entity);
+ } else if (m instanceof Method) {
+ generateMethod(entity);
+ } else if (m instanceof Field) {
+ generateField(entity);
+ } else {
+ throw new IllegalArgumentException(
+ "expected member to be Constructor, Method, or Field");
+ }
+ }
+ }
+
+ /**
+ * Get the finalised bytes to go into the generated wrappers file.
+ *
+ * @return The bytes to be written to the wrappers file.
+ */
+ public String getWrapperFileContents() {
+ return cpp.toString();
+ }
+
+ /**
+ * Get the finalised bytes to go into the generated header file.
+ *
+ * @return The bytes to be written to the header file.
+ */
+ public String getHeaderFileContents() {
+ header.append(
+ "};\n" +
+ "\n");
+ return header.toString();
+ }
+}
diff --git a/build/annotationProcessors/Makefile.in b/build/annotationProcessors/Makefile.in
new file mode 100644
index 000000000..11a273cd6
--- /dev/null
+++ b/build/annotationProcessors/Makefile.in
@@ -0,0 +1,12 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include $(topsrcdir)/config/rules.mk
+
+JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar:$(ANDROID_TOOLS)/lib/lint.jar:$(ANDROID_TOOLS)/lib/lint-checks.jar
+
+# Include Android specific java flags, instead of what's in rules.mk.
+include $(topsrcdir)/config/android-common.mk
+
+export:: annotationProcessors.jar
diff --git a/build/annotationProcessors/SDKProcessor.java b/build/annotationProcessors/SDKProcessor.java
new file mode 100644
index 000000000..ea7fc3e7b
--- /dev/null
+++ b/build/annotationProcessors/SDKProcessor.java
@@ -0,0 +1,237 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors;
+
+import com.android.tools.lint.checks.ApiLookup;
+import com.android.tools.lint.LintCliClient;
+
+import org.mozilla.goanna.annotationProcessors.classloader.AnnotatableEntity;
+import org.mozilla.goanna.annotationProcessors.classloader.ClassWithOptions;
+import org.mozilla.goanna.annotationProcessors.classloader.IterableJarLoadingURLClassLoader;
+import org.mozilla.goanna.annotationProcessors.utils.GeneratableElementIterator;
+import org.mozilla.goanna.annotationProcessors.utils.Utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Scanner;
+import java.util.Vector;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class SDKProcessor {
+ public static final String GENERATED_COMMENT =
+ "// GENERATED CODE\n" +
+ "// Generated by the Java program at /build/annotationProcessors at compile time\n" +
+ "// from annotations on Java methods. To update, change the annotations on the\n" +
+ "// corresponding Javamethods and rerun the build. Manually updating this file\n" +
+ "// will cause your build to fail.\n" +
+ "\n";
+
+ private static ApiLookup sApiLookup;
+ private static int sMaxSdkVersion;
+
+ public static void main(String[] args) throws Exception {
+ // We expect a list of jars on the commandline. If missing, whinge about it.
+ if (args.length < 5) {
+ System.err.println("Usage: java SDKProcessor sdkjar classlistfile outdir fileprefix max-sdk-version");
+ System.exit(1);
+ }
+
+ System.out.println("Processing platform bindings...");
+
+ String sdkJar = args[0];
+ Vector classes = getClassList(args[1]);
+ String outdir = args[2];
+ String generatedFilePrefix = args[3];
+ sMaxSdkVersion = Integer.parseInt(args[4]);
+
+ LintCliClient lintClient = new LintCliClient();
+ sApiLookup = ApiLookup.get(lintClient);
+
+ // Start the clock!
+ long s = System.currentTimeMillis();
+
+ // Get an iterator over the classes in the jar files given...
+ // Iterator<ClassWithOptions> jarClassIterator = IterableJarLoadingURLClassLoader.getIteratorOverJars(args);
+
+ StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
+ headerFile.append(
+ "#ifndef " + generatedFilePrefix + "_h__\n" +
+ "#define " + generatedFilePrefix + "_h__\n" +
+ "\n" +
+ "#include \"mozilla/jni/Refs.h\"\n" +
+ "\n" +
+ "namespace mozilla {\n" +
+ "namespace widget {\n" +
+ "namespace sdk {\n" +
+ "\n");
+
+ StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
+ implementationFile.append(
+ "#include \"" + generatedFilePrefix + ".h\"\n" +
+ "#include \"mozilla/jni/Accessors.h\"\n" +
+ "\n" +
+ "namespace mozilla {\n" +
+ "namespace widget {\n" +
+ "namespace sdk {\n" +
+ "\n");
+
+ // Used to track the calls to the various class-specific initialisation functions.
+ ClassLoader loader = null;
+ try {
+ loader = URLClassLoader.newInstance(new URL[] { new URL("file://" + sdkJar) },
+ SDKProcessor.class.getClassLoader());
+ } catch (Exception e) {
+ throw new RuntimeException(e.toString());
+ }
+
+ for (Iterator<String> i = classes.iterator(); i.hasNext(); ) {
+ String className = i.next();
+ System.out.println("Looking up: " + className);
+
+ generateClass(Class.forName(className, true, loader),
+ implementationFile,
+ headerFile);
+ }
+
+ implementationFile.append(
+ "} /* sdk */\n" +
+ "} /* widget */\n" +
+ "} /* mozilla */\n");
+
+ headerFile.append(
+ "} /* sdk */\n" +
+ "} /* widget */\n" +
+ "} /* mozilla */\n" +
+ "#endif\n");
+
+ writeOutputFiles(outdir, generatedFilePrefix, headerFile, implementationFile);
+ long e = System.currentTimeMillis();
+ System.out.println("SDK processing complete in " + (e - s) + "ms");
+ }
+
+ private static Member[] sortAndFilterMembers(Member[] members) {
+ Arrays.sort(members, new Comparator<Member>() {
+ @Override
+ public int compare(Member a, Member b) {
+ return a.getName().compareTo(b.getName());
+ }
+ });
+
+ ArrayList<Member> list = new ArrayList<>();
+ for (Member m : members) {
+ int version = 0;
+
+ if (m instanceof Method || m instanceof Constructor) {
+ version = sApiLookup.getCallVersion(
+ Utils.getClassDescriptor(m.getDeclaringClass()),
+ m.getName(),
+ Utils.getSignature(m));
+ } else if (m instanceof Field) {
+ version = sApiLookup.getFieldVersion(
+ Utils.getClassDescriptor(m.getDeclaringClass()), m.getName());
+ } else {
+ throw new IllegalArgumentException("expected member to be Method, Constructor, or Field");
+ }
+
+ if (version > sMaxSdkVersion) {
+ System.out.println("Skipping " + m.getDeclaringClass().getName() + "." + m.getName() +
+ ", version " + version + " > " + sMaxSdkVersion);
+ continue;
+ }
+
+ list.add(m);
+ }
+
+ return list.toArray(new Member[list.size()]);
+ }
+
+ private static void generateClass(Class<?> clazz,
+ StringBuilder implementationFile,
+ StringBuilder headerFile) {
+ String generatedName = clazz.getSimpleName();
+
+ CodeGenerator generator = new CodeGenerator(new ClassWithOptions(clazz, generatedName));
+
+ generator.generateMembers(sortAndFilterMembers(clazz.getDeclaredConstructors()));
+ generator.generateMembers(sortAndFilterMembers(clazz.getDeclaredMethods()));
+ generator.generateMembers(sortAndFilterMembers(clazz.getDeclaredFields()));
+
+ headerFile.append(generator.getHeaderFileContents());
+ implementationFile.append(generator.getWrapperFileContents());
+ }
+
+ private static Vector<String> getClassList(String path) {
+ Scanner scanner = null;
+ try {
+ scanner = new Scanner(new FileInputStream(path));
+
+ Vector lines = new Vector();
+ while (scanner.hasNextLine()) {
+ lines.add(scanner.nextLine());
+ }
+ return lines;
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ return null;
+ } finally {
+ if (scanner != null) {
+ scanner.close();
+ }
+ }
+ }
+
+ private static void writeOutputFiles(String aOutputDir, String aPrefix, StringBuilder aHeaderFile,
+ StringBuilder aImplementationFile) {
+ FileOutputStream implStream = null;
+ try {
+ implStream = new FileOutputStream(new File(aOutputDir, aPrefix + ".cpp"));
+ implStream.write(aImplementationFile.toString().getBytes());
+ } catch (IOException e) {
+ System.err.println("Unable to write " + aOutputDir + ". Perhaps a permissions issue?");
+ e.printStackTrace(System.err);
+ } finally {
+ if (implStream != null) {
+ try {
+ implStream.close();
+ } catch (IOException e) {
+ System.err.println("Unable to close implStream due to "+e);
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+
+ FileOutputStream headerStream = null;
+ try {
+ headerStream = new FileOutputStream(new File(aOutputDir, aPrefix + ".h"));
+ headerStream.write(aHeaderFile.toString().getBytes());
+ } catch (IOException e) {
+ System.err.println("Unable to write " + aOutputDir + ". Perhaps a permissions issue?");
+ e.printStackTrace(System.err);
+ } finally {
+ if (headerStream != null) {
+ try {
+ headerStream.close();
+ } catch (IOException e) {
+ System.err.println("Unable to close headerStream due to "+e);
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+ }
+}
diff --git a/build/annotationProcessors/classloader/AnnotatableEntity.java b/build/annotationProcessors/classloader/AnnotatableEntity.java
new file mode 100644
index 000000000..6ad64ccc1
--- /dev/null
+++ b/build/annotationProcessors/classloader/AnnotatableEntity.java
@@ -0,0 +1,57 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.classloader;
+
+import org.mozilla.goanna.annotationProcessors.AnnotationInfo;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+/**
+ * Union type to hold either a method, field, or ctor. Allows us to iterate "The generatable stuff", despite
+ * the fact that such things can be of either flavour.
+ */
+public class AnnotatableEntity {
+ public enum ENTITY_TYPE {METHOD, FIELD, CONSTRUCTOR}
+
+ private final Member mMember;
+ public final ENTITY_TYPE mEntityType;
+
+ public final AnnotationInfo mAnnotationInfo;
+
+ public AnnotatableEntity(Member aObject, AnnotationInfo aAnnotationInfo) {
+ mMember = aObject;
+ mAnnotationInfo = aAnnotationInfo;
+
+ if (aObject instanceof Method) {
+ mEntityType = ENTITY_TYPE.METHOD;
+ } else if (aObject instanceof Field) {
+ mEntityType = ENTITY_TYPE.FIELD;
+ } else {
+ mEntityType = ENTITY_TYPE.CONSTRUCTOR;
+ }
+ }
+
+ public Method getMethod() {
+ if (mEntityType != ENTITY_TYPE.METHOD) {
+ throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
+ }
+ return (Method) mMember;
+ }
+ public Field getField() {
+ if (mEntityType != ENTITY_TYPE.FIELD) {
+ throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
+ }
+ return (Field) mMember;
+ }
+ public Constructor<?> getConstructor() {
+ if (mEntityType != ENTITY_TYPE.CONSTRUCTOR) {
+ throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
+ }
+ return (Constructor<?>) mMember;
+ }
+}
diff --git a/build/annotationProcessors/classloader/ClassWithOptions.java b/build/annotationProcessors/classloader/ClassWithOptions.java
new file mode 100644
index 000000000..851a30150
--- /dev/null
+++ b/build/annotationProcessors/classloader/ClassWithOptions.java
@@ -0,0 +1,15 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.classloader;
+
+public class ClassWithOptions {
+ public final Class<?> wrappedClass;
+ public final String generatedName;
+
+ public ClassWithOptions(Class<?> someClass, String name) {
+ wrappedClass = someClass;
+ generatedName = name;
+ }
+}
diff --git a/build/annotationProcessors/classloader/IterableJarLoadingURLClassLoader.java b/build/annotationProcessors/classloader/IterableJarLoadingURLClassLoader.java
new file mode 100644
index 000000000..e6a8b6540
--- /dev/null
+++ b/build/annotationProcessors/classloader/IterableJarLoadingURLClassLoader.java
@@ -0,0 +1,75 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.classloader;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * A classloader which can be initialised with a list of jar files and which can provide an iterator
+ * over the top level classes in the jar files it was initialised with.
+ * classNames is kept sorted to ensure iteration order is consistent across program invocations.
+ * Otherwise, we'd forever be reporting the outdatedness of the generated code as we permute its
+ * contents.
+ */
+public class IterableJarLoadingURLClassLoader extends URLClassLoader {
+ LinkedList<String> classNames = new LinkedList<String>();
+
+ /**
+ * Create an instance and return its iterator. Provides an iterator over the classes in the jar
+ * files provided as arguments.
+ * Inner classes are not supported.
+ *
+ * @param args A list of jar file names an iterator over the classes of which is desired.
+ * @return An iterator over the top level classes in the jar files provided, in arbitrary order.
+ */
+ public static Iterator<ClassWithOptions> getIteratorOverJars(String[] args) {
+ URL[] urlArray = new URL[args.length];
+ LinkedList<String> aClassNames = new LinkedList<String>();
+
+ for (int i = 0; i < args.length; i++) {
+ try {
+ urlArray[i] = (new File(args[i])).toURI().toURL();
+
+ Enumeration<JarEntry> entries = new JarFile(args[i]).entries();
+ while (entries.hasMoreElements()) {
+ JarEntry e = entries.nextElement();
+ String fName = e.getName();
+ if (!fName.endsWith(".class")) {
+ continue;
+ }
+ final String className = fName.substring(0, fName.length() - 6).replace('/', '.');
+
+ aClassNames.add(className);
+ }
+ } catch (IOException e) {
+ System.err.println("Error loading jar file \"" + args[i] + '"');
+ e.printStackTrace(System.err);
+ }
+ }
+ Collections.sort(aClassNames);
+ return new JarClassIterator(new IterableJarLoadingURLClassLoader(urlArray, aClassNames));
+ }
+
+ /**
+ * Constructs a classloader capable of loading all classes given as URLs in urls. Used by static
+ * method above.
+ *
+ * @param urls URLs for all classes the new instance shall be capable of loading.
+ * @param aClassNames A list of names of the classes this instance shall be capable of loading.
+ */
+ protected IterableJarLoadingURLClassLoader(URL[] urls, LinkedList<String> aClassNames) {// Array to populate with URLs for each class in the given jars.
+ super(urls);
+ classNames = aClassNames;
+ }
+}
diff --git a/build/annotationProcessors/classloader/JarClassIterator.java b/build/annotationProcessors/classloader/JarClassIterator.java
new file mode 100644
index 000000000..5e5d25681
--- /dev/null
+++ b/build/annotationProcessors/classloader/JarClassIterator.java
@@ -0,0 +1,61 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.classloader;
+
+import java.util.Iterator;
+
+/**
+ * Class for iterating over an IterableJarLoadingURLClassLoader's classes.
+ */
+public class JarClassIterator implements Iterator<ClassWithOptions> {
+ private IterableJarLoadingURLClassLoader mTarget;
+ private Iterator<String> mTargetClassListIterator;
+
+ public JarClassIterator(IterableJarLoadingURLClassLoader aTarget) {
+ mTarget = aTarget;
+ mTargetClassListIterator = aTarget.classNames.iterator();
+ }
+
+ @Override
+ public boolean hasNext() {
+ return mTargetClassListIterator.hasNext();
+ }
+
+ @Override
+ public ClassWithOptions next() {
+ String className = mTargetClassListIterator.next();
+ try {
+ Class<?> ret = mTarget.loadClass(className);
+ final String canonicalName;
+
+ // Incremental builds can leave stale classfiles in the jar. Such classfiles will cause
+ // an exception at this point. We can safely ignore these classes - they cannot possibly
+ // ever be loaded as they conflict with their parent class and will be killed by Proguard
+ // later on anyway.
+ try {
+ canonicalName = ret.getCanonicalName();
+ } catch (IncompatibleClassChangeError e) {
+ return next();
+ }
+
+ if (canonicalName == null || "null".equals(canonicalName)) {
+ // Anonymous inner class - unsupported.
+ return next();
+ }
+
+ return new ClassWithOptions(ret, ret.getSimpleName());
+ } catch (ClassNotFoundException e) {
+ System.err.println("Unable to enumerate class: " + className + ". Corrupted jar file?");
+ e.printStackTrace();
+ System.exit(2);
+ }
+ return null;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("Removal of classes from iterator not supported.");
+ }
+}
diff --git a/build/annotationProcessors/moz.build b/build/annotationProcessors/moz.build
new file mode 100644
index 000000000..c8e0fb8bd
--- /dev/null
+++ b/build/annotationProcessors/moz.build
@@ -0,0 +1,20 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+jar = add_java_jar('annotationProcessors')
+jar.sources += [
+ 'AnnotationInfo.java',
+ 'AnnotationProcessor.java',
+ 'classloader/AnnotatableEntity.java',
+ 'classloader/ClassWithOptions.java',
+ 'classloader/IterableJarLoadingURLClassLoader.java',
+ 'classloader/JarClassIterator.java',
+ 'CodeGenerator.java',
+ 'SDKProcessor.java',
+ 'utils/AlphabeticAnnotatableEntityComparator.java',
+ 'utils/GeneratableElementIterator.java',
+ 'utils/Utils.java',
+]
diff --git a/build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java b/build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
new file mode 100644
index 000000000..d63fef076
--- /dev/null
+++ b/build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
@@ -0,0 +1,81 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.utils;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.Comparator;
+
+public class AlphabeticAnnotatableEntityComparator<T extends Member> implements Comparator<T> {
+ @Override
+ public int compare(T aLhs, T aRhs) {
+ // Constructors, Methods, Fields.
+ boolean lIsConstructor = aLhs instanceof Constructor;
+ boolean rIsConstructor = aRhs instanceof Constructor;
+ boolean lIsMethod = aLhs instanceof Method;
+ boolean rIsField = aRhs instanceof Field;
+
+ if (lIsConstructor) {
+ if (!rIsConstructor) {
+ return -1;
+ }
+ } else if (lIsMethod) {
+ if (rIsConstructor) {
+ return 1;
+ } else if (rIsField) {
+ return -1;
+ }
+ } else {
+ if (!rIsField) {
+ return 1;
+ }
+ }
+
+ // Verify these objects are the same type and cast them.
+ if (aLhs instanceof Method) {
+ return compare((Method) aLhs, (Method) aRhs);
+ } else if (aLhs instanceof Field) {
+ return compare((Field) aLhs, (Field) aRhs);
+ } else {
+ return compare((Constructor) aLhs, (Constructor) aRhs);
+ }
+ }
+
+ // Alas, the type system fails us.
+ private static int compare(Method aLhs, Method aRhs) {
+ // Initially, attempt to differentiate the methods be name alone..
+ String lName = aLhs.getName();
+ String rName = aRhs.getName();
+
+ int ret = lName.compareTo(rName);
+ if (ret != 0) {
+ return ret;
+ }
+
+ // The names were the same, so we need to compare signatures to find their uniqueness..
+ lName = Utils.getSignature(aLhs);
+ rName = Utils.getSignature(aRhs);
+
+ return lName.compareTo(rName);
+ }
+
+ private static int compare(Constructor<?> aLhs, Constructor<?> aRhs) {
+ // The names will be the same, so we need to compare signatures to find their uniqueness..
+ String lName = Utils.getSignature(aLhs);
+ String rName = Utils.getSignature(aRhs);
+
+ return lName.compareTo(rName);
+ }
+
+ private static int compare(Field aLhs, Field aRhs) {
+ // Compare field names..
+ String lName = aLhs.getName();
+ String rName = aRhs.getName();
+
+ return lName.compareTo(rName);
+ }
+}
diff --git a/build/annotationProcessors/utils/GeneratableElementIterator.java b/build/annotationProcessors/utils/GeneratableElementIterator.java
new file mode 100644
index 000000000..caf51aa15
--- /dev/null
+++ b/build/annotationProcessors/utils/GeneratableElementIterator.java
@@ -0,0 +1,164 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.utils;
+
+import org.mozilla.goanna.annotationProcessors.AnnotationInfo;
+import org.mozilla.goanna.annotationProcessors.classloader.AnnotatableEntity;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * Iterator over the methods in a given method list which have the WrappedJNIMethod
+ * annotation. Returns an object containing both the annotation (Which may contain interesting
+ * parameters) and the argument.
+ */
+public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
+ private final Member[] mObjects;
+ private AnnotatableEntity mNextReturnValue;
+ private int mElementIndex;
+
+ private boolean mIterateEveryEntry;
+
+ public GeneratableElementIterator(Class<?> aClass) {
+ // Get all the elements of this class as AccessibleObjects.
+ Member[] aMethods = aClass.getDeclaredMethods();
+ Member[] aFields = aClass.getDeclaredFields();
+ Member[] aCtors = aClass.getConstructors();
+
+ // Shove them all into one buffer.
+ Member[] objs = new Member[aMethods.length + aFields.length + aCtors.length];
+
+ int offset = 0;
+ System.arraycopy(aMethods, 0, objs, 0, aMethods.length);
+ offset += aMethods.length;
+ System.arraycopy(aFields, 0, objs, offset, aFields.length);
+ offset += aFields.length;
+ System.arraycopy(aCtors, 0, objs, offset, aCtors.length);
+
+ // Sort the elements to ensure determinism.
+ Arrays.sort(objs, new AlphabeticAnnotatableEntityComparator<Member>());
+ mObjects = objs;
+
+ // Check for "Wrap ALL the things" flag.
+ for (Annotation annotation : aClass.getDeclaredAnnotations()) {
+ final String annotationTypeName = annotation.annotationType().getName();
+ if (annotationTypeName.equals("org.mozilla.goanna.mozglue.generatorannotations.WrapEntireClassForJNI")) {
+ mIterateEveryEntry = true;
+ break;
+ }
+ }
+
+ findNextValue();
+ }
+
+ /**
+ * Find and cache the next appropriately annotated method, plus the annotation parameter, if
+ * one exists. Otherwise cache null, so hasNext returns false.
+ */
+ private void findNextValue() {
+ while (mElementIndex < mObjects.length) {
+ Member candidateElement = mObjects[mElementIndex];
+ mElementIndex++;
+ for (Annotation annotation : ((AnnotatedElement) candidateElement).getDeclaredAnnotations()) {
+ // WrappedJNIMethod has parameters. Use Reflection to obtain them.
+ Class<? extends Annotation> annotationType = annotation.annotationType();
+ final String annotationTypeName = annotationType.getName();
+ if (annotationTypeName.equals("org.mozilla.goanna.mozglue.generatorannotations.WrapElementForJNI")) {
+ String stubName = null;
+ boolean isMultithreadedStub = false;
+ boolean noThrow = false;
+ boolean narrowChars = false;
+ boolean catchException = false;
+ try {
+ // Determine the explicitly-given name of the stub to generate, if any.
+ final Method stubNameMethod = annotationType.getDeclaredMethod("stubName");
+ stubNameMethod.setAccessible(true);
+ stubName = (String) stubNameMethod.invoke(annotation);
+
+ // Determine if the generated stub is to allow calls from multiple threads.
+ final Method multithreadedStubMethod = annotationType.getDeclaredMethod("allowMultithread");
+ multithreadedStubMethod.setAccessible(true);
+ isMultithreadedStub = (Boolean) multithreadedStubMethod.invoke(annotation);
+
+ // Determine if ignoring exceptions
+ final Method noThrowMethod = annotationType.getDeclaredMethod("noThrow");
+ noThrowMethod.setAccessible(true);
+ noThrow = (Boolean) noThrowMethod.invoke(annotation);
+
+ // Determine if strings should be wide or narrow
+ final Method narrowCharsMethod = annotationType.getDeclaredMethod("narrowChars");
+ narrowCharsMethod.setAccessible(true);
+ narrowChars = (Boolean) narrowCharsMethod.invoke(annotation);
+
+ // Determine if we should catch exceptions
+ final Method catchExceptionMethod = annotationType.getDeclaredMethod("catchException");
+ catchExceptionMethod.setAccessible(true);
+ catchException = (Boolean) catchExceptionMethod.invoke(annotation);
+
+ } catch (NoSuchMethodException e) {
+ System.err.println("Unable to find expected field on WrapElementForJNI annotation. Did the signature change?");
+ e.printStackTrace(System.err);
+ System.exit(3);
+ } catch (IllegalAccessException e) {
+ System.err.println("IllegalAccessException reading fields on WrapElementForJNI annotation. Seems the semantics of Reflection have changed...");
+ e.printStackTrace(System.err);
+ System.exit(4);
+ } catch (InvocationTargetException e) {
+ System.err.println("InvocationTargetException reading fields on WrapElementForJNI annotation. This really shouldn't happen.");
+ e.printStackTrace(System.err);
+ System.exit(5);
+ }
+
+ // If the method name was not explicitly given in the annotation generate one...
+ if (stubName.isEmpty()) {
+ stubName = Utils.getNativeName(candidateElement);
+ }
+
+ AnnotationInfo annotationInfo = new AnnotationInfo(
+ stubName, isMultithreadedStub, noThrow, narrowChars, catchException);
+ mNextReturnValue = new AnnotatableEntity(candidateElement, annotationInfo);
+ return;
+ }
+ }
+
+ // If no annotation found, we might be expected to generate anyway
+ // using default arguments, thanks to the "Generate everything" annotation.
+ if (mIterateEveryEntry) {
+ AnnotationInfo annotationInfo = new AnnotationInfo(
+ Utils.getNativeName(candidateElement),
+ /* multithreaded */ true,
+ /* noThrow */ false,
+ /* narrowChars */ false,
+ /* catchException */ false);
+ mNextReturnValue = new AnnotatableEntity(candidateElement, annotationInfo);
+ return;
+ }
+ }
+ mNextReturnValue = null;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return mNextReturnValue != null;
+ }
+
+ @Override
+ public AnnotatableEntity next() {
+ AnnotatableEntity ret = mNextReturnValue;
+ findNextValue();
+ return ret;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("Removal of methods from GeneratableElementIterator not supported.");
+ }
+}
diff --git a/build/annotationProcessors/utils/Utils.java b/build/annotationProcessors/utils/Utils.java
new file mode 100644
index 000000000..7d6f84a55
--- /dev/null
+++ b/build/annotationProcessors/utils/Utils.java
@@ -0,0 +1,247 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna.annotationProcessors.utils;
+
+import org.mozilla.goanna.annotationProcessors.AnnotationInfo;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+
+/**
+ * A collection of utility methods used by CodeGenerator. Largely used for translating types.
+ */
+public class Utils {
+
+ // A collection of lookup tables to simplify the functions to follow...
+ private static final HashMap<String, String> NATIVE_TYPES = new HashMap<String, String>();
+
+ static {
+ NATIVE_TYPES.put("void", "void");
+ NATIVE_TYPES.put("boolean", "bool");
+ NATIVE_TYPES.put("byte", "int8_t");
+ NATIVE_TYPES.put("char", "char16_t");
+ NATIVE_TYPES.put("short", "int16_t");
+ NATIVE_TYPES.put("int", "int32_t");
+ NATIVE_TYPES.put("long", "int64_t");
+ NATIVE_TYPES.put("float", "float");
+ NATIVE_TYPES.put("double", "double");
+ }
+
+ private static final HashMap<String, String> NATIVE_ARRAY_TYPES = new HashMap<String, String>();
+
+ static {
+ NATIVE_ARRAY_TYPES.put("boolean", "mozilla::jni::BooleanArray");
+ NATIVE_ARRAY_TYPES.put("byte", "mozilla::jni::ByteArray");
+ NATIVE_ARRAY_TYPES.put("char", "mozilla::jni::CharArray");
+ NATIVE_ARRAY_TYPES.put("short", "mozilla::jni::ShortArray");
+ NATIVE_ARRAY_TYPES.put("int", "mozilla::jni::IntArray");
+ NATIVE_ARRAY_TYPES.put("long", "mozilla::jni::LongArray");
+ NATIVE_ARRAY_TYPES.put("float", "mozilla::jni::FloatArray");
+ NATIVE_ARRAY_TYPES.put("double", "mozilla::jni::DoubleArray");
+ }
+
+ private static final HashMap<String, String> CLASS_DESCRIPTORS = new HashMap<String, String>();
+
+ static {
+ CLASS_DESCRIPTORS.put("void", "V");
+ CLASS_DESCRIPTORS.put("boolean", "Z");
+ CLASS_DESCRIPTORS.put("byte", "B");
+ CLASS_DESCRIPTORS.put("char", "C");
+ CLASS_DESCRIPTORS.put("short", "S");
+ CLASS_DESCRIPTORS.put("int", "I");
+ CLASS_DESCRIPTORS.put("long", "J");
+ CLASS_DESCRIPTORS.put("float", "F");
+ CLASS_DESCRIPTORS.put("double", "D");
+ }
+
+ /**
+ * Get the C++ type corresponding to the provided type parameter.
+ *
+ * @param type Class to determine the corresponding JNI type for.
+ * @return C++ type as a String
+ */
+ public static String getNativeParameterType(Class<?> type, AnnotationInfo info) {
+ final String name = type.getName().replace('.', '/');
+
+ if (NATIVE_TYPES.containsKey(name)) {
+ return NATIVE_TYPES.get(name);
+ }
+
+ if (type.isArray()) {
+ final String compName = type.getComponentType().getName();
+ if (NATIVE_ARRAY_TYPES.containsKey(compName)) {
+ return NATIVE_ARRAY_TYPES.get(compName) + "::Param";
+ }
+ return "mozilla::jni::ObjectArray::Param";
+ }
+
+ if (type == String.class || type == CharSequence.class) {
+ return "mozilla::jni::String::Param";
+ }
+
+ if (type == Class.class) {
+ // You're doing reflection on Java objects from inside C, returning Class objects
+ // to C, generating the corresponding code using this Java program. Really?!
+ return "mozilla::jni::ClassObject::Param";
+ }
+
+ if (type == Throwable.class) {
+ return "mozilla::jni::Throwable::Param";
+ }
+
+ return "mozilla::jni::Object::Param";
+ }
+
+ public static String getNativeReturnType(Class<?> type, AnnotationInfo info) {
+ final String name = type.getName().replace('.', '/');
+
+ if (NATIVE_TYPES.containsKey(name)) {
+ return NATIVE_TYPES.get(name);
+ }
+
+ if (type.isArray()) {
+ final String compName = type.getComponentType().getName();
+ if (NATIVE_ARRAY_TYPES.containsKey(compName)) {
+ return NATIVE_ARRAY_TYPES.get(compName) + "::LocalRef";
+ }
+ return "mozilla::jni::ObjectArray::LocalRef";
+ }
+
+ if (type == String.class) {
+ return "mozilla::jni::String::LocalRef";
+ }
+
+ if (type == Class.class) {
+ // You're doing reflection on Java objects from inside C, returning Class objects
+ // to C, generating the corresponding code using this Java program. Really?!
+ return "mozilla::jni::ClassObject::LocalRef";
+ }
+
+ if (type == Throwable.class) {
+ return "mozilla::jni::Throwable::LocalRef";
+ }
+
+ return "mozilla::jni::Object::LocalRef";
+ }
+
+ /**
+ * Get the JNI class descriptor corresponding to the provided type parameter.
+ *
+ * @param type Class to determine the corresponding JNI descriptor for.
+ * @return Class descripor as a String
+ */
+ public static String getClassDescriptor(Class<?> type) {
+ final String name = type.getName().replace('.', '/');
+
+ if (CLASS_DESCRIPTORS.containsKey(name)) {
+ return CLASS_DESCRIPTORS.get(name);
+ }
+
+ if (type.isArray()) {
+ // Array names are already in class descriptor form.
+ return name;
+ }
+
+ return "L" + name + ';';
+ }
+
+ /**
+ * Get the JNI signaure for a member.
+ *
+ * @param member Member to get the signature for.
+ * @return JNI signature as a string
+ */
+ public static String getSignature(Member member) {
+ return member instanceof Field ? getSignature((Field) member) :
+ member instanceof Method ? getSignature((Method) member) :
+ getSignature((Constructor<?>) member);
+ }
+
+ /**
+ * Get the JNI signaure for a field.
+ *
+ * @param member Field to get the signature for.
+ * @return JNI signature as a string
+ */
+ public static String getSignature(Field member) {
+ return getClassDescriptor(member.getType());
+ }
+
+ private static String getSignature(Class<?>[] args, Class<?> ret) {
+ final StringBuilder sig = new StringBuilder("(");
+ for (int i = 0; i < args.length; i++) {
+ sig.append(getClassDescriptor(args[i]));
+ }
+ return sig.append(')').append(getClassDescriptor(ret)).toString();
+ }
+
+ /**
+ * Get the JNI signaure for a method.
+ *
+ * @param member Method to get the signature for.
+ * @return JNI signature as a string
+ */
+ public static String getSignature(Method member) {
+ return getSignature(member.getParameterTypes(), member.getReturnType());
+ }
+
+ /**
+ * Get the JNI signaure for a constructor.
+ *
+ * @param member Constructor to get the signature for.
+ * @return JNI signature as a string
+ */
+ public static String getSignature(Constructor<?> member) {
+ return getSignature(member.getParameterTypes(), void.class);
+ }
+
+ /**
+ * Get the C++ name for a member.
+ *
+ * @param member Member to get the name for.
+ * @return JNI name as a string
+ */
+ public static String getNativeName(Member member) {
+ final String name = getMemberName(member);
+ return name.substring(0, 1).toUpperCase() + name.substring(1);
+ }
+
+ /**
+ * Get the JNI name for a member.
+ *
+ * @param member Member to get the name for.
+ * @return JNI name as a string
+ */
+ public static String getMemberName(Member member) {
+ if (member instanceof Constructor) {
+ return "<init>";
+ }
+ return member.getName();
+ }
+
+ /**
+ * Determine if a member is declared static.
+ *
+ * @param member The Member to check.
+ * @return true if the member is declared static, false otherwise.
+ */
+ public static boolean isStatic(final Member member) {
+ return Modifier.isStatic(member.getModifiers());
+ }
+
+ /**
+ * Determine if a member is declared final.
+ *
+ * @param member The Member to check.
+ * @return true if the member is declared final, false otherwise.
+ */
+ public static boolean isFinal(final Member member) {
+ return Modifier.isFinal(member.getModifiers());
+ }
+}
diff --git a/build/appini_header.py b/build/appini_header.py
index fc5c34d29..94a2a44b7 100644
--- a/build/appini_header.py
+++ b/build/appini_header.py
@@ -13,16 +13,26 @@ def main(file):
config.read(file)
flags = set()
try:
- if config.getint('XRE', 'EnableExtensionManager') == 1:
- flags.add('NS_XRE_ENABLE_EXTENSION_MANAGER')
- except: pass
- try:
if config.getint('XRE', 'EnableProfileMigrator') == 1:
flags.add('NS_XRE_ENABLE_PROFILE_MIGRATOR')
except: pass
+ try:
+ if config.getint('Crash Reporter', 'Enabled') == 1:
+ flags.add('NS_XRE_ENABLE_CRASH_REPORTER')
+ except: pass
appdata = dict(("%s:%s" % (s, o), config.get(s, o)) for s in config.sections() for o in config.options(s))
appdata['flags'] = ' | '.join(flags) if flags else '0'
appdata['App:profile'] = '"%s"' % appdata['App:profile'] if 'App:profile' in appdata else 'NULL'
+ expected = ('App:vendor', 'App:name', 'App:remotingname', 'App:version', 'App:buildid',
+ 'App:id', 'Goanna:minversion', 'Goanna:maxversion')
+ missing = [var for var in expected if var not in appdata]
+ if missing:
+ print >>sys.stderr, \
+ "Missing values in %s: %s" % (file, ', '.join(missing))
+ sys.exit(1)
+
+ if not 'Crash Reporter:serverurl' in appdata:
+ appdata['Crash Reporter:serverurl'] = ''
print '''#include "nsXREAppData.h"
static const nsXREAppData sAppData = {
@@ -30,6 +40,7 @@ def main(file):
NULL, // directory
"%(App:vendor)s",
"%(App:name)s",
+ "%(App:remotingname)s",
"%(App:version)s",
"%(App:buildid)s",
"%(App:id)s",
@@ -38,6 +49,7 @@ def main(file):
NULL, // xreDirectory
"%(Goanna:minversion)s",
"%(Goanna:maxversion)s",
+ "%(Crash Reporter:serverurl)s",
%(App:profile)s
};''' % appdata
diff --git a/build/application.ini b/build/application.ini
index 0e9a974c2..975b2ec93 100644
--- a/build/application.ini
+++ b/build/application.ini
@@ -26,6 +26,10 @@ Name=Pale Moon
#else
Name=@MOZ_APP_BASENAME@
#endif
+RemotingName=@MOZ_APP_REMOTINGNAME@
+#ifdef MOZ_APP_DISPLAYNAME
+CodeName=@MOZ_APP_DISPLAYNAME@
+#endif
Version=@MOZ_APP_VERSION@
#ifdef MOZ_APP_PROFILE
Profile=@MOZ_APP_PROFILE@
@@ -47,6 +51,3 @@ MaxVersion=@GRE_MILESTONE@
#ifdef MOZ_PROFILE_MIGRATOR
EnableProfileMigrator=1
#endif
-#ifdef MOZ_EXTENSION_MANAGER
-EnableExtensionManager=1
-#endif
diff --git a/build/autoconf/altoptions.m4 b/build/autoconf/altoptions.m4
index 3dc8c6e9a..f8c8ba96f 100644
--- a/build/autoconf/altoptions.m4
+++ b/build/autoconf/altoptions.m4
@@ -18,7 +18,6 @@ dnl MOZ_ARG_WITH_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE])
dnl MOZ_ARG_WITHOUT_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE])
dnl MOZ_ARG_WITH_STRING( NAME, HELP, IF-SET [, ELSE])
dnl MOZ_ARG_HEADER(Comment)
-dnl MOZ_CHECK_PTHREADS( NAME, IF-YES [, ELSE ])
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
@@ -80,43 +79,45 @@ dnl MOZ_ARG_HEADER(Comment)
dnl This is used by webconfig to group options
define(MOZ_ARG_HEADER, [# $1])
-dnl
-dnl Apparently, some systems cannot properly check for the pthread
-dnl library unless <pthread.h> is included so we need to test
-dnl using it
-dnl
-dnl MOZ_CHECK_PTHREADS(lib, success, failure)
-AC_DEFUN([MOZ_CHECK_PTHREADS],
-[
-AC_MSG_CHECKING([for pthread_create in -l$1])
-echo "
- #include <pthread.h>
- #include <stdlib.h>
- void *foo(void *v) { int a = 1; }
- int main() {
- pthread_t t;
- if (!pthread_create(&t, 0, &foo, 0)) {
- pthread_join(t, 0);
- }
- exit(0);
- }" > dummy.c ;
- echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
- ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
- _res=$? ;
- rm -f dummy.c dummy${ac_exeext} ;
- if test "$_res" = "0"; then
- AC_MSG_RESULT([yes])
- [$2]
- else
- AC_MSG_RESULT([no])
- [$3]
- fi
-])
-
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
AC_DEFUN([MOZ_READ_MOZCONFIG],
[AC_REQUIRE([AC_INIT_BINSH])dnl
-# Read in '.mozconfig' script to set the initial options.
-# See the mozconfig2configure script for more details.
-_AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf
-. $_AUTOCONF_TOOLS_DIR/mozconfig2configure])
+inserted=
+dnl Shell is hard, so here is what the following does:
+dnl - Reset $@ (command line arguments)
+dnl - Add the configure options from mozconfig to $@ one by one
+dnl - Add the original command line arguments after that, one by one
+dnl
+dnl There are several tricks involved:
+dnl - It is not possible to preserve the whitespaces in $@ by assigning to
+dnl another variable, so the two first steps above need to happen in the first
+dnl iteration of the third step.
+dnl - We always want the configure options to be added, so the loop must be
+dnl iterated at least once, so we add a dummy argument first, and discard it.
+dnl - something | while read line ... makes the while run in a subshell, meaning
+dnl that anything it does is not propagated to the main shell, so we can't do
+dnl set -- foo there. As a consequence, what the while loop reading mach
+dnl environment output does is output a set of shell commands for the main shell
+dnl to eval.
+dnl - Extra care is due when lines from mach environment output contain special
+dnl shell characters, so we use ' for quoting and ensure no ' end up in between
+dnl the quoting mark unescaped.
+dnl Some of the above is directly done in mach environment --format=configure.
+failed_eval() {
+ echo "Failed eval'ing the following:"
+ $(dirname [$]0)/[$1]/mach environment --format=configure
+ exit 1
+}
+
+set -- dummy "[$]@"
+for ac_option
+do
+ if test -z "$inserted"; then
+ set --
+ eval "$($(dirname [$]0)/[$1]/mach environment --format=configure)" || failed_eval
+ inserted=1
+ else
+ set -- "[$]@" "$ac_option"
+ fi
+done
+])
diff --git a/build/autoconf/android.m4 b/build/autoconf/android.m4
index a225cb3a1..e432f976a 100644
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -38,13 +38,8 @@ if test $android_version -lt MIN_ANDROID_VERSION ; then
AC_MSG_ERROR([--with-android-version must be at least MIN_ANDROID_VERSION.])
fi
-MOZ_ARG_WITH_STRING(android-platform,
-[ --with-android-platform=DIR
- location of platform dir],
- android_platform=$withval)
-
case "$target" in
-arm-linux*-android*|*-linuxandroid*)
+arm-*linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
i?86-*android*)
@@ -69,7 +64,7 @@ case "$target" in
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
- for version in $android_gnu_compiler_version 4.6 4.4.3 ; do
+ for version in $android_gnu_compiler_version 4.8 4.7 4.6 4.4.3; do
case "$target_cpu" in
arm)
target_name=arm-linux-androideabi-$version
@@ -116,29 +111,26 @@ case "$target" in
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-android-version=$android_version"
- if test -z "$android_platform" ; then
- AC_MSG_CHECKING([for android platform directory])
-
- case "$target_cpu" in
- arm)
- target_name=arm
- ;;
- i?86)
- target_name=x86
- ;;
- mipsel)
- target_name=mips
- ;;
- esac
-
- android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
-
- if test -d "$android_platform" ; then
- AC_MSG_RESULT([$android_platform])
- else
- AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
- fi
- NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-android-platform=$android_platform"
+ AC_MSG_CHECKING([for android platform directory])
+
+ case "$target_cpu" in
+ arm)
+ target_name=arm
+ ;;
+ i?86)
+ target_name=x86
+ ;;
+ mipsel)
+ target_name=mips
+ ;;
+ esac
+
+ android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
+
+ if test -d "$android_platform" ; then
+ AC_MSG_RESULT([$android_platform])
+ else
+ AC_MSG_ERROR([not found. Please check your NDK. With the current configuration, it should be in $android_platform])
fi
dnl Old NDK support. If minimum requirement is changed to NDK r8b,
@@ -155,19 +147,25 @@ case "$target" in
dnl set up compilers
TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
- CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
- CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
- CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
+ if test -z "$CC"; then
+ CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
+ fi
+ if test -z "$CXX"; then
+ CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
+ fi
+ if test -z "$CPP"; then
+ CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
+ fi
LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
- CPPFLAGS="-isystem $android_platform/usr/include $CPPFLAGS"
+ CPPFLAGS="-idirafter $android_platform/usr/include $CPPFLAGS"
CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS"
- ASFLAGS="-isystem $android_platform/usr/include -DANDROID $ASFLAGS"
+ ASFLAGS="-idirafter $android_platform/usr/include -DANDROID $ASFLAGS"
dnl Add -llog by default, since we use it all over the place.
dnl Add --allow-shlib-undefined, because libGLESv2 links to an
@@ -193,7 +191,6 @@ case "$target" in
ANDROID_PLATFORM="${android_platform}"
AC_DEFINE(ANDROID)
- CROSS_COMPILE=1
AC_SUBST(ANDROID_NDK)
AC_SUBST(ANDROID_TOOLCHAIN)
AC_SUBST(ANDROID_PLATFORM)
@@ -224,47 +221,70 @@ if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
AC_SUBST(ANDROID_CPU_ARCH)
- if test -z "$STLPORT_CPPFLAGS$STLPORT_LDFLAGS$STLPORT_LIBS"; then
+ if test -z "$STLPORT_CPPFLAGS$STLPORT_LIBS"; then
if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
if test -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/libgnustl_static.a"; then
# android-ndk-r8b
- STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/"
- STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/include"
- STLPORT_LIBS="-lgnustl_static"
+ STLPORT_LIBS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/ -lgnustl_static"
+ STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/libs/$ANDROID_CPU_ARCH/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/$android_gnu_compiler_version/include/backward"
elif test -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libgnustl_static.a"; then
# android-ndk-r7, android-ndk-r7b, android-ndk-r8
- STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/"
+ STLPORT_LIBS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/ -lgnustl_static"
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include"
- STLPORT_LIBS="-lgnustl_static"
elif test -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a"; then
# android-ndk-r5c, android-ndk-r6, android-ndk-r6b
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include"
- STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/"
- STLPORT_LIBS="-lstdc++"
+ STLPORT_LIBS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/ -lstdc++"
else
AC_MSG_ERROR([Couldn't find path to gnu-libstdc++ in the android ndk])
fi
- elif test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
- if test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
- STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
- elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
- STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
- else
- AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
- fi
- STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
- STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
- STLPORT_LIBS="-lstlport_static"
- elif test "$target" != "arm-android-eabi"; then
- dnl fail if we're not building with NDKr4
- AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
+ else
+ STLPORT_CPPFLAGS="-isystem $_topsrcdir/build/stlport/stlport -isystem $_topsrcdir/build/stlport/overrides -isystem $android_ndk/sources/cxx-stl/system/include"
fi
fi
CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
- LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
- LIBS="$LIBS $STLPORT_LIBS"
fi
-AC_SUBST([STLPORT_SOURCES])
+AC_SUBST([MOZ_ANDROID_LIBSTDCXX])
+AC_SUBST([STLPORT_LIBS])
+
+])
+
+AC_DEFUN([MOZ_ANDROID_GOOGLE_PLAY_SERVICES],
+[
+
+if test -n "$MOZ_NATIVE_DEVICES" ; then
+ AC_SUBST(MOZ_NATIVE_DEVICES)
+
+ AC_MSG_CHECKING([for google play services])
+ GOOGLE_PLAY_SERVICES_LIB="${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
+ GOOGLE_PLAY_SERVICES_RES="${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/res"
+ AC_SUBST(GOOGLE_PLAY_SERVICES_LIB)
+ AC_SUBST(GOOGLE_PLAY_SERVICES_RES)
+ if ! test -e $GOOGLE_PLAY_SERVICES_LIB ; then
+ AC_MSG_ERROR([You must download Google Play Services to build with native video casting support enabled. Run the Android SDK tool and install Google Play Services under Extras. See http://developer.android.com/google/play-services/setup.html for more info. (looked for $GOOGLE_PLAY_SERVICES_LIB) ])
+ fi
+ AC_MSG_RESULT([$GOOGLE_PLAY_SERVICES_LIB])
+
+ ANDROID_APPCOMPAT_LIB="$ANDROID_COMPAT_DIR_BASE/v7/appcompat/libs/android-support-v7-appcompat.jar"
+ ANDROID_APPCOMPAT_RES="$ANDROID_COMPAT_DIR_BASE/v7/appcompat/res"
+ AC_MSG_CHECKING([for v7 appcompat library])
+ if ! test -e $ANDROID_APPCOMPAT_LIB ; then
+ AC_MSG_ERROR([You must download the v7 app compat Android support library when targeting Android with native video casting support enabled. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_APPCOMPAT_LIB)])
+ fi
+ AC_MSG_RESULT([$ANDROID_APPCOMPAT_LIB])
+ AC_SUBST(ANDROID_APPCOMPAT_LIB)
+ AC_SUBST(ANDROID_APPCOMPAT_RES)
+
+ ANDROID_MEDIAROUTER_LIB="$ANDROID_COMPAT_DIR_BASE/v7/mediarouter/libs/android-support-v7-mediarouter.jar"
+ ANDROID_MEDIAROUTER_RES="$ANDROID_COMPAT_DIR_BASE/v7/mediarouter/res"
+ AC_MSG_CHECKING([for v7 mediarouter library])
+ if ! test -e $ANDROID_MEDIAROUTER_LIB ; then
+ AC_MSG_ERROR([You must download the v7 media router Android support library when targeting Android with native video casting support enabled. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_MEDIAROUTER_LIB)])
+ fi
+ AC_MSG_RESULT([$ANDROID_MEDIAROUTER_LIB])
+ AC_SUBST(ANDROID_MEDIAROUTER_LIB)
+ AC_SUBST(ANDROID_MEDIAROUTER_RES)
+fi
])
@@ -276,6 +296,8 @@ MOZ_ARG_WITH_STRING(android-sdk,
location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
android_sdk=$withval)
+android_sdk_root=${withval%/platforms/android-*}
+
case "$target" in
*-android*|*-linuxandroid*)
if test -z "$android_sdk" ; then
@@ -286,31 +308,44 @@ case "$target" in
fi
# Get the api level from "$android_sdk"/source.properties.
- android_api_level=`$AWK -F = changequote(<<, >>)'<<$>>1 == "AndroidVersion.ApiLevel" {print <<$>>2}'changequote([, ]) "$android_sdk"/source.properties`
+ ANDROID_TARGET_SDK=`$AWK -F = changequote(<<, >>)'<<$>>1 == "AndroidVersion.ApiLevel" {print <<$>>2}'changequote([, ]) "$android_sdk"/source.properties`
- if test -z "$android_api_level" ; then
+ if test -z "$ANDROID_TARGET_SDK" ; then
AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
fi
- if ! test "$android_api_level" -eq "$android_api_level" ; then
- AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
+ AC_DEFINE_UNQUOTED(ANDROID_TARGET_SDK,$ANDROID_TARGET_SDK)
+ AC_SUBST(ANDROID_TARGET_SDK)
+
+ if ! test "$ANDROID_TARGET_SDK" -eq "$ANDROID_TARGET_SDK" ; then
+ AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $ANDROID_TARGET_SDK)])
fi
- if test $android_api_level -lt $1 ; then
- AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($1 or higher required).])
+ if test $ANDROID_TARGET_SDK -lt $1 ; then
+ AC_MSG_ERROR([The given Android SDK provides API level $ANDROID_TARGET_SDK ($1 or higher required).])
fi
fi
- android_platform_tools="$android_sdk"/../../platform-tools
+ android_tools="$android_sdk_root"/tools
+ android_platform_tools="$android_sdk_root"/platform-tools
if test ! -d "$android_platform_tools" ; then
android_platform_tools="$android_sdk"/tools # SDK Tools < r8
fi
- # The build tools got moved around to different directories in
- # SDK Tools r22. Try to locate them.
+
+ dnl The build tools got moved around to different directories in SDK
+ dnl Tools r22. Try to locate them. This is awful, but, from
+ dnl http://stackoverflow.com/a/4495368, the following sorts versions
+ dnl of the form x.y.z.a.b from newest to oldest:
+ dnl sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr
+ dnl We want to favour the newer versions that start with 'android-';
+ dnl that's what the sed is about.
+ dnl We might iterate over directories that aren't build-tools at all;
+ dnl we use the presence of aapt as a marker.
+ AC_MSG_CHECKING([for android build-tools directory])
android_build_tools=""
- for suffix in 17.0.0 android-4.2.2; do
- tools_directory="$android_sdk/../../build-tools/$suffix"
- if test -d "$tools_directory" ; then
+ for suffix in `ls "$android_sdk_root/build-tools" | sed -e "s,android-,999.," | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr`; do
+ tools_directory=`echo "$android_sdk_root/build-tools/$suffix" | sed -e "s,999.,android-,"`
+ if test -d "$tools_directory" -a -f "$tools_directory/aapt"; then
android_build_tools="$tools_directory"
break
fi
@@ -318,22 +353,101 @@ case "$target" in
if test -z "$android_build_tools" ; then
android_build_tools="$android_platform_tools" # SDK Tools < r22
fi
+ all_android_build_tools=""
+ for suffix in `ls "$android_sdk_root/build-tools" | sed -e "s,android-,999.," | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr`; do
+ tools_directory=`echo "$android_sdk_root/build-tools/$suffix" | sed -e "s,999.,android-,"`
+ if test -d "$tools_directory" -a -f "$tools_directory/aapt"; then
+ all_android_build_tools="$all_android_build_tools:$tools_directory"
+ fi
+ done
+
+ if test -d "$android_build_tools" -a -f "$android_build_tools/aapt"; then
+ AC_MSG_RESULT([$android_build_tools])
+ else
+ AC_MSG_ERROR([not found. Please check your SDK for the subdirectory of build-tools. With the current configuration, it should be in $android_sdk_root/build_tools])
+ fi
+
ANDROID_SDK="${android_sdk}"
- if test -e "${android_sdk}/../../extras/android/compatibility/v4/android-support-v4.jar" ; then
- ANDROID_COMPAT_LIB="${android_sdk}/../../extras/android/compatibility/v4/android-support-v4.jar"
+ ANDROID_SDK_ROOT="${android_sdk_root}"
+
+ AC_MSG_CHECKING([for compat library dirs])
+ if test -e "${android_sdk_root}/extras/android/compatibility/v4/android-support-v4.jar" ; then
+ ANDROID_COMPAT_DIR_BASE="${android_sdk_root}/extras/android/compatibility";
else
- ANDROID_COMPAT_LIB="${android_sdk}/../../extras/android/support/v4/android-support-v4.jar";
+ ANDROID_COMPAT_DIR_BASE="${android_sdk_root}/extras/android/support";
fi
+ AC_MSG_RESULT([$ANDROID_COMPAT_DIR_BASE])
+
+ ANDROID_TOOLS="${android_tools}"
ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
ANDROID_BUILD_TOOLS="${android_build_tools}"
+ AC_SUBST(ANDROID_SDK_ROOT)
AC_SUBST(ANDROID_SDK)
+ AC_SUBST(ANDROID_TOOLS)
+ AC_SUBST(ANDROID_PLATFORM_TOOLS)
+ AC_SUBST(ANDROID_BUILD_TOOLS)
+
+ ANDROID_COMPAT_LIB=$ANDROID_COMPAT_DIR_BASE/v4/android-support-v4.jar
+ AC_MSG_CHECKING([for v4 compat library])
AC_SUBST(ANDROID_COMPAT_LIB)
if ! test -e $ANDROID_COMPAT_LIB ; then
- AC_MSG_ERROR([You must download the Android support library when targeting Android. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
+ AC_MSG_ERROR([You must download the Android v4 support library when targeting Android. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
+ fi
+ AC_MSG_RESULT([$ANDROID_COMPAT_LIB])
+
+ dnl Google has a history of moving the Android tools around. We don't
+ dnl care where they are, so let's try to find them anywhere we can.
+ ALL_ANDROID_TOOLS_PATHS="$ANDROID_TOOLS$all_android_build_tools:$ANDROID_PLATFORM_TOOLS"
+ MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$ALL_ANDROID_TOOLS_PATHS])
+ MOZ_PATH_PROG(DX, dx, :, [$ALL_ANDROID_TOOLS_PATHS])
+ MOZ_PATH_PROG(AAPT, aapt, :, [$ALL_ANDROID_TOOLS_PATHS])
+ MOZ_PATH_PROG(AIDL, aidl, :, [$ALL_ANDROID_TOOLS_PATHS])
+ MOZ_PATH_PROG(ADB, adb, :, [$ALL_ANDROID_TOOLS_PATHS])
+
+ if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
+ AC_MSG_ERROR([The program zipalign was not found. Use --with-android-sdk={android-sdk-dir}.])
+ fi
+ if test -z "$DX" -o "$DX" = ":"; then
+ AC_MSG_ERROR([The program dx was not found. Use --with-android-sdk={android-sdk-dir}.])
+ fi
+ if test -z "$AAPT" -o "$AAPT" = ":"; then
+ AC_MSG_ERROR([The program aapt was not found. Use --with-android-sdk={android-sdk-dir}.])
+ fi
+ if test -z "$AIDL" -o "$AIDL" = ":"; then
+ AC_MSG_ERROR([The program aidl was not found. Use --with-android-sdk={android-sdk-dir}.])
+ fi
+ if test -z "$ADB" -o "$ADB" = ":"; then
+ AC_MSG_ERROR([The program adb was not found. Use --with-android-sdk={android-sdk-dir}.])
fi
- AC_SUBST(ANDROID_PLATFORM_TOOLS)
- AC_SUBST(ANDROID_BUILD_TOOLS)
;;
esac
+MOZ_ARG_WITH_STRING(android-min-sdk,
+[ --with-android-min-sdk=[VER] Impose a minimum Firefox for Android SDK version],
+[ MOZ_ANDROID_MIN_SDK_VERSION=$withval ])
+
+MOZ_ARG_WITH_STRING(android-max-sdk,
+[ --with-android-max-sdk=[VER] Impose a maximum Firefox for Android SDK version],
+[ MOZ_ANDROID_MAX_SDK_VERSION=$withval ])
+
+if test -n "$MOZ_ANDROID_MIN_SDK_VERSION"; then
+ if test -n "$MOZ_ANDROID_MAX_SDK_VERSION"; then
+ if test $MOZ_ANDROID_MAX_SDK_VERSION -lt $MOZ_ANDROID_MIN_SDK_VERSION ; then
+ AC_MSG_ERROR([--with-android-max-sdk must be at least the value of --with-android-min-sdk.])
+ fi
+ fi
+
+ if test $MOZ_ANDROID_MIN_SDK_VERSION -gt $ANDROID_TARGET_SDK ; then
+ AC_MSG_ERROR([--with-android-min-sdk is expected to be less than $ANDROID_TARGET_SDK])
+ fi
+
+ AC_DEFINE_UNQUOTED(MOZ_ANDROID_MIN_SDK_VERSION, $MOZ_ANDROID_MIN_SDK_VERSION)
+ AC_SUBST(MOZ_ANDROID_MIN_SDK_VERSION)
+fi
+
+if test -n "$MOZ_ANDROID_MAX_SDK_VERSION"; then
+ AC_DEFINE_UNQUOTED(MOZ_ANDROID_MAX_SDK_VERSION, $MOZ_ANDROID_MAX_SDK_VERSION)
+ AC_SUBST(MOZ_ANDROID_MAX_SDK_VERSION)
+fi
+
])
diff --git a/build/autoconf/arch.m4 b/build/autoconf/arch.m4
index ed7b2cd3b..372828393 100644
--- a/build/autoconf/arch.m4
+++ b/build/autoconf/arch.m4
@@ -14,6 +14,7 @@ MOZ_THUMB_INTERWORK=toolchain-default
MOZ_FPU=toolchain-default
MOZ_FLOAT_ABI=toolchain-default
MOZ_SOFT_FLOAT=toolchain-default
+MOZ_ALIGN=toolchain-default
MOZ_ARG_WITH_STRING(arch,
[ --with-arch=[[type|toolchain-default]]
@@ -32,21 +33,12 @@ if test -z "$MOZ_ARCH"; then
MOZ_ARCH=armv7-a
MOZ_FPU=vfp
MOZ_FLOAT_ABI=softfp
+ MOZ_ALIGN=no
;;
arm-Darwin)
MOZ_ARCH=toolchain-default
MOZ_THUMB=yes
;;
- arm-*)
- if test -n "$MOZ_PLATFORM_MAEMO"; then
- MOZ_THUMB=no
- MOZ_ARCH=armv7-a
- MOZ_FLOAT_ABI=softfp
- fi
- if test "$MOZ_PLATFORM_MAEMO" = 6; then
- MOZ_THUMB=yes
- fi
- ;;
esac
fi
@@ -169,8 +161,28 @@ no)
;;
esac
+case "$MOZ_ALIGN" in
+no)
+ align_flag="-mno-unaligned-access"
+ ;;
+yes)
+ align_flag="-munaligned-access"
+ ;;
+*)
+ align_flag=""
+ ;;
+esac
+
+if test -n "$align_flag"; then
+ _SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $align_flag"
+ AC_MSG_CHECKING(whether alignment flag ($align_flag) is supported)
+ AC_TRY_COMPILE([],[],,align_flag="")
+ CFLAGS="$_SAVE_CFLAGS"
+fi
+
dnl Use echo to avoid accumulating space characters
-all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
+all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag $align_flag`
if test -n "$all_flags"; then
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$all_flags"
@@ -204,7 +216,7 @@ if test "$CPU_ARCH" = "arm"; then
AC_MSG_CHECKING(ARM version support in compiler)
dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
- ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
+ ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]][[0-9]]*\).*/\1/p'`
AC_MSG_RESULT("$ARM_ARCH")
AC_MSG_CHECKING(for ARM NEON support in compiler)
@@ -222,8 +234,9 @@ if test "$CPU_ARCH" = "arm"; then
dnl This matches media/webrtc/trunk/webrtc/build/common.gypi.
if test -n "$ARM_ARCH"; then
if test "$ARM_ARCH" -lt 7; then
- BUILD_ARM_NEON=0
+ BUILD_ARM_NEON=
else
+ AC_DEFINE(BUILD_ARM_NEON)
BUILD_ARM_NEON=1
fi
fi
@@ -234,6 +247,7 @@ fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
AC_SUBST(BUILD_ARM_NEON)
+AC_SUBST(ARM_ARCH)
if test -n "$MOZ_ARCH"; then
NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-arch=$MOZ_ARCH"
diff --git a/build/autoconf/ccache.m4 b/build/autoconf/ccache.m4
deleted file mode 100644
index 5e2469195..000000000
--- a/build/autoconf/ccache.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-dnl ======================================================
-dnl = Enable compiling with ccache
-dnl ======================================================
-AC_DEFUN([MOZ_CHECK_CCACHE],
-[
-MOZ_ARG_WITH_STRING(ccache,
-[ --with-ccache[=path/to/ccache]
- Enable compiling with ccache],
- CCACHE=$withval, CCACHE="no")
-
-if test "$CCACHE" != "no"; then
- if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
- CCACHE=
- else
- if test ! -e "$CCACHE"; then
- AC_MSG_ERROR([$CCACHE not found])
- fi
- fi
- MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
- if test -z "$CCACHE" -o "$CCACHE" = ":"; then
- AC_MSG_ERROR([ccache not found])
- elif test -x "$CCACHE"; then
- CC="$CCACHE $CC"
- CXX="$CCACHE $CXX"
- MOZ_USING_CCACHE=1
- else
- AC_MSG_ERROR([$CCACHE is not executable])
- fi
-fi
-
-AC_SUBST(MOZ_USING_CCACHE)
-])
diff --git a/build/autoconf/check_debug_ranges.py b/build/autoconf/check_debug_ranges.py
deleted file mode 100644
index 04cf41ff3..000000000
--- a/build/autoconf/check_debug_ranges.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# This script returns the number of items for the DW_AT_ranges corresponding
-# to a given compilation unit. This is used as a helper to find a bug in some
-# versions of GNU ld.
-
-import subprocess
-import sys
-import re
-
-def get_range_for(compilation_unit, debug_info):
- '''Returns the range offset for a given compilation unit
- in a given debug_info.'''
- name = ranges = ''
- search_cu = False
- for nfo in debug_info.splitlines():
- if 'DW_TAG_compile_unit' in nfo:
- search_cu = True
- elif 'DW_TAG_' in nfo or not nfo.strip():
- if name == compilation_unit:
- return int(ranges, 16)
- name = ranges = ''
- search_cu = False
- if search_cu:
- if 'DW_AT_name' in nfo:
- name = nfo.rsplit(None, 1)[1]
- elif 'DW_AT_ranges' in nfo:
- ranges = nfo.rsplit(None, 1)[1]
- return None
-
-def get_range_length(range, debug_ranges):
- '''Returns the number of items in the range starting at the
- given offset.'''
- length = 0
- for line in debug_ranges.splitlines():
- m = re.match('\s*([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)', line)
- if m and int(m.group(1), 16) == range:
- length += 1
- return length
-
-def main(bin, compilation_unit):
- p = subprocess.Popen(['objdump', '-W', bin], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
- (out, err) = p.communicate()
- sections = re.split('\n(Contents of the|The section) ', out)
- debug_info = [s for s in sections if s.startswith('.debug_info')]
- debug_ranges = [s for s in sections if s.startswith('.debug_ranges')]
- if not debug_ranges or not debug_info:
- return 0
-
- range = get_range_for(compilation_unit, debug_info[0])
- if range is not None:
- return get_range_length(range, debug_ranges[0])
-
- return -1
-
-
-if __name__ == '__main__':
- print main(*sys.argv[1:])
diff --git a/build/autoconf/clang-plugin.m4 b/build/autoconf/clang-plugin.m4
new file mode 100644
index 000000000..bcd37ca6c
--- /dev/null
+++ b/build/autoconf/clang-plugin.m4
@@ -0,0 +1,60 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_CONFIG_CLANG_PLUGIN], [
+
+MOZ_ARG_ENABLE_BOOL(clang-plugin,
+[ --enable-clang-plugin Enable building with the mozilla clang plugin ],
+ ENABLE_CLANG_PLUGIN=1,
+ ENABLE_CLANG_PLUGIN= )
+if test -n "$ENABLE_CLANG_PLUGIN"; then
+ if test -z "$CLANG_CC"; then
+ AC_MSG_ERROR([Can't use clang plugin without clang.])
+ fi
+
+ AC_MSG_CHECKING([for llvm-config])
+ if test -z "$LLVMCONFIG"; then
+ LLVMCONFIG=`$CXX -print-prog-name=llvm-config`
+ fi
+
+ if test -z "$LLVMCONFIG"; then
+ LLVMCONFIG=`which llvm-config`
+ fi
+
+ if test ! -x "$LLVMCONFIG"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Cannot find an llvm-config binary for building a clang plugin])
+ fi
+
+ AC_MSG_RESULT([$LLVMCONFIG])
+
+ if test -z "$LLVMCONFIG"; then
+ AC_MSG_ERROR([Cannot find an llvm-config binary for building a clang plugin])
+ fi
+ LLVM_CXXFLAGS=`$LLVMCONFIG --cxxflags`
+ dnl The clang package we use on OSX is old, and its llvm-config doesn't
+ dnl recognize --system-libs, so ask for that separately. llvm-config's
+ dnl failure here is benign, so we can ignore it if it happens.
+ LLVM_LDFLAGS=`$LLVMCONFIG --system-libs | xargs`
+ LLVM_LDFLAGS="$LLVM_LDFLAGS `$LLVMCONFIG --ldflags --libs core mc analysis asmparser mcparser bitreader option | xargs`"
+
+ if test "${OS_ARCH}" = "Darwin"; then
+ CLANG_LDFLAGS="-lclangFrontend -lclangDriver -lclangSerialization"
+ CLANG_LDFLAGS="$CLANG_LDFLAGS -lclangParse -lclangSema -lclangAnalysis"
+ CLANG_LDFLAGS="$CLANG_LDFLAGS -lclangEdit -lclangAST -lclangLex"
+ CLANG_LDFLAGS="$CLANG_LDFLAGS -lclangBasic -lclangASTMatchers"
+ else
+ CLANG_LDFLAGS="-lclangASTMatchers"
+ fi
+
+ AC_DEFINE(MOZ_CLANG_PLUGIN)
+fi
+
+AC_SUBST(LLVM_CXXFLAGS)
+AC_SUBST(LLVM_LDFLAGS)
+AC_SUBST(CLANG_LDFLAGS)
+
+AC_SUBST(ENABLE_CLANG_PLUGIN)
+
+])
diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
index e09a4563c..cb47cf749 100644
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -6,6 +6,18 @@ dnl Add compiler specific options
AC_DEFUN([MOZ_DEFAULT_COMPILER],
[
+dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-setup directive
+ if test -z "$MOZILLA_OFFICIAL"; then
+ DEVELOPER_OPTIONS=1
+ fi
+ MOZ_ARG_ENABLE_BOOL(release,
+ [ --enable-release Build with more conservative, release engineering-oriented options.
+ This may slow down builds.],
+ DEVELOPER_OPTIONS=,
+ DEVELOPER_OPTIONS=1)
+
+ AC_SUBST(DEVELOPER_OPTIONS)
+
dnl Default to MSVC for win32 and gcc-4.2 for darwin
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
@@ -13,8 +25,8 @@ case "$target" in
*-mingw*)
if test -z "$CC"; then CC=cl; fi
if test -z "$CXX"; then CXX=cl; fi
- if test -z "$CPP"; then CPP="cl -E -nologo"; fi
- if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
+ if test -z "$CPP"; then CPP="$CC -E -nologo"; fi
+ if test -z "$CXXCPP"; then CXXCPP="$CXX -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
if test -z "$LD"; then LD=link; fi
if test -z "$AS"; then
case "${target_cpu}" in
@@ -78,34 +90,171 @@ if test -z "$_MOZ_USE_RTTI"; then
fi
])
+dnl ========================================================
+dnl =
+dnl = Debugging Options
+dnl =
+dnl ========================================================
+AC_DEFUN([MOZ_DEBUGGING_OPTS],
+[
+dnl Debug info is ON by default.
+if test -z "$MOZ_DEBUG_FLAGS"; then
+ if test -n "$_MSC_VER"; then
+ MOZ_DEBUG_FLAGS="-Zi"
+ else
+ MOZ_DEBUG_FLAGS="-g"
+ fi
+fi
+
+AC_SUBST(MOZ_DEBUG_FLAGS)
+
+MOZ_ARG_ENABLE_STRING(debug,
+[ --enable-debug[=DBG] Enable building with developer debug info
+ (using compiler flags DBG)],
+[ if test "$enableval" != "no"; then
+ MOZ_DEBUG=1
+ if test -n "$enableval" -a "$enableval" != "yes"; then
+ MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
+ _MOZ_DEBUG_FLAGS_SET=1
+ fi
+ else
+ MOZ_DEBUG=
+ fi ],
+ MOZ_DEBUG=)
+
+if test -z "$MOZ_DEBUG" -o -n "$MOZ_ASAN"; then
+ MOZ_NO_DEBUG_RTL=1
+fi
+
+AC_SUBST(MOZ_NO_DEBUG_RTL)
+
+MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -DTRACING"
+MOZ_ARG_WITH_STRING(debug-label,
+[ --with-debug-label=LABELS
+ Define DEBUG_<value> for each comma-separated
+ value given.],
+[ for option in `echo $withval | sed 's/,/ /g'`; do
+ MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
+done])
+
+MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
+
+if test -n "$MOZ_DEBUG"; then
+ AC_MSG_CHECKING([for valid debug flags])
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
+ AC_TRY_COMPILE([#include <stdio.h>],
+ [printf("Hello World\n");],
+ _results=yes,
+ _results=no)
+ AC_MSG_RESULT([$_results])
+ if test "$_results" = "no"; then
+ AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
+ fi
+ CFLAGS=$_SAVE_CFLAGS
+fi
+
+dnl ========================================================
+dnl = Enable generation of debug symbols
+dnl ========================================================
+MOZ_ARG_ENABLE_STRING(debug-symbols,
+[ --enable-debug-symbols[=DBG]
+ Enable debugging symbols (using compiler flags DBG)],
+[ if test "$enableval" != "no"; then
+ MOZ_DEBUG_SYMBOLS=1
+ if test -n "$enableval" -a "$enableval" != "yes"; then
+ if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
+ MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
+ else
+ AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
+ fi
+ fi
+ else
+ MOZ_DEBUG_SYMBOLS=
+ fi ],
+ MOZ_DEBUG_SYMBOLS=1)
+
+if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
+ AC_DEFINE(MOZ_DEBUG_SYMBOLS)
+ export MOZ_DEBUG_SYMBOLS
+fi
+
+])
+
dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
+ MOZ_DEBUGGING_OPTS
MOZ_RTTI
if test "$CLANG_CXX"; then
## We disable return-type-c-linkage because jsval is defined as a C++ type but is
## returned by C functions. This is possible because we use knowledge about the ABI
## to typedef it to a C type with the same layout when the headers are included
## from C.
- ##
- ## mismatched-tags is disabled (bug 780474) mostly because it's useless.
- ## Worse, it's not supported by gcc, so it will cause tryserver bustage
- ## without any easy way for non-Clang users to check for it.
- _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags"
+ _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage"
fi
-if test -z "$GNU_CC"; then
- case "$target" in
- *-mingw*)
- ## Warning 4099 (equivalent of mismatched-tags) is disabled (bug 780474)
- ## for the same reasons as above.
- _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -wd4099"
- esac
+AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually is a C++ compiler])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+_SAVE_LIBS=$LIBS
+LIBS=
+AC_TRY_LINK([#include <new>], [int *foo = new int;],,
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([$CXX $CXXFLAGS $LDFLAGS failed to compile and link a simple C++ source.]))
+LIBS=$_SAVE_LIBS
+AC_LANG_RESTORE
+AC_MSG_RESULT([yes])
+
+if test -n "$DEVELOPER_OPTIONS"; then
+ MOZ_FORCE_GOLD=1
fi
+MOZ_ARG_ENABLE_BOOL(gold,
+[ --enable-gold Enable GNU Gold Linker when it is not already the default],
+ MOZ_FORCE_GOLD=1,
+ MOZ_FORCE_GOLD=
+ )
+
+if test "$GNU_CC" -a -n "$MOZ_FORCE_GOLD"; then
+ dnl if the default linker is BFD ld, check if gold is available and try to use it
+ dnl for local builds only.
+ if $CC -Wl,--version 2>&1 | grep -q "GNU ld"; then
+ GOLD=$($CC -print-prog-name=ld.gold)
+ case "$GOLD" in
+ /*)
+ ;;
+ *)
+ GOLD=$(which $GOLD)
+ ;;
+ esac
+ if test -n "$GOLD"; then
+ mkdir -p $_objdir/build/unix/gold
+ rm -f $_objdir/build/unix/gold/ld
+ ln -s "$GOLD" $_objdir/build/unix/gold/ld
+ if $CC -B $_objdir/build/unix/gold -Wl,--version 2>&1 | grep -q "GNU gold"; then
+ LDFLAGS="$LDFLAGS -B $_objdir/build/unix/gold"
+ else
+ rm -rf $_objdir/build/unix/gold
+ fi
+ fi
+ fi
+fi
+if test "$GNU_CC"; then
+ if $CC $LDFLAGS -Wl,--version 2>&1 | grep -q "GNU ld"; then
+ LD_IS_BFD=1
+ fi
+fi
+
+AC_SUBST([LD_IS_BFD])
+
if test "$GNU_CC"; then
- CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
- CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions"
+ if test -z "$DEVELOPER_OPTIONS"; then
+ CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
+ CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
+ fi
+ CFLAGS="$CFLAGS -fno-math-errno"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno"
fi
dnl ========================================================
@@ -117,7 +266,7 @@ MOZ_ARG_DISABLE_BOOL(icf,
MOZ_DISABLE_ICF=1,
MOZ_DISABLE_ICF= )
-if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$MOZ_DISABLE_ICF"; then
+if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$MOZ_DISABLE_ICF" -a -z "$DEVELOPER_OPTIONS"; then
AC_CACHE_CHECK([whether the linker supports Identical Code Folding],
LD_SUPPORTS_ICF,
[echo 'int foo() {return 42;}' \
@@ -148,32 +297,67 @@ dnl ========================================================
dnl = Automatically remove dead symbols
dnl ========================================================
-if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
- dnl See bug 670659
- AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
- GC_SECTIONS_BREAKS_DEBUG_RANGES,
- [echo 'int foo() {return 42;}' \
- 'int bar() {return 1;}' \
- 'int main() {return foo();}' > conftest.${ac_ext}
- if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -c conftest.${ac_ext} 1>&2]) &&
- AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
- test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
- if test "`$PYTHON "$_topsrcdir"/build/autoconf/check_debug_ranges.py conftest.${ac_objext} conftest.${ac_ext}`" = \
- "`$PYTHON "$_topsrcdir"/build/autoconf/check_debug_ranges.py conftest${ac_exeext} conftest.${ac_ext}`"; then
- GC_SECTIONS_BREAKS_DEBUG_RANGES=no
- else
- GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
- fi
- else
- dnl We really don't expect to get here, but just in case
- GC_SECTIONS_BREAKS_DEBUG_RANGES="no, but it's broken in some other way"
- fi
- rm -rf conftest*])
- if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
+if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS"; then
+ if test -n "$MOZ_DEBUG_FLAGS"; then
+ dnl See bug 670659
+ AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
+ GC_SECTIONS_BREAKS_DEBUG_RANGES,
+ [echo 'int foo() {return 42;}' \
+ 'int bar() {return 1;}' \
+ 'int main() {return foo();}' > conftest.${ac_ext}
+ if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -c conftest.${ac_ext} 1>&2]) &&
+ AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
+ test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
+ if test "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest.${ac_objext} conftest.${ac_ext}`" = \
+ "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest${ac_exeext} conftest.${ac_ext}`"; then
+ GC_SECTIONS_BREAKS_DEBUG_RANGES=no
+ else
+ GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
+ fi
+ else
+ dnl We really don't expect to get here, but just in case
+ GC_SECTIONS_BREAKS_DEBUG_RANGES="no, but it's broken in some other way"
+ fi
+ rm -rf conftest*])
+ if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
+ DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
+ fi
+ else
DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
fi
fi
+# bionic in Android < 4.1 doesn't support PIE
+# On OSX, the linker defaults to building PIE programs when targetting OSX 10.7+,
+# but not when targetting OSX < 10.7. OSX < 10.7 doesn't support running PIE
+# programs, so as long as support for OSX 10.6 is kept, we can't build PIE.
+# Even after dropping 10.6 support, MOZ_PIE would not be useful since it's the
+# default (and clang says the -pie option is not used).
+# On other Unix systems, some file managers (Nautilus) can't start PIE programs
+if test -n "$gonkdir" && test "$ANDROID_VERSION" -ge 16; then
+ MOZ_PIE=1
+else
+ MOZ_PIE=
+fi
+
+MOZ_ARG_ENABLE_BOOL(pie,
+[ --enable-pie Enable Position Independent Executables],
+ MOZ_PIE=1,
+ MOZ_PIE= )
+
+if test "$GNU_CC" -a -n "$MOZ_PIE"; then
+ AC_MSG_CHECKING([for PIE support])
+ _SAVE_LDFLAGS=$LDFLAGS
+ LDFLAGS="$LDFLAGS -pie"
+ AC_TRY_LINK(,,AC_MSG_RESULT([yes])
+ [MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -pie"],
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([--enable-pie requires PIE support from the linker.]))
+ LDFLAGS=$_SAVE_LDFLAGS
+fi
+
+AC_SUBST(MOZ_PROGRAM_LDFLAGS)
+
])
dnl GCC and clang will fail if given an unknown warning option like -Wfoobar.
diff --git a/build/autoconf/config.guess b/build/autoconf/config.guess
index 721b21a24..72625d40c 100755
--- a/build/autoconf/config.guess
+++ b/build/autoconf/config.guess
@@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright 1992-2014 Free Software Foundation, Inc.
-timestamp='2009-08-19'
+timestamp='2014-02-12'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -17,26 +15,22 @@ timestamp='2009-08-19'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -56,8 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright 1992-2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -139,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ ;;
+esac
+
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -180,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
- os=netbsd
+ os=netbsd
;;
esac
# The OS release
@@ -201,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -223,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -269,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -295,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
+ echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -333,6 +354,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
@@ -391,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@@ -477,8 +501,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -491,7 +515,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@@ -548,7 +572,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
- *:AIX:*:[456])
+ *:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -591,52 +615,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
+ esac ;;
+ esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ sed 's/^ //' << EOF >$dummy.c
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -727,22 +751,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@@ -766,14 +790,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -785,34 +809,39 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
- *:Interix*:[3456]*)
- case ${UNAME_MACHINE} in
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
- EM64T | authenticamd | genuineintel)
+ authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -845,45 +874,81 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+ fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
- echo cris-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
- echo frv-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ i*86:Linux:*:*)
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@@ -901,123 +966,65 @@ EOF
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ or32:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-${LIBC}
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-${LIBC}
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-${LIBC}
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^LIBC/{
- s: ::g
- p
- }'`"
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1025,11 +1032,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
+ # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@@ -1061,7 +1068,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@@ -1089,13 +1096,13 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
- exit ;;
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@@ -1130,8 +1137,8 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
@@ -1174,10 +1181,10 @@ EOF
echo ns32k-sni-sysv
fi
exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@@ -1203,11 +1210,11 @@ EOF
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
+ echo mips-nec-sysv${UNAME_RELEASE}
else
- echo mips-unknown-sysv${UNAME_RELEASE}
+ echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@@ -1220,6 +1227,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1246,13 +1256,31 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386) eval $set_cc_for_build
- if $CC_FOR_BUILD -E -dM -x c /dev/null | grep __LP64__>/dev/null 2>&1 ; then
- UNAME_PROCESSOR=x86_64
- fi ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1266,7 +1294,10 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1311,13 +1342,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
+ echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@@ -1335,158 +1366,10 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
exit ;;
- esac
-fi
+esac
cat >&2 <<EOF
$0: unable to guess system type
diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4
index ceba24b67..e35a52a81 100644
--- a/build/autoconf/config.status.m4
+++ b/build/autoconf/config.status.m4
@@ -10,12 +10,50 @@ dnl The necessary comma after the tuple can't be put here because it
dnl can mess around with things like:
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
define([AC_SUBST],
+[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
+[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
(''' $1 ''', r''' [$]$1 ''')
AC_DIVERT_POP()dnl
-])])
+])])])])
+
+dnl Like AC_SUBST, but makes the value available as a set in python,
+dnl with values got from the value of the environment variable, split on
+dnl whitespaces.
+define([AC_SUBST_SET],
+[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
+[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
+[ifdef([AC_SUBST_SET_$1], ,
+[define([AC_SUBST_SET_$1], )dnl
+AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
+ (''' $1 ''', set(r''' [$]$1 '''.split()))
+AC_DIVERT_POP()dnl
+])])])])
+
+dnl Like AC_SUBST, but makes the value available as a list in python,
+dnl with values got from the value of the environment variable, split on
+dnl whitespaces.
+define([AC_SUBST_LIST],
+[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_LIST_$1], ,
+[define([AC_SUBST_LIST_$1], )dnl
+AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
+ (''' $1 ''', list(r''' [$]$1 '''.split()))
+AC_DIVERT_POP()dnl
+])])])])
+
+dnl Ignore AC_SUBSTs for variables we don't have use for but that autoconf
+dnl itself exports.
+define([AC_SUBST_CFLAGS], )
+define([AC_SUBST_CPPFLAGS], )
+define([AC_SUBST_CXXFLAGS], )
+define([AC_SUBST_FFLAGS], )
+define([AC_SUBST_DEFS], )
+define([AC_SUBST_LDFLAGS], )
+define([AC_SUBST_LIBS], )
dnl Wrap AC_DEFINE to store values in a format suitable for python.
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
@@ -42,7 +80,7 @@ ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1
])
dnl Replace AC_OUTPUT to create and call a python config.status
-define([AC_OUTPUT],
+define([MOZ_CREATE_CONFIG_STATUS],
[dnl Top source directory in Windows format (as opposed to msys format).
WIN_TOP_SRC=
encoding=utf-8
@@ -67,7 +105,6 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
: ${CONFIG_STATUS=./config.status}
dnl We're going to need [ ] for python syntax.
@@ -81,12 +118,14 @@ cat > $CONFIG_STATUS <<EOF
# coding=$encoding
import os
+import types
dnl topsrcdir is the top source directory in native form, as opposed to a
dnl form suitable for make.
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
if not os.path.isabs(topsrcdir):
rel = os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir)
- topsrcdir = os.path.normpath(os.path.abspath(rel))
+ topsrcdir = os.path.abspath(rel)
+topsrcdir = os.path.normpath(topsrcdir)
topobjdir = os.path.abspath(os.path.dirname(<<<__file__>>>))
@@ -104,7 +143,7 @@ rm confdefs.pytmp confdefs.h
cat >> $CONFIG_STATUS <<\EOF
] ]
-substs = [(name[1:-1], value[1:-1]) for name, value in [
+substs = [(name[1:-1], value[1:-1] if isinstance(value, types.StringTypes) else value) for name, value in [
EOF
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
@@ -122,33 +161,6 @@ done
cat >> $CONFIG_STATUS <<\EOF
] ]
-dnl List of files to apply AC_SUBSTs to. This is the list of files given
-dnl as an argument to AC_OUTPUT ($1)
-files = [
-EOF
-
-for out in $1; do
- echo " '$out'," >> $CONFIG_STATUS
-done
-
-cat >> $CONFIG_STATUS <<\EOF
-]
-
-dnl List of header files to apply AC_DEFINEs to. This is stored in the
-dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
-headers = [
-EOF
-
-ifdef(<<<AC_LIST_HEADER>>>, <<<
-HEADERS="AC_LIST_HEADER"
-for header in $HEADERS; do
- echo " '$header'," >> $CONFIG_STATUS
-done
->>>)dnl
-
-cat >> $CONFIG_STATUS <<\EOF
-]
-
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
non_global_defines = [
EOF
@@ -162,20 +174,51 @@ fi
cat >> $CONFIG_STATUS <<EOF
]
-__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']
+__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs']
+EOF
+
+# We don't want js/src/config.status to do anything in goanna builds.
+if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
+ cat >> $CONFIG_STATUS <<EOF
dnl Do the actual work
if __name__ == '__main__':
args = dict([(name, globals()[name]) for name in __all__])
- import sys
-dnl Don't rely on virtualenv here. Standalone js doesn't use it.
- sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
- from ConfigStatus import config_status
+ from mozbuild.config_status import config_status
config_status(**args)
EOF
+
+fi
+
changequote([, ])
+
chmod +x $CONFIG_STATUS
+])
+
+define([MOZ_RUN_CONFIG_STATUS],
+[
+
+MOZ_RUN_ALL_SUBCONFIGURES()
+
rm -fr confdefs* $ac_clean_files
dnl Execute config.status, unless --no-create was passed to configure.
-test "$no_create" = yes || ${PYTHON} $CONFIG_STATUS || exit 1
+if test "$no_create" != yes && ! ${PYTHON} $CONFIG_STATUS; then
+ trap '' EXIT
+ exit 1
+fi
+])
+
+define([m4_fatal],[
+errprint([$1
+])
+m4exit(1)
+])
+
+define([AC_OUTPUT], [ifelse($#_$1, 1_, [MOZ_CREATE_CONFIG_STATUS()
+MOZ_RUN_CONFIG_STATUS()],
+[m4_fatal([Use CONFIGURE_SUBST_FILES in moz.build files to create substituted files.])]
+)])
+
+define([AC_CONFIG_HEADER],
+[m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
])
diff --git a/build/autoconf/config.sub b/build/autoconf/config.sub
index 1c035c931..91476e8a9 100644
--- a/build/autoconf/config.sub
+++ b/build/autoconf/config.sub
@@ -1,38 +1,31 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright 1992-2014 Free Software Foundation, Inc.
-timestamp='2011-01-03'
+timestamp='2014-01-01'
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -75,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright 1992-2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,10 +115,11 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova* | wince-winmo*)
+ storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -152,12 +145,12 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
- -bluegene*)
- os=-cnk
+ -bluegene*)
+ os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
@@ -173,10 +166,10 @@ case $os in
os=-chorusos
basic_machine=$1
;;
- -chorusrdb)
- os=-chorusrdb
+ -chorusrdb)
+ os=-chorusrdb
basic_machine=$1
- ;;
+ ;;
-hiux*)
os=-hiuxwe2
;;
@@ -221,6 +214,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
-lynx*)
os=-lynxos
;;
@@ -245,20 +244,28 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
+ | aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
+ | epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -276,32 +283,45 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
- | nios | nios2 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
- | or32 \
+ | open8 \
+ | or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
+ | rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu | strongarm \
- | tahoe | thumb | tic4x | tic80 | tron \
- | v850 | v850e \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -311,6 +331,21 @@ case $basic_machine in
basic_machine=mt-unknown
;;
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
@@ -325,25 +360,31 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
+ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
+ | be32-* | be64-* \
| bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
+ | le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -361,28 +402,34 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
- | nios-* | nios2-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
- | romp-* | rs6000-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
| tron-* \
- | v850-* | v850e-* | vax-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
@@ -407,7 +454,7 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
- abacus)
+ abacus)
basic_machine=abacus-unknown
;;
adobe68k)
@@ -477,11 +524,20 @@ case $basic_machine in
basic_machine=powerpc-ibm
os=-cnk
;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
;;
- cegcc)
+ cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
@@ -513,7 +569,7 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
- cr16)
+ cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
@@ -671,7 +727,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@@ -729,11 +784,15 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
@@ -768,10 +827,18 @@ case $basic_machine in
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
+ msys)
+ basic_machine=i686-pc
+ os=-msys
+ ;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@@ -836,6 +903,12 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -918,9 +991,10 @@ case $basic_machine in
;;
power) basic_machine=power-ibm
;;
- ppc) basic_machine=powerpc-unknown
+ ppc | ppcbe) basic_machine=powerpc-unknown
;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@@ -945,7 +1019,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
@@ -1014,6 +1092,9 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
sun2)
basic_machine=m68000-sun
;;
@@ -1070,20 +1151,8 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tic55x | c55x*)
- basic_machine=tic55x-unknown
- os=-coff
- ;;
- tic6x | c6x*)
- basic_machine=tic6x-unknown
- os=-coff
- ;;
tile*)
- basic_machine=tile-unknown
+ basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
@@ -1153,6 +1222,9 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
ymp)
basic_machine=ymp-cray
os=-unicos
@@ -1250,9 +1322,12 @@ esac
if [ x"$os" != x"" ]
then
case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
+ # First match some system type aliases
+ # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1274,21 +1349,22 @@ case $os in
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -kopensolaris* \
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -mingw64* | -linux-gnu* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1296,7 +1372,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -winmo*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1335,12 +1411,9 @@ case $os in
-opened*)
os=-openedition
;;
- -os400*)
+ -os400*)
os=-os400
;;
- -wince-winmo*)
- os=-wince-winmo
- ;;
-wince*)
os=-wince
;;
@@ -1387,7 +1460,7 @@ case $os in
-sinix*)
os=-sysv4
;;
- -tpf*)
+ -tpf*)
os=-tpf
;;
-triton*)
@@ -1423,9 +1496,6 @@ case $os in
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
@@ -1435,6 +1505,8 @@ case $os in
-android*)
os=-android
;;
+ -nacl*)
+ ;;
-none)
;;
*)
@@ -1457,10 +1529,10 @@ else
# system, and we'll never get to this point.
case $basic_machine in
- score-*)
+ score-*)
os=-elf
;;
- spu-*)
+ spu-*)
os=-elf
;;
*-acorn)
@@ -1472,8 +1544,23 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
- c4x-* | tic4x-*)
- os=-coff
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ c8051-*)
+ os=-elf
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
@@ -1493,14 +1580,11 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
;;
m68*-cisco)
os=-aout
;;
- mep-*)
+ mep-*)
os=-elf
;;
mips*-cisco)
@@ -1509,6 +1593,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
+ or1k-*)
+ os=-elf
+ ;;
or32-*)
os=-coff
;;
@@ -1527,7 +1614,7 @@ case $basic_machine in
*-ibm)
os=-aix
;;
- *-knuth)
+ *-knuth)
os=-mmixware
;;
*-wec)
diff --git a/build/autoconf/ffi.m4 b/build/autoconf/ffi.m4
new file mode 100644
index 000000000..e775c615d
--- /dev/null
+++ b/build/autoconf/ffi.m4
@@ -0,0 +1,100 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_CONFIG_FFI], [
+
+MOZ_ARG_ENABLE_BOOL(system-ffi,
+[ --enable-system-ffi Use system libffi (located with pkgconfig)],
+ MOZ_NATIVE_FFI=1 )
+
+if test -n "$MOZ_NATIVE_FFI"; then
+ # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
+ # for non-GCC compilers.
+ if test -z "$GNU_CC"; then
+ PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
+ else
+ PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
+ fi
+fi
+
+AC_SUBST(MOZ_NATIVE_FFI)
+
+])
+
+AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
+if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
+
+ if test "$BUILD_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
+ # Run the libffi 'configure' script.
+ ac_configure_args="--disable-shared --enable-static --disable-raw-api"
+ if test "$MOZ_DEBUG"; then
+ ac_configure_args="$ac_configure_args --enable-debug"
+ fi
+ if test "$DSO_PIC_CFLAGS"; then
+ ac_configure_args="$ac_configure_args --with-pic"
+ fi
+ for var in AS CC CXX CPP LD AR RANLIB STRIP; do
+ ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
+ done
+ if test "$CROSS_COMPILE"; then
+ export CPPFLAGS CFLAGS LDFLAGS
+ fi
+ ac_configure_args="$ac_configure_args --build=$build --host=$target"
+ if test "$_MSC_VER"; then
+ # Use a wrapper script for cl and ml that looks more like gcc.
+ # autotools can't quite handle an MSVC build environment yet.
+ LDFLAGS=
+ CFLAGS=
+ ac_configure_args="$ac_configure_args LD=link CPP=\"$CC -nologo -EP\" \
+ CXXCPP=\"$CXX -nologo -EP\" SHELL=sh.exe"
+ flags=
+ if test -z "$MOZ_NO_DEBUG_RTL" -a -n "$MOZ_DEBUG"; then
+ flags=" -DUSE_DEBUG_RTL"
+ fi
+ if test -n "$CLANG_CL"; then
+ flags="$flags -clang-cl"
+ fi
+ case "${target_cpu}" in
+ x86_64)
+ # Need target since MSYS tools into mozilla-build may be 32bit
+ ac_configure_args="$ac_configure_args \
+ CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$flags\" \
+ CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$flags\""
+ ;;
+ *)
+ ac_configure_args="$ac_configure_args \
+ CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$flags\" \
+ CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$flags\""
+ ;;
+ esac
+ fi
+ if test "$SOLARIS_SUNPRO_CC"; then
+ # Always use gcc for libffi on Solaris
+ if test ! "$HAVE_64BIT_BUILD"; then
+ ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS="
+ else
+ ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS="
+ fi
+ fi
+ if test "$AIX_IBM_XLC"; then
+ # Always use gcc for libffi on IBM AIX5/AIX6
+ if test ! "$HAVE_64BIT_BUILD"; then
+ ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32"
+ else
+ ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64"
+ fi
+ fi
+
+ # Use a separate cache file for libffi, since it does things differently
+ # from our configure.
+ old_config_files=$CONFIG_FILES
+ unset CONFIG_FILES
+ AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi)
+ ac_configure_args="$_SUBDIR_CONFIG_ARGS"
+ CONFIG_FILES=$old_config_files
+ fi
+
+fi
+])
+
diff --git a/build/autoconf/frameptr.m4 b/build/autoconf/frameptr.m4
index 7f18fc5e5..428b1fb16 100644
--- a/build/autoconf/frameptr.m4
+++ b/build/autoconf/frameptr.m4
@@ -28,9 +28,12 @@ AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
esac
fi
- # if we are debugging or profiling, we want a frame pointer.
+ # if we are debugging, profiling or using sanitizers, we want a frame pointer.
if test -z "$MOZ_OPTIMIZE" -o \
- -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
+ -n "$MOZ_PROFILING" -o \
+ -n "$MOZ_DEBUG" -o \
+ -n "$MOZ_MSAN" -o \
+ -n "$MOZ_ASAN"; then
MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
else
MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"
diff --git a/build/autoconf/gcc-pr49911.m4 b/build/autoconf/gcc-pr49911.m4
deleted file mode 100644
index 9bb762aa2..000000000
--- a/build/autoconf/gcc-pr49911.m4
+++ /dev/null
@@ -1,71 +0,0 @@
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-dnl Check if the compiler is gcc and has PR49911. If so
-dnl disable vrp.
-
-AC_DEFUN([MOZ_GCC_PR49911],
-[
-if test "$GNU_CC"; then
-
-AC_MSG_CHECKING(for gcc PR49911)
-ac_have_gcc_pr49911="no"
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-
-_SAVE_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="-O2"
-AC_TRY_RUN([
-extern "C" void abort(void);
-typedef enum {
-eax, ecx, edx, ebx, esp, ebp,
-esi, edi }
-RegisterID;
-union StateRemat {
- RegisterID reg_;
- int offset_;
-};
-static StateRemat FromRegister(RegisterID reg) {
- StateRemat sr;
- sr.reg_ = reg;
- return sr;
-}
-static StateRemat FromAddress3(int address) {
- StateRemat sr;
- sr.offset_ = address;
- if (address < 46 && address >= 0) {
- abort();
- }
- return sr;
-}
-struct FrameState {
- StateRemat dataRematInfo2(bool y, int z) {
- if (y) return FromRegister(RegisterID(1));
- return FromAddress3(z);
- }
-};
-FrameState frame;
-StateRemat x;
-__attribute__((noinline)) void jsop_setelem(bool y, int z) {
- x = frame.dataRematInfo2(y, z);
-}
-int main(void) {
- jsop_setelem(0, 47);
-}
-], true,
- ac_have_gcc_pr49911="yes",
- true)
-CXXFLAGS="$_SAVE_CXXFLAGS"
-
-AC_LANG_RESTORE
-
-if test "$ac_have_gcc_pr49911" = "yes"; then
- AC_MSG_RESULT(yes)
- CFLAGS="$CFLAGS -fno-tree-vrp"
- CXXFLAGS="$CXXFLAGS -fno-tree-vrp"
-else
- AC_MSG_RESULT(no)
-fi
-fi
-])
diff --git a/build/autoconf/hooks.m4 b/build/autoconf/hooks.m4
index 64661dc7e..2a321eef3 100644
--- a/build/autoconf/hooks.m4
+++ b/build/autoconf/hooks.m4
@@ -15,12 +15,73 @@ define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
define([AC_INIT_PREPARE],
[_MOZ_AC_INIT_PREPARE($1)
MOZ_CONFIG_LOG_TRAP
+> subconfigures
+> skip_subconfigures
])
-dnl Disable the trap when running sub-configures.
-define([_MOZ_AC_OUTPUT_SUBDIRS], defn([AC_OUTPUT_SUBDIRS]))
define([AC_OUTPUT_SUBDIRS],
-[trap '' EXIT
-_MOZ_AC_OUTPUT_SUBDIRS($1)
-MOZ_CONFIG_LOG_TRAP
+[for moz_config_dir in $1; do
+ _CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ case "$moz_config_dir" in
+ *:*)
+ objdir=$(echo $moz_config_dir | awk -F: '{print [$]2}')
+ ;;
+ *)
+ objdir=$moz_config_dir
+ ;;
+ esac
+ dnl Because config.status, storing AC_SUBSTs, is written before any
+ dnl subconfigure runs, we need to use a file. Moreover, some subconfigures
+ dnl are started from a subshell, and variable modifications from a subshell
+ dnl wouldn't be preserved.
+ echo $objdir >> subconfigures
+
+ dumpenv="true | "
+ case "$host" in
+ *-mingw*)
+ _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL)
+ if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then
+ _CONFIG_SHELL="${_CONFIG_SHELL}.exe"
+ fi
+ dnl Yes, this is horrible. But since msys doesn't preserve environment
+ dnl variables and command line arguments as they are when transitioning
+ dnl from msys (this script) to python (below), we have to resort to hacks,
+ dnl storing the environment and command line arguments from a msys process
+ dnl (perl), and reading it from python.
+ dumpenv="$PERL $_topsrcdir/build/win32/dumpenv4python.pl $ac_configure_args | "
+ ;;
+ esac
+
+ eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py --prepare "$srcdir" "$moz_config_dir" "$_CONFIG_SHELL" $ac_configure_args ifelse($2,,,--cache-file="$2")
+
+ dnl Actual subconfigure execution happens in MOZ_RUN_CONFIG_STATUS
+done
+])
+
+define([AC_OUTPUT_SUBDIRS_NOW],
+[
+for moz_config_dir_ in $1; do
+ AC_OUTPUT_SUBDIRS($moz_config_dir_,$2)
+ tail -1 subconfigures >> skip_subconfigures
+ MOZ_RUN_SUBCONFIGURES(`tail -1 skip_subconfigures`)
+done
])
+
+define([MOZ_RUN_SUBCONFIGURES],
+[dnl Execute subconfigure, unless --no-recursion was passed to configure.
+if test "$no_recursion" != yes; then
+ trap '' EXIT
+ if ! $PYTHON $_topsrcdir/build/subconfigure.py $1; then
+ exit 1
+ fi
+ MOZ_CONFIG_LOG_TRAP
+fi
+])
+
+define([MOZ_RUN_ALL_SUBCONFIGURES],[
+MOZ_RUN_SUBCONFIGURES([--list subconfigures --skip skip_subconfigures])
+])
+
+dnl Print error messages in config.log as well as stderr
+define([AC_MSG_ERROR],
+[{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])
diff --git a/build/autoconf/hotfixes.m4 b/build/autoconf/hotfixes.m4
new file mode 100644
index 000000000..1522df9c0
--- /dev/null
+++ b/build/autoconf/hotfixes.m4
@@ -0,0 +1,24 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Set of hotfixes to address issues in autoconf 2.13
+
+dnl Divert AC_CHECK_FUNC so that the #includes it uses can't interfere
+dnl with the function it tests.
+dnl So, when testing e.g. posix_memalign, any #include that AC_CHECK_FUNC
+dnl prints is replaced with:
+dnl #define posix_memalign innocuous_posix_memalign
+dnl #include "theinclude"
+dnl #undef posix_memalign
+dnl This avoids double declaration of that function when the header normally
+dnl declares it, while the test itself is just expecting the function not to be
+dnl declared at all, and declares it differently (which doesn't matter for the
+dnl test itself).
+dnl More recent versions of autoconf are essentially doing this.
+define([ac_cv_func_], [ac_cv_func2_])dnl
+define([_AC_CHECK_FUNC],defn([AC_CHECK_FUNC]))dnl
+define([AC_CHECK_FUNC], [dnl
+patsubst(_AC_CHECK_FUNC($@), [#include.*$], [#define $1 innocuous_$1
+\&
+#undef $1])])dnl
diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4
new file mode 100644
index 000000000..8bd8fbe46
--- /dev/null
+++ b/build/autoconf/icu.m4
@@ -0,0 +1,296 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Set the MOZ_ICU_VERSION variable to denote the current version of the
+dnl ICU library, and also the MOZ_SHARED_ICU which would be true if we are
+dnl linking against a shared library of ICU, either one that we build from
+dnl our copy of ICU or the system provided library.
+
+AC_DEFUN([MOZ_CONFIG_ICU], [
+
+ICU_LIB_NAMES=
+MOZ_NATIVE_ICU=
+MOZ_ARG_WITH_BOOL(system-icu,
+[ --with-system-icu
+ Use system ICU (located with pkgconfig)],
+ MOZ_NATIVE_ICU=1)
+
+if test -n "$MOZ_NATIVE_ICU"; then
+ PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
+ MOZ_SHARED_ICU=1
+else
+ MOZ_ICU_CFLAGS='-I$(topsrcdir)/intl/icu/source/common -I$(topsrcdir)/intl/icu/source/i18n'
+ AC_SUBST_LIST(MOZ_ICU_CFLAGS)
+fi
+
+AC_SUBST(MOZ_NATIVE_ICU)
+
+MOZ_ARG_WITH_STRING(intl-api,
+[ --with-intl-api, --with-intl-api=build, --without-intl-api
+ Determine the status of the ECMAScript Internationalization API. The first
+ (or lack of any of these) builds and exposes the API. The second builds it
+ but doesn't use ICU or expose the API to script. The third doesn't build
+ ICU at all.],
+ _INTL_API=$withval)
+
+ENABLE_INTL_API=
+EXPOSE_INTL_API=
+case "$_INTL_API" in
+no)
+ ;;
+build)
+ ENABLE_INTL_API=1
+ ;;
+yes)
+ ENABLE_INTL_API=1
+ EXPOSE_INTL_API=1
+ ;;
+*)
+ AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
+ ;;
+esac
+
+if test -n "$ENABLE_INTL_API"; then
+ USE_ICU=1
+fi
+
+if test -n "$EXPOSE_INTL_API"; then
+ AC_DEFINE(EXPOSE_INTL_API)
+fi
+
+if test -n "$ENABLE_INTL_API"; then
+ AC_DEFINE(ENABLE_INTL_API)
+fi
+
+dnl Settings for the implementation of the ECMAScript Internationalization API
+if test -n "$USE_ICU"; then
+ icudir="$_topsrcdir/intl/icu/source"
+ if test ! -d "$icudir"; then
+ icudir="$_topsrcdir/../../intl/icu/source"
+ if test ! -d "$icudir"; then
+ AC_MSG_ERROR([Cannot find the ICU directory])
+ fi
+ fi
+
+ version=`sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"`
+ if test x"$version" = x; then
+ AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno])
+ fi
+ MOZ_ICU_VERSION="$version"
+
+ if test -z "${JS_STANDALONE}" -a -n "${JS_SHARED_LIBRARY}${MOZ_NATIVE_ICU}"; then
+ MOZ_SHARED_ICU=1
+ fi
+
+ AC_SUBST(MOZ_ICU_VERSION)
+ AC_SUBST(MOZ_SHARED_ICU)
+
+ if test -z "$MOZ_NATIVE_ICU"; then
+ case "$OS_TARGET" in
+ WINNT)
+ ICU_LIB_NAMES="icuin icuuc icudt"
+ MOZ_ICU_DBG_SUFFIX=
+ if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
+ MOZ_ICU_DBG_SUFFIX=d
+ fi
+ ;;
+ Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|GNU/kFreeBSD)
+ ICU_LIB_NAMES="icui18n icuuc icudata"
+ ;;
+ *)
+ AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
+ esac
+ fi
+fi
+
+AC_SUBST(MOZ_ICU_DBG_SUFFIX)
+AC_SUBST(ENABLE_INTL_API)
+AC_SUBST(USE_ICU)
+AC_SUBST_LIST(ICU_LIB_NAMES)
+
+if test -n "$USE_ICU" -a -z "$MOZ_NATIVE_ICU"; then
+ dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds.
+ if test -z "$MOZ_SHARED_ICU"; then
+ AC_DEFINE(U_STATIC_IMPLEMENTATION)
+ fi
+ dnl Source files that use ICU should have control over which parts of the ICU
+ dnl namespace they want to use.
+ AC_DEFINE(U_USING_ICU_NAMESPACE,0)
+fi
+
+
+])
+
+AC_DEFUN([MOZ_SUBCONFIGURE_ICU], [
+
+if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
+
+ if test -n "$USE_ICU" -a -z "$MOZ_NATIVE_ICU"; then
+ # Set ICU compile options
+ ICU_CPPFLAGS=""
+ # don't use icu namespace automatically in client code
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0"
+ # don't include obsolete header files
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
+ # remove chunks of the library that we don't need (yet)
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_IDNA"
+ # we don't need to pass data to and from legacy char* APIs
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_CHARSET_IS_UTF8"
+ # make sure to not accidentally pick up system-icu headers
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -I$icudir/common -I$icudir/i18n"
+
+ ICU_CROSS_BUILD_OPT=""
+
+ if test "$CROSS_COMPILE"; then
+ # Remove _DEPEND_CFLAGS from HOST_FLAGS to avoid configure error
+ HOST_ICU_CFLAGS="$HOST_CFLAGS"
+ HOST_ICU_CXXFLAGS="$HOST_CXXFLAGS"
+
+ HOST_ICU_CFLAGS=`echo $HOST_ICU_CFLAGS | sed "s|$_DEPEND_CFLAGS||g"`
+ HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CFXXLAGS | sed "s|$_DEPEND_CFLAGS||g"`
+
+ # ICU requires RTTI
+ if test "$GNU_CC"; then
+ HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
+ elif test "$_MSC_VER"; then
+ HOST_ICU_CXXFLAGS=`echo $HOST_ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
+ fi
+
+ HOST_ICU_BUILD_OPTS=""
+ if test -n "$MOZ_DEBUG"; then
+ HOST_ICU_BUILD_OPTS="$HOST_ICU_BUILD_OPTS --enable-debug"
+ fi
+
+ abs_srcdir=`(cd $srcdir; pwd)`
+ mkdir -p $_objdir/intl/icu/host
+ (export AR="$HOST_AR"
+ export RANLIB="$HOST_RANLIB"
+ export CC="$HOST_CC"
+ export CXX="$HOST_CXX"
+ export CPP="$HOST_CPP"
+ export LD="$HOST_LD"
+ export CFLAGS="$HOST_ICU_CFLAGS $HOST_OPTIMIZE_FLAGS"
+ export CPPFLAGS="$ICU_CPPFLAGS"
+ export CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS"
+ export LDFLAGS="$HOST_LDFLAGS"
+ ac_configure_args="$HOST_ICU_BUILD_OPTS"
+ ac_configure_args="$ac_configure_args --enable-static --disable-shared --enable-extras=no --enable-icuio=no --enable-layout=no --enable-tests=no --enable-samples=no"
+ AC_OUTPUT_SUBDIRS_NOW(intl/icu/source:intl/icu/host)
+ ) || exit 1
+ # generate config/icucross.mk
+ $GMAKE -C $_objdir/intl/icu/host/ config/icucross.mk
+
+ # --with-cross-build requires absolute path
+ ICU_HOST_PATH=`cd $_objdir/intl/icu/host && pwd`
+ ICU_CROSS_BUILD_OPT="--with-cross-build=$ICU_HOST_PATH --disable-tools"
+ ICU_TARGET_OPT="--build=$build --host=$target"
+ else
+ # CROSS_COMPILE isn't set build and target are i386 and x86-64.
+ # So we must set target for --build and --host.
+ ICU_TARGET_OPT="--build=$target --host=$target"
+ fi
+
+ if test -z "$MOZ_SHARED_ICU"; then
+ # To reduce library size, use static linking
+ ICU_LINK_OPTS="--enable-static --disable-shared"
+ else
+ ICU_LINK_OPTS="--disable-static --enable-shared"
+ fi
+ # Force the ICU static libraries to be position independent code
+ ICU_CFLAGS="$DSO_PIC_CFLAGS $CFLAGS"
+ ICU_CXXFLAGS="$DSO_PIC_CFLAGS $CXXFLAGS"
+
+ ICU_BUILD_OPTS=""
+ if test -n "$MOZ_DEBUG" -o "MOZ_DEBUG_SYMBOLS"; then
+ ICU_CFLAGS="$ICU_CFLAGS $MOZ_DEBUG_FLAGS"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_DEBUG_FLAGS"
+ if test -n "$CROSS_COMPILE" -a "$OS_TARGET" = "Darwin" \
+ -a "$HOST_OS_ARCH" != "Darwin"
+ then
+ # Bug 951758: Cross-OSX builds with non-Darwin hosts have issues
+ # with -g and friends (like -gdwarf and -gfull) because they try
+ # to run dsymutil
+ changequote(,)
+ ICU_CFLAGS=`echo $ICU_CFLAGS | sed 's|-g[^ \t]*||g'`
+ ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-g[^ \t]*||g'`
+ changequote([,])
+ fi
+
+ ICU_LDFLAGS="$MOZ_DEBUG_LDFLAGS"
+ if test -z "$MOZ_DEBUG"; then
+ # To generate debug symbols, it requires MOZ_DEBUG_FLAGS.
+ # But, not debug build.
+ ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
+ elif test -z "$MOZ_NO_DEBUG_RTL"; then
+ ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
+ fi
+ fi
+ if test -z "$MOZ_OPTIMIZE"; then
+ ICU_BUILD_OPTS="$ICU_BUILD_OPTS --disable-release"
+ else
+ ICU_CFLAGS="$ICU_CFLAGS $MOZ_OPTIMIZE_FLAGS"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
+ fi
+
+ if test "$am_cv_langinfo_codeset" = "no"; then
+ # ex. Android
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_HAVE_NL_LANGINFO_CODESET=0"
+ fi
+
+ # ICU requires RTTI
+ if test "$GNU_CC"; then
+ ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-fno-rtti|-frtti|g'`
+ else
+ if test "$_MSC_VER"; then
+ ICU_CXXFLAGS=`echo $ICU_CXXFLAGS | sed 's|-GR-|-GR|g'`
+ fi
+
+ # Add RTL flags for MSVCRT.DLL
+ if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
+ ICU_CFLAGS="$ICU_CFLAGS -MDd"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
+ else
+ ICU_CFLAGS="$ICU_CFLAGS -MD"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS -MD"
+ fi
+
+ # add disable optimize flag for workaround for bug 899948
+ if test -z "$MOZ_OPTIMIZE"; then
+ ICU_CFLAGS="$ICU_CFLAGS -Od"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS -Od"
+ fi
+ fi
+
+ if test -z "$MOZ_SHARED_ICU"; then
+ ICU_CXXFLAGS="$ICU_CXXFLAGS -DU_STATIC_IMPLEMENTATION"
+ ICU_CFLAGS="$ICU_CFLAGS -DU_STATIC_IMPLEMENTATION"
+ if test "$GNU_CC"; then
+ ICU_CFLAGS="$ICU_CFLAGS -fvisibility=hidden"
+ ICU_CXXFLAGS="$ICU_CXXFLAGS -fvisibility=hidden"
+ fi
+ fi
+
+ (export AR="$AR"
+ export CC="$CC"
+ export CXX="$CXX"
+ export LD="$LD"
+ export ARFLAGS="$ARFLAGS"
+ export CPPFLAGS="$ICU_CPPFLAGS $CPPFLAGS"
+ export CFLAGS="$ICU_CFLAGS"
+ export CXXFLAGS="$ICU_CXXFLAGS"
+ export LDFLAGS="$ICU_LDFLAGS $LDFLAGS"
+ ac_configure_args="$ICU_BUILD_OPTS $ICU_CROSS_BUILD_OPT $ICU_LINK_OPTS $ICU_TARGET_OPT"
+ ac_configure_args="$ac_configure_args --disable-extras --disable-icuio --disable-layout --disable-tests --disable-samples"
+ AC_OUTPUT_SUBDIRS(intl/icu/source:intl/icu/target)
+ ) || exit 1
+ fi
+
+fi
+
+])
diff --git a/build/autoconf/libstdcxx.py b/build/autoconf/libstdcxx.py
deleted file mode 100755
index f5d1f7605..000000000
--- a/build/autoconf/libstdcxx.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-# This script find the version of libstdc++ and prints it as single number
-# with 8 bits per element. For example, GLIBCXX_3.4.10 becomes
-# 3 << 16 | 4 << 8 | 10 = 197642. This format is easy to use
-# in the C preprocessor.
-
-# We find out both the host and target versions. Since the output
-# will be used from shell, we just print the two assignments and evaluate
-# them from shell.
-
-import os
-import subprocess
-import re
-
-re_for_ld = re.compile('.*\((.*)\).*')
-
-def parse_readelf_line(x):
- """Return the version from a readelf line that looks like:
- 0x00ec: Rev: 1 Flags: none Index: 8 Cnt: 2 Name: GLIBCXX_3.4.6
- """
- return x.split(':')[-1].split('_')[-1].strip()
-
-def parse_ld_line(x):
- """Parse a line from the output of ld -t. The output of gold is just
- the full path, gnu ld prints "-lstdc++ (path)".
- """
- t = re_for_ld.match(x)
- if t:
- return t.groups()[0].strip()
- return x.strip()
-
-def split_ver(v):
- """Covert the string '1.2.3' into the list [1,2,3]
- """
- return [int(x) for x in v.split('.')]
-
-def cmp_ver(a, b):
- """Compare versions in the form 'a.b.c'
- """
- for (i, j) in zip(split_ver(a), split_ver(b)):
- if i != j:
- return i - j
- return 0
-
-def encode_ver(v):
- """Encode the version as a single number.
- """
- t = split_ver(v)
- return t[0] << 16 | t[1] << 8 | t[2]
-
-def find_version(e):
- """Given the value of environment variable CXX or HOST_CXX, find the
- version of the libstdc++ it uses.
- """
- args = e.split()
- args += ['-shared', '-Wl,-t']
- p = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
- candidates = [x for x in p.stdout if 'libstdc++.so' in x]
- assert len(candidates) == 1
- libstdcxx = parse_ld_line(candidates[-1])
-
- p = subprocess.Popen(['readelf', '-V', libstdcxx], stdout=subprocess.PIPE)
- versions = [parse_readelf_line(x)
- for x in p.stdout.readlines() if 'Name: GLIBCXX' in x]
- last_version = sorted(versions, cmp = cmp_ver)[-1]
- return encode_ver(last_version)
-
-if __name__ == '__main__':
- cxx_env = os.environ['CXX']
- print 'MOZ_LIBSTDCXX_TARGET_VERSION=%s' % find_version(cxx_env)
- host_cxx_env = os.environ.get('HOST_CXX', cxx_env)
- print 'MOZ_LIBSTDCXX_HOST_VERSION=%s' % find_version(host_cxx_env)
diff --git a/build/autoconf/llvm-pr8927.m4 b/build/autoconf/llvm-pr8927.m4
index 0c3033ba0..5c4dc7d16 100644
--- a/build/autoconf/llvm-pr8927.m4
+++ b/build/autoconf/llvm-pr8927.m4
@@ -42,7 +42,7 @@ AC_LANG_RESTORE
if test "$ac_have_llvm_pr8927" = "yes"; then
AC_MSG_RESULT(yes)
- echo This compiler would miscompile firefox, plase upgrade.
+ echo This compiler would miscompile firefox, please upgrade.
echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
echo for more information.
exit 1
diff --git a/build/autoconf/match-dir.sh b/build/autoconf/match-dir.sh
deleted file mode 100755
index 3c22809d9..000000000
--- a/build/autoconf/match-dir.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#
-# This script will match a dir with a set of dirs.
-#
-# Usage: match-dir.sh match [dir1 dir2 ... dirn]
-#
-# Send comments, improvements, bugs to ramiro@netscape.com
-#
-
-if [ -f Makefile ]; then
- MAKEFILE="Makefile"
-else
- if [ -f Makefile.in ]; then
- MAKEFILE="Makefile.in"
- else
- echo
- echo "There ain't no 'Makefile' or 'Makefile.in' over here: $pwd, dude."
- echo
- exit 1
- fi
-fi
-
-# Use DEPTH in the Makefile.in to determine the depth
-depth=`grep -w DEPTH ${MAKEFILE} | grep "\.\." | awk -F"=" '{ print $2; }'`
-cwd=`pwd`
-
-# Determine the depth count
-n=`echo $depth | tr '/' ' ' | wc -w`
-
-cd $depth
-objdir=`pwd`
-
-path=`echo $cwd | sed "s|^${objdir}/||"`
-
-match=$path
-
-for i in $*
-do
-# echo "Looking for $match in $i"
-
- echo $i | grep -q -x $match
-
- if [ $? -eq 0 ]
- then
- echo "1"
-
- exit 0
- fi
-
-# echo "Looking for $i in $match"
-
- echo $match | grep -q $i
-
- if [ $? -eq 0 ]
- then
- echo "1"
-
- exit 0
- fi
-done
-
-echo "0"
-
-exit 0
diff --git a/build/autoconf/mozconfig-find b/build/autoconf/mozconfig-find
deleted file mode 100755
index 97dd90c35..000000000
--- a/build/autoconf/mozconfig-find
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# mozconfigfind - Loads options from .mozconfig onto configure's
-# command-line. The .mozconfig file is searched for in the
-# order:
-# If $MOZCONFIG is set, use that.
-# If one of $TOPSRCDIR/.mozconfig or $TOPSRCDIR/mozconfig exists, use it.
-# If both exist, or if various legacy locations contain a mozconfig, error.
-# Otherwise, use the default build options.
-#
-topsrcdir=$1
-
-abspath() {
- if uname -s | grep -q MINGW; then
- # We have no way to figure out whether we're in gmake or pymake right
- # now. gmake gives us Unix-style paths while pymake gives us Windows-style
- # paths, so attempt to handle both.
- regexes='^\([A-Za-z]:\|\\\\\|\/\) ^\/'
- else
- regexes='^\/'
- fi
-
- for regex in $regexes; do
- if echo $1 | grep -q $regex; then
- echo $1
- return
- fi
- done
-
- # If we're at this point, we have a relative path
- echo `pwd`/$1
-}
-
-if [ -n "$MOZCONFIG" ] && ! [ -f "$MOZCONFIG" ]; then
- echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!" 1>&2
- exit 1
-fi
-
-if [ -n "$MOZ_MYCONFIG" ]; then
- echo "Your environment currently has the MOZ_MYCONFIG variable set to \"$MOZ_MYCONFIG\". MOZ_MYCONFIG is no longer supported. Please use MOZCONFIG instead." 1>&2
- exit 1
-fi
-
-if [ -z "$MOZCONFIG" ] && [ -f "$topsrcdir/.mozconfig" ] && [ -f "$topsrcdir/mozconfig" ]; then
- echo "Both \$topsrcdir/.mozconfig and \$topsrcdir/mozconfig are supported, but you must choose only one. Please remove the other." 1>&2
- exit 1
-fi
-
-for _config in "$MOZCONFIG" \
- "$topsrcdir/.mozconfig" \
- "$topsrcdir/mozconfig"
-do
- if test -f "$_config"; then
- abspath $_config
- exit 0
- fi
-done
-
-# We used to support a number of other implicit .mozconfig locations. We now
-# detect if we were about to use any of these locations and issue an error if we
-# find any.
-for _config in "$topsrcdir/mozconfig.sh" \
- "$topsrcdir/myconfig.sh" \
- "$HOME/.mozconfig" \
- "$HOME/.mozconfig.sh" \
- "$HOME/.mozmyconfig.sh"
-do
- if test -f "$_config"; then
- echo "You currently have a mozconfig at \"$_config\". This implicit location is no longer supported. Please move it to $topsrcdir/.mozconfig or specify it explicitly via \$MOZCONFIG." 1>&2
- exit 1
- fi
-done
diff --git a/build/autoconf/mozconfig2client-mk b/build/autoconf/mozconfig2client-mk
deleted file mode 100755
index 1b632226d..000000000
--- a/build/autoconf/mozconfig2client-mk
+++ /dev/null
@@ -1,80 +0,0 @@
-#! /bin/sh
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# mozconfig2client-mk - Translates .mozconfig into options for client.mk.
-# Prints defines to stdout.
-#
-# See mozconfig2configure for more details
-
-print_header() {
- cat <<EOF
-# gmake
-# This file is automatically generated for client.mk.
-# Do not edit. Edit $FOUND_MOZCONFIG instead.
-
-EOF
-}
-
-ac_add_options() {
- echo "# $* is used by configure (not client.mk)"
-}
-
-ac_add_app_options() {
- echo "# $* is used by configure (not client.mk)"
-}
-
-mk_add_options() {
- for _opt
- do
- # Escape shell characters, space, tab, dollar, quote, backslash,
- # and substitute '@<word>@' with '$(<word>)'.
- _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'`
- echo $_opt;
- opts="${opts:+$opts^}$_opt";
- done
-}
-
-mk_echo_options() {
- echo "Adding client.mk options from $FOUND_MOZCONFIG:" >&2
- IFS=^
- for _opt in $opts; do
- echo " $_opt" >&2
- done
-}
-
-# Main
-#--------------------------------------------------
-
-scriptdir=`dirname $0`
-topsrcdir=$1
-opts=""
-
-# If the path changes, configure should be rerun
-echo "# PATH=$PATH"
-
-# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
-isfoundset=${FOUND_MOZCONFIG+yes}
-if [ -z $isfoundset ]; then
- FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir`
- if [ $? -ne 0 ]; then
- echo '$(error Fix above errors before continuing.)'
- else
- isfoundset=yes
- fi
-fi
-
-if [ -n $isfoundset ]; then
- if [ "$FOUND_MOZCONFIG" ]
- then
- print_header
- . "$FOUND_MOZCONFIG"
- fi
- echo "export FOUND_MOZCONFIG := $FOUND_MOZCONFIG"
-
- if [ "$opts" ]; then
- mk_echo_options
- fi
-fi
diff --git a/build/autoconf/mozconfig2configure b/build/autoconf/mozconfig2configure
deleted file mode 100755
index 3e502c0b8..000000000
--- a/build/autoconf/mozconfig2configure
+++ /dev/null
@@ -1,103 +0,0 @@
-#! /bin/sh
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# mozconfig2configure - Loads options from .mozconfig onto configure's
-# command-line. See mozconfig-find for how the config file is
-# found
-#
-# The options from .mozconfig are inserted into the command-line
-# before the real command-line options. This way the real options
-# will override any .mozconfig options.
-#
-# .mozconfig is a shell script. To add an option to configure's
-# command-line use the pre-defined function, ac_add_options,
-#
-# ac_add_options <configure-option> [<configure-option> ... ]
-#
-# For example,
-#
-# ac_add_options --with-pthreads --enable-debug
-#
-# ac_add_options can be called multiple times in .mozconfig.
-# Each call adds more options to configure's command-line.
-
-# Note: $_AUTOCONF_TOOLS_DIR must be defined in the script that includes this.
-
-ac_add_options() {
- for _opt
- do
- # Escape shell characters, space, tab, dollar, quote, backslash, parentheses.
- _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\\(\)]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'`
- _opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'`
-
- # Avoid adding duplicates
- case "$ac_options" in
- # Note that all options in $ac_options are enclosed in quotes,
- # so there will always be a last character to match [^-A-Za-z0-9_]
- *"\"$_opt[^-A-Za-z0-9_]"* ) ;;
- * ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;;
- esac
- done
-}
-
-ac_add_app_options() {
- APP=$1
- shift;
- if [ "$APP" = "$MOZ_BUILD_APP" ]; then
- ac_add_options "$*";
- fi
-}
-
-mk_add_options() {
- # These options are for client.mk
- # configure can safely ignore them.
- :
-}
-
-ac_echo_options() {
- echo "Adding configure options from $FOUND_MOZCONFIG:"
- eval "set -- $mozconfig_ac_options"
- for _opt
- do
- echo " $_opt"
- done
-}
-
-# Main
-#--------------------------------------------------
-topsrcdir=`dirname $0`
-ac_options=
-mozconfig_ac_options=
-
-# Save the real command-line options
-for _opt
-do
- # Escape shell characters, space, tab, dollar, quote, backslash.
- _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'`
- ac_options="$ac_options \"$_opt\""
-done
-
-
-# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
-isfoundset=${FOUND_MOZCONFIG+yes}
-if [ -z $isfoundset ]; then
- FOUND_MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir`
- if [ $? -ne 0 ]; then
- echo "Fix above errors before continuing." 1>&2
- exit 1
- fi
-fi
-
-if [ "$FOUND_MOZCONFIG" ]; then
- . "$FOUND_MOZCONFIG"
-fi
-export FOUND_MOZCONFIG
-
-if [ "$mozconfig_ac_options" ]; then
- ac_echo_options 1>&2
-fi
-
-eval "set -- $mozconfig_ac_options $ac_options"
diff --git a/build/autoconf/moznbytetype.m4 b/build/autoconf/moznbytetype.m4
deleted file mode 100644
index dfecaa583..000000000
--- a/build/autoconf/moznbytetype.m4
+++ /dev/null
@@ -1,103 +0,0 @@
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-dnl MOZ_N_BYTE_TYPE(VARIABLE, SIZE, POSSIBLE-TYPES)
-dnl
-dnl Check to see which of POSSIBLE-TYPES has a size of SIZE. If we
-dnl find one, define VARIABLE to be the size-BYTE type. If no type
-dnl matches, exit the configure script with an error message. Types
-dnl whose written form contains spaces should appear in POSSIBLE-TYPES
-dnl enclosed by shell quotes.
-dnl
-dnl The cache variable moz_cv_n_byte_type_VARIABLE gets set to the
-dnl type, if found.
-dnl
-dnl for example:
-dnl MOZ_N_BYTE_TYPE([JS_INT32_T], [4], [int long 'long long' short])
-dnl
-AC_DEFUN([MOZ_N_BYTE_TYPE],
-[
-dnl The simplest approach would simply be to run a program that says
-dnl printf ("%d\n", sizeof ($type));
-dnl But that won't work when cross-compiling; this will.
-AC_CACHE_CHECK([for a $2-byte type], moz_cv_n_byte_type_$1, [
- moz_cv_n_byte_type_$1=
- for type in $3; do
- AC_TRY_COMPILE([],
- [
- int a[sizeof ($type) == $2 ? 1 : -1];
- return 0;
- ],
- [moz_cv_n_byte_type_$1=$type; break], [])
- done
- if test ! "$moz_cv_n_byte_type_$1"; then
- AC_MSG_ERROR([Couldn't find a $2-byte type])
- fi
-])
-AC_DEFINE_UNQUOTED($1, [$moz_cv_n_byte_type_$1],
- [a $2-byte type on the target machine])
-])
-
-dnl MOZ_SIZE_OF_TYPE(VARIABLE, TYPE, POSSIBLE-SIZES)
-dnl
-dnl Check to see which of POSSIBLE-SIZES is the sizeof(TYPE). If we find one,
-dnl define VARIABLE SIZE. If no size matches, exit the configure script with
-dnl an error message.
-dnl
-dnl The cache variable moz_cv_size_of_VARIABLE gets set to the size, if
-dnl found.
-dnl
-dnl for example:
-dnl MOZ_SIZE_OF_TYPE([JS_BYTES_PER_WORD], [void*], [4 8])
-AC_DEFUN([MOZ_SIZE_OF_TYPE],
-[
-AC_CACHE_CHECK([for the size of $2], moz_cv_size_of_$1, [
- moz_cv_size_of_$1=
- for size in $3; do
- AC_TRY_COMPILE([],
- [
- int a[sizeof ($2) == $size ? 1 : -1];
- return 0;
- ],
- [moz_cv_size_of_$1=$size; break], [])
- done
- if test ! "$moz_cv_size_of_$1"; then
- AC_MSG_ERROR([No size found for $2])
- fi
-])
-AC_DEFINE_UNQUOTED($1, [$moz_cv_size_of_$1])
-])
-
-dnl MOZ_ALIGN_OF_TYPE(VARIABLE, TYPE, POSSIBLE-ALIGNS)
-dnl
-dnl Check to see which of POSSIBLE-ALIGNS is the necessary alignment of TYPE.
-dnl If we find one, define VARIABLE ALIGNMENT. If no alignment matches, exit
-dnl the configure script with an error message.
-dnl
-dnl The cache variable moz_cv_align_of_VARIABLE gets set to the size, if
-dnl found.
-dnl
-dnl for example:
-dnl MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
-AC_DEFUN([MOZ_ALIGN_OF_TYPE],
-[
-AC_CACHE_CHECK([for the alignment of $2], moz_cv_align_of_$1, [
- moz_cv_align_of_$1=
- for align in $3; do
- AC_TRY_COMPILE([
- #include <stddef.h>
- struct aligner { char c; $2 a; };
- ],
- [
- int a[offsetof(struct aligner, a) == $align ? 1 : -1];
- return 0;
- ],
- [moz_cv_align_of_$1=$align; break], [])
- done
- if test ! "$moz_cv_align_of_$1"; then
- AC_MSG_ERROR([No alignment found for $2])
- fi
-])
-AC_DEFINE_UNQUOTED($1, [$moz_cv_align_of_$1])
-])
diff --git a/build/autoconf/nspr-build.m4 b/build/autoconf/nspr-build.m4
new file mode 100644
index 000000000..305f13ab7
--- /dev/null
+++ b/build/autoconf/nspr-build.m4
@@ -0,0 +1,263 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_CONFIG_NSPR], [
+
+ifelse([$1],,define(CONFIGURING_JS,yes))
+
+dnl Possible ways this can be called:
+dnl from toplevel configure:
+dnl JS_STANDALONE= BUILDING_JS=
+dnl from js/src/configure invoked by toplevel configure:
+dnl JS_STANDALONE= BUILDING_JS=1
+dnl from standalone js/src/configure:
+dnl JS_STANDALONE=1 BUILDING_JS=1
+
+dnl ========================================================
+dnl = Find the right NSPR to use.
+dnl ========================================================
+MOZ_ARG_WITH_STRING(nspr-cflags,
+[ --with-nspr-cflags=FLAGS
+ Pass FLAGS to CC when building code that uses NSPR.
+ Use this when there's no accurate nspr-config
+ script available. This is the case when building
+ SpiderMonkey as part of the Mozilla tree: the
+ top-level configure script computes NSPR flags
+ that accomodate the quirks of that environment.],
+ NSPR_CFLAGS=$withval)
+MOZ_ARG_WITH_STRING(nspr-libs,
+[ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR.
+ See --with-nspr-cflags for more details.],
+ NSPR_LIBS=$withval)
+
+ifdef([CONFIGURING_JS],[
+ MOZ_ARG_ENABLE_BOOL(nspr-build,
+[ --enable-nspr-build Configure and build NSPR from source tree],
+ MOZ_BUILD_NSPR=1,
+ MOZ_BUILD_NSPR=)
+])
+
+if test -z "$BUILDING_JS" || test -n "$JS_STANDALONE"; then
+ _IS_OUTER_CONFIGURE=1
+fi
+
+MOZ_ARG_WITH_BOOL(system-nspr,
+[ --with-system-nspr Use an NSPR that is already built and installed.
+ Use the 'nspr-config' script in the current path,
+ or look for the script in the directories given with
+ --with-nspr-exec-prefix or --with-nspr-prefix.
+ (Those flags are only checked if you specify
+ --with-system-nspr.)],
+ _USE_SYSTEM_NSPR=1 )
+
+JS_POSIX_NSPR=unset
+ifdef([CONFIGURING_JS],[
+ if test -n "$JS_STANDALONE"; then
+ case "$target" in
+ *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
+ if test -z "$_HAS_NSPR"; then
+ JS_POSIX_NSPR_DEFAULT=1
+ fi
+ ;;
+ esac
+ fi
+
+ MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
+[ --enable-posix-nspr-emulation
+ Enable emulation of NSPR for POSIX systems],
+ JS_POSIX_NSPR=1,
+ JS_POSIX_NSPR=)
+])
+
+dnl Pass at most one of
+dnl --with-system-nspr
+dnl --with-nspr-cflags/libs
+dnl --enable-nspr-build
+dnl --enable-posix-nspr-emulation
+
+AC_MSG_CHECKING([NSPR selection])
+nspr_opts=
+which_nspr=default
+if test -n "$_USE_SYSTEM_NSPR"; then
+ nspr_opts="x$nspr_opts"
+ which_nspr="system"
+fi
+if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
+ nspr_opts="x$nspr_opts"
+ which_nspr="command-line"
+fi
+if test -n "$MOZ_BUILD_NSPR"; then
+ nspr_opts="x$nspr_opts"
+ which_nspr="source-tree"
+fi
+if test "$JS_POSIX_NSPR" = unset; then
+ JS_POSIX_NSPR=
+else
+ nspr_opts="x$nspr_opts"
+ which_nspr="posix-wrapper"
+fi
+
+if test -z "$nspr_opts"; then
+ if test -z "$BUILDING_JS"; then
+ dnl Toplevel configure defaults to using nsprpub from the source tree
+ MOZ_BUILD_NSPR=1
+ which_nspr="source-tree"
+ else
+ dnl JS configure defaults to emulated NSPR if available, falling back
+ dnl to nsprpub.
+ JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT"
+ if test -z "$JS_POSIX_NSPR"; then
+ MOZ_BUILD_NSPR=1
+ which_nspr="source-tree"
+ else
+ which_nspr="posix-wrapper"
+ fi
+ fi
+fi
+
+if test -z "$nspr_opts" || test "$nspr_opts" = x; then
+ AC_MSG_RESULT($which_nspr)
+else
+ AC_MSG_ERROR([only one way of using NSPR may be selected. See 'configure --help'.])
+fi
+
+AC_SUBST(MOZ_BUILD_NSPR)
+
+if test -n "$BUILDING_JS"; then
+ if test "$JS_POSIX_NSPR" = 1; then
+ AC_DEFINE(JS_POSIX_NSPR)
+ fi
+ AC_SUBST(JS_POSIX_NSPR)
+fi
+
+# A (sub)configure invoked by the toplevel configure will always receive
+# --with-nspr-libs on the command line. It will never need to figure out
+# anything itself.
+if test -n "$_IS_OUTER_CONFIGURE"; then
+
+if test -n "$_USE_SYSTEM_NSPR"; then
+ AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([you do not have NSPR installed or your version is older than $NSPR_MINVER.])])
+fi
+
+if test -n "$MOZ_NATIVE_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $NSPR_CFLAGS"
+ AC_TRY_COMPILE([#include "prtypes.h"],
+ [#ifndef PR_STATIC_ASSERT
+ #error PR_STATIC_ASSERT not defined or requires including prtypes.h
+ #endif],
+ ,
+ AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
+ AC_TRY_COMPILE([#include "prtypes.h"],
+ [#ifndef PR_UINT64
+ #error PR_UINT64 not defined or requires including prtypes.h
+ #endif],
+ ,
+ AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
+ CFLAGS=$_SAVE_CFLAGS
+elif test -z "$JS_POSIX_NSPR"; then
+ if test -z "$LIBXUL_SDK"; then
+ NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
+ if test -n "$GNU_CC"; then
+ NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
+ else
+ NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
+ fi
+ else
+ NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
+ NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
+ fi
+fi
+
+AC_SUBST(NSPR_CFLAGS)
+
+NSPR_PKGCONF_CHECK="nspr"
+if test -n "$MOZ_NATIVE_NSPR"; then
+ # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc
+ NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER"
+
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $NSPR_CFLAGS"
+ AC_TRY_COMPILE([#include "prlog.h"],
+ [#ifndef PR_STATIC_ASSERT
+ #error PR_STATIC_ASSERT not defined
+ #endif],
+ ,
+ AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
+ CFLAGS=$_SAVE_CFLAGS
+fi
+AC_SUBST(NSPR_PKGCONF_CHECK)
+
+fi # _IS_OUTER_CONFIGURE
+
+])
+
+AC_DEFUN([MOZ_SUBCONFIGURE_NSPR], [
+
+if test -z "$MOZ_NATIVE_NSPR"; then
+ ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
+ if test -n "$MOZ_USING_CCACHE"; then
+ # Avoid double prepending ccache by omitting --with-ccache in building NSPR.
+ ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-ccache[[^ ]]*//'`"
+ fi
+
+ if test -z "$MOZ_DEBUG"; then
+ ac_configure_args="$ac_configure_args --disable-debug"
+ else
+ ac_configure_args="$ac_configure_args --enable-debug"
+ if test -n "$MOZ_NO_DEBUG_RTL"; then
+ ac_configure_args="$ac_configure_args --disable-debug-rtl"
+ fi
+ fi
+ if test "$MOZ_OPTIMIZE" = "1"; then
+ ac_configure_args="$ac_configure_args --enable-optimize"
+ elif test -z "$MOZ_OPTIMIZE"; then
+ ac_configure_args="$ac_configure_args --disable-optimize"
+ fi
+ if test -n "$HAVE_64BIT_BUILD"; then
+ ac_configure_args="$ac_configure_args --enable-64bit"
+ fi
+ if test -n "$USE_ARM_KUSER"; then
+ ac_configure_args="$ac_configure_args --with-arm-kuser"
+ fi
+ # A configure script generated by autoconf 2.68 does not allow the cached
+ # values of "precious" variables such as CFLAGS and LDFLAGS to differ from
+ # the values passed to the configure script. Since we modify CFLAGS and
+ # LDFLAGS before passing them to NSPR's configure script, we cannot share
+ # config.cache with NSPR. As a result, we cannot pass AS, CC, CXX, etc. to
+ # NSPR via a shared config.cache file and must pass them to NSPR on the
+ # configure command line.
+ for var in AS CC CXX CPP LD AR RANLIB STRIP; do
+ ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
+ done
+ # A configure script generated by autoconf 2.68 warns if --host is
+ # specified but --build isn't. So we always pass --build to NSPR's
+ # configure script.
+ ac_configure_args="$ac_configure_args --build=$build"
+ ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
+
+ # Save these, so we can mess with them for the subconfigure ..
+ _SAVE_CFLAGS="$CFLAGS"
+ _SAVE_CPPFLAGS="$CPPFLAGS"
+ _SAVE_LDFLAGS="$LDFLAGS"
+
+ if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
+ # dladdr is supported by the new linker, even when the system linker doesn't
+ # support it. Trick nspr into using dladdr when it's not supported.
+ export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
+ fi
+ export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
+ export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
+
+ AC_OUTPUT_SUBDIRS(nsprpub)
+
+ # .. and restore them
+ CFLAGS="$_SAVE_CFLAGS"
+ CPPFLAGS="$_SAVE_CPPFLAGS"
+ LDFLAGS="$_SAVE_LDFLAGS"
+
+ ac_configure_args="$_SUBDIR_CONFIG_ARGS"
+fi
+
+])
diff --git a/build/autoconf/nspr.m4 b/build/autoconf/nspr.m4
index 68087b45c..4be1abb2f 100644
--- a/build/autoconf/nspr.m4
+++ b/build/autoconf/nspr.m4
@@ -64,17 +64,25 @@ AC_ARG_WITH(nspr-exec-prefix,
if test -z "$no_nspr"; then
nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
+ if test -z "$nspr_config_micro_version"; then
+ nspr_config_micro_version="0"
+ fi
+
min_nspr_major_version=`echo $min_nspr_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
min_nspr_minor_version=`echo $min_nspr_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
min_nspr_micro_version=`echo $min_nspr_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
+ if test -z "$min_nspr_micro_version"; then
+ min_nspr_micro_version="0"
+ fi
+
if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
no_nspr="yes"
elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
@@ -97,6 +105,6 @@ AC_ARG_WITH(nspr-exec-prefix,
AC_SUBST(NSPR_CFLAGS)
- AC_SUBST(NSPR_LIBS)
+ AC_SUBST_LIST(NSPR_LIBS)
])
diff --git a/build/autoconf/nss.m4 b/build/autoconf/nss.m4
index 14e585746..91c89f399 100644
--- a/build/autoconf/nss.m4
+++ b/build/autoconf/nss.m4
@@ -45,17 +45,25 @@ AC_ARG_WITH(nss-exec-prefix,
NSS_LIBS=`$NSS_CONFIG $nss_config_args --libs`
nss_config_major_version=`$NSS_CONFIG $nss_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
nss_config_minor_version=`$NSS_CONFIG $nss_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
nss_config_micro_version=`$NSS_CONFIG $nss_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
+ if test -z "$nss_config_micro_version"; then
+ nss_config_micro_version="0"
+ fi
+
min_nss_major_version=`echo $min_nss_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
min_nss_minor_version=`echo $min_nss_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
min_nss_micro_version=`echo $min_nss_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
+ if test -z "$min_nss_micro_version"; then
+ min_nss_micro_version="0"
+ fi
+
if test "$nss_config_major_version" -lt "$min_nss_major_version"; then
no_nss="yes"
elif test "$nss_config_major_version" -eq "$min_nss_major_version" &&
@@ -78,6 +86,6 @@ AC_ARG_WITH(nss-exec-prefix,
AC_SUBST(NSS_CFLAGS)
- AC_SUBST(NSS_LIBS)
+ AC_SUBST_LIST(NSS_LIBS)
])
diff --git a/build/autoconf/pkg.m4 b/build/autoconf/pkg.m4
index 4b0083072..74b438f58 100644
--- a/build/autoconf/pkg.m4
+++ b/build/autoconf/pkg.m4
@@ -43,8 +43,8 @@ AC_DEFUN([PKG_CHECK_MODULES],
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
- AC_SUBST($1_CFLAGS)
- AC_SUBST($1_LIBS)
+ AC_SUBST_LIST($1_CFLAGS)
+ AC_SUBST_LIST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
diff --git a/build/autoconf/python-virtualenv.m4 b/build/autoconf/python-virtualenv.m4
index ef8e476a8..e7dd99058 100644
--- a/build/autoconf/python-virtualenv.m4
+++ b/build/autoconf/python-virtualenv.m4
@@ -24,7 +24,7 @@ dnl If this is a mozilla-central, we'll find the virtualenv in the top
dnl source directory. If this is a SpiderMonkey build, we assume we're at
dnl js/src and try to find the virtualenv from the mozilla-central root.
for base in $MOZILLA_CENTRAL_PATH $_topsrcdir $_topsrcdir/../..; do
- possible=$base/build/virtualenv/populate_virtualenv.py
+ possible=$base/python/mozbuild/mozbuild/virtualenv.py
if test -e $possible; then
_virtualenv_topsrcdir=$base
@@ -53,7 +53,8 @@ if test -z $DONT_POPULATE_VIRTUALENV; then
dnl virtualenv is present and up to date. It sanitizes the environment
dnl for us, so we don't need to clean anything out.
$PYTHON $_virtualenv_populate_path \
- $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
+ $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv \
+ $_virtualenv_topsrcdir/build/virtualenv_packages.txt || exit 1
case "$host_os" in
mingw*)
@@ -73,5 +74,12 @@ if test "$?" != 0; then
AC_MSG_ERROR([Python environment does not appear to be sane.])
fi
AC_MSG_RESULT([yes])
+
+PYTHON_SITE_PACKAGES=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()"`
+if test -z "$PYTHON_SITE_PACKAGES"; then
+ AC_MSG_ERROR([Could not determine python site packages directory.])
+fi
+AC_SUBST([PYTHON_SITE_PACKAGES])
+
])
diff --git a/build/autoconf/toolchain.m4 b/build/autoconf/toolchain.m4
index 95d43e527..bcf58dda0 100644
--- a/build/autoconf/toolchain.m4
+++ b/build/autoconf/toolchain.m4
@@ -10,15 +10,37 @@ GNU_CC=
GNU_CXX=
CC_VERSION='N/A'
CXX_VERSION='N/A'
-if test "$GCC" = "yes"; then
- GNU_CC=1
- CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
+cat <<EOF > conftest.c
+#if defined(_MSC_VER)
+#if defined(__clang__)
+COMPILER clang-cl _MSC_VER
+#else
+COMPILER msvc _MSC_FULL_VER
+#endif
+#elif defined(__clang__)
+COMPILER clang __clang_major__.__clang_minor__.__clang_patchlevel__
+#elif defined(__GNUC__)
+COMPILER gcc __GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
+#elif defined(__INTEL_COMPILER)
+COMPILER icc __INTEL_COMPILER
+#endif
+EOF
+read dummy compiler CC_VERSION <<EOF
+$($CC -E $CPPFLAGS $CFLAGS conftest.c 2>/dev/null | grep COMPILER)
+EOF
+read dummy cxxcompiler CXX_VERSION <<EOF
+$($CXX -E $CPPFLAGS $CXXFLAGS conftest.c 2>/dev/null | grep COMPILER)
+EOF
+if test "$compiler" != "$cxxcompiler"; then
+ AC_MSG_ERROR([Your C and C++ compilers are different. You need to use the same compiler.])
fi
-if test "$GXX" = "yes"; then
+CC_VERSION=`echo "$CC_VERSION" | sed 's/ //g'`
+CXX_VERSION=`echo "$CXX_VERSION" | sed 's/ //g'`
+if test "$compiler" = "gcc"; then
+ GNU_CC=1
GNU_CXX=1
- CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
changequote(<<,>>)
- GCC_VERSION_FULL=`echo "$CXX_VERSION" | $PERL -pe 's/^.*gcc version ([^ ]*).*/<<$>>1/'`
+ GCC_VERSION_FULL="$CXX_VERSION"
GCC_VERSION=`echo "$GCC_VERSION_FULL" | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/<<$>>1/;'`
GCC_MAJOR_VERSION=`echo ${GCC_VERSION} | $AWK -F\. '{ print <<$>>1 }'`
@@ -33,34 +55,217 @@ rm -f conftest.out
if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
GNU_LD=1
fi
+
+if test "$compiler" = "msvc"; then
+ MSVC_VERSION_FULL="$CXX_VERSION"
+ CC_VERSION=`echo ${CC_VERSION} | cut -c 1-4`
+ CXX_VERSION=`echo ${CXX_VERSION} | cut -c 1-4`
+fi
+
+INTEL_CC=
+INTEL_CXX=
+if test "$compiler" = "icc"; then
+ INTEL_CC=1
+ INTEL_CXX=1
+fi
+
+CLANG_CC=
+CLANG_CXX=
+CLANG_CL=
+if test "$compiler" = "clang"; then
+ GNU_CC=1
+ GNU_CXX=1
+ CLANG_CC=1
+ CLANG_CXX=1
+fi
+if test "$compiler" = "clang-cl"; then
+ CLANG_CL=1
+ # We force clang-cl to emulate Visual C++ 2013 in configure.in, but that
+ # is based on the CLANG_CL variable defined here, so make sure that we're
+ # getting the right version here manually.
+ CC_VERSION=1800
+ CXX_VERSION=1800
+ MSVC_VERSION_FULL=180030723
+ # Build on clang-cl with MSVC 2013 Update 3 with fallback emulation.
+ CFLAGS="$CFLAGS -fms-compatibility-version=18.00.30723 -fallback"
+ CXXFLAGS="$CXXFLAGS -fms-compatibility-version=18.00.30723 -fallback"
+fi
+
if test "$GNU_CC"; then
if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
GCC_USE_GNU_LD=1
fi
fi
-INTEL_CC=
-INTEL_CXX=
-if test "$GCC" = yes; then
- if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CC=1
- fi
+AC_SUBST(CLANG_CXX)
+AC_SUBST(CLANG_CL)
+
+if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
+ if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 7 ||
+ test "$GCC_MAJOR_VERSION" -lt 4; then
+ AC_MSG_ERROR([Only GCC 4.7 or newer supported])
+ fi
fi
+])
+
+AC_DEFUN([MOZ_CROSS_COMPILER],
+[
+echo "cross compiling from $host to $target"
+
+_SAVE_CC="$CC"
+_SAVE_CFLAGS="$CFLAGS"
+_SAVE_LDFLAGS="$LDFLAGS"
-if test "$GXX" = yes; then
- if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CXX=1
- fi
+AC_MSG_CHECKING([for host c compiler])
+AC_CHECK_PROGS(HOST_CC, cc gcc clang cl, "")
+if test -z "$HOST_CC"; then
+ AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
fi
+AC_MSG_RESULT([$HOST_CC])
+AC_MSG_CHECKING([for host c++ compiler])
+AC_CHECK_PROGS(HOST_CXX, c++ g++ clang++ cl, "")
+if test -z "$HOST_CXX"; then
+ AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
+fi
+AC_MSG_RESULT([$HOST_CXX])
-CLANG_CC=
-CLANG_CXX=
-if test "`$CC -v 2>&1 | egrep -c '(clang version|Apple.*clang)'`" != "0"; then
- CLANG_CC=1
+if test -z "$HOST_CFLAGS"; then
+ HOST_CFLAGS="$CFLAGS"
+fi
+if test -z "$HOST_CXXFLAGS"; then
+ HOST_CXXFLAGS="$CXXFLAGS"
+fi
+if test -z "$HOST_LDFLAGS"; then
+ HOST_LDFLAGS="$LDFLAGS"
+fi
+if test -z "$HOST_AR_FLAGS"; then
+ HOST_AR_FLAGS="$AR_FLAGS"
+fi
+AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
+AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
+CC="$HOST_CC"
+CFLAGS="$HOST_CFLAGS"
+LDFLAGS="$HOST_LDFLAGS"
+
+AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
+AC_TRY_COMPILE([], [return(0);],
+ [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
+ AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
+
+CC="$HOST_CXX"
+CFLAGS="$HOST_CXXFLAGS"
+AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
+AC_TRY_COMPILE([], [return(0);],
+ [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
+ AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
+
+CC=$_SAVE_CC
+CFLAGS=$_SAVE_CFLAGS
+LDFLAGS=$_SAVE_LDFLAGS
+
+AC_CHECK_PROGS(CC, "${target_alias}-gcc" "${target}-gcc", :)
+unset ac_cv_prog_CC
+AC_PROG_CC
+AC_CHECK_PROGS(CXX, "${target_alias}-g++" "${target}-g++", :)
+unset ac_cv_prog_CXX
+AC_PROG_CXX
+
+AC_CHECK_PROGS(RANLIB, "${target_alias}-ranlib" "${target}-ranlib", :)
+AC_CHECK_PROGS(AR, "${target_alias}-ar" "${target}-ar", :)
+AC_CHECK_PROGS(AS, "${target_alias}-as" "${target}-as", :)
+AC_CHECK_PROGS(LD, "${target_alias}-ld" "${target}-ld", :)
+AC_CHECK_PROGS(STRIP, "${target_alias}-strip" "${target}-strip", :)
+AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", :)
+AC_CHECK_PROGS(OTOOL, "${target_alias}-otool" "${target}-otool", :)
+AC_DEFINE(CROSS_COMPILE)
+CROSS_COMPILE=1
+
+dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
+dnl dnl have erroneously been set to "no", because the x86 build host is
+dnl dnl able to run ppc code in a translated environment, making a cross
+dnl dnl compiler appear native. So we override that here.
+cross_compiling=yes
+])
+
+AC_DEFUN([MOZ_CXX11],
+[
+dnl Check whether gcc's c++0x mode works
+dnl Updates to the test below should be duplicated further below for the
+dnl cross-compiling case.
+AC_LANG_CPLUSPLUS
+if test "$GNU_CXX"; then
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+ _ADDED_CXXFLAGS="-std=gnu++0x"
+
+ AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
+ ac_cv_cxx0x_headers_bug,
+ [AC_TRY_COMPILE([#include <memory>], [],
+ ac_cv_cxx0x_headers_bug="no",
+ ac_cv_cxx0x_headers_bug="yes")])
+
+ if test "$CLANG_CXX" -a "$ac_cv_cxx0x_headers_bug" = "yes"; then
+ CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
+ _ADDED_CXXFLAGS="$_ADDED_CXXFLAGS -I$_topsrcdir/build/unix/headers"
+ AC_CACHE_CHECK(whether workaround for gcc c++0x headers conflict with clang works,
+ ac_cv_cxx0x_clang_workaround,
+ [AC_TRY_COMPILE([#include <memory>], [],
+ ac_cv_cxx0x_clang_workaround="yes",
+ ac_cv_cxx0x_clang_workaround="no")])
+
+ if test "ac_cv_cxx0x_clang_workaround" = "no"; then
+ AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
+ fi
+ elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
+ AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
+ fi
fi
+if test -n "$CROSS_COMPILE"; then
+ dnl When cross compile, we have no variable telling us what the host compiler is. Figure it out.
+ cat > conftest.C <<EOF
+#if defined(__clang__)
+CLANG
+#elif defined(__GNUC__)
+GCC
+#endif
+EOF
+ host_compiler=`$HOST_CXX -E conftest.C | egrep '(CLANG|GCC)'`
+ rm conftest.C
+ if test -n "$host_compiler"; then
+ HOST_CXXFLAGS="$HOST_CXXFLAGS -std=gnu++0x"
+
+ _SAVE_CXXFLAGS="$CXXFLAGS"
+ _SAVE_CPPFLAGS="$CPPFLAGS"
+ _SAVE_CXX="$CXX"
+ CXXFLAGS="$HOST_CXXFLAGS"
+ CPPFLAGS="$HOST_CPPFLAGS"
+ CXX="$HOST_CXX"
+ AC_CACHE_CHECK(for host gcc c++0x headers bug without rtti,
+ ac_cv_host_cxx0x_headers_bug,
+ [AC_TRY_COMPILE([#include <memory>], [],
+ ac_cv_host_cxx0x_headers_bug="no",
+ ac_cv_host_cxx0x_headers_bug="yes")])
-if test "`$CXX -v 2>&1 | egrep -c '(clang version|Apple.*clang)'`" != "0"; then
- CLANG_CXX=1
+ if test "$host_compiler" = CLANG -a "$ac_cv_host_cxx0x_headers_bug" = "yes"; then
+ CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
+ AC_CACHE_CHECK(whether workaround for host gcc c++0x headers conflict with host clang works,
+ ac_cv_host_cxx0x_clang_workaround,
+ [AC_TRY_COMPILE([#include <memory>], [],
+ ac_cv_host_cxx0x_clang_workaround="yes",
+ ac_cv_host_cxx0x_clang_workaround="no")])
+
+ if test "ac_cv_host_cxx0x_clang_workaround" = "no"; then
+ AC_MSG_ERROR([Your host toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
+ fi
+ HOST_CXXFLAGS="$CXXFLAGS"
+ elif test "$ac_cv_host_cxx0x_headers_bug" = "yes"; then
+ AC_MSG_ERROR([Your host toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
+ fi
+ CXXFLAGS="$_SAVE_CXXFLAGS"
+ CPPFLAGS="$_SAVE_CPPFLAGS"
+ CXX="$_SAVE_CXX"
+ fi
+elif test "$GNU_CXX"; then
+ HOST_CXXFLAGS="$HOST_CXXFLAGS $_ADDED_CXXFLAGS"
fi
-AC_SUBST(CLANG_CXX)
+AC_LANG_C
])
diff --git a/build/autoconf/winsdk.m4 b/build/autoconf/winsdk.m4
index f2d01d14a..fb512da0f 100644
--- a/build/autoconf/winsdk.m4
+++ b/build/autoconf/winsdk.m4
@@ -6,32 +6,17 @@ dnl Identify which version of the SDK we're building with
dnl Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
dnl from there
AC_DEFUN([MOZ_FIND_WINSDK_VERSION], [
- MOZ_CHECK_HEADERS([winsdkver.h])
- if test "$ac_cv_header_winsdkver_h" = "yes"; then
- dnl Get the highest _WIN32_WINNT and NTDDI versions supported
- dnl Take the higher of the two
- dnl This is done because the Windows 7 beta SDK reports its
- dnl NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
- AC_CACHE_CHECK(for highest Windows version supported by this SDK,
- ac_cv_winsdk_maxver,
- [cat > conftest.h <<EOF
+ AC_CACHE_CHECK(for highest Windows version supported by this SDK,
+ ac_cv_winsdk_maxver,
+ [cat > conftest.h <<EOF
#include <winsdkver.h>
-#include <sdkddkver.h>
-#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
-#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
-#else
-#define WINSDK_MAXVER NTDDI_MAXVER
-#endif
-
-WINSDK_MAXVER
+WINVER_MAXVER
EOF
ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
rm -f conftest.h
])
- MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
- else
- dnl Any SDK which doesn't have WinSDKVer.h is too old.
- AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
- fi
+ dnl WinSDKVer.h returns the version number in 4-digit format while many
+ dnl consumers expect 8. Therefore, pad the result with an extra 4 zeroes.
+ MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}0000
])
diff --git a/build/autoconf/wrapper.m4 b/build/autoconf/wrapper.m4
index 179db068a..50f3ce283 100644
--- a/build/autoconf/wrapper.m4
+++ b/build/autoconf/wrapper.m4
@@ -12,10 +12,63 @@ MOZ_ARG_WITH_STRING(compiler_wrapper,
Enable compiling with wrappers such as distcc and ccache],
COMPILER_WRAPPER=$withval, COMPILER_WRAPPER="no")
+MOZ_ARG_WITH_STRING(ccache,
+[ --with-ccache[=path/to/ccache]
+ Enable compiling with ccache],
+ CCACHE=$withval, CCACHE="no")
+
+if test "$CCACHE" != "no"; then
+ if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
+ CCACHE=
+ else
+ if test ! -e "$CCACHE"; then
+ AC_MSG_ERROR([$CCACHE not found])
+ fi
+ fi
+ MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
+ if test -z "$CCACHE" -o "$CCACHE" = ":"; then
+ AC_MSG_ERROR([ccache not found])
+ elif test -x "$CCACHE"; then
+ if test "$COMPILER_WRAPPER" != "no"; then
+ COMPILER_WRAPPER="$CCACHE $COMPILER_WRAPPER"
+ else
+ COMPILER_WRAPPER="$CCACHE"
+ fi
+ MOZ_USING_CCACHE=1
+ else
+ AC_MSG_ERROR([$CCACHE is not executable])
+ fi
+fi
+
+AC_SUBST(MOZ_USING_CCACHE)
+
if test "$COMPILER_WRAPPER" != "no"; then
- CC="$COMPILER_WRAPPER $CC"
- CXX="$COMPILER_WRAPPER $CXX"
- MOZ_USING_COMPILER_WRAPPER=1
+ case "$target" in
+ *-mingw*)
+ dnl When giving a windows path with backslashes, js/src/configure
+ dnl fails because of double wrapping because the test further below
+ dnl doesn't work with backslashes. While fixing that test to work
+ dnl might seem better, a lot of the make build backend actually
+ dnl doesn't like backslashes, so normalize windows paths to use
+ dnl forward slashes.
+ COMPILER_WRAPPER=`echo "$COMPILER_WRAPPER" | tr '\\' '/'`
+ ;;
+ esac
+
+ case "$CC" in
+ $COMPILER_WRAPPER\ *)
+ :
+ ;;
+ *)
+ CC="$COMPILER_WRAPPER $CC"
+ CXX="$COMPILER_WRAPPER $CXX"
+ _SUBDIR_CC="$CC"
+ _SUBDIR_CXX="$CXX"
+ ac_cv_prog_CC="$CC"
+ ac_cv_prog_CXX="$CXX"
+ MOZ_USING_COMPILER_WRAPPER=1
+ ;;
+ esac
fi
AC_SUBST(MOZ_USING_COMPILER_WRAPPER)
diff --git a/build/autoconf/zlib.m4 b/build/autoconf/zlib.m4
index 59c0b758f..933a11054 100644
--- a/build/autoconf/zlib.m4
+++ b/build/autoconf/zlib.m4
@@ -48,7 +48,7 @@ if test -z "$MOZ_ZLIB_LIBS$MOZ_ZLIB_CFLAGS$SKIP_LIBRARY_CHECKS"; then
fi
AC_SUBST(MOZ_ZLIB_CFLAGS)
-AC_SUBST(MOZ_ZLIB_LIBS)
+AC_SUBST_LIST(MOZ_ZLIB_LIBS)
AC_SUBST(MOZ_NATIVE_ZLIB)
])
diff --git a/build/automation-build.mk b/build/automation-build.mk
index 9a04c3c87..dd9260b17 100644
--- a/build/automation-build.mk
+++ b/build/automation-build.mk
@@ -4,20 +4,20 @@
include $(MOZILLA_DIR)/build/binary-location.mk
-browser_path := \"$(browser_path)\"
+browser_path := '"$(browser_path)"'
_PROFILE_DIR = $(TARGET_DEPTH)/_profile/pgo
-ABSOLUTE_TOPSRCDIR = $(call core_abspath,$(MOZILLA_DIR))
+ABSOLUTE_TOPSRCDIR = $(abspath $(MOZILLA_DIR))
_CERTS_SRC_DIR = $(ABSOLUTE_TOPSRCDIR)/build/pgo/certs
AUTOMATION_PPARGS = \
-DBROWSER_PATH=$(browser_path) \
- -DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
- -DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
- -DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
- -DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
- -DPERL="\"$(PERL)\"" \
+ -DXPC_BIN_PATH='"$(LIBXUL_DIST)/bin"' \
+ -DBIN_SUFFIX='"$(BIN_SUFFIX)"' \
+ -DPROFILE_DIR='"$(_PROFILE_DIR)"' \
+ -DCERTS_SRC_DIR='"$(_CERTS_SRC_DIR)"' \
+ -DPERL='"$(PERL)"' \
$(NULL)
ifeq ($(OS_ARCH),Darwin)
@@ -32,12 +32,6 @@ else
AUTOMATION_PPARGS += -DIS_LINUX=0
endif
-ifeq ($(MOZ_BUILD_APP),camino)
-AUTOMATION_PPARGS += -DIS_CAMINO=1
-else
-AUTOMATION_PPARGS += -DIS_CAMINO=0
-endif
-
ifeq ($(host_os), cygwin)
AUTOMATION_PPARGS += -DIS_CYGWIN=1
endif
@@ -61,7 +55,7 @@ AUTOMATION_PPARGS += -DIS_ASAN=0
endif
automation.py: $(MOZILLA_DIR)/build/automation.py.in $(MOZILLA_DIR)/build/automation-build.mk
- $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
- $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< -o $@)
GARBAGE += automation.py automation.pyc
diff --git a/build/automation.py.in b/build/automation.py.in
index 987f8e1a8..1618c3b6e 100644
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -5,8 +5,8 @@
from __future__ import with_statement
import codecs
-from datetime import datetime, timedelta
import itertools
+import json
import logging
import os
import re
@@ -18,6 +18,8 @@ import sys
import threading
import tempfile
import sqlite3
+import zipfile
+from datetime import datetime, timedelta
from string import Template
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
@@ -26,19 +28,24 @@ import automationutils
# --------------------------------------------------------------
# TODO: this is a hack for mozbase without virtualenv, remove with bug 849900
-#
-here = os.path.dirname(__file__)
+# These paths refer to relative locations to test.zip, not the OBJDIR or SRCDIR
+here = os.path.dirname(os.path.realpath(__file__))
mozbase = os.path.realpath(os.path.join(os.path.dirname(here), 'mozbase'))
if os.path.isdir(mozbase):
for package in os.listdir(mozbase):
- sys.path.append(os.path.join(mozbase, package))
+ package_path = os.path.join(mozbase, package)
+ if package_path not in sys.path:
+ sys.path.append(package_path)
import mozcrash
+from mozprofile import Profile, Preferences
+from mozprofile.permissions import ServerLocations
# ---------------------------------------------------------------
_DEFAULT_PREFERENCE_FILE = os.path.join(SCRIPT_DIR, 'prefs_general.js')
+_DEFAULT_APPS_FILE = os.path.join(SCRIPT_DIR, 'webapps_mochitest.json')
_DEFAULT_WEB_SERVER = "127.0.0.1"
_DEFAULT_HTTP_PORT = 8888
@@ -60,9 +67,7 @@ _APP_STATUS_CERTIFIED = 3
#else
_IS_CYGWIN = False
#endif
-#expand _IS_CAMINO = __IS_CAMINO__ != 0
#expand _BIN_SUFFIX = __BIN_SUFFIX__
-#expand _PERL = __PERL__
#expand _DEFAULT_APP = "./" + __BROWSER_PATH__
#expand _CERTS_SRC_DIR = __CERTS_SRC_DIR__
@@ -134,9 +139,7 @@ class Automation(object):
IS_MAC = _IS_MAC
IS_LINUX = _IS_LINUX
IS_CYGWIN = _IS_CYGWIN
- IS_CAMINO = _IS_CAMINO
BIN_SUFFIX = _BIN_SUFFIX
- PERL = _PERL
UNIXISH = not IS_WIN32 and not IS_MAC
@@ -177,7 +180,6 @@ class Automation(object):
"log",
"runApp",
"Process",
- "addCommonOptions",
"initializeProfile",
"DIST_BIN",
"DEFAULT_APP",
@@ -209,8 +211,7 @@ class Automation(object):
universal_newlines=False,
startupinfo=None,
creationflags=0):
- args = automationutils.wrapCommand(args)
- print "args: %s" % args
+ _log.info("INFO | automation.py | Launching: %s", subprocess.list2cmdline(args))
subprocess.Popen.__init__(self, args, bufsize, executable,
stdin, stdout, stderr,
preexec_fn, close_fds,
@@ -291,11 +292,14 @@ class Automation(object):
return locations
def setupPermissionsDatabase(self, profileDir, permissions):
+ # Included for reftest compatibility;
+ # see https://bugzilla.mozilla.org/show_bug.cgi?id=688667
+
# Open database and create table
permDB = sqlite3.connect(os.path.join(profileDir, "permissions.sqlite"))
cursor = permDB.cursor();
- cursor.execute("PRAGMA user_version=3");
+ cursor.execute("PRAGMA user_version=4");
# SQL copied from nsPermissionManager.cpp
cursor.execute("""CREATE TABLE IF NOT EXISTS moz_hosts (
@@ -305,345 +309,82 @@ class Automation(object):
permission INTEGER,
expireType INTEGER,
expireTime INTEGER,
+ modificationTime INTEGER,
appId INTEGER,
isInBrowserElement INTEGER)""")
# Insert desired permissions
for perm in permissions.keys():
for host,allow in permissions[perm]:
- cursor.execute("INSERT INTO moz_hosts values(NULL, ?, ?, ?, 0, 0, 0, 0)",
+ cursor.execute("INSERT INTO moz_hosts values(NULL, ?, ?, ?, 0, 0, 0, 0, 0)",
(host, perm, 1 if allow else 2))
# Commit and close
permDB.commit()
cursor.close()
- def setupTestApps(self, profileDir, apps):
- webappJSONTemplate = Template(""""$id": {
- "origin": "$origin",
- "installOrigin": "$origin",
- "receipt": null,
- "installTime": 132333986000,
- "manifestURL": "$manifestURL",
- "localId": $localId,
- "id": "$id",
- "appStatus": $appStatus,
- "csp": "$csp"
-}""")
-
- manifestTemplate = Template("""{
- "name": "$name",
- "csp": "$csp",
- "description": "$description",
- "launch_path": "/",
- "developer": {
- "name": "Mozilla",
- "url": "https://mozilla.org/"
- },
- "permissions": [
- ],
- "locales": {
- "en-US": {
- "name": "$name",
- "description": "$description"
- }
- },
- "default_locale": "en-US",
- "icons": {
- }
-}
-""")
-
- # Create webapps/webapps.json
- webappsDir = os.path.join(profileDir, "webapps")
- if not os.access(webappsDir, os.F_OK):
- os.mkdir(webappsDir)
-
- lineRe = re.compile(r'(.*?)"(.*?)": (.*)')
-
- webappsJSONFilename = os.path.join(webappsDir, "webapps.json")
- webappsJSON = []
- if os.access(webappsJSONFilename, os.F_OK):
- # If there is an existing webapps.json file (which will be the case for
- # b2g), we parse the data in the existing file before appending test
- # test apps to it.
- startId = 1
- webappsJSONFile = open(webappsJSONFilename, "r")
- contents = webappsJSONFile.read()
-
- for app_content in contents.split('},'):
- app = {}
- # ghetto json parser needed due to lack of json/simplejson on test slaves
- for line in app_content.split('\n'):
- m = lineRe.match(line)
- if m:
- value = m.groups()[2]
- # remove any trailing commas
- if value[-1:] == ',':
- value = value[:-1]
- # set the app name from a line that looks like this:
- # "name.gaiamobile.org": {
- if value == '{':
- app['id'] = m.groups()[1]
- # parse string, None, bool and int types
- elif value[0:1] == '"':
- app[m.groups()[1]] = value[1:-1]
- elif value == "null":
- app[m.groups()[1]] = None
- elif value == "true":
- app[m.groups()[1]] = True
- elif value == "false":
- app[m.groups()[1]] = False
- else:
- app[m.groups()[1]] = int(value)
- if app:
- webappsJSON.append(app)
-
- webappsJSONFile.close()
-
- startId = 1
- for app in webappsJSON:
- if app['localId'] >= startId:
- startId = app['localId'] + 1
- if not app.get('csp'):
- app['csp'] = ''
- if not app.get('appStatus'):
- app['appStatus'] = 3
-
- for localId, app in enumerate(apps):
- app['localId'] = localId + startId # localId must be from 1..N
- if not app.get('id'):
- app['id'] = app['name']
- webappsJSON.append(app)
-
- contents = []
- for app in webappsJSON:
- contents.append(webappJSONTemplate.substitute(app))
- contents = '{\n' + ',\n'.join(contents) + '\n}\n'
-
- webappsJSONFile = open(webappsJSONFilename, "w")
- webappsJSONFile.write(contents)
- webappsJSONFile.close()
-
- # Create manifest file for each app.
- for app in apps:
- manifest = manifestTemplate.substitute(app)
-
- manifestDir = os.path.join(webappsDir, app['name'])
- os.mkdir(manifestDir)
-
- manifestFile = open(os.path.join(manifestDir, "manifest.webapp"), "a")
- manifestFile.write(manifest)
- manifestFile.close()
-
def initializeProfile(self, profileDir,
extraPrefs=None,
useServerLocations=False,
- initialProfile=None,
- prefsPath=_DEFAULT_PREFERENCE_FILE):
+ prefsPath=_DEFAULT_PREFERENCE_FILE,
+ appsPath=_DEFAULT_APPS_FILE,
+ addons=None):
" Sets up the standard testing profile."
extraPrefs = extraPrefs or []
- prefs = []
- # Start with a clean slate.
- shutil.rmtree(profileDir, True)
-
- if initialProfile:
- shutil.copytree(initialProfile, profileDir)
- else:
- os.mkdir(profileDir)
-
- # Set up permissions database
- locations = self.readLocations()
- self.setupPermissionsDatabase(profileDir,
- {'allowXULXBL':[(l.host, 'noxul' not in l.options) for l in locations]});
-
- f = open(prefsPath, 'r')
- part = f.read() % {"server" : "%s:%s" % (self.webServer, self.httpPort)}
- f.close()
- prefs.append(part)
+ # create the profile
+ prefs = {}
+ locations = None
if useServerLocations:
- # We need to proxy every server but the primary one.
- origins = ["'%s://%s:%s'" % (l.scheme, l.host, l.port)
- for l in filter(lambda l: "primary" not in l.options, locations)]
- origins = ", ".join(origins)
-
- pacURL = """data:text/plain,
-function FindProxyForURL(url, host)
-{
- var origins = [%(origins)s];
- var regex = new RegExp('^([a-z][-a-z0-9+.]*)' +
- '://' +
- '(?:[^/@]*@)?' +
- '(.*?)' +
- '(?::(\\\\\\\\d+))?/');
- var matches = regex.exec(url);
- if (!matches)
- return 'DIRECT';
- var isHttp = matches[1] == 'http';
- var isHttps = matches[1] == 'https';
- var isWebSocket = matches[1] == 'ws';
- var isWebSocketSSL = matches[1] == 'wss';
- if (!matches[3])
- {
- if (isHttp | isWebSocket) matches[3] = '80';
- if (isHttps | isWebSocketSSL) matches[3] = '443';
- }
- if (isWebSocket)
- matches[1] = 'http';
- if (isWebSocketSSL)
- matches[1] = 'https';
-
- var origin = matches[1] + '://' + matches[2] + ':' + matches[3];
- if (origins.indexOf(origin) < 0)
- return 'DIRECT';
- if (isHttp)
- return 'PROXY %(remote)s:%(httpport)s';
- if (isHttps || isWebSocket || isWebSocketSSL)
- return 'PROXY %(remote)s:%(sslport)s';
- return 'DIRECT';
-}""" % { "origins": origins,
- "remote": self.webServer,
- "httpport":self.httpPort,
- "sslport": self.sslPort }
- pacURL = "".join(pacURL.splitlines())
-
- part = """
-user_pref("network.proxy.type", 2);
-user_pref("network.proxy.autoconfig_url", "%(pacURL)s");
-
-user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless to others
-""" % {"pacURL": pacURL}
+ locations = ServerLocations()
+ locations.read(os.path.abspath('server-locations.txt'), True)
else:
- part = 'user_pref("network.proxy.type", 0);\n'
- prefs.append(part)
+ prefs['network.proxy.type'] = 0
+
+ prefs.update(Preferences.read_prefs(prefsPath))
for v in extraPrefs:
thispref = v.split("=", 1)
if len(thispref) < 2:
print "Error: syntax error in --setpref=" + v
sys.exit(1)
- part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1])
- prefs.append(part)
-
- # write the preferences
- prefsFile = open(profileDir + "/" + "user.js", "a")
- prefsFile.write("".join(prefs))
- prefsFile.close()
-
- apps = [
- {
- 'name': 'http_example_org',
- 'csp': '',
- 'origin': 'http://example.org',
- 'manifestURL': 'http://example.org/manifest.webapp',
- 'description': 'http://example.org App',
- 'appStatus': _APP_STATUS_INSTALLED
- },
- {
- 'name': 'https_example_com',
- 'csp': '',
- 'origin': 'https://example.com',
- 'manifestURL': 'https://example.com/manifest.webapp',
- 'description': 'https://example.com App',
- 'appStatus': _APP_STATUS_INSTALLED
- },
- {
- 'name': 'http_test1_example_org',
- 'csp': '',
- 'origin': 'http://test1.example.org',
- 'manifestURL': 'http://test1.example.org/manifest.webapp',
- 'description': 'http://test1.example.org App',
- 'appStatus': _APP_STATUS_INSTALLED
- },
- {
- 'name': 'http_test1_example_org_8000',
- 'csp': '',
- 'origin': 'http://test1.example.org:8000',
- 'manifestURL': 'http://test1.example.org:8000/manifest.webapp',
- 'description': 'http://test1.example.org:8000 App',
- 'appStatus': _APP_STATUS_INSTALLED
- },
- {
- 'name': 'http_sub1_test1_example_org',
- 'csp': '',
- 'origin': 'http://sub1.test1.example.org',
- 'manifestURL': 'http://sub1.test1.example.org/manifest.webapp',
- 'description': 'http://sub1.test1.example.org App',
- 'appStatus': _APP_STATUS_INSTALLED
- },
- {
- 'name': 'https_example_com_privileged',
- 'csp': '',
- 'origin': 'https://example.com',
- 'manifestURL': 'https://example.com/manifest_priv.webapp',
- 'description': 'https://example.com Privileged App',
- 'appStatus': _APP_STATUS_PRIVILEGED
- },
- {
- 'name': 'https_example_com_certified',
- 'csp': '',
- 'origin': 'https://example.com',
- 'manifestURL': 'https://example.com/manifest_cert.webapp',
- 'description': 'https://example.com Certified App',
- 'appStatus': _APP_STATUS_CERTIFIED
- },
- {
- 'name': 'https_example_csp_certified',
- 'csp': "default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'",
- 'origin': 'https://example.com',
- 'manifestURL': 'https://example.com/manifest_csp_cert.webapp',
- 'description': 'https://example.com Certified App with manifest policy',
- 'appStatus': _APP_STATUS_CERTIFIED
- },
- {
- 'name': 'https_example_csp_installed',
- 'csp': "default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'",
- 'origin': 'https://example.com',
- 'manifestURL': 'https://example.com/manifest_csp_inst.webapp',
- 'description': 'https://example.com Installed App with manifest policy',
- 'appStatus': _APP_STATUS_INSTALLED
- },
- {
- 'name': 'https_example_csp_privileged',
- 'csp': "default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'",
- 'origin': 'https://example.com',
- 'manifestURL': 'https://example.com/manifest_csp_priv.webapp',
- 'description': 'https://example.com Privileged App with manifest policy',
- 'appStatus': _APP_STATUS_PRIVILEGED
- },
- {
- 'name': 'https_a_domain_certified',
- 'csp': "",
- 'origin': 'https://acertified.com',
- 'manifestURL': 'https://acertified.com/manifest.webapp',
- 'description': 'https://acertified.com Certified App',
- 'appStatus': _APP_STATUS_CERTIFIED
- },
- {
- 'name': 'https_a_domain_privileged',
- 'csp': "",
- 'origin': 'https://aprivileged.com',
- 'manifestURL': 'https://aprivileged.com/manifest.webapp',
- 'description': 'https://aprivileged.com Privileged App ',
- 'appStatus': _APP_STATUS_PRIVILEGED
- },
- ];
- self.setupTestApps(profileDir, apps)
-
- def addCommonOptions(self, parser):
- "Adds command-line options which are common to mochitest and reftest."
-
- parser.add_option("--setpref",
- action = "append", type = "string",
- default = [],
- dest = "extraPrefs", metavar = "PREF=VALUE",
- help = "defines an extra user preference")
+ prefs[thispref[0]] = thispref[1]
+
+
+ interpolation = {"server": "%s:%s" % (self.webServer, self.httpPort)}
+ prefs = json.loads(json.dumps(prefs) % interpolation)
+ for pref in prefs:
+ prefs[pref] = Preferences.cast(prefs[pref])
+
+ # load apps
+ apps = None
+ if appsPath and os.path.exists(appsPath):
+ with open(appsPath, 'r') as apps_file:
+ apps = json.load(apps_file)
+
+ proxy = {'remote': str(self.webServer),
+ 'http': str(self.httpPort),
+ 'https': str(self.sslPort),
+ # use SSL port for legacy compatibility; see
+ # - https://bugzilla.mozilla.org/show_bug.cgi?id=688667#c66
+ # - https://bugzilla.mozilla.org/show_bug.cgi?id=899221
+ # 'ws': str(self.webSocketPort)
+ 'ws': str(self.sslPort)
+ }
+
+ # return profile object
+ profile = Profile(profile=profileDir,
+ addons=addons,
+ locations=locations,
+ preferences=prefs,
+ restore=False,
+ apps=apps,
+ proxy=proxy)
+ return profile
def fillCertificateDB(self, profileDir, certPath, utilityPath, xrePath):
pwfilePath = os.path.join(profileDir, ".crtdbpw")
-
pwfile = open(pwfilePath, "w")
pwfile.write("\n")
pwfile.close()
@@ -693,6 +434,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
pk12util = os.path.join(utilityPath, "pk12util" + self.BIN_SUFFIX)
status = self.Process([certutil, "-N", "-d", profileDir, "-f", pwfilePath], env = env).wait()
+ automationutils.printstatus(status, "certutil")
if status != 0:
return status
@@ -704,61 +446,84 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
trustBits = "CT,,"
if root.endswith("-object"):
trustBits = "CT,,CT"
- self.Process([certutil, "-A", "-i", os.path.join(certPath, item),
+ status = self.Process([certutil, "-A", "-i", os.path.join(certPath, item),
"-d", profileDir, "-f", pwfilePath, "-n", root, "-t", trustBits],
env = env).wait()
+ automationutils.printstatus(status, "certutil")
if ext == ".client":
- self.Process([pk12util, "-i", os.path.join(certPath, item), "-w",
+ status = self.Process([pk12util, "-i", os.path.join(certPath, item), "-w",
pwfilePath, "-d", profileDir],
env = env).wait()
+ automationutils.printstatus(status, "pk12util")
os.unlink(pwfilePath)
return 0
- def environment(self, env = None, xrePath = None):
+ def environment(self, env=None, xrePath=None, debugger=False, dmdPath=None, lsanPath=None):
if xrePath == None:
xrePath = self.DIST_BIN
if env == None:
env = dict(os.environ)
ldLibraryPath = os.path.abspath(os.path.join(SCRIPT_DIR, xrePath))
+ dmdLibrary = None
+ preloadEnvVar = None
if self.UNIXISH or self.IS_MAC:
envVar = "LD_LIBRARY_PATH"
+ preloadEnvVar = "LD_PRELOAD"
if self.IS_MAC:
envVar = "DYLD_LIBRARY_PATH"
+ dmdLibrary = "libdmd.dylib"
else: # unixish
env['MOZILLA_FIVE_HOME'] = xrePath
+ dmdLibrary = "libdmd.so"
if envVar in env:
ldLibraryPath = ldLibraryPath + ":" + env[envVar]
env[envVar] = ldLibraryPath
elif self.IS_WIN32:
- env["PATH"] = env["PATH"] + ";" + ldLibraryPath
+ env["PATH"] = env["PATH"] + ";" + str(ldLibraryPath)
+ dmdLibrary = "dmd.dll"
+ preloadEnvVar = "MOZ_REPLACE_MALLOC_LIB"
+
+ if dmdPath and dmdLibrary and preloadEnvVar:
+ env[preloadEnvVar] = os.path.join(dmdPath, dmdLibrary)
+
+ # Crash on non-local network connections by default.
+ # MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily
+ # enable non-local connections for the purposes of local testing. Don't
+ # override the user's choice here. See bug 1049688.
+ env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1')
env['GNOME_DISABLE_CRASH_DIALOG'] = '1'
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
- env['NS_TRACE_MALLOC_DISABLE_STACKS'] = '1'
-
- # Additional temporary logging while we try to debug some intermittent
- # WebRTC conditions. This is necessary to troubleshoot bugs 841496,
- # 841150, and 839677 (at least)
- # Also (temporary) bug 870002 (mediastreamgraph)
- if 'NSPR_LOG_MODULES' not in env:
- env['NSPR_LOG_MODULES'] = 'signaling:5,mtransport:3'
- env['R_LOG_LEVEL'] = '5'
- env['R_LOG_DESTINATION'] = 'stderr'
- env['R_LOG_VERBOSE'] = '1'
+
+ # Set WebRTC logging in case it is not set yet
+ env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5')
+ env.setdefault('R_LOG_LEVEL', '6')
+ env.setdefault('R_LOG_DESTINATION', 'stderr')
+ env.setdefault('R_LOG_VERBOSE', '1')
# ASan specific environment stuff
if self.IS_ASAN and (self.IS_LINUX or self.IS_MAC):
+ # Symbolizer support
+ llvmsym = os.path.join(xrePath, "llvm-symbolizer")
+ if os.path.isfile(llvmsym):
+ env["ASAN_SYMBOLIZER_PATH"] = llvmsym
+ self.log.info("INFO | automation.py | ASan using symbolizer at %s", llvmsym)
+ else:
+ self.log.info("TEST-UNEXPECTED-FAIL | automation.py | Failed to find ASan symbolizer at %s", llvmsym)
+
try:
totalMemory = int(os.popen("free").readlines()[1].split()[1])
- # Only 2 GB RAM or less available? Use custom ASan options to reduce
+ # Only 4 GB RAM or less available? Use custom ASan options to reduce
# the amount of resources required to do the tests. Standard options
# will otherwise lead to OOM conditions on the current test slaves.
- if totalMemory <= 1024 * 1024 * 2:
+ if totalMemory <= 1024 * 1024 * 4:
self.log.info("INFO | automation.py | ASan running in low-memory configuration")
- env["ASAN_OPTIONS"] = "quarantine_size=50331648:redzone=64"
+ env["ASAN_OPTIONS"] = "quarantine_size=50331648:malloc_context_size=5"
+ else:
+ self.log.info("INFO | automation.py | ASan running in default memory configuration")
except OSError,err:
self.log.info("Failed determine available memory, disabling ASan low-memory configuration: %s", err.strerror)
except:
@@ -766,36 +531,50 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
return env
+ def killPid(self, pid):
+ try:
+ os.kill(pid, getattr(signal, "SIGKILL", signal.SIGTERM))
+ except WindowsError:
+ self.log.info("Failed to kill process %d." % pid)
+
if IS_WIN32:
PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
GetLastError = ctypes.windll.kernel32.GetLastError
def readWithTimeout(self, f, timeout):
- """Try to read a line of output from the file object |f|.
- |f| must be a pipe, like the |stdout| member of a subprocess.Popen
- object created with stdout=PIPE. If no output
- is received within |timeout| seconds, return a blank line.
- Returns a tuple (line, did_timeout), where |did_timeout| is True
- if the read timed out, and False otherwise."""
+ """
+ Try to read a line of output from the file object |f|. |f| must be a
+ pipe, like the |stdout| member of a subprocess.Popen object created
+ with stdout=PIPE. Returns a tuple (line, did_timeout), where |did_timeout|
+ is True if the read timed out, and False otherwise. If no output is
+ received within |timeout| seconds, returns a blank line.
+ """
+
if timeout is None:
- # shortcut to allow callers to pass in "None" for no timeout.
- return (f.readline(), False)
+ timeout = 0
+
x = msvcrt.get_osfhandle(f.fileno())
l = ctypes.c_long()
done = time.time() + timeout
- while time.time() < done:
+
+ buffer = ""
+ while timeout == 0 or time.time() < done:
if self.PeekNamedPipe(x, None, 0, None, ctypes.byref(l), None) == 0:
err = self.GetLastError()
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
return ('', False)
else:
self.log.error("readWithTimeout got error: %d", err)
- if l.value > 0:
- # we're assuming that the output is line-buffered,
- # which is not unreasonable
- return (f.readline(), False)
+ # read a character at a time, checking for eol. Return once we get there.
+ index = 0
+ while index < l.value:
+ char = f.read(1)
+ buffer += char
+ if char == '\n':
+ return (buffer, False)
+ index = index + 1
time.sleep(0.01)
- return ('', True)
+ return (buffer, True)
def isPidAlive(self, pid):
STILL_ACTIVE = 259
@@ -808,14 +587,6 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
ctypes.windll.kernel32.CloseHandle(pHandle)
return pExitCode.value == STILL_ACTIVE
- def killPid(self, pid):
- PROCESS_TERMINATE = 0x0001
- pHandle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
- if not pHandle:
- return
- ctypes.windll.kernel32.TerminateProcess(pHandle, 1)
- ctypes.windll.kernel32.CloseHandle(pHandle)
-
else:
def readWithTimeout(self, f, timeout):
@@ -845,59 +616,14 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
return False
raise
- def killPid(self, pid):
- os.kill(pid, signal.SIGKILL)
-
def dumpScreen(self, utilityPath):
if self.haveDumpedScreen:
self.log.info("Not taking screenshot here: see the one that was previously logged")
return
self.haveDumpedScreen = True;
+ automationutils.dumpScreen(utilityPath)
- # Need to figure out what tool and whether it write to a file or stdout
- if self.UNIXISH:
- utility = [os.path.join(utilityPath, "screentopng")]
- imgoutput = 'stdout'
- elif self.IS_MAC:
- utility = ['/usr/sbin/screencapture', '-C', '-x', '-t', 'png']
- imgoutput = 'file'
- elif self.IS_WIN32:
- utility = [os.path.join(utilityPath, "screenshot.exe")]
- imgoutput = 'file'
-
- # Run the capture correctly for the type of capture
- try:
- if imgoutput == 'file':
- tmpfd, imgfilename = tempfile.mkstemp(prefix='mozilla-test-fail_')
- os.close(tmpfd)
- dumper = self.Process(utility + [imgfilename])
- elif imgoutput == 'stdout':
- dumper = self.Process(utility, bufsize=-1,
- stdout=subprocess.PIPE, close_fds=True)
- except OSError, err:
- self.log.info("Failed to start %s for screenshot: %s",
- utility[0], err.strerror)
- return
-
- # Check whether the capture utility ran successfully
- dumper_out, dumper_err = dumper.communicate()
- if dumper.returncode != 0:
- self.log.info("%s exited with code %d", utility, dumper.returncode)
- return
-
- try:
- if imgoutput == 'stdout':
- image = dumper_out
- elif imgoutput == 'file':
- with open(imgfilename, 'rb') as imgfile:
- image = imgfile.read()
- except IOError, err:
- self.log.info("Failed to read image from %s", imgoutput)
-
- import base64
- encoded = base64.b64encode(image)
- self.log.info("SCREENSHOT: data:image/png;base64,%s", encoded)
def killAndGetStack(self, processPID, utilityPath, debuggerInfo):
"""Kill the process, preferrably in a way that gets us a stack trace.
@@ -912,7 +638,6 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath):
""" Look for timeout or crashes and return the status after the process terminates """
- stackFixerProcess = None
stackFixerFunction = None
didTimeout = False
hitMaxTime = False
@@ -928,19 +653,24 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
import fix_stack_using_bpsyms as stackFixerModule
stackFixerFunction = lambda line: stackFixerModule.fixSymbols(line, symbolsPath)
del sys.path[0]
- elif self.IS_DEBUG_BUILD and self.IS_MAC and False:
+ elif self.IS_DEBUG_BUILD and self.IS_MAC:
# Run each line through a function in fix_macosx_stack.py (uses atos)
sys.path.insert(0, utilityPath)
import fix_macosx_stack as stackFixerModule
stackFixerFunction = lambda line: stackFixerModule.fixSymbols(line)
del sys.path[0]
elif self.IS_DEBUG_BUILD and self.IS_LINUX:
- # Run logsource through fix-linux-stack.pl (uses addr2line)
+ # Run each line through a function in fix_linux_stack.py (uses addr2line)
# This method is preferred for developer machines, so we don't have to run "make buildsymbols".
- stackFixerProcess = self.Process([self.PERL, os.path.join(utilityPath, "fix-linux-stack.pl")],
- stdin=logsource,
- stdout=subprocess.PIPE)
- logsource = stackFixerProcess.stdout
+ sys.path.insert(0, utilityPath)
+ import fix_linux_stack as stackFixerModule
+ stackFixerFunction = lambda line: stackFixerModule.fixSymbols(line)
+ del sys.path[0]
+
+ # With metro browser runs this script launches the metro test harness which launches the browser.
+ # The metro test harness hands back the real browser process id via log output which we need to
+ # pick up on and parse out. This variable tracks the real browser process id if we find it.
+ browserProcessId = -1
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
while line != "" and not didTimeout:
@@ -953,31 +683,39 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
self.dumpScreen(utilityPath)
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
+
+ if "METRO_BROWSER_PROCESS" in line:
+ index = line.find("=")
+ if index:
+ browserProcessId = line[index+1:].rstrip()
+ self.log.info("INFO | automation.py | metro browser sub process id detected: %s", browserProcessId)
+
if not hitMaxTime and maxTime and datetime.now() - startTime > timedelta(seconds = maxTime):
- # Kill the application, but continue reading from stack fixer so as not to deadlock on stackFixerProcess.wait().
+ # Kill the application.
hitMaxTime = True
self.log.info("TEST-UNEXPECTED-FAIL | %s | application ran for longer than allowed maximum time of %d seconds", self.lastTestSeen, int(maxTime))
self.killAndGetStack(proc.pid, utilityPath, debuggerInfo)
if didTimeout:
+ if line:
+ self.log.info(line.rstrip().decode("UTF-8", "ignore"))
self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed out after %d seconds with no output", self.lastTestSeen, int(timeout))
- self.killAndGetStack(proc.pid, utilityPath, debuggerInfo)
+ if browserProcessId == -1:
+ browserProcessId = proc.pid
+ self.killAndGetStack(browserProcessId, utilityPath, debuggerInfo)
status = proc.wait()
+ automationutils.printstatus(status, "Main app process")
if status == 0:
self.lastTestSeen = "Main app process exited normally"
if status != 0 and not didTimeout and not hitMaxTime:
self.log.info("TEST-UNEXPECTED-FAIL | %s | Exited with code %d during test run", self.lastTestSeen, status)
- if stackFixerProcess is not None:
- fixerStatus = stackFixerProcess.wait()
- if fixerStatus != 0 and not didTimeout and not hitMaxTime:
- self.log.info("TEST-UNEXPECTED-FAIL | automation.py | Stack fixer process exited with code %d during test run", fixerStatus)
return status
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
""" build the application command line """
cmd = os.path.abspath(app)
- if self.IS_MAC and not self.IS_CAMINO and os.path.exists(cmd + "-bin"):
+ if self.IS_MAC and os.path.exists(cmd + "-bin"):
# Prefer 'app-bin' in case 'app' is a shell script.
# We can remove this hack once bug 673899 etc are fixed.
cmd += "-bin"
@@ -985,9 +723,9 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
args = []
if debuggerInfo:
- args.extend(debuggerInfo["args"])
+ args.extend(debuggerInfo.args)
args.append(cmd)
- cmd = os.path.abspath(debuggerInfo["path"])
+ cmd = os.path.abspath(debuggerInfo.path)
if self.IS_MAC:
args.append("-foreground")
@@ -999,10 +737,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
args.extend(("-no-remote", "-profile", profileDirectory))
if testURL is not None:
- if self.IS_CAMINO:
- args.extend(("-url", testURL))
- else:
- args.append((testURL))
+ args.append((testURL))
args.extend(extraArgs)
return cmd, args
@@ -1040,7 +775,8 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
runSSLTunnel = False, utilityPath = None,
xrePath = None, certPath = None,
debuggerInfo = None, symbolsPath = None,
- timeout = -1, maxTime = None, onLaunch = None):
+ timeout = -1, maxTime = None, onLaunch = None,
+ detectShutdownLeaks = False, screenshotOnFail=False, testPath=None, bisectChunk=None):
"""
Run the app, log the duration it took to execute, return the status code.
Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing for |timeout| seconds.
@@ -1079,7 +815,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
cmd, args = self.buildCommandLine(app, debuggerInfo, profileDir, testURL, extraArgs)
startTime = datetime.now()
- if debuggerInfo and debuggerInfo["interactive"]:
+ if debuggerInfo and debuggerInfo.interactive:
# If an interactive debugger is attached, don't redirect output,
# don't use timeouts, and don't capture ctrl-c.
timeout = None
@@ -1163,7 +899,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
os.makedirs(extensionsRootDir)
if os.path.isfile(extensionSource):
- reader = automationutils.ZipFileReader(extensionSource)
+ reader = zipfile.ZipFile(extensionSource, "r")
for filename in reader.namelist():
# Sanity check the zip file.
diff --git a/build/automationutils.py b/build/automationutils.py
index cd0368ac6..8879c6002 100644
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -4,197 +4,76 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import with_statement
-import glob, logging, os, platform, shutil, subprocess, sys, tempfile, urllib2, zipfile
+import logging
+from operator import itemgetter
+import os
+import platform
import re
-from urlparse import urlparse
+import signal
+import subprocess
+import sys
+import tempfile
+import mozinfo
__all__ = [
- "ZipFileReader",
- "addCommonOptions",
"dumpLeakLog",
- "isURL",
"processLeakLog",
- "getDebuggerInfo",
- "DEBUGGER_INFO",
- "replaceBackSlashes",
- "wrapCommand",
+ 'systemMemory',
+ 'environment',
+ 'dumpScreen',
+ "ShutdownLeaks",
+ "setAutomationLog",
]
-# Map of debugging programs to information about them, like default arguments
-# and whether or not they are interactive.
-DEBUGGER_INFO = {
- # gdb requires that you supply the '--args' flag in order to pass arguments
- # after the executable name to the executable.
- "gdb": {
- "interactive": True,
- "args": "-q --args"
- },
-
- "cgdb": {
- "interactive": True,
- "args": "-q --args"
- },
- "cgdb": {
- "interactive": True,
- "args": "-q --args"
- },
-
- "lldb": {
- "interactive": True,
- "args": "--"
- },
-
- # valgrind doesn't explain much about leaks unless you set the
- # '--leak-check=full' flag.
- "valgrind": {
- "interactive": False,
- "args": "--leak-check=full"
- }
-}
-
-class ZipFileReader(object):
- """
- Class to read zip files in Python 2.5 and later. Limited to only what we
- actually use.
- """
-
- def __init__(self, filename):
- self._zipfile = zipfile.ZipFile(filename, "r")
-
- def __del__(self):
- self._zipfile.close()
-
- def _getnormalizedpath(self, path):
- """
- Gets a normalized path from 'path' (or the current working directory if
- 'path' is None). Also asserts that the path exists.
- """
- if path is None:
- path = os.curdir
- path = os.path.normpath(os.path.expanduser(path))
- assert os.path.isdir(path)
- return path
-
- def _extractname(self, name, path):
- """
- Extracts a file with the given name from the zip file to the given path.
- Also creates any directories needed along the way.
- """
- filename = os.path.normpath(os.path.join(path, name))
- if name.endswith("/"):
- os.makedirs(filename)
- else:
- path = os.path.split(filename)[0]
- if not os.path.isdir(path):
- os.makedirs(path)
- with open(filename, "wb") as dest:
- dest.write(self._zipfile.read(name))
-
- def namelist(self):
- return self._zipfile.namelist()
-
- def read(self, name):
- return self._zipfile.read(name)
-
- def extract(self, name, path = None):
- if hasattr(self._zipfile, "extract"):
- return self._zipfile.extract(name, path)
-
- # This will throw if name is not part of the zip file.
- self._zipfile.getinfo(name)
-
- self._extractname(name, self._getnormalizedpath(path))
-
- def extractall(self, path = None):
- if hasattr(self._zipfile, "extractall"):
- return self._zipfile.extractall(path)
-
- path = self._getnormalizedpath(path)
-
- for name in self._zipfile.namelist():
- self._extractname(name, path)
-
log = logging.getLogger()
-
-def isURL(thing):
- """Return True if |thing| looks like a URL."""
- # We want to download URLs like http://... but not Windows paths like c:\...
- return len(urlparse(thing).scheme) >= 2
-
-def addCommonOptions(parser, defaults={}):
- parser.add_option("--xre-path",
- action = "store", type = "string", dest = "xrePath",
- # individual scripts will set a sane default
- default = None,
- help = "absolute path to directory containing XRE (probably xulrunner)")
- if 'SYMBOLS_PATH' not in defaults:
- defaults['SYMBOLS_PATH'] = None
- parser.add_option("--symbols-path",
- action = "store", type = "string", dest = "symbolsPath",
- default = defaults['SYMBOLS_PATH'],
- help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols")
- parser.add_option("--debugger",
- action = "store", dest = "debugger",
- help = "use the given debugger to launch the application")
- parser.add_option("--debugger-args",
- action = "store", dest = "debuggerArgs",
- help = "pass the given args to the debugger _before_ "
- "the application on the command line")
- parser.add_option("--debugger-interactive",
- action = "store_true", dest = "debuggerInteractive",
- help = "prevents the test harness from redirecting "
- "stdout and stderr for interactive debuggers")
-
-def getFullPath(directory, path):
- "Get an absolute path relative to 'directory'."
- return os.path.normpath(os.path.join(directory, os.path.expanduser(path)))
-
-def searchPath(directory, path):
- "Go one step beyond getFullPath and try the various folders in PATH"
- # Try looking in the current working directory first.
- newpath = getFullPath(directory, path)
- if os.path.isfile(newpath):
- return newpath
-
- # At this point we have to fail if a directory was given (to prevent cases
- # like './gdb' from matching '/usr/bin/./gdb').
- if not os.path.dirname(path):
- for dir in os.environ['PATH'].split(os.pathsep):
- newpath = os.path.join(dir, path)
- if os.path.isfile(newpath):
- return newpath
- return None
-
-def getDebuggerInfo(directory, debugger, debuggerArgs, debuggerInteractive = False):
-
- debuggerInfo = None
-
- if debugger:
- debuggerPath = searchPath(directory, debugger)
- if not debuggerPath:
- print "Error: Path %s doesn't exist." % debugger
- sys.exit(1)
-
- debuggerName = os.path.basename(debuggerPath).lower()
-
- def getDebuggerInfo(type, default):
- if debuggerName in DEBUGGER_INFO and type in DEBUGGER_INFO[debuggerName]:
- return DEBUGGER_INFO[debuggerName][type]
- return default
-
- debuggerInfo = {
- "path": debuggerPath,
- "interactive" : getDebuggerInfo("interactive", False),
- "args": getDebuggerInfo("args", "").split()
- }
-
- if debuggerArgs:
- debuggerInfo["args"] = debuggerArgs.split()
- if debuggerInteractive:
- debuggerInfo["interactive"] = debuggerInteractive
-
- return debuggerInfo
-
+def resetGlobalLog():
+ while log.handlers:
+ log.removeHandler(log.handlers[0])
+ handler = logging.StreamHandler(sys.stdout)
+ log.setLevel(logging.INFO)
+ log.addHandler(handler)
+resetGlobalLog()
+
+def setAutomationLog(alt_logger):
+ global log
+ log = alt_logger
+
+# Python does not provide strsignal() even in the very latest 3.x.
+# This is a reasonable fake.
+def strsig(n):
+ # Signal numbers run 0 through NSIG-1; an array with NSIG members
+ # has exactly that many slots
+ _sigtbl = [None]*signal.NSIG
+ for k in dir(signal):
+ if k.startswith("SIG") and not k.startswith("SIG_") and k != "SIGCLD" and k != "SIGPOLL":
+ _sigtbl[getattr(signal, k)] = k
+ # Realtime signals mostly have no names
+ if hasattr(signal, "SIGRTMIN") and hasattr(signal, "SIGRTMAX"):
+ for r in range(signal.SIGRTMIN+1, signal.SIGRTMAX+1):
+ _sigtbl[r] = "SIGRTMIN+" + str(r - signal.SIGRTMIN)
+ # Fill in any remaining gaps
+ for i in range(signal.NSIG):
+ if _sigtbl[i] is None:
+ _sigtbl[i] = "unrecognized signal, number " + str(i)
+ if n < 0 or n >= signal.NSIG:
+ return "out-of-range signal, number "+str(n)
+ return _sigtbl[n]
+
+def printstatus(status, name = ""):
+ # 'status' is the exit status
+ if os.name != 'posix':
+ # Windows error codes are easier to look up if printed in hexadecimal
+ if status < 0:
+ status += 2**32
+ print "TEST-INFO | %s: exit status %x\n" % (name, status)
+ elif os.WIFEXITED(status):
+ print "TEST-INFO | %s: exit %d\n" % (name, os.WEXITSTATUS(status))
+ elif os.WIFSIGNALED(status):
+ # The python stdlib doesn't appear to have strsignal(), alas
+ print "TEST-INFO | {}: killed by {}".format(name,strsig(os.WTERMSIG(status)))
+ else:
+ # This is probably a can't-happen condition on Unix, but let's be defensive
+ print "TEST-INFO | %s: undecodable exit status %04x\n" % (name, status)
def dumpLeakLog(leakLogFile, filter = False):
"""Process the leak log, without parsing it.
@@ -218,7 +97,7 @@ def dumpLeakLog(leakLogFile, filter = False):
# Simply copy the log.
log.info(leakReport.rstrip("\n"))
-def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
+def processSingleLeakFile(leakLogFileName, processType, leakThreshold, ignoreMissingLeaks):
"""Process a single leak log.
"""
@@ -229,15 +108,14 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
r"(?P<size>-?\d+)\s+(?P<bytesLeaked>-?\d+)\s+"
r"-?\d+\s+(?P<numLeaked>-?\d+)")
- processString = ""
- if processType:
- # eg 'plugin'
- processString = " %s process:" % processType
-
+ processString = "%s process:" % processType
crashedOnPurpose = False
totalBytesLeaked = None
+ logAsWarning = False
leakAnalysis = []
+ leakedObjectAnalysis = []
leakedObjectNames = []
+ recordLeakedObjects = False
with open(leakLogFileName, "r") as leaks:
for line in leaks:
if line.find("purposefully crash") > -1:
@@ -257,35 +135,62 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
log.info(line.rstrip())
# Analyse the leak log, but output later or it will interrupt the leak table
if name == "TOTAL":
- totalBytesLeaked = bytesLeaked
+ # Multiple default processes can end up writing their bloat views into a single
+ # log, particularly on B2G. Eventually, these should be split into multiple
+ # logs (bug 1068869), but for now, we report the largest leak.
+ if totalBytesLeaked != None:
+ leakAnalysis.append("WARNING | leakcheck | %s multiple BloatView byte totals found"
+ % processString)
+ else:
+ totalBytesLeaked = 0
+ if bytesLeaked > totalBytesLeaked:
+ totalBytesLeaked = bytesLeaked
+ # Throw out the information we had about the previous bloat view.
+ leakedObjectNames = []
+ leakedObjectAnalysis = []
+ recordLeakedObjects = True
+ else:
+ recordLeakedObjects = False
if size < 0 or bytesLeaked < 0 or numLeaked < 0:
- leakAnalysis.append("TEST-UNEXPECTED-FAIL | leakcheck |%s negative leaks caught!"
+ leakAnalysis.append("TEST-UNEXPECTED-FAIL | leakcheck | %s negative leaks caught!"
% processString)
+ logAsWarning = True
continue
- if name != "TOTAL" and numLeaked != 0:
+ if name != "TOTAL" and numLeaked != 0 and recordLeakedObjects:
leakedObjectNames.append(name)
- leakAnalysis.append("TEST-INFO | leakcheck |%s leaked %d %s (%s bytes)"
- % (processString, numLeaked, name, bytesLeaked))
- log.info('\n'.join(leakAnalysis))
+ leakedObjectAnalysis.append("TEST-INFO | leakcheck | %s leaked %d %s (%s bytes)"
+ % (processString, numLeaked, name, bytesLeaked))
+
+ leakAnalysis.extend(leakedObjectAnalysis)
+ if logAsWarning:
+ log.warning('\n'.join(leakAnalysis))
+ else:
+ log.info('\n'.join(leakAnalysis))
+
+ logAsWarning = False
if totalBytesLeaked is None:
# We didn't see a line with name 'TOTAL'
if crashedOnPurpose:
- log.info("TEST-INFO | leakcheck |%s deliberate crash and thus no leak log"
+ log.info("TEST-INFO | leakcheck | %s deliberate crash and thus no leak log"
+ % processString)
+ elif ignoreMissingLeaks:
+ log.info("TEST-INFO | leakcheck | %s ignoring missing output line for total leaks"
% processString)
else:
- # TODO: This should be a TEST-UNEXPECTED-FAIL, but was changed to a warning
- # due to too many intermittent failures (see bug 831223).
- log.info("WARNING | leakcheck |%s missing output line for total leaks!"
+ log.info("TEST-UNEXPECTED-FAIL | leakcheck | %s missing output line for total leaks!"
% processString)
+ log.info("TEST-INFO | leakcheck | missing output line from log file %s"
+ % leakLogFileName)
return
if totalBytesLeaked == 0:
- log.info("TEST-PASS | leakcheck |%s no leaks detected!" % processString)
+ log.info("TEST-PASS | leakcheck | %s no leaks detected!" % processString)
return
# totalBytesLeaked was seen and is non-zero.
if totalBytesLeaked > leakThreshold:
+ logAsWarning = True
# Fail the run if we're over the threshold (which defaults to 0)
prefix = "TEST-UNEXPECTED-FAIL"
else:
@@ -297,51 +202,440 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold):
leakedObjectSummary = ', '.join(leakedObjectNames[:maxSummaryObjects])
if len(leakedObjectNames) > maxSummaryObjects:
leakedObjectSummary += ', ...'
- log.info("%s | leakcheck |%s %d bytes leaked (%s)"
- % (prefix, processString, totalBytesLeaked, leakedObjectSummary))
-def processLeakLog(leakLogFile, leakThreshold = 0):
+ if logAsWarning:
+ log.warning("%s | leakcheck | %s %d bytes leaked (%s)"
+ % (prefix, processString, totalBytesLeaked, leakedObjectSummary))
+ else:
+ log.info("%s | leakcheck | %s %d bytes leaked (%s)"
+ % (prefix, processString, totalBytesLeaked, leakedObjectSummary))
+
+def processLeakLog(leakLogFile, options):
"""Process the leak log, including separate leak logs created
by child processes.
Use this function if you want an additional PASS/FAIL summary.
It must be used with the |XPCOM_MEM_BLOAT_LOG| environment variable.
+
+ The base of leakLogFile for a non-default process needs to end with
+ _proctype_pid12345.log
+ "proctype" is a string denoting the type of the process, which should
+ be the result of calling XRE_ChildProcessTypeToString(). 12345 is
+ a series of digits that is the pid for the process. The .log is
+ optional.
+
+ All other file names are treated as being for default processes.
+
+ The options argument is checked for two optional attributes,
+ leakThresholds and ignoreMissingLeaks.
+
+ leakThresholds should be a dict mapping process types to leak thresholds,
+ in bytes. If a process type is not present in the dict the threshold
+ will be 0.
+
+ ignoreMissingLeaks should be a list of process types. If a process
+ creates a leak log without a TOTAL, then we report an error if it isn't
+ in the list ignoreMissingLeaks.
"""
if not os.path.exists(leakLogFile):
log.info("WARNING | leakcheck | refcount logging is off, so leaks can't be detected!")
return
- if leakThreshold != 0:
- log.info("TEST-INFO | leakcheck | threshold set at %d bytes" % leakThreshold)
+ leakThresholds = getattr(options, 'leakThresholds', {})
+ ignoreMissingLeaks = getattr(options, 'ignoreMissingLeaks', [])
+
+ # This list is based on kGoannaProcessTypeString. ipdlunittest processes likely
+ # are not going to produce leak logs we will ever see.
+ knownProcessTypes = ["default", "plugin", "tab", "goannamediaplugin"]
+
+ for processType in knownProcessTypes:
+ log.info("TEST-INFO | leakcheck | %s process: leak threshold set at %d bytes"
+ % (processType, leakThresholds.get(processType, 0)))
+
+ for processType in leakThresholds:
+ if not processType in knownProcessTypes:
+ log.info("TEST-UNEXPECTED-FAIL | leakcheck | Unknown process type %s in leakThresholds"
+ % processType)
(leakLogFileDir, leakFileBase) = os.path.split(leakLogFile)
- fileNameRegExp = re.compile(r".*?_([a-z]*)_pid\d*$")
if leakFileBase[-4:] == ".log":
leakFileBase = leakFileBase[:-4]
- fileNameRegExp = re.compile(r".*?_([a-z]*)_pid\d*.log$")
+ fileNameRegExp = re.compile(r"_([a-z]*)_pid\d*.log$")
+ else:
+ fileNameRegExp = re.compile(r"_([a-z]*)_pid\d*$")
for fileName in os.listdir(leakLogFileDir):
if fileName.find(leakFileBase) != -1:
thisFile = os.path.join(leakLogFileDir, fileName)
- processType = None
m = fileNameRegExp.search(fileName)
if m:
processType = m.group(1)
- processSingleLeakFile(thisFile, processType, leakThreshold)
+ else:
+ processType = "default"
+ if not processType in knownProcessTypes:
+ log.info("TEST-UNEXPECTED-FAIL | leakcheck | Leak log with unknown process type %s"
+ % processType)
+ leakThreshold = leakThresholds.get(processType, 0)
+ processSingleLeakFile(thisFile, processType, leakThreshold,
+ processType in ignoreMissingLeaks)
+
+def systemMemory():
+ """
+ Returns total system memory in kilobytes.
+ Works only on unix-like platforms where `free` is in the path.
+ """
+ return int(os.popen("free").readlines()[1].split()[1])
+
+def environment(xrePath, env=None, debugger=False, dmdPath=None, lsanPath=None):
+ """populate OS environment variables for mochitest"""
-def replaceBackSlashes(input):
- return input.replace('\\', '/')
+ env = os.environ.copy() if env is None else env
-def wrapCommand(cmd):
+ assert os.path.isabs(xrePath)
+
+ if mozinfo.isMac:
+ ldLibraryPath = os.path.join(os.path.dirname(xrePath), "MacOS")
+ else:
+ ldLibraryPath = xrePath
+
+ envVar = None
+ dmdLibrary = None
+ preloadEnvVar = None
+ if 'toolkit' in mozinfo.info and mozinfo.info['toolkit'] == "gonk":
+ # Skip all of this, it's only valid for the host.
+ pass
+ elif mozinfo.isUnix:
+ envVar = "LD_LIBRARY_PATH"
+ env['MOZILLA_FIVE_HOME'] = xrePath
+ dmdLibrary = "libdmd.so"
+ preloadEnvVar = "LD_PRELOAD"
+ elif mozinfo.isMac:
+ envVar = "DYLD_LIBRARY_PATH"
+ dmdLibrary = "libdmd.dylib"
+ preloadEnvVar = "DYLD_INSERT_LIBRARIES"
+ elif mozinfo.isWin:
+ envVar = "PATH"
+ dmdLibrary = "dmd.dll"
+ preloadEnvVar = "MOZ_REPLACE_MALLOC_LIB"
+ if envVar:
+ envValue = ((env.get(envVar), str(ldLibraryPath))
+ if mozinfo.isWin
+ else (ldLibraryPath, dmdPath, env.get(envVar)))
+ env[envVar] = os.path.pathsep.join([path for path in envValue if path])
+
+ if dmdPath and dmdLibrary and preloadEnvVar:
+ env[preloadEnvVar] = os.path.join(dmdPath, dmdLibrary)
+
+ # Crash on non-local network connections by default.
+ # MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily
+ # enable non-local connections for the purposes of local testing. Don't
+ # override the user's choice here. See bug 1049688.
+ env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1')
+
+ # Set WebRTC logging in case it is not set yet
+ env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5')
+ env.setdefault('R_LOG_LEVEL', '6')
+ env.setdefault('R_LOG_DESTINATION', 'stderr')
+ env.setdefault('R_LOG_VERBOSE', '1')
+
+ # ASan specific environment stuff
+ asan = bool(mozinfo.info.get("asan"))
+ if asan and (mozinfo.isLinux or mozinfo.isMac):
+ try:
+ # Symbolizer support
+ llvmsym = os.path.join(xrePath, "llvm-symbolizer")
+ if os.path.isfile(llvmsym):
+ env["ASAN_SYMBOLIZER_PATH"] = llvmsym
+ log.info("INFO | runtests.py | ASan using symbolizer at %s" % llvmsym)
+ else:
+ log.info("TEST-UNEXPECTED-FAIL | runtests.py | Failed to find ASan symbolizer at %s" % llvmsym)
+
+ totalMemory = systemMemory()
+
+ # Only 4 GB RAM or less available? Use custom ASan options to reduce
+ # the amount of resources required to do the tests. Standard options
+ # will otherwise lead to OOM conditions on the current test slaves.
+ message = "INFO | runtests.py | ASan running in %s configuration"
+ asanOptions = []
+ if totalMemory <= 1024 * 1024 * 4:
+ message = message % 'low-memory'
+ asanOptions = ['quarantine_size=50331648', 'malloc_context_size=5']
+ else:
+ message = message % 'default memory'
+
+ if lsanPath:
+ log.info("LSan enabled.")
+ asanOptions.append('detect_leaks=1')
+ lsanOptions = ["exitcode=0"]
+ suppressionsFile = os.path.join(lsanPath, 'lsan_suppressions.txt')
+ if os.path.exists(suppressionsFile):
+ log.info("LSan using suppression file " + suppressionsFile)
+ lsanOptions.append("suppressions=" + suppressionsFile)
+ else:
+ log.info("WARNING | runtests.py | LSan suppressions file does not exist! " + suppressionsFile)
+ env["LSAN_OPTIONS"] = ':'.join(lsanOptions)
+ # Run shutdown GCs and CCs to avoid spurious leaks.
+ env['MOZ_CC_RUN_DURING_SHUTDOWN'] = '1'
+
+ if len(asanOptions):
+ env['ASAN_OPTIONS'] = ':'.join(asanOptions)
+
+ except OSError,err:
+ log.info("Failed determine available memory, disabling ASan low-memory configuration: %s" % err.strerror)
+ except:
+ log.info("Failed determine available memory, disabling ASan low-memory configuration")
+ else:
+ log.info(message)
+
+ return env
+
+def dumpScreen(utilityPath):
+ """dumps a screenshot of the entire screen to a directory specified by
+ the MOZ_UPLOAD_DIR environment variable"""
+
+ # Need to figure out which OS-dependent tool to use
+ if mozinfo.isUnix:
+ utility = [os.path.join(utilityPath, "screentopng")]
+ utilityname = "screentopng"
+ elif mozinfo.isMac:
+ utility = ['/usr/sbin/screencapture', '-C', '-x', '-t', 'png']
+ utilityname = "screencapture"
+ elif mozinfo.isWin:
+ utility = [os.path.join(utilityPath, "screenshot.exe")]
+ utilityname = "screenshot"
+
+ # Get dir where to write the screenshot file
+ parent_dir = os.environ.get('MOZ_UPLOAD_DIR', None)
+ if not parent_dir:
+ log.info('Failed to retrieve MOZ_UPLOAD_DIR env var')
+ return
+
+ # Run the capture
+ try:
+ tmpfd, imgfilename = tempfile.mkstemp(prefix='mozilla-test-fail-screenshot_', suffix='.png', dir=parent_dir)
+ os.close(tmpfd)
+ returncode = subprocess.call(utility + [imgfilename])
+ printstatus(returncode, utilityname)
+ except OSError, err:
+ log.info("Failed to start %s for screenshot: %s" %
+ utility[0], err.strerror)
+ return
+
+class ShutdownLeaks(object):
+ """
+ Parses the mochitest run log when running a debug build, assigns all leaked
+ DOM windows (that are still around after test suite shutdown, despite running
+ the GC) to the tests that created them and prints leak statistics.
"""
- If running on OS X 10.5 or older, wrap |cmd| so that it will
- be executed as an i386 binary, in case it's a 32-bit/64-bit universal
- binary.
+
+ def __init__(self, logger):
+ self.logger = logger
+ self.tests = []
+ self.leakedWindows = {}
+ self.leakedDocShells = set()
+ self.currentTest = None
+ self.seenShutdown = False
+
+ def log(self, message):
+ if message['action'] == 'log':
+ line = message['message']
+ if line[2:11] == "DOMWINDOW":
+ self._logWindow(line)
+ elif line[2:10] == "DOCSHELL":
+ self._logDocShell(line)
+ elif line.startswith("TEST-START | Shutdown"):
+ self.seenShutdown = True
+ elif message['action'] == 'test_start':
+ fileName = message['test'].replace("chrome://mochitests/content/browser/", "")
+ self.currentTest = {"fileName": fileName, "windows": set(), "docShells": set()}
+ elif message['action'] == 'test_end':
+ # don't track a test if no windows or docShells leaked
+ if self.currentTest and (self.currentTest["windows"] or self.currentTest["docShells"]):
+ self.tests.append(self.currentTest)
+ self.currentTest = None
+
+ def process(self):
+ if not self.seenShutdown:
+ self.logger.warning("TEST-UNEXPECTED-FAIL | ShutdownLeaks | process() called before end of test suite")
+
+ for test in self._parseLeakingTests():
+ for url, count in self._zipLeakedWindows(test["leakedWindows"]):
+ self.logger.warning("TEST-UNEXPECTED-FAIL | %s | leaked %d window(s) until shutdown [url = %s]" % (test["fileName"], count, url))
+
+ if test["leakedWindowsString"]:
+ self.logger.info("TEST-INFO | %s | windows(s) leaked: %s" % (test["fileName"], test["leakedWindowsString"]))
+
+ if test["leakedDocShells"]:
+ self.logger.warning("TEST-UNEXPECTED-FAIL | %s | leaked %d docShell(s) until shutdown" % (test["fileName"], len(test["leakedDocShells"])))
+ self.logger.info("TEST-INFO | %s | docShell(s) leaked: %s" % (test["fileName"],
+ ', '.join(["[pid = %s] [id = %s]" % x for x in test["leakedDocShells"]])))
+
+ def _logWindow(self, line):
+ created = line[:2] == "++"
+ pid = self._parseValue(line, "pid")
+ serial = self._parseValue(line, "serial")
+
+ # log line has invalid format
+ if not pid or not serial:
+ self.logger.warning("TEST-UNEXPECTED-FAIL | ShutdownLeaks | failed to parse line <%s>" % line)
+ return
+
+ key = (pid, serial)
+
+ if self.currentTest:
+ windows = self.currentTest["windows"]
+ if created:
+ windows.add(key)
+ else:
+ windows.discard(key)
+ elif self.seenShutdown and not created:
+ self.leakedWindows[key] = self._parseValue(line, "url")
+
+ def _logDocShell(self, line):
+ created = line[:2] == "++"
+ pid = self._parseValue(line, "pid")
+ id = self._parseValue(line, "id")
+
+ # log line has invalid format
+ if not pid or not id:
+ self.logger.warning("TEST-UNEXPECTED-FAIL | ShutdownLeaks | failed to parse line <%s>" % line)
+ return
+
+ key = (pid, id)
+
+ if self.currentTest:
+ docShells = self.currentTest["docShells"]
+ if created:
+ docShells.add(key)
+ else:
+ docShells.discard(key)
+ elif self.seenShutdown and not created:
+ self.leakedDocShells.add(key)
+
+ def _parseValue(self, line, name):
+ match = re.search("\[%s = (.+?)\]" % name, line)
+ if match:
+ return match.group(1)
+ return None
+
+ def _parseLeakingTests(self):
+ leakingTests = []
+
+ for test in self.tests:
+ leakedWindows = [id for id in test["windows"] if id in self.leakedWindows]
+ test["leakedWindows"] = [self.leakedWindows[id] for id in leakedWindows]
+ test["leakedWindowsString"] = ', '.join(["[pid = %s] [serial = %s]" % x for x in leakedWindows])
+ test["leakedDocShells"] = [id for id in test["docShells"] if id in self.leakedDocShells]
+ test["leakCount"] = len(test["leakedWindows"]) + len(test["leakedDocShells"])
+
+ if test["leakCount"]:
+ leakingTests.append(test)
+
+ return sorted(leakingTests, key=itemgetter("leakCount"), reverse=True)
+
+ def _zipLeakedWindows(self, leakedWindows):
+ counts = []
+ counted = set()
+
+ for url in leakedWindows:
+ if not url in counted:
+ counts.append((url, leakedWindows.count(url)))
+ counted.add(url)
+
+ return sorted(counts, key=itemgetter(1), reverse=True)
+
+
+class LSANLeaks(object):
"""
- if platform.system() == "Darwin" and \
- hasattr(platform, 'mac_ver') and \
- platform.mac_ver()[0][:4] < '10.6':
- return ["arch", "-arch", "i386"] + cmd
- # otherwise just execute the command normally
- return cmd
+ Parses the log when running an LSAN build, looking for interesting stack frames
+ in allocation stacks, and prints out reports.
+ """
+
+ def __init__(self, logger):
+ self.logger = logger
+ self.inReport = False
+ self.foundFrames = set([])
+ self.recordMoreFrames = None
+ self.currStack = None
+ self.maxNumRecordedFrames = 4
+
+ # Don't various allocation-related stack frames, as they do not help much to
+ # distinguish different leaks.
+ unescapedSkipList = [
+ "malloc", "js_malloc", "malloc_", "__interceptor_malloc", "moz_malloc", "moz_xmalloc",
+ "calloc", "js_calloc", "calloc_", "__interceptor_calloc", "moz_calloc", "moz_xcalloc",
+ "realloc","js_realloc", "realloc_", "__interceptor_realloc", "moz_realloc", "moz_xrealloc",
+ "new",
+ "js::MallocProvider",
+ ]
+ self.skipListRegExp = re.compile("^" + "|".join([re.escape(f) for f in unescapedSkipList]) + "$")
+
+ self.startRegExp = re.compile("==\d+==ERROR: LeakSanitizer: detected memory leaks")
+ self.stackFrameRegExp = re.compile(" #\d+ 0x[0-9a-f]+ in ([^(</]+)")
+ self.sysLibStackFrameRegExp = re.compile(" #\d+ 0x[0-9a-f]+ \(([^+]+)\+0x[0-9a-f]+\)")
+
+
+ def log(self, line):
+ if re.match(self.startRegExp, line):
+ self.inReport = True
+ return
+
+ if not self.inReport:
+ return
+
+ if line.startswith("Direct leak"):
+ self._finishStack()
+ self.recordMoreFrames = True
+ self.currStack = []
+ return
+
+ if line.startswith("Indirect leak"):
+ self._finishStack()
+ # Only report direct leaks, in the hope that they are less flaky.
+ self.recordMoreFrames = False
+ return
+
+ if line.startswith("SUMMARY: AddressSanitizer"):
+ self._finishStack()
+ self.inReport = False
+ return
+
+ if not self.recordMoreFrames:
+ return
+
+ stackFrame = re.match(self.stackFrameRegExp, line)
+ if stackFrame:
+ # Split the frame to remove any return types.
+ frame = stackFrame.group(1).split()[-1]
+ if not re.match(self.skipListRegExp, frame):
+ self._recordFrame(frame)
+ return
+
+ sysLibStackFrame = re.match(self.sysLibStackFrameRegExp, line)
+ if sysLibStackFrame:
+ # System library stack frames will never match the skip list,
+ # so don't bother checking if they do.
+ self._recordFrame(sysLibStackFrame.group(1))
+
+ # If we don't match either of these, just ignore the frame.
+ # We'll end up with "unknown stack" if everything is ignored.
+
+ def process(self):
+ for f in self.foundFrames:
+ self.logger.warning("TEST-UNEXPECTED-FAIL | LeakSanitizer | leak at " + f)
+
+ def _finishStack(self):
+ if self.recordMoreFrames and len(self.currStack) == 0:
+ self.currStack = ["unknown stack"]
+ if self.currStack:
+ self.foundFrames.add(", ".join(self.currStack))
+ self.currStack = None
+ self.recordMoreFrames = False
+ self.numRecordedFrames = 0
+
+ def _recordFrame(self, frame):
+ self.currStack.append(frame)
+ self.numRecordedFrames += 1
+ if self.numRecordedFrames >= self.maxNumRecordedFrames:
+ self.recordMoreFrames = False
diff --git a/build/binary-location.mk b/build/binary-location.mk
index e3c14ac85..19ae4b55f 100644
--- a/build/binary-location.mk
+++ b/build/binary-location.mk
@@ -5,19 +5,15 @@
# finds the location of the browser and puts it in the variable $(browser_path)
ifneq (,$(filter WINNT,$(OS_ARCH)))
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
+program = $(MOZ_APP_NAME)$(BIN_SUFFIX)
else
-PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
+program = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
endif
TARGET_DIST = $(TARGET_DEPTH)/dist
-ifeq ($(MOZ_BUILD_APP),camino)
-browser_path = $(TARGET_DIST)/Camino.app/Contents/MacOS/Camino
-else
ifeq ($(OS_ARCH),Darwin)
-browser_path = $(TARGET_DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
+browser_path = $(TARGET_DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(program)
else
-browser_path = $(TARGET_DIST)/bin/$(PROGRAM)
-endif
+browser_path = $(TARGET_DIST)/bin/$(program)
endif
diff --git a/build/bloatcycle.html b/build/bloatcycle.html
deleted file mode 100644
index dd605e459..000000000
--- a/build/bloatcycle.html
+++ /dev/null
@@ -1,164 +0,0 @@
-<script>
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- From mozilla/toolkit/content
- These files did not have a license
-*/
-
-function quitHook()
-{
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "http://" + location.host + "/server/shutdown", true);
- xhr.onreadystatechange = function (event)
- {
- if (xhr.readyState == 4)
- goQuitApplication();
- };
- xhr.send(null);
-}
-
-function canQuitApplication()
-{
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- if (!os)
- {
- return true;
- }
-
- try
- {
- var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
- os.notifyObservers(cancelQuit, "quit-application-requested", null);
-
- // Something aborted the quit process.
- if (cancelQuit.data)
- {
- return false;
- }
- }
- catch (ex)
- {
- }
- os.notifyObservers(null, "quit-application-granted", null);
- return true;
-}
-
-function goQuitApplication()
-{
- const privs = 'UniversalXPConnect';
-
- try
- {
- netscape.security.PrivilegeManager.enablePrivilege(privs);
- }
- catch(ex)
- {
- throw('goQuitApplication: privilege failure ' + ex);
- }
-
- if (!canQuitApplication())
- {
- return false;
- }
-
- const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
- const kAppShell = '@mozilla.org/appshell/appShellService;1';
- var appService;
- var forceQuit;
-
- if (kAppStartup in Components.classes)
- {
- appService = Components.classes[kAppStartup].
- getService(Components.interfaces.nsIAppStartup);
- forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
-
- }
- else if (kAppShell in Components.classes)
- {
- appService = Components.classes[kAppShell].
- getService(Components.interfaces.nsIAppShellService);
- forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
- }
- else
- {
- throw 'goQuitApplication: no AppStartup/appShell';
- }
-
- var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
-
- var windowManagerInterface = windowManager.
- QueryInterface(Components.interfaces.nsIWindowMediator);
-
- var enumerator = windowManagerInterface.getEnumerator(null);
-
- while (enumerator.hasMoreElements())
- {
- var domWindow = enumerator.getNext();
- if (("tryToClose" in domWindow) && !domWindow.tryToClose())
- {
- return false;
- }
- domWindow.close();
- }
-
- try
- {
- appService.quit(forceQuit);
- }
- catch(ex)
- {
- throw('goQuitApplication: ' + ex);
- }
-
- return true;
-}
-
-// bloat test driver for TestGtkEmbed
-//
-// set |user_pref("dom.allow_scripts_to_close_windows", true);| to
-// allow this to close the window when the loop is done.
-//
-// "ftp://ftp.mozilla.org", // not supported for TestGtkEmbed
-//
-
-var list =
- [
- "sample.html",
- "forms.html",
- "grid.html",
- "forms.html",
- "elements.html"
- ];
-var interval = 5000; // 15000
-var idx = 0;
-var w;
-
-window.onload = function () {
- w = window.open("about:blank");
- window.setTimeout(loadURL, interval);
-};
-function loadURL () {
- w.location.href = list[idx++];
- if (idx < list.length) {
- window.setTimeout(loadURL, interval);
- } else {
- if (navigator.platform.indexOf('Mac') != -1) {
- goQuitApplication();
- } else {
- window.setTimeout("w.close();", interval);
- window.setTimeout("window.close();", interval*2);
- }
- }
-}
-var i;
-
-for(i=0; i < list.length;i++) {
- document.write(list[i]);
- document.write("<br>");
-}
-</script>
diff --git a/build/cl.py b/build/cl.py
deleted file mode 100644
index 319d768bd..000000000
--- a/build/cl.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import ctypes
-import os, os.path
-import subprocess
-import sys
-
-CL_INCLUDES_PREFIX = os.environ.get("CL_INCLUDES_PREFIX", "Note: including file:")
-
-GetShortPathName = ctypes.windll.kernel32.GetShortPathNameW
-GetLongPathName = ctypes.windll.kernel32.GetLongPathNameW
-
-
-# cl.exe likes to print inconsistent paths in the showIncludes output
-# (some lowercased, some not, with different directions of slashes),
-# and we need the original file case for make/pymake to be happy.
-# As this is slow and needs to be called a lot of times, use a cache
-# to speed things up.
-_normcase_cache = {}
-
-def normcase(path):
- # Get*PathName want paths with backslashes
- path = path.replace('/', os.sep)
- dir = os.path.dirname(path)
- # name is fortunately always going to have the right case,
- # so we can use a cache for the directory part only.
- name = os.path.basename(path)
- if dir in _normcase_cache:
- result = _normcase_cache[dir]
- else:
- path = ctypes.create_unicode_buffer(dir)
- length = GetShortPathName(path, None, 0)
- shortpath = ctypes.create_unicode_buffer(length)
- GetShortPathName(path, shortpath, length)
- length = GetLongPathName(shortpath, None, 0)
- if length > len(path):
- path = ctypes.create_unicode_buffer(length)
- GetLongPathName(shortpath, path, length)
- result = _normcase_cache[dir] = path.value
- return os.path.join(result, name)
-
-
-def InvokeClWithDependencyGeneration(cmdline):
- target = ""
- # Figure out what the target is
- for arg in cmdline:
- if arg.startswith("-Fo"):
- target = arg[3:]
- break
-
- if target == None:
- print >>sys.stderr, "No target set" and sys.exit(1)
-
- # Assume the source file is the last argument
- source = cmdline[-1]
- assert not source.startswith('-')
-
- # The deps target lives here
- depstarget = os.path.basename(target) + ".pp"
-
- cmdline += ['-showIncludes']
- cl = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
-
- deps = set([normcase(source).replace(os.sep, '/')])
- for line in cl.stdout:
- # cl -showIncludes prefixes every header with "Note: including file:"
- # and an indentation corresponding to the depth (which we don't need)
- if line.startswith(CL_INCLUDES_PREFIX):
- dep = line[len(CL_INCLUDES_PREFIX):].strip()
- # We can't handle pathes with spaces properly in mddepend.pl, but
- # we can assume that anything in a path with spaces is a system
- # header and throw it away.
- dep = normcase(dep)
- if ' ' not in dep:
- deps.add(dep.replace(os.sep, '/'))
- else:
- sys.stdout.write(line) # Make sure we preserve the relevant output
- # from cl
-
- ret = cl.wait()
- if ret != 0 or target == "":
- sys.exit(ret)
-
- depsdir = os.path.normpath(os.path.join(os.curdir, ".deps"))
- depstarget = os.path.join(depsdir, depstarget)
- if not os.path.isdir(depsdir):
- try:
- os.makedirs(depsdir)
- except OSError:
- pass # This suppresses the error we get when the dir exists, at the
- # cost of masking failure to create the directory. We'll just
- # die on the next line though, so it's not that much of a loss.
-
- with open(depstarget, "w") as f:
- f.write("%s: %s" % (target, source))
- for dep in sorted(deps):
- f.write(" \\\n%s" % dep)
- f.write('\n')
- for dep in sorted(deps):
- f.write("%s:\n" % dep)
-
-if __name__ == "__main__":
- InvokeClWithDependencyGeneration(sys.argv[1:])
diff --git a/build/clang-plugin/Makefile.in b/build/clang-plugin/Makefile.in
index a83561270..c17933fe8 100644
--- a/build/clang-plugin/Makefile.in
+++ b/build/clang-plugin/Makefile.in
@@ -2,41 +2,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-CXX := @CXX@
-CXXFLAGS := @CXXFLAGS@
-LDFLAGS := @LDFLAGS@
-VPATH := @srcdir@
-
-# Helper for end
-NULL :=
-
-CPPSRCS := \
- clang-plugin.cpp \
- $(NULL)
-
-TESTSRCS := \
- TestMustOverride.cpp \
- TestNonHeapClass.cpp \
- TestStackClass.cpp \
- $(NULL)
-
-OBJS := $(patsubst %.cpp,%.o,$(CPPSRCS))
-TESTS := $(patsubst %.cpp,test-%,$(TESTSRCS))
-
-PLUGIN := libclang-plugin.so
-
-all: $(PLUGIN) $(TESTS)
-
-$(OBJS): %.o: %.cpp Makefile
- $(CXX) -o $@ -c $(CXXFLAGS) $<
-
-$(PLUGIN): $(OBJS)
- rm -f $@
- $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $(OBJS) -lclangASTMatchers
-
-TESTFLAGS := -fsyntax-only -Xclang -verify \
- -Xclang -load -Xclang $(CURDIR)/$(PLUGIN) \
- -Xclang -add-plugin -Xclang moz-check
-
-$(TESTS): test-%: tests/%.cpp $(PLUGIN)
- $(CXX) $(TESTFLAGS) $<
+# LLVM_CXXFLAGS comes with its own optimization flags.
+MOZ_OPTIMIZE =
+
+include $(topsrcdir)/config/config.mk
+
+# In the current moz.build world, we need to override essentially every
+# variable to limit ourselves to what we need to build the clang plugin.
+OS_CXXFLAGS := $(LLVM_CXXFLAGS) -fno-rtti -fno-exceptions
+OS_COMPILE_CXXFLAGS :=
+OS_LDFLAGS := $(LLVM_LDFLAGS) $(CLANG_LDFLAGS)
+DSO_LDOPTS := -shared
+
+# Use the default OS X deployment target to enable using the libc++ headers
+# correctly. Note that the binary produced here is a host tool and doesn't need
+# to be distributed.
+MACOSX_DEPLOYMENT_TARGET :=
diff --git a/build/clang-plugin/clang-plugin.cpp b/build/clang-plugin/clang-plugin.cpp
index 2106214c1..455d3e2d0 100644
--- a/build/clang-plugin/clang-plugin.cpp
+++ b/build/clang-plugin/clang-plugin.cpp
@@ -12,12 +12,21 @@
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include <memory>
#define CLANG_VERSION_FULL (CLANG_VERSION_MAJOR * 100 + CLANG_VERSION_MINOR)
using namespace llvm;
using namespace clang;
+#if CLANG_VERSION_FULL >= 306
+typedef std::unique_ptr<ASTConsumer> ASTConsumerPtr;
+#else
+typedef ASTConsumer *ASTConsumerPtr;
+#endif
+
namespace {
using namespace clang::ast_matchers;
@@ -25,15 +34,23 @@ class DiagnosticsMatcher {
public:
DiagnosticsMatcher();
- ASTConsumer *makeASTConsumer() {
+ ASTConsumerPtr makeASTConsumer() {
return astMatcher.newASTConsumer();
}
private:
- class StackClassChecker : public MatchFinder::MatchCallback {
+ class ScopeChecker : public MatchFinder::MatchCallback {
public:
+ enum Scope {
+ eLocal,
+ eGlobal
+ };
+ ScopeChecker(Scope scope_) :
+ scope(scope_) {}
virtual void run(const MatchFinder::MatchResult &Result);
void noteInferred(QualType T, DiagnosticsEngine &Diag);
+ private:
+ Scope scope;
};
class NonHeapClassChecker : public MatchFinder::MatchCallback {
@@ -42,11 +59,98 @@ private:
void noteInferred(QualType T, DiagnosticsEngine &Diag);
};
- StackClassChecker stackClassChecker;
+ class ArithmeticArgChecker : public MatchFinder::MatchCallback {
+ public:
+ virtual void run(const MatchFinder::MatchResult &Result);
+ };
+
+ class TrivialCtorDtorChecker : public MatchFinder::MatchCallback {
+ public:
+ virtual void run(const MatchFinder::MatchResult &Result);
+ };
+
+ class NaNExprChecker : public MatchFinder::MatchCallback {
+ public:
+ virtual void run(const MatchFinder::MatchResult &Result);
+ };
+
+ class NoAddRefReleaseOnReturnChecker : public MatchFinder::MatchCallback {
+ public:
+ virtual void run(const MatchFinder::MatchResult &Result);
+ };
+
+ ScopeChecker stackClassChecker;
+ ScopeChecker globalClassChecker;
NonHeapClassChecker nonheapClassChecker;
+ ArithmeticArgChecker arithmeticArgChecker;
+ TrivialCtorDtorChecker trivialCtorDtorChecker;
+ NaNExprChecker nanExprChecker;
+ NoAddRefReleaseOnReturnChecker noAddRefReleaseOnReturnChecker;
MatchFinder astMatcher;
};
+namespace {
+
+bool isInIgnoredNamespace(const Decl *decl) {
+ const DeclContext *DC = decl->getDeclContext()->getEnclosingNamespaceContext();
+ const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(DC);
+ if (!ND) {
+ return false;
+ }
+
+ while (const DeclContext *ParentDC = ND->getParent()) {
+ if (!isa<NamespaceDecl>(ParentDC)) {
+ break;
+ }
+ ND = cast<NamespaceDecl>(ParentDC);
+ }
+
+ const auto& name = ND->getName();
+
+ // namespace std and icu are ignored for now
+ return name == "std" || // standard C++ lib
+ name == "__gnu_cxx" || // gnu C++ lib
+ name == "boost" || // boost
+ name == "webrtc" || // upstream webrtc
+ name == "icu_52" || // icu
+ name == "google" || // protobuf
+ name == "google_breakpad" || // breakpad
+ name == "soundtouch" || // libsoundtouch
+ name == "stagefright" || // libstagefright
+ name == "MacFileUtilities" || // MacFileUtilities
+ name == "dwarf2reader" || // dwarf2reader
+ name == "arm_ex_to_module" || // arm_ex_to_module
+ name == "testing"; // gtest
+}
+
+bool isIgnoredPath(const Decl *decl) {
+ decl = decl->getCanonicalDecl();
+ SourceLocation Loc = decl->getLocation();
+ const SourceManager &SM = decl->getASTContext().getSourceManager();
+ SmallString<1024> FileName = SM.getFilename(Loc);
+ llvm::sys::fs::make_absolute(FileName);
+ llvm::sys::path::reverse_iterator begin = llvm::sys::path::rbegin(FileName),
+ end = llvm::sys::path::rend(FileName);
+ for (; begin != end; ++begin) {
+ if (begin->compare_lower(StringRef("skia")) == 0 ||
+ begin->compare_lower(StringRef("angle")) == 0 ||
+ begin->compare_lower(StringRef("harfbuzz")) == 0 ||
+ begin->compare_lower(StringRef("hunspell")) == 0 ||
+ begin->compare_lower(StringRef("scoped_ptr.h")) == 0 ||
+ begin->compare_lower(StringRef("graphite2")) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool isInterestingDecl(const Decl *decl) {
+ return !isInIgnoredNamespace(decl) &&
+ !isIgnoredPath(decl);
+}
+
+}
+
class MozChecker : public ASTConsumer, public RecursiveASTVisitor<MozChecker> {
DiagnosticsEngine &Diag;
const CompilerInstance &CI;
@@ -54,7 +158,7 @@ class MozChecker : public ASTConsumer, public RecursiveASTVisitor<MozChecker> {
public:
MozChecker(const CompilerInstance &CI) : Diag(CI.getDiagnostics()), CI(CI) {}
- ASTConsumer *getOtherConsumer() {
+ ASTConsumerPtr getOtherConsumer() {
return matcher.makeASTConsumer();
}
@@ -106,8 +210,10 @@ public:
// The way that Clang checks if a method M overrides its parent method
// is if the method has the same name but would not overload.
if (M->getName() == (*it)->getName() &&
- !CI.getSema().IsOverload(*M, (*it), false))
+ !CI.getSema().IsOverload(*M, (*it), false)) {
overridden = true;
+ break;
+ }
}
if (!overridden) {
unsigned overrideID = Diag.getDiagnosticIDs()->getCustomDiagID(
@@ -119,6 +225,35 @@ public:
Diag.Report((*it)->getLocation(), overrideNote);
}
}
+
+ if (!d->isAbstract() && isInterestingDecl(d)) {
+ for (CXXRecordDecl::ctor_iterator ctor = d->ctor_begin(),
+ e = d->ctor_end(); ctor != e; ++ctor) {
+ // Ignore non-converting ctors
+ if (!ctor->isConvertingConstructor(false)) {
+ continue;
+ }
+ // Ignore copy or move constructors
+ if (ctor->isCopyOrMoveConstructor()) {
+ continue;
+ }
+ // Ignore deleted constructors
+ if (ctor->isDeleted()) {
+ continue;
+ }
+ // Ignore whitelisted constructors
+ if (MozChecker::hasCustomAnnotation(*ctor, "moz_implicit")) {
+ continue;
+ }
+ unsigned ctorID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Error, "bad implicit conversion constructor for %0");
+ unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Note, "consider adding the explicit keyword to the constructor");
+ Diag.Report(ctor->getLocation(), ctorID) << d->getDeclName();
+ Diag.Report(ctor->getLocation(), noteID);
+ }
+ }
+
return true;
}
};
@@ -131,7 +266,8 @@ public:
enum ClassAllocationNature {
RegularClass = 0,
NonHeapClass = 1,
- StackClass = 2
+ StackClass = 2,
+ GlobalClass = 3
};
/// A cached data of whether classes are stack classes, non-heap classes, or
@@ -150,6 +286,9 @@ ClassAllocationNature getClassAttrs(CXXRecordDecl *D) {
// Base class: anyone with this annotation is obviously a stack class
if (MozChecker::hasCustomAnnotation(D, "moz_stack_class"))
return StackClass;
+ // Base class: anyone with this annotation is obviously a global class
+ if (MozChecker::hasCustomAnnotation(D, "moz_global_class"))
+ return GlobalClass;
// See if we cached the result.
DenseMap<const CXXRecordDecl *,
@@ -178,6 +317,10 @@ ClassAllocationNature getClassAttrs(CXXRecordDecl *D) {
inferredAllocCauses[D] = std::make_pair(
base->getType()->getAsCXXRecordDecl(), StackClass);
return StackClass;
+ } else if (super == GlobalClass) {
+ inferredAllocCauses[D] = std::make_pair(
+ base->getType()->getAsCXXRecordDecl(), GlobalClass);
+ return GlobalClass;
} else if (super == NonHeapClass) {
inferredAllocCauses[D] = std::make_pair(
base->getType()->getAsCXXRecordDecl(), NonHeapClass);
@@ -192,6 +335,9 @@ ClassAllocationNature getClassAttrs(CXXRecordDecl *D) {
if (fieldType == StackClass) {
inferredAllocCauses[D] = std::make_pair(*field, StackClass);
return StackClass;
+ } else if (fieldType == GlobalClass) {
+ inferredAllocCauses[D] = std::make_pair(*field, GlobalClass);
+ return GlobalClass;
} else if (fieldType == NonHeapClass) {
inferredAllocCauses[D] = std::make_pair(*field, NonHeapClass);
type = NonHeapClass;
@@ -219,17 +365,141 @@ AST_MATCHER(QualType, stackClassAggregate) {
return getClassAttrs(Node) == StackClass;
}
+/// This matcher will match any class with the global class assertion or an
+/// array of such classes.
+AST_MATCHER(QualType, globalClassAggregate) {
+ return getClassAttrs(Node) == GlobalClass;
+}
+
/// This matcher will match any class with the stack class assertion or an
/// array of such classes.
AST_MATCHER(QualType, nonheapClassAggregate) {
return getClassAttrs(Node) == NonHeapClass;
}
+
+/// This matcher will match any function declaration that is declared as a heap
+/// allocator.
+AST_MATCHER(FunctionDecl, heapAllocator) {
+ return MozChecker::hasCustomAnnotation(&Node, "moz_heap_allocator");
+}
+
+/// This matcher will match any declaration that is marked as not accepting
+/// arithmetic expressions in its arguments.
+AST_MATCHER(Decl, noArithmeticExprInArgs) {
+ return MozChecker::hasCustomAnnotation(&Node, "moz_no_arith_expr_in_arg");
+}
+
+/// This matcher will match any C++ class that is marked as having a trivial
+/// constructor and destructor.
+AST_MATCHER(CXXRecordDecl, hasTrivialCtorDtor) {
+ return MozChecker::hasCustomAnnotation(&Node, "moz_trivial_ctor_dtor");
+}
+
+/// This matcher will match any function declaration that is marked to prohibit
+/// calling AddRef or Release on its return value.
+AST_MATCHER(FunctionDecl, hasNoAddRefReleaseOnReturnAttr) {
+ return MozChecker::hasCustomAnnotation(&Node, "moz_no_addref_release_on_return");
+}
+
+/// This matcher will match all arithmetic binary operators.
+AST_MATCHER(BinaryOperator, binaryArithmeticOperator) {
+ BinaryOperatorKind opcode = Node.getOpcode();
+ return opcode == BO_Mul ||
+ opcode == BO_Div ||
+ opcode == BO_Rem ||
+ opcode == BO_Add ||
+ opcode == BO_Sub ||
+ opcode == BO_Shl ||
+ opcode == BO_Shr ||
+ opcode == BO_And ||
+ opcode == BO_Xor ||
+ opcode == BO_Or ||
+ opcode == BO_MulAssign ||
+ opcode == BO_DivAssign ||
+ opcode == BO_RemAssign ||
+ opcode == BO_AddAssign ||
+ opcode == BO_SubAssign ||
+ opcode == BO_ShlAssign ||
+ opcode == BO_ShrAssign ||
+ opcode == BO_AndAssign ||
+ opcode == BO_XorAssign ||
+ opcode == BO_OrAssign;
+}
+
+/// This matcher will match all arithmetic unary operators.
+AST_MATCHER(UnaryOperator, unaryArithmeticOperator) {
+ UnaryOperatorKind opcode = Node.getOpcode();
+ return opcode == UO_PostInc ||
+ opcode == UO_PostDec ||
+ opcode == UO_PreInc ||
+ opcode == UO_PreDec ||
+ opcode == UO_Plus ||
+ opcode == UO_Minus ||
+ opcode == UO_Not;
+}
+
+/// This matcher will match == and != binary operators.
+AST_MATCHER(BinaryOperator, binaryEqualityOperator) {
+ BinaryOperatorKind opcode = Node.getOpcode();
+ return opcode == BO_EQ || opcode == BO_NE;
+}
+
+/// This matcher will match floating point types.
+AST_MATCHER(QualType, isFloat) {
+ return Node->isRealFloatingType();
+}
+
+/// This matcher will match locations in system headers. This is adopted from
+/// isExpansionInSystemHeader in newer clangs, but modified in order to work
+/// with old clangs that we use on infra.
+AST_MATCHER(BinaryOperator, isInSystemHeader) {
+ auto &SourceManager = Finder->getASTContext().getSourceManager();
+ auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart());
+ if (ExpansionLoc.isInvalid()) {
+ return false;
+ }
+ return SourceManager.isInSystemHeader(ExpansionLoc);
+}
+
+/// This matcher will match locations in SkScalar.h. This header contains a
+/// known NaN-testing expression which we would like to whitelist.
+AST_MATCHER(BinaryOperator, isInSkScalarDotH) {
+ SourceLocation Loc = Node.getOperatorLoc();
+ auto &SourceManager = Finder->getASTContext().getSourceManager();
+ SmallString<1024> FileName = SourceManager.getFilename(Loc);
+ return llvm::sys::path::rbegin(FileName)->equals("SkScalar.h");
+}
+
+/// This matcher will match all accesses to AddRef or Release methods.
+AST_MATCHER(MemberExpr, isAddRefOrRelease) {
+ ValueDecl *Member = Node.getMemberDecl();
+ CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Member);
+ if (Method) {
+ std::string Name = Method->getNameAsString();
+ return Name == "AddRef" || Name == "Release";
+ }
+ return false;
+}
+
}
}
namespace {
-DiagnosticsMatcher::DiagnosticsMatcher() {
+bool isPlacementNew(const CXXNewExpr *expr) {
+ // Regular new expressions aren't placement new
+ if (expr->getNumPlacementArgs() == 0)
+ return false;
+ if (MozChecker::hasCustomAnnotation(expr->getOperatorNew(),
+ "moz_heap_allocator"))
+ return false;
+ return true;
+}
+
+DiagnosticsMatcher::DiagnosticsMatcher()
+ : stackClassChecker(ScopeChecker::eLocal),
+ globalClassChecker(ScopeChecker::eGlobal)
+{
// Stack class assertion: non-local variables of a stack class are forbidden
// (non-localness checked in the callback)
astMatcher.addMatcher(varDecl(hasType(stackClassAggregate())).bind("node"),
@@ -238,60 +508,147 @@ DiagnosticsMatcher::DiagnosticsMatcher() {
astMatcher.addMatcher(newExpr(hasType(pointerType(
pointee(stackClassAggregate())
))).bind("node"), &stackClassChecker);
+ // Global class assertion: non-global variables of a global class are forbidden
+ // (globalness checked in the callback)
+ astMatcher.addMatcher(varDecl(hasType(globalClassAggregate())).bind("node"),
+ &globalClassChecker);
+ // Global class assertion: new global class is forbidden
+ astMatcher.addMatcher(newExpr(hasType(pointerType(
+ pointee(globalClassAggregate())
+ ))).bind("node"), &globalClassChecker);
// Non-heap class assertion: new non-heap class is forbidden (unless placement
// new)
astMatcher.addMatcher(newExpr(hasType(pointerType(
pointee(nonheapClassAggregate())
))).bind("node"), &nonheapClassChecker);
+
+ // Any heap allocation function that returns a non-heap or a stack class or
+ // a global class is definitely doing something wrong
+ astMatcher.addMatcher(callExpr(callee(functionDecl(allOf(heapAllocator(),
+ returns(pointerType(pointee(nonheapClassAggregate()))))))).bind("node"),
+ &nonheapClassChecker);
+ astMatcher.addMatcher(callExpr(callee(functionDecl(allOf(heapAllocator(),
+ returns(pointerType(pointee(stackClassAggregate()))))))).bind("node"),
+ &stackClassChecker);
+
+ astMatcher.addMatcher(callExpr(callee(functionDecl(allOf(heapAllocator(),
+ returns(pointerType(pointee(globalClassAggregate()))))))).bind("node"),
+ &globalClassChecker);
+
+ astMatcher.addMatcher(callExpr(allOf(hasDeclaration(noArithmeticExprInArgs()),
+ anyOf(
+ hasDescendant(binaryOperator(allOf(binaryArithmeticOperator(),
+ hasLHS(hasDescendant(declRefExpr())),
+ hasRHS(hasDescendant(declRefExpr()))
+ )).bind("node")),
+ hasDescendant(unaryOperator(allOf(unaryArithmeticOperator(),
+ hasUnaryOperand(allOf(hasType(builtinType()),
+ anyOf(hasDescendant(declRefExpr()), declRefExpr())))
+ )).bind("node"))
+ )
+ )).bind("call"),
+ &arithmeticArgChecker);
+ astMatcher.addMatcher(constructExpr(allOf(hasDeclaration(noArithmeticExprInArgs()),
+ anyOf(
+ hasDescendant(binaryOperator(allOf(binaryArithmeticOperator(),
+ hasLHS(hasDescendant(declRefExpr())),
+ hasRHS(hasDescendant(declRefExpr()))
+ )).bind("node")),
+ hasDescendant(unaryOperator(allOf(unaryArithmeticOperator(),
+ hasUnaryOperand(allOf(hasType(builtinType()),
+ anyOf(hasDescendant(declRefExpr()), declRefExpr())))
+ )).bind("node"))
+ )
+ )).bind("call"),
+ &arithmeticArgChecker);
+
+ astMatcher.addMatcher(recordDecl(hasTrivialCtorDtor()).bind("node"),
+ &trivialCtorDtorChecker);
+
+ astMatcher.addMatcher(binaryOperator(allOf(binaryEqualityOperator(),
+ hasLHS(has(declRefExpr(hasType(qualType((isFloat())))).bind("lhs"))),
+ hasRHS(has(declRefExpr(hasType(qualType((isFloat())))).bind("rhs"))),
+ unless(anyOf(isInSystemHeader(), isInSkScalarDotH()))
+ )).bind("node"),
+ &nanExprChecker);
+
+ astMatcher.addMatcher(callExpr(callee(functionDecl(hasNoAddRefReleaseOnReturnAttr()).bind("func")),
+ hasParent(memberExpr(isAddRefOrRelease(),
+ hasParent(callExpr())).bind("member")
+ )).bind("node"),
+ &noAddRefReleaseOnReturnChecker);
}
-void DiagnosticsMatcher::StackClassChecker::run(
+void DiagnosticsMatcher::ScopeChecker::run(
const MatchFinder::MatchResult &Result) {
DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
unsigned stackID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Error, "variable of type %0 only valid on the stack");
+ unsigned globalID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Error, "variable of type %0 only valid as global");
+ unsigned errorID = (scope == eGlobal) ? globalID : stackID;
if (const VarDecl *d = Result.Nodes.getNodeAs<VarDecl>("node")) {
- // Ignore the match if it's a local variable.
- if (d->hasLocalStorage())
- return;
+ if (scope == eLocal) {
+ // Ignore the match if it's a local variable.
+ if (d->hasLocalStorage())
+ return;
+ } else if (scope == eGlobal) {
+ // Ignore the match if it's a global variable or a static member of a
+ // class. The latter is technically not in the global scope, but for the
+ // use case of classes that intend to avoid introducing static
+ // initializers that is fine.
+ if (d->hasGlobalStorage() && !d->isStaticLocal())
+ return;
+ }
- Diag.Report(d->getLocation(), stackID) << d->getType();
+ Diag.Report(d->getLocation(), errorID) << d->getType();
noteInferred(d->getType(), Diag);
} else if (const CXXNewExpr *expr =
Result.Nodes.getNodeAs<CXXNewExpr>("node")) {
// If it's placement new, then this match doesn't count.
- if (expr->getNumPlacementArgs() > 0)
+ if (scope == eLocal && isPlacementNew(expr))
return;
- Diag.Report(expr->getStartLoc(), stackID) << expr->getAllocatedType();
+ Diag.Report(expr->getStartLoc(), errorID) << expr->getAllocatedType();
noteInferred(expr->getAllocatedType(), Diag);
+ } else if (const CallExpr *expr =
+ Result.Nodes.getNodeAs<CallExpr>("node")) {
+ QualType badType = expr->getCallReturnType()->getPointeeType();
+ Diag.Report(expr->getLocStart(), errorID) << badType;
+ noteInferred(badType, Diag);
}
}
-void DiagnosticsMatcher::StackClassChecker::noteInferred(QualType T,
+void DiagnosticsMatcher::ScopeChecker::noteInferred(QualType T,
DiagnosticsEngine &Diag) {
unsigned inheritsID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Note,
- "%0 is a stack class because it inherits from a stack class %1");
+ "%0 is a %2 class because it inherits from a %2 class %1");
unsigned memberID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Note,
- "%0 is a stack class because member %1 is a stack class %2");
+ "%0 is a %3 class because member %1 is a %3 class %2");
+ const char* attribute = (scope == eGlobal) ?
+ "moz_global_class" : "moz_stack_class";
+ const char* type = (scope == eGlobal) ?
+ "global" : "stack";
- // Find the CXXRecordDecl that is the stack class of interest
+ // Find the CXXRecordDecl that is the local/global class of interest
while (const ArrayType *arrTy = T->getAsArrayTypeUnsafe())
T = arrTy->getElementType();
CXXRecordDecl *clazz = T->getAsCXXRecordDecl();
// Direct result, we're done.
- if (MozChecker::hasCustomAnnotation(clazz, "moz_stack_class"))
+ if (MozChecker::hasCustomAnnotation(clazz, attribute))
return;
const Decl *cause = inferredAllocCauses[clazz].first;
if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(cause)) {
- Diag.Report(clazz->getLocation(), inheritsID) << T << CRD->getDeclName();
+ Diag.Report(clazz->getLocation(), inheritsID) <<
+ T << CRD->getDeclName() << type;
} else if (const FieldDecl *FD = dyn_cast<FieldDecl>(cause)) {
- Diag.Report(FD->getLocation(), memberID) << T << FD << FD->getType();
+ Diag.Report(FD->getLocation(), memberID) <<
+ T << FD << FD->getType() << type;
}
-
+
// Recursively follow this back.
noteInferred(cast<ValueDecl>(cause)->getType(), Diag);
}
@@ -301,12 +658,17 @@ void DiagnosticsMatcher::NonHeapClassChecker::run(
DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
unsigned stackID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Error, "variable of type %0 is not valid on the heap");
- const CXXNewExpr *expr = Result.Nodes.getNodeAs<CXXNewExpr>("node");
- // If it's placement new, then this match doesn't count.
- if (expr->getNumPlacementArgs() > 0)
- return;
- Diag.Report(expr->getStartLoc(), stackID) << expr->getAllocatedType();
- noteInferred(expr->getAllocatedType(), Diag);
+ if (const CXXNewExpr *expr = Result.Nodes.getNodeAs<CXXNewExpr>("node")) {
+ // If it's placement new, then this match doesn't count.
+ if (isPlacementNew(expr))
+ return;
+ Diag.Report(expr->getStartLoc(), stackID) << expr->getAllocatedType();
+ noteInferred(expr->getAllocatedType(), Diag);
+ } else if (const CallExpr *expr = Result.Nodes.getNodeAs<CallExpr>("node")) {
+ QualType badType = expr->getCallReturnType()->getPointeeType();
+ Diag.Report(expr->getLocStart(), stackID) << badType;
+ noteInferred(badType, Diag);
+ }
}
void DiagnosticsMatcher::NonHeapClassChecker::noteInferred(QualType T,
@@ -338,17 +700,101 @@ void DiagnosticsMatcher::NonHeapClassChecker::noteInferred(QualType T,
noteInferred(cast<ValueDecl>(cause)->getType(), Diag);
}
+void DiagnosticsMatcher::ArithmeticArgChecker::run(
+ const MatchFinder::MatchResult &Result) {
+ DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
+ unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Error, "cannot pass an arithmetic expression of built-in types to %0");
+ const Expr *expr = Result.Nodes.getNodeAs<Expr>("node");
+ if (const CallExpr *call = Result.Nodes.getNodeAs<CallExpr>("call")) {
+ Diag.Report(expr->getLocStart(), errorID) << call->getDirectCallee();
+ } else if (const CXXConstructExpr *ctr = Result.Nodes.getNodeAs<CXXConstructExpr>("call")) {
+ Diag.Report(expr->getLocStart(), errorID) << ctr->getConstructor();
+ }
+}
+
+void DiagnosticsMatcher::TrivialCtorDtorChecker::run(
+ const MatchFinder::MatchResult &Result) {
+ DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
+ unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Error, "class %0 must have trivial constructors and destructors");
+ const CXXRecordDecl *node = Result.Nodes.getNodeAs<CXXRecordDecl>("node");
+
+ bool badCtor = !node->hasTrivialDefaultConstructor();
+ bool badDtor = !node->hasTrivialDestructor();
+ if (badCtor || badDtor)
+ Diag.Report(node->getLocStart(), errorID) << node;
+}
+
+void DiagnosticsMatcher::NaNExprChecker::run(
+ const MatchFinder::MatchResult &Result) {
+ if (!Result.Context->getLangOpts().CPlusPlus) {
+ // mozilla::IsNaN is not usable in C, so there is no point in issuing these warnings.
+ return;
+ }
+
+ DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
+ unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Error, "comparing a floating point value to itself for NaN checking can lead to incorrect results");
+ unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Note, "consider using mozilla::IsNaN instead");
+ const BinaryOperator *expr = Result.Nodes.getNodeAs<BinaryOperator>("node");
+ const DeclRefExpr *lhs = Result.Nodes.getNodeAs<DeclRefExpr>("lhs");
+ const DeclRefExpr *rhs = Result.Nodes.getNodeAs<DeclRefExpr>("rhs");
+ const ImplicitCastExpr *lhsExpr = dyn_cast<ImplicitCastExpr>(expr->getLHS());
+ const ImplicitCastExpr *rhsExpr = dyn_cast<ImplicitCastExpr>(expr->getRHS());
+ // The AST subtree that we are looking for will look like this:
+ // -BinaryOperator ==/!=
+ // |-ImplicitCastExpr LValueToRValue
+ // | |-DeclRefExpr
+ // |-ImplicitCastExpr LValueToRValue
+ // |-DeclRefExpr
+ // The check below ensures that we are dealing with the correct AST subtree shape, and
+ // also that both of the found DeclRefExpr's point to the same declaration.
+ if (lhs->getFoundDecl() == rhs->getFoundDecl() &&
+ lhsExpr && rhsExpr &&
+ std::distance(lhsExpr->child_begin(), lhsExpr->child_end()) == 1 &&
+ std::distance(rhsExpr->child_begin(), rhsExpr->child_end()) == 1 &&
+ *lhsExpr->child_begin() == lhs &&
+ *rhsExpr->child_begin() == rhs) {
+ Diag.Report(expr->getLocStart(), errorID);
+ Diag.Report(expr->getLocStart(), noteID);
+ }
+}
+
+void DiagnosticsMatcher::NoAddRefReleaseOnReturnChecker::run(
+ const MatchFinder::MatchResult &Result) {
+ DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
+ unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID(
+ DiagnosticIDs::Error, "%1 cannot be called on the return value of %0");
+ const Stmt *node = Result.Nodes.getNodeAs<Stmt>("node");
+ const FunctionDecl *func = Result.Nodes.getNodeAs<FunctionDecl>("func");
+ const MemberExpr *member = Result.Nodes.getNodeAs<MemberExpr>("member");
+ const CXXMethodDecl *method = dyn_cast<CXXMethodDecl>(member->getMemberDecl());
+
+ Diag.Report(node->getLocStart(), errorID) << func << method;
+}
+
class MozCheckAction : public PluginASTAction {
public:
- ASTConsumer *CreateASTConsumer(CompilerInstance &CI, StringRef fileName) {
+ ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, StringRef fileName) override {
+#if CLANG_VERSION_FULL >= 306
+ std::unique_ptr<MozChecker> checker(make_unique<MozChecker>(CI));
+
+ std::vector<std::unique_ptr<ASTConsumer>> consumers;
+ consumers.push_back(std::move(checker));
+ consumers.push_back(checker->getOtherConsumer());
+ return make_unique<MultiplexConsumer>(std::move(consumers));
+#else
MozChecker *checker = new MozChecker(CI);
ASTConsumer *consumers[] = { checker, checker->getOtherConsumer() };
return new MultiplexConsumer(consumers);
+#endif
}
bool ParseArgs(const CompilerInstance &CI,
- const std::vector<std::string> &args) {
+ const std::vector<std::string> &args) override {
return true;
}
};
diff --git a/build/clang-plugin/configure b/build/clang-plugin/configure
deleted file mode 100755
index c658f0463..000000000
--- a/build/clang-plugin/configure
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-# Default srcdir to this directory
-srcdir=
-
-for option; do
- case "$option" in
- -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case "$option" in
- --srcdir=*) srcdir="$optarg";;
- esac
-done
-
-if test -z "$CXX"; then
- CXX=`which clang++`
-fi
-
-echo -n "checking for llvm-config... "
-
-if test -z "$LLVMCONFIG"; then
- LLVMCONFIG=`which llvm-config`
-fi
-
-if test -z "$LLVMCONFIG"; then
- LLVMCONFIG=`dirname $CXX`/llvm-config
-fi
-
-if test ! -x "$LLVMCONFIG"; then
- echo "configure: error: Cannot find an llvm-config binary for building a clang plugin" 1>&2
- exit 1
-fi
-
-echo "$LLVMCONFIG"
-
-LLVMCXXFLAGS=`$LLVMCONFIG --cxxflags`
-LLVMLDFLAGS=`$LLVMCONFIG --ldflags`
-CXXFLAGS="$CXXFLAGS $LLVMCXXFLAGS -fno-rtti -fno-exceptions"
-LDFLAGS="$LDFLAGS $LLVMLDFLAGS"
-
-cat $srcdir/Makefile.in | sed \
- -e "s%@CXX@%$CXX%" \
- -e "s%@CXXFLAGS@%$CXXFLAGS%" \
- -e "s%@LDFLAGS@%$LDFLAGS%" \
- -e "s%@srcdir@%$srcdir%" \
- > Makefile
diff --git a/build/unix/test/moz.build b/build/clang-plugin/moz.build
index 895d11993..0f4f4aaba 100644
--- a/build/unix/test/moz.build
+++ b/build/clang-plugin/moz.build
@@ -4,3 +4,15 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+SharedLibrary('clang-plugin')
+
+SOURCES += [
+ 'clang-plugin.cpp',
+]
+
+DISABLE_STL_WRAPPING = True
+NO_VISIBILITY_FLAGS = True
+
+DIRS += [
+ 'tests',
+]
diff --git a/build/clang-plugin/tests/Makefile.in b/build/clang-plugin/tests/Makefile.in
new file mode 100644
index 000000000..47393978c
--- /dev/null
+++ b/build/clang-plugin/tests/Makefile.in
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Build without any warning flags, and with clang verify flag for a
+# syntax-only build (no codegen), without a limit on the number of errors.
+OS_CFLAGS := $(filter-out -W%,$(OS_CFLAGS)) -fsyntax-only -Xclang -verify -ferror-limit=0
+OS_CXXFLAGS := $(filter-out -W%,$(OS_CXXFLAGS)) -fsyntax-only -Xclang -verify -ferror-limit=0
+
+include $(topsrcdir)/config/rules.mk
+
+export:: $(OBJS)
+
+# We don't actually build anything.
+.PHONY: $(OBJS)
diff --git a/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp b/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp
new file mode 100644
index 000000000..cee6479fa
--- /dev/null
+++ b/build/clang-plugin/tests/TestBadImplicitConversionCtor.cpp
@@ -0,0 +1,41 @@
+#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
+
+struct Foo {
+ Foo(int); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ Foo(int, char=0); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ Foo(...); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
+ Foo(int, unsigned);
+ Foo(Foo&);
+ Foo(const Foo&);
+ Foo(volatile Foo&);
+ Foo(const volatile Foo&);
+ Foo(Foo&&);
+ Foo(const Foo&&);
+ Foo(volatile Foo&&);
+ Foo(const volatile Foo&&);
+};
+
+struct Bar {
+ explicit Bar(int);
+ explicit Bar(int, char=0);
+ explicit Bar(...);
+};
+
+struct Baz {
+ MOZ_IMPLICIT Baz(int);
+ MOZ_IMPLICIT Baz(int, char=0);
+ MOZ_IMPLICIT Baz(...);
+};
+
+struct Barn {
+ Barn(int) = delete;
+ Barn(int, char=0) = delete;
+ Barn(...) = delete;
+};
+
+struct Abstract {
+ Abstract(int);
+ Abstract(int, char=0);
+ Abstract(...);
+ virtual void f() = 0;
+};
diff --git a/build/clang-plugin/tests/TestCustomHeap.cpp b/build/clang-plugin/tests/TestCustomHeap.cpp
new file mode 100644
index 000000000..97fde638f
--- /dev/null
+++ b/build/clang-plugin/tests/TestCustomHeap.cpp
@@ -0,0 +1,28 @@
+#define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
+#define MOZ_HEAP_ALLOCATOR \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
+ __attribute__((annotate("moz_heap_allocator"))) \
+ _Pragma("GCC diagnostic pop")
+
+#include <stdlib.h>
+#include <memory>
+
+struct MOZ_NONHEAP_CLASS X {
+};
+
+void *operator new(size_t x, int qual) MOZ_HEAP_ALLOCATOR {
+ return ::operator new(x);
+}
+
+template <typename T>
+T *customAlloc() MOZ_HEAP_ALLOCATOR {
+ T *arg = static_cast<T*>(malloc(sizeof(T)));
+ return new (arg) T();
+}
+
+template <typename T>
+void misuseX(T q) {
+ X *foo = customAlloc<X>(); // expected-error {{variable of type 'X' is not valid on the heap}}
+ X *foo2 = new (100) X(); // expected-error {{variable of type 'X' is not valid on the heap}}
+}
diff --git a/build/clang-plugin/tests/TestGlobalClass.cpp b/build/clang-plugin/tests/TestGlobalClass.cpp
new file mode 100644
index 000000000..88da22e9c
--- /dev/null
+++ b/build/clang-plugin/tests/TestGlobalClass.cpp
@@ -0,0 +1,52 @@
+#define MOZ_GLOBAL_CLASS __attribute__((annotate("moz_global_class")))
+#include <stddef.h>
+
+struct MOZ_GLOBAL_CLASS Global {
+ int i;
+ void *operator new(size_t x) throw() { return 0; }
+ void *operator new(size_t blah, char *buffer) { return buffer; }
+};
+
+template <class T>
+struct MOZ_GLOBAL_CLASS TemplateClass {
+ T i;
+};
+
+void gobble(void *) { }
+
+void misuseGlobalClass(int len) {
+ Global notValid; // expected-error {{variable of type 'Global' only valid as global}}
+ Global alsoNotValid[2]; // expected-error {{variable of type 'Global [2]' only valid as global}}
+ static Global valid; // expected-error {{variable of type 'Global' only valid as global}}
+ static Global alsoValid[2]; // expected-error {{variable of type 'Global [2]' only valid as global}}
+
+ gobble(&valid);
+ gobble(&notValid);
+ gobble(&alsoValid[0]);
+
+ gobble(new Global); // expected-error {{variable of type 'Global' only valid as global}}
+ gobble(new Global[10]); // expected-error {{variable of type 'Global' only valid as global}}
+ gobble(new TemplateClass<int>); // expected-error {{variable of type 'TemplateClass<int>' only valid as global}}
+ gobble(len <= 5 ? &valid : new Global); // expected-error {{variable of type 'Global' only valid as global}}
+
+ char buffer[sizeof(Global)];
+ gobble(new (buffer) Global); // expected-error {{variable of type 'Global' only valid as global}}
+}
+
+Global valid;
+struct RandomClass {
+ Global nonstaticMember; // expected-note {{'RandomClass' is a global class because member 'nonstaticMember' is a global class 'Global'}}
+ static Global staticMember;
+};
+struct MOZ_GLOBAL_CLASS RandomGlobalClass {
+ Global nonstaticMember;
+ static Global staticMember;
+};
+
+struct BadInherit : Global {}; // expected-note {{'BadInherit' is a global class because it inherits from a global class 'Global'}}
+struct MOZ_GLOBAL_CLASS GoodInherit : Global {};
+
+void misuseGlobalClassEvenMore(int len) {
+ BadInherit moreInvalid; // expected-error {{variable of type 'BadInherit' only valid as global}}
+ RandomClass evenMoreInvalid; // expected-error {{variable of type 'RandomClass' only valid as global}}
+}
diff --git a/build/clang-plugin/tests/TestNANTestingExpr.cpp b/build/clang-plugin/tests/TestNANTestingExpr.cpp
new file mode 100644
index 000000000..943577d4a
--- /dev/null
+++ b/build/clang-plugin/tests/TestNANTestingExpr.cpp
@@ -0,0 +1,16 @@
+void test(bool x);
+void foo() {
+ float f, f2;
+ typedef double mydouble;
+ mydouble d;
+ double d2;
+ test(f == f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
+ test(d == d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
+ test(f != f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
+ test(d != d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
+ test(f != d);
+ test(d == (d - f));
+ test(f == f2);
+ test(d == d2);
+ test(d + 1 == d);
+}
diff --git a/build/clang-plugin/tests/TestNANTestingExprC.c b/build/clang-plugin/tests/TestNANTestingExprC.c
new file mode 100644
index 000000000..ab2fead22
--- /dev/null
+++ b/build/clang-plugin/tests/TestNANTestingExprC.c
@@ -0,0 +1,17 @@
+/* expected-no-diagnostics */
+void test(int x);
+void foo() {
+ float f, f2;
+ typedef double mydouble;
+ mydouble d;
+ double d2;
+ test(f == f);
+ test(d == d);
+ test(f != f);
+ test(d != d);
+ test(f != d);
+ test(d == (d - f));
+ test(f == f2);
+ test(d == d2);
+ test(d + 1 == d);
+}
diff --git a/build/clang-plugin/tests/TestNoAddRefReleaseOnReturn.cpp b/build/clang-plugin/tests/TestNoAddRefReleaseOnReturn.cpp
new file mode 100644
index 000000000..8283a7258
--- /dev/null
+++ b/build/clang-plugin/tests/TestNoAddRefReleaseOnReturn.cpp
@@ -0,0 +1,65 @@
+#define MOZ_NO_ADDREF_RELEASE_ON_RETURN __attribute__((annotate("moz_no_addref_release_on_return")))
+
+struct Test {
+ void AddRef();
+ void Release();
+ void foo();
+};
+
+struct S {
+ Test* f() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+ Test& g() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+ Test h() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+};
+
+template<class T>
+struct X {
+ T* f() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+ T& g() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+ T h() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+};
+
+template<class T>
+struct SP {
+ T* operator->() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+};
+
+Test* f() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+Test& g() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+Test h() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
+
+void test() {
+ S s;
+ s.f()->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'f'}}
+ s.f()->Release(); // expected-error{{'Release' cannot be called on the return value of 'f'}}
+ s.f()->foo();
+ s.g().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'g'}}
+ s.g().Release(); // expected-error{{'Release' cannot be called on the return value of 'g'}}
+ s.g().foo();
+ s.h().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'h'}}
+ s.h().Release(); // expected-error{{'Release' cannot be called on the return value of 'h'}}
+ s.h().foo();
+ X<Test> x;
+ x.f()->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'f'}}
+ x.f()->Release(); // expected-error{{'Release' cannot be called on the return value of 'f'}}
+ x.f()->foo();
+ x.g().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'g'}}
+ x.g().Release(); // expected-error{{'Release' cannot be called on the return value of 'g'}}
+ x.g().foo();
+ x.h().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'h'}}
+ x.h().Release(); // expected-error{{'Release' cannot be called on the return value of 'h'}}
+ x.h().foo();
+ SP<Test> sp;
+ sp->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'operator->'}}
+ sp->Release(); // expected-error{{'Release' cannot be called on the return value of 'operator->'}}
+ sp->foo();
+ f()->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'f'}}
+ f()->Release(); // expected-error{{'Release' cannot be called on the return value of 'f'}}
+ f()->foo();
+ g().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'g'}}
+ g().Release(); // expected-error{{'Release' cannot be called on the return value of 'g'}}
+ g().foo();
+ h().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'h'}}
+ h().Release(); // expected-error{{'Release' cannot be called on the return value of 'h'}}
+ h().foo();
+}
diff --git a/build/clang-plugin/tests/TestNoArithmeticExprInArgument.cpp b/build/clang-plugin/tests/TestNoArithmeticExprInArgument.cpp
new file mode 100644
index 000000000..d147b1701
--- /dev/null
+++ b/build/clang-plugin/tests/TestNoArithmeticExprInArgument.cpp
@@ -0,0 +1,32 @@
+#define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT __attribute__((annotate("moz_no_arith_expr_in_arg")))
+
+struct X {
+ explicit X(int) MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT;
+ void baz(int) MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT;
+};
+
+int operator+(int, X);
+int operator+(X, int);
+int operator++(X);
+
+void badArithmeticsInArgs() {
+ int a = 1;
+ typedef int myint;
+ myint b = 2;
+ X goodObj1(a);
+ goodObj1.baz(b);
+ X badObj1(a + b); // expected-error{{cannot pass an arithmetic expression of built-in types to 'X'}}
+ X badObj2 = X(a ? 0 : ++a); // expected-error{{cannot pass an arithmetic expression of built-in types to 'X'}}
+ X badObj3(~a); // expected-error{{cannot pass an arithmetic expression of built-in types to 'X'}}
+ badObj1.baz(a - 1 - b); // expected-error{{cannot pass an arithmetic expression of built-in types to 'baz'}}
+ badObj1.baz(++a); // expected-error{{cannot pass an arithmetic expression of built-in types to 'baz'}}
+ badObj1.baz(a++); // expected-error{{cannot pass an arithmetic expression of built-in types to 'baz'}}
+ badObj1.baz(a || b);
+ badObj1.baz(a + goodObj1);
+ badObj1.baz(goodObj1 + a);
+ badObj1.baz(++goodObj1);
+ badObj1.baz(-1);
+ badObj1.baz(-1.0);
+ badObj1.baz(1 + 2);
+ badObj1.baz(1 << (sizeof(int)/2));
+}
diff --git a/build/clang-plugin/tests/TestNonHeapClass.cpp b/build/clang-plugin/tests/TestNonHeapClass.cpp
index 65fdb35ee..cf258ad00 100644
--- a/build/clang-plugin/tests/TestNonHeapClass.cpp
+++ b/build/clang-plugin/tests/TestNonHeapClass.cpp
@@ -4,7 +4,7 @@
struct MOZ_NONHEAP_CLASS NonHeap {
int i;
- void *operator new(size_t x) { return 0; }
+ void *operator new(size_t x) throw() { return 0; }
void *operator new(size_t blah, char *buffer) { return buffer; }
};
diff --git a/build/clang-plugin/tests/TestStackClass.cpp b/build/clang-plugin/tests/TestStackClass.cpp
index 1cce9f4ab..6f01e3843 100644
--- a/build/clang-plugin/tests/TestStackClass.cpp
+++ b/build/clang-plugin/tests/TestStackClass.cpp
@@ -3,7 +3,7 @@
struct MOZ_STACK_CLASS Stack {
int i;
- void *operator new(size_t x) { return 0; }
+ void *operator new(size_t x) throw() { return 0; }
void *operator new(size_t blah, char *buffer) { return buffer; }
};
diff --git a/build/clang-plugin/tests/TestTrivialCtorDtor.cpp b/build/clang-plugin/tests/TestTrivialCtorDtor.cpp
new file mode 100644
index 000000000..81604c190
--- /dev/null
+++ b/build/clang-plugin/tests/TestTrivialCtorDtor.cpp
@@ -0,0 +1,58 @@
+#define MOZ_TRIVIAL_CTOR_DTOR __attribute__((annotate("moz_trivial_ctor_dtor")))
+
+struct MOZ_TRIVIAL_CTOR_DTOR EmptyClass{};
+
+template <class T>
+struct MOZ_TRIVIAL_CTOR_DTOR TemplateEmptyClass{};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadUserDefinedCtor { // expected-error {{class 'BadUserDefinedCtor' must have trivial constructors and destructors}}
+ BadUserDefinedCtor() {}
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadUserDefinedDtor { // expected-error {{class 'BadUserDefinedDtor' must have trivial constructors and destructors}}
+ ~BadUserDefinedDtor() {}
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadVirtualDtor { // expected-error {{class 'BadVirtualDtor' must have trivial constructors and destructors}}
+ virtual ~BadVirtualDtor() {}
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadVirtualMember { // expected-error {{class 'BadVirtualMember' must have trivial constructors and destructors}}
+ virtual void f();
+};
+
+void foo();
+struct MOZ_TRIVIAL_CTOR_DTOR BadNonEmptyCtorDtor { // expected-error {{class 'BadNonEmptyCtorDtor' must have trivial constructors and destructors}}
+ BadNonEmptyCtorDtor() { foo(); }
+ ~BadNonEmptyCtorDtor() { foo(); }
+};
+
+struct NonTrivialCtor {
+ NonTrivialCtor() { foo(); }
+};
+
+struct NonTrivialDtor {
+ ~NonTrivialDtor() { foo(); }
+};
+
+struct VirtualMember {
+ virtual void f();
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadNonTrivialCtorInBase : NonTrivialCtor { // expected-error {{class 'BadNonTrivialCtorInBase' must have trivial constructors and destructors}}
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadNonTrivialDtorInBase : NonTrivialDtor { // expected-error {{class 'BadNonTrivialDtorInBase' must have trivial constructors and destructors}}
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadNonTrivialCtorInMember { // expected-error {{class 'BadNonTrivialCtorInMember' must have trivial constructors and destructors}}
+ NonTrivialCtor m;
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadNonTrivialDtorInMember { // expected-error {{class 'BadNonTrivialDtorInMember' must have trivial constructors and destructors}}
+ NonTrivialDtor m;
+};
+
+struct MOZ_TRIVIAL_CTOR_DTOR BadVirtualMemberInMember { // expected-error {{class 'BadVirtualMemberInMember' must have trivial constructors and destructors}}
+ VirtualMember m;
+};
diff --git a/build/clang-plugin/tests/moz.build b/build/clang-plugin/tests/moz.build
new file mode 100644
index 000000000..2b5bf2a27
--- /dev/null
+++ b/build/clang-plugin/tests/moz.build
@@ -0,0 +1,22 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SOURCES += [
+ 'TestBadImplicitConversionCtor.cpp',
+ 'TestCustomHeap.cpp',
+ 'TestGlobalClass.cpp',
+ 'TestMustOverride.cpp',
+ 'TestNANTestingExpr.cpp',
+ 'TestNANTestingExprC.c',
+ 'TestNoAddRefReleaseOnReturn.cpp',
+ 'TestNoArithmeticExprInArgument.cpp',
+ 'TestNonHeapClass.cpp',
+ 'TestStackClass.cpp',
+ 'TestTrivialCtorDtor.cpp',
+]
+
+DISABLE_STL_WRAPPING = True
+NO_VISIBILITY_FLAGS = True
diff --git a/build/compare-mozconfig/compare-mozconfigs-wrapper.py b/build/compare-mozconfig/compare-mozconfigs-wrapper.py
new file mode 100644
index 000000000..b0b856026
--- /dev/null
+++ b/build/compare-mozconfig/compare-mozconfigs-wrapper.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import unicode_literals
+
+import subprocess
+import sys
+from os import path
+from buildconfig import substs
+
+import logging
+log = logging.getLogger(__name__)
+
+def determine_platform():
+ platform_mapping = {'WINNT': {'x86_64': 'win64',
+ 'i686': 'win32'},
+ 'Darwin': {'x86_64': 'macosx-universal',
+ 'i386':'macosx-universal'},
+ 'Linux': {'x86_64': 'linux64',
+ 'i686': 'linux32'}}
+
+ os_type = substs['OS_TARGET']
+ cpu_type = substs['TARGET_CPU']
+ return platform_mapping.get(os_type, {}).get(cpu_type, None)
+
+def main():
+ """ A wrapper script that calls compare-mozconfig.py
+ based on the platform that the machine is building for"""
+ platform = determine_platform()
+
+ if platform is not None:
+ python_exe = substs['PYTHON']
+ topsrcdir = substs['top_srcdir']
+
+ # construct paths and args for compare-mozconfig
+ browser_dir = path.join(topsrcdir, 'browser')
+ script_path = path.join(topsrcdir, 'build/compare-mozconfig/compare-mozconfigs.py')
+ whitelist_path = path.join(browser_dir, 'config/mozconfigs/whitelist')
+ beta_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'beta')
+ release_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'release')
+ nightly_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'nightly')
+
+ log.info("Comparing beta against nightly mozconfigs")
+ ret_code = subprocess.call([python_exe, script_path, '--whitelist',
+ whitelist_path, '--no-download',
+ platform + ',' + beta_mozconfig_path +
+ ',' + nightly_mozconfig_path])
+
+ if ret_code > 0:
+ return ret_code
+
+ log.info("Comparing release against nightly mozconfigs")
+ ret_code = subprocess.call([python_exe, script_path, '--whitelist',
+ whitelist_path, '--no-download',
+ platform + ',' + release_mozconfig_path +
+ ',' + nightly_mozconfig_path])
+
+ return ret_code
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/build/compare-mozconfig/compare-mozconfigs.py b/build/compare-mozconfig/compare-mozconfigs.py
new file mode 100644
index 000000000..598c00ea2
--- /dev/null
+++ b/build/compare-mozconfig/compare-mozconfigs.py
@@ -0,0 +1,165 @@
+#!/usr/bin/python
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# originally from http://hg.mozilla.org/build/tools/file/4ab9c1a4e05b/scripts/release/compare-mozconfigs.py
+
+from __future__ import unicode_literals
+
+import logging
+import os
+import site
+import sys
+import urllib2
+import difflib
+
+FAILURE_CODE = 1
+SUCCESS_CODE = 0
+
+log = logging.getLogger(__name__)
+
+class ConfigError(Exception):
+ pass
+
+def make_hg_url(hgHost, repoPath, protocol='https', revision=None,
+ filename=None):
+ """construct a valid hg url from a base hg url (hg.mozilla.org),
+ repoPath, revision and possible filename"""
+ base = '%s://%s' % (protocol, hgHost)
+ repo = '/'.join(p.strip('/') for p in [base, repoPath])
+ if not filename:
+ if not revision:
+ return repo
+ else:
+ return '/'.join([p.strip('/') for p in [repo, 'rev', revision]])
+ else:
+ assert revision
+ return '/'.join([p.strip('/') for p in [repo, 'raw-file', revision,
+ filename]])
+
+def readConfig(configfile, keys=[], required=[]):
+ c = {}
+ execfile(configfile, c)
+ for k in keys:
+ c = c[k]
+ items = c.keys()
+ err = False
+ for key in required:
+ if key not in items:
+ err = True
+ log.error("Required item `%s' missing from %s" % (key, c))
+ if err:
+ raise ConfigError("Missing at least one item in config, see above")
+ return c
+
+def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform,
+ mozconfigWhitelist={}):
+ """Compares mozconfig to nightly_mozconfig and compare to an optional
+ whitelist of known differences. mozconfig_pair and nightly_mozconfig_pair
+ are pairs containing the mozconfig's identifier and the list of lines in
+ the mozconfig."""
+
+ # unpack the pairs to get the names, the names are just for
+ # identifying the mozconfigs when logging the error messages
+ mozconfig_name, mozconfig_lines = mozconfig_pair
+ nightly_mozconfig_name, nightly_mozconfig_lines = nightly_mozconfig_pair
+
+ missing_args = mozconfig_lines == [] or nightly_mozconfig_lines == []
+ if missing_args:
+ log.info("Missing mozconfigs to compare for %s" % platform)
+ return False
+
+ success = True
+
+ diff_instance = difflib.Differ()
+ diff_result = diff_instance.compare(mozconfig_lines, nightly_mozconfig_lines)
+ diff_list = list(diff_result)
+
+ for line in diff_list:
+ clean_line = line[1:].strip()
+ if (line[0] == '-' or line[0] == '+') and len(clean_line) > 1:
+ # skip comment lines
+ if clean_line.startswith('#'):
+ continue
+ # compare to whitelist
+ message = ""
+ if line[0] == '-':
+ if platform in mozconfigWhitelist.get('release', {}):
+ if clean_line in \
+ mozconfigWhitelist['release'][platform]:
+ continue
+ elif line[0] == '+':
+ if platform in mozconfigWhitelist.get('nightly', {}):
+ if clean_line in \
+ mozconfigWhitelist['nightly'][platform]:
+ continue
+ else:
+ log.warning("%s not in %s %s!" % (
+ clean_line, platform,
+ mozconfigWhitelist['nightly'][platform]))
+ else:
+ log.error("Skipping line %s!" % line)
+ continue
+ message = "found in %s but not in %s: %s"
+ if line[0] == '-':
+ log.error(message % (mozconfig_name,
+ nightly_mozconfig_name, clean_line))
+ else:
+ log.error(message % (nightly_mozconfig_name,
+ mozconfig_name, clean_line))
+ success = False
+ return success
+
+def get_mozconfig(path, options):
+ """Consumes a path and returns a list of lines from
+ the mozconfig file. If download is required, the path
+ specified should be relative to the root of the hg
+ repository e.g browser/config/mozconfigs/linux32/nightly"""
+ if options.no_download:
+ return open(path, 'r').readlines()
+ else:
+ url = make_hg_url(options.hghost, options.branch, 'http',
+ options.revision, path)
+ return urllib2.urlopen(url).readlines()
+
+if __name__ == '__main__':
+ from optparse import OptionParser
+ parser = OptionParser()
+
+ parser.add_option('--branch', dest='branch')
+ parser.add_option('--revision', dest='revision')
+ parser.add_option('--hghost', dest='hghost', default='hg.mozilla.org')
+ parser.add_option('--whitelist', dest='whitelist')
+ parser.add_option('--no-download', action='store_true', dest='no_download',
+ default=False)
+ options, args = parser.parse_args()
+
+ logging.basicConfig(level=logging.INFO)
+
+ missing_args = options.branch is None or options.revision is None
+ if not options.no_download and missing_args:
+ logging.error('Not enough arguments to download mozconfigs')
+ sys.exit(FAILURE_CODE)
+
+ mozconfig_whitelist = readConfig(options.whitelist, ['whitelist'])
+
+ for arg in args:
+ platform, mozconfig_path, nightly_mozconfig_path = arg.split(',')
+
+ mozconfig_lines = get_mozconfig(mozconfig_path, options)
+ nightly_mozconfig_lines = get_mozconfig(nightly_mozconfig_path, options)
+
+ mozconfig_pair = (mozconfig_path, mozconfig_lines)
+ nightly_mozconfig_pair = (nightly_mozconfig_path,
+ nightly_mozconfig_lines)
+
+ passed = verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair,
+ platform, mozconfig_whitelist)
+
+ if passed:
+ logging.info('Mozconfig check passed!')
+ else:
+ logging.error('Mozconfig check failed!')
+ sys.exit(FAILURE_CODE)
+ sys.exit(SUCCESS_CODE)
diff --git a/build/defines.sh b/build/defines.sh
index 4c8f89c77..cf98c3d8b 100755
--- a/build/defines.sh
+++ b/build/defines.sh
@@ -1,3 +1,3 @@
# Define indicating that this build is prior to one of the early betas. To be
# unset mid-way through the beta cycle.
-# EARLY_BETA_OR_EARLIER=1
+EARLY_BETA_OR_EARLIER=
diff --git a/build/docs/androideclipse.rst b/build/docs/androideclipse.rst
new file mode 100644
index 000000000..a8c048130
--- /dev/null
+++ b/build/docs/androideclipse.rst
@@ -0,0 +1,90 @@
+.. _build_androideclipse:
+
+========================
+Android Eclipse Projects
+========================
+
+The build system contains alpha support for generating Android Eclipse
+project files to aid with development.
+
+To generate Android Eclipse project files, you'll need to have a fully
+built and packaged tree::
+
+ mach build && mach package
+
+(This is because Eclipse itself packages an APK containing
+``omni.ja``, and ``omni.ja`` is only assembled during packaging.)
+
+Then, simply generate the Android Eclipse build backend::
+
+ mach build-backend -b AndroidEclipse
+
+If all goes well, the path to the generated projects should be
+printed (currently, ``$OBJDIR/android_eclipse``).
+
+To use the generated Android Eclipse project files, you'll need to
+have a recent version of Eclipse (see `Tested Versions`_) with the
+`Eclipse ADT plugin
+<http://developer.android.com/tools/sdk/eclipse-adt.html>`_
+installed. You can then import all the projects into Eclipse using
+*File > Import ... > General > Existing Projects into Workspace*.
+
+Updating Project Files
+======================
+
+As you pull and update the source tree, your Android Eclipse files may
+fall out of sync with the build configuration. The tree should still
+build fine from within Eclipse, but source files may be missing and in
+rare circumstances Eclipse's index may not have the proper build
+configuration.
+
+To account for this, you'll want to periodically regenerate the
+Android Eclipse project files. You can do this by running ``mach build
+&& mach package && mach build-backend -b AndroidEclipse`` from the
+command line. It's a good idea to refresh and clean build all projects
+in Eclipse after doing this.
+
+In future, we'd like to include an Android Eclipse run configuration
+or build target that integrates updating the project files.
+
+Currently, regeneration rewrites the original project files. **If
+you've made any customizations to the projects, they will likely get
+overwritten.** We would like to improve this user experience in the
+future.
+
+Troubleshooting
+===============
+
+If Eclipse's builder gets confused, you should always refresh and
+clean build all projects. If Eclipse's builder is continually
+confused, you can see a log of what is happening at
+``$OBJDIR/android_eclipse/build.log``.
+
+If you run into memory problems executing ``dex``, you should
+`Increase Eclipse's memory limits <http://stackoverflow.com/a/11093228>`_.
+
+The produced Android Eclipse project files are unfortunately not
+portable. Please don't move them around.
+
+Structure of Android Eclipse projects
+=====================================
+
+The Android Eclipse backend generates several projects spanning Fennec
+itself and its tests. You'll mostly interact with the *Fennec* project
+itself.
+
+In future, we'd like to expand this documentation to include some of
+the technical details of how the Eclipse integration works, and how to
+add additional Android Eclipse projects using the ``moz.build``
+system.
+
+Tested Versions
+===============
+
+=============== ==================================== =================
+OS Version Working as of
+=============== ==================================== =================
+Mac OS X Luna (Build id: 20130919-0819) February 2014
+Mac OS X Kepler (Build id: 20131219-0014) February 2014
+Mac OS X 10.8.5 Kepler (Build id: 20130919-0819) February 2014
+=============== ==================================== =================
diff --git a/build/docs/build-overview.rst b/build/docs/build-overview.rst
new file mode 100644
index 000000000..a81531bc9
--- /dev/null
+++ b/build/docs/build-overview.rst
@@ -0,0 +1,117 @@
+.. _build_overview:
+
+=====================
+Build System Overview
+=====================
+
+This document provides an overview on how the build system works. It is
+targeted at people wanting to learn about internals of the build system.
+It is not meant for persons who casually interact with the build system.
+That being said, knowledge empowers, so consider reading on.
+
+The build system is composed of many different components working in
+harmony to build the source tree. We begin with a graphic overview.
+
+.. graphviz::
+
+ digraph build_components {
+ rankdir="LR";
+ "configure" -> "config.status" -> "build backend" -> "build output"
+ }
+
+Phase 1: Configuration
+======================
+
+Phase 1 centers around the ``configure`` script, which is a bash shell script.
+The file is generated from a file called ``configure.in`` which is written in M4
+and processed using Autoconf 2.13 to create the final configure script.
+You don't have to worry about how you obtain a ``configure`` file: the build
+system does this for you.
+
+The primary job of ``configure`` is to determine characteristics of the system
+and compiler, apply options passed into it, and validate everything looks OK to
+build. The primary output of the ``configure`` script is an executable file
+in the object directory called ``config.status``. ``configure`` also produces
+some additional files (like ``autoconf.mk``). However, the most important file
+in terms of architecture is ``config.status``.
+
+The existence of a ``config.status`` file may be familiar to those who have worked
+with Autoconf before. However, Mozilla's ``config.status`` is different from almost
+any other ``config.status`` you've ever seen: it's written in Python! Instead of
+having our ``configure`` script produce a shell script, we have it generating
+Python.
+
+Now is as good a time as any to mention that Python is prevalent in our build
+system. If we need to write code for the build system, we do it in Python.
+That's just how we roll. For more, see :ref:`python`.
+
+``config.status`` contains 2 parts: data structures representing the output of
+``configure`` and a command-line interface for preparing/configuring/generating
+an appropriate build backend. (A build backend is merely a tool used to build
+the tree - like GNU Make or Tup). These data structures essentially describe
+the current state of the system and what the existing build configuration looks
+like. For example, it defines which compiler to use, how to invoke it, which
+application features are enabled, etc. You are encouraged to open up
+``config.status`` to have a look for yourself!
+
+Once we have emitted a ``config.status`` file, we pass into the realm of
+phase 2.
+
+Phase 2: Build Backend Preparation and the Build Definition
+===========================================================
+
+Once ``configure`` has determined what the current build configuration is,
+we need to apply this to the source tree so we can actually build.
+
+What essentially happens is the automatically-produced ``config.status`` Python
+script is executed as soon as ``configure`` has generated it. ``config.status``
+is charged with the task of tell a tool how to build the tree. To do this,
+``config.status`` must first scan the build system definition.
+
+The build system definition consists of various ``moz.build`` files in the tree.
+There is roughly one ``moz.build`` file per directory or per set of related directories.
+Each ``moz.build`` files defines how its part of the build config works. For
+example it says *I want these C++ files compiled* or *look for additional
+information in these directories.* config.status starts with the ``moz.build``
+file from the root directory and then descends into referenced ``moz.build``
+files by following ``DIRS`` variables or similar.
+
+As the ``moz.build`` files are read, data structures describing the overall
+build system definition are emitted. These data structures are then fed into a
+build backend, which then performs actions, such as writing out files to
+be read by a build tool. e.g. a ``make`` backend will write a
+``Makefile``.
+
+When ``config.status`` runs, you'll see the following output::
+
+ Reticulating splines...
+ Finished reading 1096 moz.build files into 1276 descriptors in 2.40s
+ Backend executed in 2.39s
+ 2188 total backend files. 0 created; 1 updated; 2187 unchanged
+ Total wall time: 5.03s; CPU time: 3.79s; Efficiency: 75%
+
+What this is saying is that a total of *1096* ``moz.build`` files were read.
+Altogether, *1276* data structures describing the build configuration were
+derived from them. It took *2.40s* wall time to just read these files and
+produce the data structures. The *1276* data structures were fed into the
+build backend which then determined it had to manage *2188* files derived
+from those data structures. Most of them already existed and didn't need
+changed. However, *1* was updated as a result of the new configuration.
+The whole process took *5.03s*. Although, only *3.79s* was in
+CPU time. That likely means we spent roughly *25%* of the time waiting on
+I/O.
+
+For more on how ``moz.build`` files work, see :ref:`mozbuild-files`.
+
+Phase 3: Invokation of the Build Backend
+========================================
+
+When most people think of the build system, they think of phase 3. This is
+where we take all the code in the tree and produce Firefox or whatever
+application you are creating. Phase 3 effectively takes whatever was
+generated by phase 2 and runs it. Since the dawn of Mozilla, this has been
+make consuming Makefiles. However, with the transition to moz.build files,
+you may soon see non-Make build backends, such as Tup or Visual Studio.
+
+When building the tree, most of the time is spent in phase 3. This is when
+header files are installed, C++ files are compiled, files are preprocessed, etc.
diff --git a/build/docs/build-targets.rst b/build/docs/build-targets.rst
new file mode 100644
index 000000000..dacd46c7f
--- /dev/null
+++ b/build/docs/build-targets.rst
@@ -0,0 +1,62 @@
+.. _build_targets:
+
+=============
+Build Targets
+=============
+
+When you build with ``mach build``, there are some special targets that can be
+built. This page attempts to document them.
+
+Partial Tree Targets
+====================
+
+The targets in this section only build part of the tree. Please note that
+partial tree builds can be unreliable. Use at your own risk.
+
+export
+ Build the *export* tier. The *export* tier builds everything that is
+ required for C/C++ compilation. It stages all header files, processes
+ IDLs, etc.
+
+compile
+ Build the *compile* tier. The *compile* tier compiles all C/C++ files.
+
+libs
+ Build the *libs* tier. The *libs* tier performs linking and performs
+ most build steps which aren't related to compilation.
+
+tools
+ Build the *tools* tier. The *tools* tier mostly deals with supplementary
+ tools and compiled tests. It will link tools against libXUL, including
+ compiled test binaries.
+
+binaries:
+ Recompiles and relinks C/C++ files. Only works after a complete normal
+ build, but allows for much faster rebuilds of C/C++ code. For performance
+ reasons, however, it skips nss, nspr, icu and ffi. This is targeted to
+ improve local developer workflow when touching C/C++ code.
+
+install-manifests
+ Process install manifests. Install manifests handle the installation of
+ files into the object directory.
+
+ Unless ``NO_REMOVE=1`` is defined in the environment, files not accounted
+ in the install manifests will be deleted from the object directory.
+
+install-tests
+ Processes the tests install manifest.
+
+Common Actions
+==============
+
+The targets in this section correspond to common build-related actions. Many
+of the actions in this section are effectively frontends to shell scripts.
+These actions will likely all be replaced by mach commands someday.
+
+buildsymbols
+ Create a symbols archive for the current build.
+
+ This must be performed after a successful build.
+
+check
+ Run build system tests.
diff --git a/build/docs/cppeclipse.rst b/build/docs/cppeclipse.rst
new file mode 100644
index 000000000..4492add47
--- /dev/null
+++ b/build/docs/cppeclipse.rst
@@ -0,0 +1,54 @@
+.. _build_cppeclipse:
+
+=====================
+Cpp Eclipse Projects
+=====================
+
+For additional information on using Eclipse CDT see
+`the MDN page
+<https://developer.mozilla.org/en-US/docs/Eclipse_CDT>`_.
+
+The build system contains alpha support for generating C++ Eclipse
+project files to aid with development.
+
+Please report bugs to bugzilla and make them depend on bug 973770.
+
+To generate a C++ Eclipse project files, you'll need to have a fully
+built tree::
+
+ mach build
+
+Then, simply generate the Android Eclipse build backend::
+
+ mach build-backend -b CppEclipse
+
+If all goes well, the path to the generated workspace should be
+printed (currently, ``$OBJDIR/android_eclipse``).
+
+To use the generated Android Eclipse project files, you'll need to
+have a Eclipse CDT 8.3 (We plan to follow the latest Eclipse release)
+`Eclipse CDT plugin
+<https://www.eclipse.org/cdt/>`_
+installed. You can then import all the projects into Eclipse using
+*File > Import ... > General > Existing Projects into Workspace*
+-only- if you have not ran the background indexer.
+
+Updating Project Files
+======================
+
+As you pull and update the source tree, your C++ Eclipse files may
+fall out of sync with the build configuration. The tree should still
+build fine from within Eclipse, but source files may be missing and in
+rare circumstances Eclipse's index may not have the proper build
+configuration.
+
+To account for this, you'll want to periodically regenerate the
+Android Eclipse project files. You can do this by running ``mach build
+&& mach build-backend -b CppEclipse`` from the
+command line.
+
+Currently, regeneration rewrites the original project files. **If
+you've made any customizations to the projects, they will likely get
+overwritten.** We would like to improve this user experience in the
+future.
+
diff --git a/build/docs/defining-binaries.rst b/build/docs/defining-binaries.rst
new file mode 100644
index 000000000..99a76af6b
--- /dev/null
+++ b/build/docs/defining-binaries.rst
@@ -0,0 +1,315 @@
+.. _defining_binaries:
+
+======================================
+Defining Binaries for the Build System
+======================================
+
+One part of what the build system does is compile C/C++ and link the resulting
+objects to produce executables and/or libraries. This document describes the
+basics of defining what is going to be built and how. All the following
+describes constructs to use in moz.build files.
+
+
+Source files
+============
+
+Source files to be used in a given directory are registered in the ``SOURCES``
+and ``UNIFIED_SOURCES`` variables. ``UNIFIED_SOURCES`` have a special behavior
+in that they are aggregated by batches of 16, requiring, for example, that there
+are no conflicting variables in those source files.
+
+``SOURCES`` and ``UNIFIED_SOURCES`` are lists which must be appended to, and
+each append requires the given list to be alphanumerically ordered.
+
+ UNIFIED_SOURCES += [
+ 'FirstSource.cpp',
+ 'SecondSource.cpp',
+ 'ThirdSource.cpp',
+ ]
+
+ SOURCES += [
+ 'OtherSource.cpp',
+ ]
+
+``SOURCES`` and ``UNIFIED_SOURCES`` can contain a mix of different file types,
+for C, C++, and Objective C.
+
+
+Static Libraries
+================
+
+To build a static library, other than defining the source files (see above), one
+just needs to define a library name with the ``Library`` template.
+
+ Library('foo')
+
+The library file name will be ``libfoo.a`` on UNIX systems and ``foo.lib`` on
+Windows.
+
+If the static library needs to aggregate other static libraries, a list of
+``Library`` names can be added to the ``USE_LIBS`` variable. Like ``SOURCES``, it
+requires the appended list to be alphanumerically ordered.
+
+ USE_LIBS += ['bar', 'baz']
+
+If there are multiple directories containing the same ``Library`` name, it is
+possible to disambiguate by prefixing with the path to the wanted one (relative
+or absolute):
+
+ USE_LIBS += [
+ '/path/from/topsrcdir/to/bar',
+ '../relative/baz',
+ ]
+
+Note that the leaf name in those paths is the ``Library`` name, not an actual
+file name.
+
+Note that currently, the build system may not create an actual library for
+static libraries. It is an implementation detail that shouldn't need to be
+worried about.
+
+As a special rule, ``USE_LIBS`` is allowed to contain references to shared
+libraries. In such cases, programs and shared libraries linking this static
+library will inherit those shared library dependencies.
+
+
+Intermediate (Static) Libraries
+===============================
+
+In many cases in the tree, static libraries are built with the only purpose
+of being linked into another, bigger one (like libxul). Instead of adding all
+required libraries to ``USE_LIBS`` for the bigger one, it is possible to tell
+the build system that the library built in the current directory is meant to
+be linked to that bigger library, with the ``FINAL_LIBRARY`` variable.
+
+ FINAL_LIBRARY = 'xul'
+
+The ``FINAL_LIBRARY`` value must match a unique ``Library`` name somewhere
+in the tree.
+
+As a special rule, those intermediate libraries don't need a ``Library`` name
+for themselves.
+
+
+Shared Libraries
+================
+
+Sometimes, we want shared libraries, a.k.a. dynamic libraries. Such libraries
+are defined similarly to static libraries, using the ``SharedLibrary`` template
+instead of ``Library``.
+
+ SharedLibrary('foo')
+
+When this template is used, no static library is built. See further below to
+build both types of libraries.
+
+With a ``SharedLibrary`` name of ``foo``, the library file name will be
+``libfoo.dylib`` on OSX, ``libfoo.so`` on ELF systems (Linux, etc.), and
+``foo.dll`` on Windows. On Windows, there is also an import library named
+``foo.lib``, used on the linker command line. ``libfoo.dylib`` and
+``libfoo.so`` are considered the import library name for, resp. OSX and ELF
+systems.
+
+On OSX, one may want to create a special kind of dynamic library: frameworks.
+This is done with the ``Framework`` template.
+
+ Framework('foo')
+
+With a ``Framework`` name of ``foo``, the framework file name will be ``foo``.
+This template however affects the behavior on all platforms, so it needs to
+be set only on OSX.
+
+
+Executables
+===========
+
+Executables, a.k.a. programs, are, in the simplest form, defined with the
+``Program`` template.
+
+ Program('foobar')
+
+On UNIX systems, the executable file name will be ``foobar``, while on Windows,
+it will be ``foobar.exe``.
+
+Like static and shared libraries, the build system can be instructed to link
+libraries to the executable with ``USE_LIBS``, listing various ``Library``
+names.
+
+In some cases, we want to create an executable per source file in the current
+directory, in which case we can use the ``SimplePrograms`` template
+
+ SimplePrograms([
+ 'FirstProgram',
+ 'SecondProgram',
+ ])
+
+Contrary to ``Program``, which requires corresponding ``SOURCES``, when using
+``SimplePrograms``, the corresponding ``SOURCES`` are implied. If the
+corresponding ``sources`` have an extension different from ``.cpp``, it is
+possible to specify the proper extension:
+
+ SimplePrograms([
+ 'ThirdProgram',
+ 'FourthProgram',
+ ], ext='.c')
+
+Please note this construct was added for compatibility with what already lives
+in the mozilla tree ; it is recommended not to add new simple programs with
+sources with a different extension than ``.cpp``.
+
+Similar to ``SimplePrograms``, is the ``CppUnitTests`` template, which defines,
+with the same rules, C++ unit tests programs. Like ``SimplePrograms``, it takes
+an ``ext`` argument to specify the extension for the corresponding ``SOURCES``,
+if it's different from ``.cpp``.
+
+
+Linking with system libraries
+=============================
+
+Programs and libraries usually need to link with system libraries, such as a
+widget toolkit, etc. Those required dependencies can be given with the
+``OS_LIBS`` variable.
+
+ OS_LIBS += [
+ 'foo',
+ 'bar',
+ ]
+
+This expands to ``foo.lib bar.lib`` when building with MSVC, and
+``-lfoo -lbar`` otherwise.
+
+For convenience with ``pkg-config``, ``OS_LIBS`` can also take linker flags
+such as ``-L/some/path`` and ``-llib``, such that it is possible to directly
+assign ``LIBS`` variables from ``CONFIG``, such as:
+
+ OS_LIBS += CONFIG['MOZ_PANGO_LIBS']
+
+(assuming ``CONFIG['MOZ_PANGO_LIBS']`` is a list, not a string)
+
+Like ``USE_LIBS``, this variable applies to static and shared libraries, as
+well as programs.
+
+
+Libraries from third party build system
+=======================================
+
+Some libraries in the tree are not built by the moz.build-governed build
+system, and there is no ``Library`` corresponding to them.
+
+However, ``USE_LIBS`` allows to reference such libraries by giving a full
+path (like when disambiguating identical ``Library`` names). The same naming
+rules apply as other uses of ``USE_LIBS``, so only the library name without
+prefix and suffix shall be given.
+
+ USE_LIBS += [
+ '/path/from/topsrcdir/to/third-party/bar',
+ '../relative/third-party/baz',
+ ]
+
+Note that ``/path/from/topsrcdir/to/third-party`` and
+``../relative/third-party/baz`` must lead under a subconfigured directory (a
+directory with an AC_OUTPUT_SUBDIRS in configure.in), or ``security/nss``.
+
+
+Building both static and shared libraries
+=========================================
+
+When both types of libraries are required, one needs to set both
+``FORCE_SHARED_LIB`` and ``FORCE_STATIC_LIB`` boolean variables.
+
+ FORCE_SHARED_LIB = True
+ FORCE_STATIC_LIB = True
+
+But because static libraries and Windows import libraries have the same file
+names, either the static or the shared library name needs to be different
+than the name given to the ``Library`` template.
+
+The ``STATIC_LIBRARY_NAME`` and ``SHARED_LIBRARY_NAME`` variables can be used
+to change either the static or the shared library name.
+
+ Library('foo')
+ STATIC_LIBRARY_NAME = 'foo_s'
+
+With the above, on Windows, ``foo_s.lib`` will be the static library,
+``foo.dll`` the shared library, and ``foo.lib`` the import library.
+
+In some cases, for convenience, it is possible to set both
+``STATIC_LIBRARY_NAME`` and ``SHARED_LIBRARY_NAME``. For example:
+
+ Library('mylib')
+ STATIC_LIBRARY_NAME = 'mylib_s'
+ SHARED_LIBRARY_NAME = CONFIG['SHARED_NAME']
+
+This allows to use ``mylib`` in the ``USE_LIBS`` of another library or
+executable.
+
+When refering to a ``Library`` name building both types of libraries in
+``USE_LIBS``, the shared library is chosen to be linked. But sometimes,
+it is wanted to link the static version, in which case the ``Library`` name
+needs to be prefixed with ``static:`` in ``USE_LIBS``
+
+ a/moz.build:
+ Library('mylib')
+ FORCE_SHARED_LIB = True
+ FORCE_STATIC_LIB = True
+ STATIC_LIBRARY_NAME = 'mylib_s'
+ b/moz.build:
+ Program('myprog')
+ USE_LIBS += [
+ 'static:mylib',
+ ]
+
+
+Miscellaneous
+=============
+
+The ``SDK_LIBRARY`` boolean variable defines whether the library in the current
+directory is going to be installed in the SDK.
+
+The ``SONAME`` variable declares a "shared object name" for the library. It
+defaults to the ``Library`` name or the ``SHARED_LIBRARY_NAME`` if set. When
+linking to a library with a ``SONAME``, the resulting library or program will
+have a dependency on the library with the name corresponding to the ``SONAME``
+instead of the ``Library`` name. This only impacts ELF systems.
+
+ a/moz.build:
+ Library('mylib')
+ b/moz.build:
+ Library('otherlib')
+ SONAME = 'foo'
+ c/moz.build:
+ Program('myprog')
+ USE_LIBS += [
+ 'mylib',
+ 'otherlib',
+ ]
+
+On e.g. Linux, the above ``myprog`` will have DT_NEEDED markers for
+``libmylib.so`` and ``libfoo.so`` instead of ``libmylib.so`` and
+``libotherlib.so`` if there weren't a ``SONAME``. This means the runtime
+requirement for ``myprog`` is ``libfoo.so`` instead of ``libotherlib.so``.
+
+
+Goanna-related binaries
+======================
+
+Some programs or libraries are totally independent of Goanna, and can use the
+above mentioned templates. Others are Goanna-related in some way, and may
+need XPCOM linkage, mozglue. These things are tedious. A set of additional
+templates exists to ease defining such programs and libraries. They are
+essentially the same as the above mentioned templates, prefixed with "Goanna":
+
+ - ``GoannaProgram``
+ - ``GoannaSimplePrograms``
+ - ``GoannaCppUnitTests``
+ - ``GoannaSharedLibrary``
+ - ``GoannaFramework``
+
+There is also ``XPCOMBinaryComponent`` for XPCOM components, which is a
+special kind of library.
+
+All the Goanna-prefixed templates take the same arguments as their
+non-Goanna-prefixed counterparts, and can take a few more arguments
+for non-standard cases. See the definition of ``GoannaBinary`` in
+build/goanna_templates.mozbuild for more details, but most usecases
+should not require these additional arguments.
diff --git a/build/docs/environment-variables.rst b/build/docs/environment-variables.rst
new file mode 100644
index 000000000..c46339159
--- /dev/null
+++ b/build/docs/environment-variables.rst
@@ -0,0 +1,31 @@
+.. _environment_variables:
+
+================================================
+Environment Variables Impacting the Build System
+================================================
+
+Various environment variables have an impact on the behavior of the
+build system. This document attempts to document them.
+
+AUTOCLOBBER
+ If defines, the build system will automatically clobber as needed.
+ The default behavior is to print a message and error out when a
+ clobber is needed.
+
+ This variable is typically defined in a :ref:`mozconfig <mozconfig>`
+ file via ``mk_add_options``.
+
+REBUILD_CHECK
+ If defined, the build system will print information about why
+ certain files were rebuilt.
+
+ This feature is disabled by default because it makes the build slower.
+
+MACH_NO_TERMINAL_FOOTER
+ If defined, the terminal footer displayed when building with mach in
+ a TTY is disabled.
+
+MACH_NO_WRITE_TIMES
+ If defined, mach commands will not prefix output lines with the
+ elapsed time since program start. This option is equivalent to
+ passing ``--log-no-times`` to mach.
diff --git a/build/docs/glossary.rst b/build/docs/glossary.rst
new file mode 100644
index 000000000..f846effe5
--- /dev/null
+++ b/build/docs/glossary.rst
@@ -0,0 +1,48 @@
+========
+Glossary
+========
+
+.. glossary::
+ :sorted:
+
+ object directory
+ A directory holding the output of the build system. The build
+ system attempts to isolate all file modifications to this
+ directory. By convention, object directories are commonly
+ directories under the source directory prefixed with **obj-**.
+ e.g. **obj-firefox**.
+
+ mozconfig
+ A shell script used to configure the build system.
+
+ configure
+ A generated shell script which detects the current system
+ environment, applies a requested set of build configuration
+ options, and writes out metadata to be consumed by the build
+ system.
+
+ config.status
+ An executable file produced by **configure** that takes the
+ generated build config and writes out files used to build the
+ tree. Traditionally, config.status writes out a bunch of
+ Makefiles.
+
+ install manifest
+ A file containing metadata describing file installation rules.
+ A large part of the build system consists of copying files
+ around to appropriate places. We write out special files
+ describing the set of required operations so we can process the
+ actions effeciently. These files are install manifests.
+
+ clobber build
+ A build performed with an initially empty object directory. All
+ build actions must be performed.
+
+ incremental build
+ A build performed with the result of a previous build in an
+ object directory. The build should not have to work as hard because
+ it will be able to reuse the work from previous builds.
+
+ mozinfo
+ An API for accessing a common and limited subset of the build and
+ run-time configuration. See :ref:`mozinfo`.
diff --git a/build/docs/index.rst b/build/docs/index.rst
new file mode 100644
index 000000000..96b50745a
--- /dev/null
+++ b/build/docs/index.rst
@@ -0,0 +1,46 @@
+============
+Build System
+============
+
+Important Concepts
+==================
+.. toctree::
+ :maxdepth: 1
+
+ glossary
+ build-overview
+ supported-configurations
+ Mozconfig Files <mozconfigs>
+ mozbuild-files
+ mozbuild-symbols
+ Profile Guided Optimization <pgo>
+ slow
+ environment-variables
+ build-targets
+ python
+ test_manifests
+ mozinfo
+ preprocessor
+ jar-manifests
+ defining-binaries
+
+integrated development environment (IDE)
+========================================
+.. toctree::
+ :maxdepth: 1
+
+ androideclipse
+ cppeclipse
+ visualstudio
+
+mozbuild
+========
+
+mozbuild is a Python package containing a lot of the code for the
+Mozilla build system.
+
+.. toctree::
+ :maxdepth: 1
+
+ mozbuild/index
+ mozbuild/dumbmake
diff --git a/build/docs/jar-manifests.rst b/build/docs/jar-manifests.rst
new file mode 100644
index 000000000..230d9539a
--- /dev/null
+++ b/build/docs/jar-manifests.rst
@@ -0,0 +1,81 @@
+.. _jar_manifests:
+
+=============
+JAR Manifests
+=============
+
+JAR Manifests are plaintext files in the tree that are used to package chrome
+files into the correct JARs, and create
+`Chrome Registration <https://developer.mozilla.org/en-US/docs/Chrome_Registration>`_
+manifests. JAR Manifests are commonly named ``jar.mn``. They are
+declared in ``moz.build`` files using the ``JAR_MANIFESTS`` variable.
+
+``jar.mn`` files are automatically processed by the build system when building a
+source directory that contains one. The ``jar``.mn is run through the
+:ref:`preprocessor` before being passed to the manifest processor. In order to
+have ``@variables@`` expanded (such as ``@AB_CD@``) throughout the file, add
+the line ``#filter substitution`` at the top of your ``jar.mn`` file.
+
+The format of a jar.mn is fairly simple; it consists of a heading specifying
+which JAR file is being packaged, followed by indented lines listing files and
+chrome registration instructions.
+
+To see a simple ``jar.mn`` file at work, see ``toolkit/profile/jar.mn``. A much
+more complex ``jar.mn`` is at ``toolkit/locales/jar.mn``.
+
+Shipping Chrome Files
+=====================
+
+To ship chrome files in a JAR, an indented line indicates a file to be packaged::
+
+ <jarfile>.jar:
+ path/in/jar/file_name.xul (source/tree/location/file_name.xul)
+
+The source tree location may also be an *absolute* path (taken from the
+top of the source tree::
+
+ path/in/jar/file_name.xul (/path/in/sourcetree/file_name.xul)
+
+An asterisk marker (``*``) at the beginning of the line indicates that the
+file should be processed by the :ref:`preprocessor` before being packaged::
+
+ * path/in/jar/preprocessed.xul (source/tree/location/file_name.xul)
+
+A plus marker (``+``) at the beginning of the line indicates that the file
+should replace an existing file, even if the source file's timestamp isn't
+newer than the existing file::
+
+ + path/in/jar/file_name.xul (source/tree/location/my_file_name.xul)
+
+Preprocessed files always replace existing files, to ensure that changes in
+``#expand`` or ``#include`` directives are picked up, so ``+`` and ``*`` are
+equivalent.
+
+There is a special source-directory format for localized files (note the
+percent sign in the source file location): this format reads ``localized.dtd``
+from the ``en-US`` directory if building an English version, and reads the
+file from the alternate localization source tree
+``/l10n/<locale>/path/localized.dtd`` if building a localized version::
+
+ locale/path/localized.dtd (%localized/path/localized.dtd)
+
+Register Chrome
+===============
+
+`Chrome Registration <https://developer.mozilla.org/en-US/docs/Chrome_Registration>`_
+instructions are marked with a percent sign (``%``) at the beginning of the
+line, and must be part of the definition of a JAR file. Any additional percents
+signs are replaced with an appropriate relative URL of the JAR file being
+packaged::
+
+ % content global %path/in/jar/
+ % overlay chrome://blah/content/blah.xul chrome://foo/content/overlay.xul
+
+There are two possible locations for a manifest file. If the chrome is being
+built into a standalone application, the ``jar.mn`` processor creates a
+``<jarfilename>.manifest`` next to the JAR file itself. This is the default
+behavior.
+
+If the build specifies ``USE_EXTENSION_MANIFEST = 1``, the ``jar.mn`` processor
+creates a single ``chrome.manifest`` file suitable for registering chrome as
+an extension.
diff --git a/build/docs/mozbuild-files.rst b/build/docs/mozbuild-files.rst
new file mode 100644
index 000000000..a1cba0106
--- /dev/null
+++ b/build/docs/mozbuild-files.rst
@@ -0,0 +1,116 @@
+.. _mozbuild-files:
+
+===============
+moz.build Files
+===============
+
+``moz.build`` files are the mechanism by which tree metadata (notably
+the build configuration) is defined.
+
+Directories in the tree contain ``moz.build`` files which declare
+functionality for their respective part of the tree. This includes
+things such as the list of C++ files to compile, where to find tests,
+etc.
+
+``moz.build`` files are actually Python scripts. However, their
+execution is governed by special rules. This is explained below.
+
+moz.build Python Sandbox
+========================
+
+As mentioned above, ``moz.build`` files are Python scripts. However,
+they are executed in a special Python *sandbox* that significantly
+changes and limits the execution environment. The environment is so
+different, it's doubtful most ``moz.build`` files would execute without
+error if executed by a vanilla Python interpreter (e.g. ``python
+moz.build``.
+
+The following properties make execution of ``moz.build`` files special:
+
+1. The execution environment exposes a limited subset of Python.
+2. There is a special set of global symbols and an enforced naming
+ convention of symbols.
+
+The limited subset of Python is actually an extremely limited subset.
+Only a few symbols from ``__builtins__`` are exposed. These include
+``True``, ``False``, and ``None``. Global functions like ``import``,
+``print``, and ``open`` aren't available. Without these, ``moz.build``
+files can do very little. *This is by design*.
+
+The execution sandbox treats all ``UPPERCASE`` variables specially. Any
+``UPPERCASE`` variable must be known to the sandbox before the script
+executes. Any attempt to read or write to an unknown ``UPPERCASE``
+variable will result in an exception being raised. Furthermore, the
+types of all ``UPPERCASE`` variables is strictly enforced. Attempts to
+assign an incompatible type to an ``UPPERCASE`` variable will result in
+an exception being raised.
+
+The strictness of behavior with ``UPPERCASE`` variables is a very
+intentional design decision. By ensuring strict behavior, any operation
+involving an ``UPPERCASE`` variable is guaranteed to have well-defined
+side-effects. Previously, when the build configuration was defined in
+``Makefiles``, assignments to variables that did nothing would go
+unnoticed. ``moz.build`` files fix this problem by eliminating the
+potential for false promises.
+
+After a ``moz.build`` file has completed execution, only the
+``UPPERCASE`` variables are used to retrieve state.
+
+The set of variables and functions available to the Python sandbox is
+defined by the :py:mod:`mozbuild.frontend.context` module. The
+data structures in this module are consumed by the
+:py:class:`mozbuild.frontend.reader.MozbuildSandbox` class to construct
+the sandbox. There are tests to ensure that the set of symbols exposed
+to an empty sandbox are all defined in the ``context`` module.
+This module also contains documentation for each symbol, so nothing can
+sneak into the sandbox without being explicitly defined and documented.
+
+Reading and Traversing moz.build Files
+======================================
+
+The process responsible for reading ``moz.build`` files simply starts at
+a root ``moz.build`` file, processes it, emits the globals namespace to
+a consumer, and then proceeds to process additional referenced
+``moz.build`` files from the original file. The consumer then examines
+the globals/``UPPERCASE`` variables set as part of execution and then
+converts the data therein to Python class instances.
+
+The executed Python sandbox is essentially represented as a dictionary
+of all the special ``UPPERCASE`` variables populated during its
+execution.
+
+The code for reading ``moz.build`` files lives in
+:py:mod:`mozbuild.frontend.reader`. The Python sandboxes evaluation results
+(:py:class:`mozbuild.frontend.context.Context`) are passed into
+:py:mod:`mozbuild.frontend.emitter`, which converts them to classes defined
+in :py:mod:`mozbuild.frontend.data`. Each class in this module defines a
+domain-specific component of tree metdata. e.g. there will be separate
+classes that represent a JavaScript file vs a compiled C++ file or test
+manifests. This means downstream consumers of this data can filter on class
+types to only consume what they are interested in.
+
+There is no well-defined mapping between ``moz.build`` file instances
+and the number of :py:mod:`mozbuild.frontend.data` classes derived from
+each. Depending on the content of the ``moz.build`` file, there may be 1
+object derived or 100.
+
+The purpose of the ``emitter`` layer between low-level sandbox execution
+and metadata representation is to facilitate a unified normalization and
+verification step. There are multiple downstream consumers of the
+``moz.build``-derived data and many will perform the same actions. This
+logic can be complicated, so we have a component dedicated to it.
+
+Other Notes
+===========
+
+:py:class:`mozbuild.frontend.reader.BuildReader`` and
+:py:class:`mozbuild.frontend.reader.TreeMetadataEmitter`` have a
+stream-based API courtesy of generators. When you hook them up properly,
+the :py:mod:`mozbuild.frontend.data` classes are emitted before all
+``moz.build`` files have been read. This means that downstream errors
+are raised soon after sandbox execution.
+
+Lots of the code for evaluating Python sandboxes is applicable to
+non-Mozilla systems. In theory, it could be extracted into a standalone
+and generic package. However, until there is a need, there will
+likely be some tightly coupled bits.
diff --git a/build/docs/mozbuild-symbols.rst b/build/docs/mozbuild-symbols.rst
new file mode 100644
index 000000000..4e9a8853a
--- /dev/null
+++ b/build/docs/mozbuild-symbols.rst
@@ -0,0 +1,7 @@
+.. _mozbuild_symbols:
+
+========================
+mozbuild Sandbox Symbols
+========================
+
+.. mozbuildsymbols:: mozbuild.frontend.context
diff --git a/build/docs/mozbuild/dumbmake.rst b/build/docs/mozbuild/dumbmake.rst
new file mode 100644
index 000000000..7840695ad
--- /dev/null
+++ b/build/docs/mozbuild/dumbmake.rst
@@ -0,0 +1,38 @@
+dumbmake
+========
+
+*dumbmake* is a simple dependency tracker for make.
+
+It turns lists of make targets into longer lists of make targets that
+include dependencies. For example:
+
+ netwerk, package
+
+might be turned into
+
+ netwerk, netwerk/build, toolkit/library, package
+
+The dependency list is read from the plain text file
+`topsrcdir/build/dumbmake-dependencies`. The format best described by
+example:
+
+ build_this
+ when_this_changes
+
+Interpret this to mean that `build_this` is a dependency of
+`when_this_changes`. More formally, a line (CHILD) indented more than
+the preceding line (PARENT) means that CHILD should trigger building
+PARENT. That is, building CHILD will trigger building first CHILD and
+then PARENT.
+
+This structure is recursive:
+
+ build_this_when_either_change
+ build_this_only_when
+ this_changes
+
+This means that `build_this_when_either_change` is a dependency of
+`build_this_only_when` and `this_changes`, and `build_this_only_when`
+is a dependency of `this_changes`. Building `this_changes` will build
+first `this_changes`, then `build_this_only_when`, and finally
+`build_this_when_either_change`.
diff --git a/build/docs/mozbuild/index.rst b/build/docs/mozbuild/index.rst
new file mode 100644
index 000000000..86f38940b
--- /dev/null
+++ b/build/docs/mozbuild/index.rst
@@ -0,0 +1,41 @@
+========
+mozbuild
+========
+
+mozbuild is a Python package providing functionality used by Mozilla's
+build system.
+
+Modules Overview
+================
+
+* mozbuild.backend -- Functionality for producing and interacting with build
+ backends. A build backend is an entity that consumes build system metadata
+ (from mozbuild.frontend) and does something useful with it (typically writing
+ out files that can be used by a build tool to build the tree).
+* mozbuild.compilation -- Functionality related to compiling. This
+ includes managing compiler warnings.
+* mozbuild.frontend -- Functionality for reading build frontend files
+ (what defines the build system) and converting them to data structures
+ which are fed into build backends to produce backend configurations.
+* mozpack -- Functionality related to packaging builds.
+
+Overview
+========
+
+The build system consists of frontend files that define what to do. They
+say things like "compile X" "copy Y."
+
+The mozbuild.frontend package contains code for reading these frontend
+files and converting them to static data structures. The set of produced
+static data structures for the tree constitute the current build
+configuration.
+
+There exist entities called build backends. From a high level, build
+backends consume the build configuration and do something with it. They
+typically produce tool-specific files such as make files which can be used
+to build the tree.
+
+Piecing it all together, we have frontend files that are parsed into data
+structures. These data structures are fed into a build backend. The output
+from build backends is used by builders to build the tree.
+
diff --git a/build/docs/mozconfigs.rst b/build/docs/mozconfigs.rst
new file mode 100644
index 000000000..1befca9ec
--- /dev/null
+++ b/build/docs/mozconfigs.rst
@@ -0,0 +1,70 @@
+.. _mozconfig:
+
+===============
+mozconfig Files
+===============
+
+mozconfig files are used to configure how a build works.
+
+mozconfig files are actually shell scripts. They are executed in a
+special context with specific variables and functions exposed to them.
+
+API
+===
+
+Functions
+---------
+
+The following special functions are available to a mozconfig script.
+
+ac_add_options
+^^^^^^^^^^^^^^
+
+This function is used to declare extra options/arguments to pass into
+configure.
+
+e.g.::
+
+ ac_add_options --disable-tests
+ ac_add_options --enable-optimize
+
+mk_add_options
+^^^^^^^^^^^^^^
+
+This function is used to inject statements into client.mk for execution.
+It is typically used to define variables, notably the object directory.
+
+e.g.::
+
+ mk_add_options AUTOCLOBBER=1
+
+ac_add_options
+^^^^^^^^^^^^^^
+
+This is a variant of ac_add_options() which only adds configure options
+for a specified application. This is only used when building multiple
+applications through client.mk. This function is typically not needed.
+
+Special mk_add_options Variables
+--------------------------------
+
+For historical reasons, the method for communicating certain
+well-defined variables is via mk_add_options(). In this section, we
+document what those special variables are.
+
+MOZ_OBJDIR
+^^^^^^^^^^
+
+This variable is used to define the :term:`object directory` for the current
+build.
+
+Finding the active mozconfig
+============================
+
+Multiple mozconfig files can exist to provide different configuration
+options for different tasks. The rules for finding the active mozconfig
+are defined in the
+:py:func:`mozbuild.mozconfig.MozconfigLoader.find_mozconfig` method:
+
+.. autoclass:: mozbuild.mozconfig.MozconfigLoader
+ :members: find_mozconfig
diff --git a/build/docs/mozinfo.rst b/build/docs/mozinfo.rst
new file mode 100644
index 000000000..991581126
--- /dev/null
+++ b/build/docs/mozinfo.rst
@@ -0,0 +1,148 @@
+.. _mozinfo:
+
+=======
+mozinfo
+=======
+
+``mozinfo`` is a solution for representing a subset of build
+configuration and run-time data.
+
+``mozinfo`` data is typically accessed through a ``mozinfo.json`` file
+which is written to the :term:`object directory` during build
+configuration. The code for writing this file lives in
+:py:mod:`mozbuild.mozinfo`.
+
+``mozinfo.json`` is an object/dictionary of simple string values.
+
+The attributes in ``mozinfo.json`` are used for many purposes. One use
+is to filter tests for applicability to the current build. For more on
+this, see :ref:`test_manifests`.
+
+.. _mozinfo_attributes:
+
+mozinfo.json Attributes
+=================================
+
+``mozinfo`` currently records the following attributes.
+
+appname
+ The application being built.
+
+ Value comes from ``MOZ_APP_NAME`` from ``config.status``.
+
+ Optional.
+
+asan
+ Whether address sanitization is enabled.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
+
+bin_suffix
+ The file suffix for binaries produced with this build.
+
+ Values may be an empty string, as not all platforms have a binary
+ suffix.
+
+ Always defined.
+
+bits
+ The number of bits in the CPU this build targets.
+
+ Values are typically ``32`` or ``64``.
+
+ Universal Mac builds do not have this key defined.
+
+ Unkown processor architectures (see ``processor`` below) may not have
+ this key defined.
+
+ Optional.
+
+buildapp
+ The path to the XUL application being built.
+
+ For desktop Firefox, this is ``browser``. For Fennec, it's
+ ``mobile/android``. For B2G, it's ``b2g``.
+
+datareporting
+ Whether data reporting (MOZ_DATA_REPORTING) is enabled for this build.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
+
+debug
+ Whether this is a debug build.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
+
+healthreport
+ Whether the Health Report feature is enabled.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
+
+mozconfig
+ The path of the :ref:`mozconfig file <mozconfig>` used to produce this build.
+
+ Optional.
+
+os
+ The operating system the build is produced for. Values for tier-1
+ supported platforms are ``linux``, ``win``, ``mac``, ``b2g``, and
+ ``android``. For other platforms, the value is the lowercase version
+ of the ``OS_TARGET`` variable from ``config.status``.
+
+ Always defined.
+
+processor
+ Information about the processor architecture this build targets.
+
+ Values come from ``TARGET_CPU``, however some massaging may be
+ performed.
+
+ If the build is a universal build on Mac (it targets both 32-bit and
+ 64-bit), the value is ``universal-x86-x86_64``.
+
+ If the value starts with ``arm``, the value is ``arm``.
+
+ If the value starts with a string of the form ``i[3-9]86]``, the
+ value is ``x86``.
+
+ Always defined.
+
+tests_enabled
+ Whether tests are enabled for this build.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
+
+toolkit
+ The widget toolkit in case. The value comes from the
+ ``MOZ_WIDGET_TOOLKIT`` ``config.status`` variable.
+
+ Always defined.
+
+topsrcdir
+ The path to the source directory the build came from.
+
+ Always defined.
+
+wave
+ Whether Wave audio support is enabled.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
+
+webm
+ Whether WebM support is enabled.
+
+ Values are ``true`` and ``false``.
+
+ Always defined.
diff --git a/build/docs/pgo.rst b/build/docs/pgo.rst
new file mode 100644
index 000000000..51d03c625
--- /dev/null
+++ b/build/docs/pgo.rst
@@ -0,0 +1,40 @@
+.. _pgo:
+
+===========================
+Profile Guided Optimization
+===========================
+
+:abbr:`PGO (Profile Guided Optimization)` is the process of adding
+probes to a compiled binary, running said binary, then using the
+run-time information to *recompile* the binary to (hopefully) make it
+faster.
+
+How PGO Builds Work
+===================
+
+The supported interface for invoking a PGO build is to evaluate the
+*build* target of client.mk with *MOZ_PGO* defined. e.g.::
+
+ $ make -f client.mk MOZ_PGO=1
+
+This is equivalent to::
+
+ $ make -f client.mk profiledbuild
+
+Which is roughly equivalent to:
+
+#. Perform a build with *MOZ_PROFILE_GENERATE=1* and *MOZ_PGO_INSTRUMENTED=1*
+#. Package with *MOZ_PGO_INSTRUMENTED=1*
+#. Performing a run of the instrumented binaries
+#. $ make maybe_clobber_profiledbuild
+#. Perform a build with *MOZ_PROFILE_USE=1*
+
+Differences between toolchains
+==============================
+
+There are some implementation differences depending on the compiler
+toolchain being used.
+
+The *maybe_clobber_profiledbuild* step gets its name because of a
+difference. On Windows, this step merely moves some *.pgc* files around.
+Using GCC or Clang, it is equivalent to a *make clean*.
diff --git a/build/docs/preprocessor.rst b/build/docs/preprocessor.rst
new file mode 100644
index 000000000..95a5f7cd7
--- /dev/null
+++ b/build/docs/preprocessor.rst
@@ -0,0 +1,244 @@
+.. _preprocessor:
+
+=================
+Text Preprocessor
+=================
+
+The build system contains a text preprocessor similar to the C preprocessor,
+meant for processing files which have no built-in preprocessor such as XUL
+and JavaScript documents. It is implemented at ``python/mozbuild/mozbuild/preprocessor.py`` and
+is typically invoked via :ref:`jar_manifests`.
+
+While used to preprocess CSS files, the directives are changed to begin with
+``%`` instead of ``#`` to avoid conflict of the id selectors.
+
+Directives
+==========
+
+Variable Definition
+-------------------
+
+define
+^^^^^^
+
+::
+
+ #define variable
+ #define variable value
+
+Defines a preprocessor variable.
+
+Note that, unlike the C preprocessor, instances of this variable later in the
+source are not automatically replaced (see #filter). If value is not supplied,
+it defaults to ``1``.
+
+Note that whitespace is significant, so ``"#define foo one"`` and
+``"#define foo one "`` is different (in the second case, ``foo`` is defined to
+be a four-character string).
+
+undef
+^^^^^
+
+::
+
+ #undef variable
+
+Undefines a preprocessor variable.
+
+Conditionals
+------------
+
+if
+^^
+
+::
+
+ #if variable
+ #if !variable
+ #if variable==string
+ #if variable!=string
+
+Disables output if the conditional is false. This can be nested to arbitrary
+depths. Note that in the equality checks, the variable must come first, and
+the comparison operator must not be surrounded by any whitespace.
+
+else
+^^^^
+
+::
+
+ #else
+
+Reverses the state of the previous conditional block; for example, if the
+last ``#if`` was true (output was enabled), an ``#else`` makes it off
+(output gets disabled).
+
+.. warning:: An ``#else`` is relative to the last conditional block only,
+ unlike the C preprocessor.
+
+ It does not matter whether any blocks before it were true. This behavior
+ changed on trunk (Goanna 1.9) on 2006-12-07; see Bug 277122 for details.
+
+::
+
+ #if 1
+ always included
+ #elif 1
+ never included
+ #else
+ always included
+ #endif
+
+endif
+^^^^^
+
+::
+
+ #endif
+
+Ends the conditional block.
+
+ifdef / ifndef
+^^^^^^^^^^^^^^
+
+::
+
+ #ifdef variable
+ #ifndef variable
+
+An ``#if`` conditional that is true only if the preprocessor variable
+variable is defined (in the case of ``ifdef``) or not defined (``ifndef``).
+
+elif / elifdef / elifndef
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+::
+
+ #elif variable
+ #elif !variable
+ #elif variable == string
+ #elif variable != string
+ #elifdef variable
+ #elifndef variable
+
+A shorthand to mean an ``#else`` combined with the relevant conditional.
+The following two blocks are equivalent::
+
+ #ifdef foo
+ block 1
+ #elifdef bar
+ block 2
+ #endif
+
+::
+
+ #ifdef foo
+ block 1
+ #else
+ #ifdef bar
+ block 2
+ #endif
+ #endif
+
+.. warning:: An ``#elif``, ``#elifdef``, or ``#elifndef`` is relative to
+ the last conditional block only (as well as the condition it implies),
+ unlike the C preprocessor. It does not matter whether any blocks before
+ it were true. This behavior changed on trunk (Goanna 1.9) on 2006-12-07.
+ See Bug 277122 for details.
+
+File Inclusion
+--------------
+
+include
+^^^^^^^
+
+::
+
+ #include filename
+
+The file specified by filename is processed as if the contents was placed
+at this position. This also means that preprocessor conditionals can even
+be started in one file and ended in another (but is highly discouraged).
+There is no limit on depth of inclusion, or repeated inclusion of the same
+file, or self inclusion; thus, care should be taken to avoid infinite loops.
+
+includesubst
+^^^^^^^^^^^^
+
+::
+
+ #includesubst @variable@filename
+
+Same as a ``#include`` except that all instances of variable in the included
+file is also expanded as in ``#filter`` substitution
+
+expand
+^^^^^^
+
+::
+
+ #expand string
+
+All variables wrapped in ``__`` are replaced with their value, for this line
+only. If the variable is not defined, it expands to an empty string. For
+example, if ``foo`` has the value ``bar``, and ``baz`` is not defined, then::
+
+ #expand This <__foo__> <__baz__> gets expanded
+
+Is expanded to::
+
+ This <bar> <> gets expanded
+
+filter / unfilter
+^^^^^^^^^^^^^^^^^
+
+::
+
+ #filter filter1 filter2 ... filterN
+ #unfilter filter1 filter2 ... filterN
+
+``#filter`` turns on the given filter.
+
+Filters are run in alphabetical order on a per-line basis.
+
+``#unfilter`` turns off the given filter. Available filters are:
+
+emptyLines
+ strips blank lines from the output
+slashslash
+ strips everything from the first two consecutive slash (``/``)
+ characters until the end of the line
+spaces
+ collapses consecutive sequences of spaces into a single space,
+ and strips leading and trailing spaces
+substitution
+ all variables wrapped in @ are replaced with their value. If the
+ variable is not defined, it is a fatal error. Similar to ``#expand``
+ and ``#filter``
+attemptSubstitution
+ all variables wrapped in ``@`` are replaced with their value, or an
+ empty string if the variable is not defined. Similar to ``#expand``.
+
+literal
+^^^^^^^
+
+::
+
+ #literal string
+
+Output the string (i.e. the rest of the line) literally, with no other fixups.
+This is useful to output lines starting with ``#``, or to temporarily
+disable filters.
+
+Other
+-----
+
+#error
+^^^^^^
+
+::
+
+ #error string
+
+Cause a fatal error at this point, with the error message being the
+given string.
diff --git a/build/docs/python.rst b/build/docs/python.rst
new file mode 100644
index 000000000..098541706
--- /dev/null
+++ b/build/docs/python.rst
@@ -0,0 +1,178 @@
+.. _python:
+
+===========================
+Python and the Build System
+===========================
+
+The Python programming language is used significantly in the build
+system. If we need to write code for the build system or for a tool
+related to the build system, Python is typically the first choice.
+
+Python Requirements
+===================
+
+The tree requires Python 2.7.3 or greater but not Python 3 to build.
+All Python packages not in the Python distribution are included in the
+source tree. So all you should need is a vanilla Python install and you
+should be good to go.
+
+Only CPython (the Python distribution available from www.python.org) is
+supported.
+
+We require Python 2.7.3 (and not say 2.7.2) to build because Python
+2.7.3 contains numerous bug fixes, especially around the area of Unicode
+handling. These bug fixes are extremely annoying and have to be worked
+around. The build maintainers were tired of doing this, so the minimum
+version requirement was upped (bug 870420).
+
+We intend to eventually support Python 3. This will come by way of dual
+2.7/3.x compatibility because a single flag day conversion to 3.x will
+be too cumbersome given the amount of Python that would need converted.
+We will not know which 3.x minor release we are targeting until this
+effort is underway. This is tracked in bug 636155.
+
+Compiled Python Packages
+========================
+
+There are some features of the build that rely on compiled Python packages
+(packages containing C source). These features are currently all
+optional because not every system contains the Python development
+headers required to build these extensions.
+
+We recommend you have the Python development headers installed (``mach
+bootstrap`` should do this for you) so you can take advantage of these
+features.
+
+Issues with OS X System Python
+==============================
+
+The Python that ships with OS X has historically been littered with
+subtle bugs and suboptimalities. Furthermore, OS X up through 10.8 don't
+ship with Python 2.7.3 (10.8 ships with 2.7.2).
+
+OS X 10.8 and below users will be required to install a new Python
+distribution. This may not be necessary for OS X 10.9+. However, we
+still recommend installing a separate Python because of the history with
+OS X's system Python issues.
+
+We recommend installing Python through Homebrew or MacPorts. If you run
+``mach bootstrap``, this should be done for you.
+
+Virtualenvs
+===========
+
+The build system relies heavily on
+`virtualenvs <http://www.virtualenv.org/en/latest/>`_. Virtualenvs are
+standalone and isolated Python environments. The problem a virtualenv
+solves is that of dependencies across multiple Python components. If two
+components on a system relied on different versions of a package, there
+could be a conflict. Instead of managing multiple versions of a package
+simultaneously, Python and virtualenvs take the route that it is easier
+to just keep them separate so there is no potential for conflicts.
+
+Very early in the build process, a virtualenv is created inside the
+:term:`object directory`. The virtualenv is configured such that it can
+find all the Python packages in the source tree. The code for this lives
+in :py:mod:`mozbuild.virtualenv`.
+
+Deficiencies
+------------
+
+There are numerous deficiencies with the way virtualenvs are handled in
+the build system.
+
+* mach reinvents the virtualenv.
+
+ There is code in ``build/mach_bootstrap.py`` that configures ``sys.path``
+ much the same way the virtualenv does. There are various bugs tracking
+ this. However, no clear solution has yet been devised. It's not a huge
+ problem and thus not a huge priority.
+
+* They aren't preserved across copies and packaging.
+
+ If you attempt to copy an entire tree from one machine to another or
+ from one directory to another, chances are the virtualenv will fall
+ apart. It would be nice if we could preserve it somehow. Instead of
+ actually solving portable virtualenvs, all we really need to solve is
+ encapsulating the logic for populating the virtualenv along with all
+ dependent files in the appropriate place.
+
+* .pyc files written to source directory.
+
+ We rely heavily on ``.pth`` files in our virtualenv. A ``.pth`` file
+ is a special file that contains a list of paths. Python will take the
+ set of listed paths encountered in ``.pth`` files and add them to
+ ``sys.path``.
+
+ When Python compiles a ``.py`` file to bytecode, it writes out a
+ ``.pyc`` file so it doesn't have to perform this compilation again.
+ It puts these ``.pyc`` files alongside the ``.pyc`` file. Python
+ provides very little control for determing where these ``.pyc`` files
+ go, even in Python 3 (which offers customer importers).
+
+ With ``.pth`` files pointing back to directories in the source tree
+ and not the object directory, ``.pyc`` files are created in the source
+ tree. This is bad because when Python imports a module, it first looks
+ for a ``.pyc`` file before the ``.py`` file. If there is a ``.pyc``
+ file but no ``.py`` file, it will happily import the module. This
+ wreaks havoc during file moves, refactoring, etc.
+
+ There are various proposals for fixing this. See bug 795995.
+
+Installing Python Manually
+==========================
+
+We highly recommend you use your system's package manager or a
+well-supported 3rd party package manager to install Python for you. If
+these are not available to you, we recommend the following tools for
+installing Python:
+
+* `buildout.python <https://github.com/collective/buildout.python>`_
+* `pyenv <https://github.com/yyuu/pyenv>`_
+* An official installer from http://www.python.org.
+
+If all else fails, consider compiling Python from source manually. But this
+should be viewed as the least desirable option.
+
+Common Issues with Python
+=========================
+
+Upgrading your Python distribution breaks the virtualenv
+--------------------------------------------------------
+
+If you upgrade the Python distribution (e.g. install Python 2.7.5
+from 2.7.3, chances are parts of the virtualenv will break.
+This commonly manifests as a cryptic ``Cannot import XXX`` exception.
+More often than not, the module being imported contains binary/compiled
+components.
+
+If you upgrade or reinstall your Python distribution, we recommend
+clobbering your build.
+
+Packages installed at the system level conflict with build system's
+-------------------------------------------------------------------
+
+It is common for people to install Python packages using ``sudo`` (e.g.
+``sudo pip install psutil``) or with the system's package manager
+(e.g. ``apt-get install python-mysql``.
+
+A problem with this is that packages installed at the system level may
+conflict with the package provided by the source tree. As of bug 907902
+and changeset f18eae7c3b27 (September 16, 2013), this should no longer
+be an issue since the virtualenv created as part of the build doesn't
+add the system's ``site-packages`` directory to ``sys.path``. However,
+poorly installed packages may still find a way to creep into the mix and
+interfere with our virtualenv.
+
+As a general principle, we recommend against using your system's package
+manager or using ``sudo`` to install Python packages. Instead, create
+virtualenvs and isolated Python environments for all of your Python
+projects.
+
+Python on $PATH is not appropriate
+----------------------------------
+
+Tools like ``mach`` will look for Python by performing ``/usr/bin/env
+python`` or equivalent. Please be sure the appropriate Python 2.7.3+
+path is on $PATH. On OS X, this likely means you'll need to modify your
+shell's init script to put something ahead of ``/usr/bin``.
diff --git a/build/docs/slow.rst b/build/docs/slow.rst
new file mode 100644
index 000000000..546fe26ce
--- /dev/null
+++ b/build/docs/slow.rst
@@ -0,0 +1,179 @@
+.. _slow:
+
+============================
+Why the Build System is Slow
+============================
+
+A common complaint about the build system is that it's slow. There are
+many reasons contributing to its slowness. We will attempt to document
+them here.
+
+First, it is important to distinguish between a :term:`clobber build`
+and an :term:`incremental build`. The reasons for why each are slow can
+be different.
+
+The build does a lot of work
+============================
+
+It may not be obvious, but the main reason the build system is slow is
+because it does a lot of work! The source tree consists of a few
+thousand C++ files. On a modern machine, we spend over 120 minutes of CPU
+core time compiling files! So, if you are looking for the root cause of
+slow clobber builds, look at the sheer volume of C++ files in the tree.
+
+You don't have enough CPU cores and MHz
+=======================================
+
+The build should be CPU bound. If the build system maintainers are
+optimizing the build system perfectly, every CPU core in your machine
+should be 100% saturated during a build. While this isn't currently the
+case (keep reading below), generally speaking, the more CPU cores you
+have in your machine and the more total MHz in your machine, the better.
+
+**We highly recommend building with no fewer than 4 physical CPU
+cores.** Please note the *physical* in this sentence. Hyperthreaded
+cores (an Intel Core i7 will report 8 CPU cores but only 4 are physical
+for example) only yield at most a 1.25x speedup per core.
+
+We also recommend using the most modern CPU model possible. Haswell
+chips deliver much more performance per CPU cycle than say Sandy Bridge
+CPUs.
+
+This cause impacts both clobber and incremental builds.
+
+You are building with a slow I/O layer
+======================================
+
+The build system can be I/O bound if your I/O layer is slow. Linking
+libxul on some platforms and build architectures can perform gigabytes
+of I/O.
+
+To minimize the impact of slow I/O on build performance, **we highly
+recommend building with an SSD.** Power users with enough memory may opt
+to build from a RAM disk. Mechanical disks should be avoided if at all
+possible.
+
+Some may dispute the importance of an SSD on build times. It is true
+that the beneficial impact of an SSD can be mitigated if your system has
+lots of memory and the build files stay in the page cache. However,
+operating system memory management is complicated. You don't really have
+control over what or when something is evicted from the page cache.
+Therefore, unless your machine is a dedicated build machine or you have
+more memory than is needed by everything running on your machine,
+chances are you'll run into page cache eviction and you I/O layer will
+impact build performance. That being said, an SSD certainly doesn't
+hurt build times. And, anyone who has used a machine with an SSD will
+tell you how great of an investment it is for performance all around the
+operating system. On top of that, some automated tests are I/O bound
+(like those touching SQLite databases), so an SSD will make tests
+faster.
+
+This cause impacts both clobber and incremental builds.
+
+You don't have enough memory
+============================
+
+The build system allocates a lot of memory, especially when building
+many things in parallel. If you don't have enough free system memory,
+the build will cause swap activity, slowing down your system and the
+build. Even if you never get to the point of swapping, the build system
+performs a lot of I/O and having all accessed files in memory and the
+page cache can significantly reduce the influence of the I/O layer on
+the build system.
+
+**We recommend building with no less than 8 GB of system memory.** As
+always, the more memory you have, the better. For a bare bones machine
+doing nothing more than building the source tree, anything more than 16
+GB is likely entering the point of diminishing returns.
+
+This cause impacts both clobber and incremental builds.
+
+You are building on Windows
+===========================
+
+New processes on Windows are about a magnitude slower to spawn than on
+UNIX-y systems such as Linux. This is because Windows has optimized new
+threads while the \*NIX platforms typically optimize new processes.
+Anyway, the build system spawns thousands of new processes during a
+build. Parts of the build that rely on rapid spawning of new processes
+are slow on Windows as a result. This is most pronounced when running
+*configure*. The configure file is a giant shell script and shell
+scripts rely heavily on new processes. This is why configure on Windows
+can run over a minute slower on Windows.
+
+Another reason Windows builds are slower is because Windows lacks proper
+symlink support. On systems that support symlinks, we can generate a
+file into a staging area then symlink it into the final directory very
+quickly. On Windows, we have to perform a full file copy. This incurs
+much more I/O. And if done poorly, can muck with file modification
+times, messing up build dependencies. As of the summer of 2013, the
+impact of symlinks is being mitigated through the use
+of an :term:`install manifest`.
+
+These issues impact both clobber and incremental builds.
+
+Recursive make traversal is slow
+================================
+
+The build system has traditionally been built by employing recursive
+make. Recursive make involves make iterating through directories / make
+files sequentially and executing each in turn. This is inefficient for
+directories containing few targets/tasks because make could be *starved*
+for work when processing these directories. Any time make is starved,
+the build isn't using all available CPU cycles and the build is slower
+as a result.
+
+Work has started in bug 907365 to fix this issue by changing the way
+make traverses all the make files.
+
+The impact of slow recursive make traversal is mostly felt on
+incremental builds. Traditionally, most of the wall time during a
+no-op build is spent in make traversal.
+
+make is inefficient
+===================
+
+Compared to modern build backends like Tup or Ninja, make is slow and
+inefficient. We can only make make so fast. At some point, we'll hit a
+performance plateau and will need to use a different tool to make builds
+faster.
+
+Please note that clobber and incremental builds are different. A clobber
+build with make will likely be as fast as a clobber build with e.g. Tup.
+However, Tup should vastly outperform make when it comes to incremental
+builds. Therefore, this issue is mostly seen when performing incremental
+builds.
+
+C++ header dependency hell
+==========================
+
+Modifying a *.h* file can have significant impact on the build system.
+If you modify a *.h* that is used by 1000 C++ files, all of those 1000
+C++ files will be recompiled.
+
+Our code base has traditionally been sloppy managing the impact of
+changed headers on build performance. Bug 785103 tracks improving the
+situation.
+
+This issue mostly impacts the times of an :term:`incremental build`.
+
+A search/indexing service on your machine is running
+====================================================
+
+Many operating systems have a background service that automatically
+indexes filesystem content to make searching faster. On Windows, you
+have the Windows Search Service. On OS X, you have Finder.
+
+These background services sometimes take a keen interest in the files
+being produced as part of the build. Since the build system produces
+hundreds of megabytes or even a few gigabytes of file data, you can
+imagine how much work this is to index! If this work is being performed
+while the build is running, your build will be slower.
+
+OS X's Finder is notorious for indexing when the build is running. And,
+it has a tendency to suck up a whole CPU core. This can make builds
+several minutes slower. If you build with ``mach`` and have the optional
+``psutil`` package built (it requires Python development headers - see
+:ref:`python` for more) and Finder is running during a build, mach will
+print a warning at the end of the build, complete with instructions on
+how to fix it.
diff --git a/build/docs/supported-configurations.rst b/build/docs/supported-configurations.rst
new file mode 100644
index 000000000..eaa18172c
--- /dev/null
+++ b/build/docs/supported-configurations.rst
@@ -0,0 +1,55 @@
+.. _build_supported_configurations:
+
+========================
+Supported Configurations
+========================
+
+This page attempts to document supported build configurations.
+
+Windows
+=======
+
+We support building on Windows XP and newer operating systems using
+Visual Studio 2010 and newer.
+
+The following are not fully supported by Mozilla (but may work):
+
+* Building without the latest *MozillaBuild* Windows development
+ environment
+* Building with Mingw or any other non-Visual Studio toolchain.
+
+OS X
+====
+
+We support building on OS X 10.6 and newer with the OS X 10.6 SDK.
+
+The tree should build with the following OS X releases and SDK versions:
+
+* 10.6 Snow Leopard
+* 10.7 Lion
+* 10.8 Mountain Lion
+* 10.9 Mavericks
+
+The tree requires building with Clang 3.3 and newer. This corresponds to
+version of 4.2 of Apple's Clang that ships with Xcode. This corresponds
+to Xcode 4.6 and newer. Xcode 4.6 only runs on OS X 10.7.4 and newer.
+So, OS X 10.6 users will need to install a non-Apple toolchain. Running
+``mach bootstrap`` should install an appropriate toolchain from Homebrew
+or MacPorts automatically.
+
+The tree should build with GCC 4.4 and newer on OS X. However, this
+build configuration isn't as widely used (and differs from what Mozilla
+uses to produce OS X builds), so it's recommended to stick with Clang.
+
+Linux
+=====
+
+Linux 2.6 and later kernels are supported.
+
+Most distributions are supported as long as the proper package
+dependencies are in place. Running ``mach bootstrap`` should install
+packages for popular Linux distributions. ``configure`` will typically
+detect missing dependencies and inform you how to disable features to
+work around unsatisfied dependencies.
+
+Clang 3.3 or GCC 4.7 is required to build the tree.
diff --git a/build/docs/test_manifests.rst b/build/docs/test_manifests.rst
new file mode 100644
index 000000000..b0b3e6593
--- /dev/null
+++ b/build/docs/test_manifests.rst
@@ -0,0 +1,201 @@
+.. _test_manifests:
+
+==============
+Test Manifests
+==============
+
+Many test suites have their test metadata defined in files called
+**test manifests**.
+
+Test manifests are divided into two flavors: :ref:`manifestparser_manifests`
+and :ref:`reftest_manifests`.
+
+Naming Convention
+=================
+
+The build system does not enforce file naming for test manifest files.
+However, the following convention is used.
+
+mochitest.ini
+ For the *plain* flavor of mochitests.
+
+chrome.ini
+ For the *chrome* flavor of mochitests.
+
+browser.ini
+ For the *browser chrome* flavor of mochitests.
+
+a11y.ini
+ For the *a11y* flavor of mochitests.
+
+xpcshell.ini
+ For *xpcshell* tests.
+
+webapprt.ini
+ For the *chrome* flavor of webapp runtime mochitests.
+
+.. _manifestparser_manifests:
+
+ManifestParser Manifests
+==========================
+
+ManifestParser manifests are essentially ini files that conform to a basic
+set of assumptions.
+
+The `reference documentation <http://mozbase.readthedocs.org/en/latest/manifestparser.html>`_
+for manifestparser manifests describes the basic format of test manifests.
+
+In summary, manifests are ini files with section names describing test files::
+
+ [test_foo.js]
+ [test_bar.js]
+
+Keys under sections can hold metadata about each test::
+
+ [test_foo.js]
+ skip-if = os == "win"
+ [test_foo.js]
+ skip-if = os == "linux" && debug
+ [test_baz.js]
+ fail-if = os == "mac" || os == "android"
+
+There is a special **DEFAULT** section whose keys/metadata apply to all
+sections/tests::
+
+ [DEFAULT]
+ property = value
+
+ [test_foo.js]
+
+In the above example, **test_foo.js** inherits the metadata **property = value**
+from the **DEFAULT** section.
+
+Recognized Metadata
+-------------------
+
+Test manifests can define some common keys/metadata to influence behavior.
+Those keys are as follows:
+
+head
+ List of files that will be executed before the test file. (Used in
+ xpcshell tests.)
+
+tail
+ List of files that will be executed after the test file. (Used in
+ xpcshell tests.)
+
+support-files
+ List of additional files required to run tests. This is typically
+ defined in the **DEFAULT** section.
+
+ Unlike other file lists, *support-files* supports a globbing mechanism
+ to facilitate pulling in many files with minimal typing. This globbing
+ mechanism is activated if an entry in this value contains a ``*``
+ character. A single ``*`` will wildcard match all files in a directory.
+ A double ``**`` will descend into child directories. For example,
+ ``data/*`` will match ``data/foo`` but not ``data/subdir/bar`` where
+ ``data/**`` will match ``data/foo`` and ``data/subdir/bar``.
+
+ Support files starting with ``/`` are placed in a root directory, rather
+ than a location determined by the manifest location. For mochitests,
+ this allows for the placement of files at the server root. The source
+ file is selected from the base name (e.g., ``foo`` for ``/path/foo``).
+ Files starting with ``/`` cannot be selected using globbing.
+
+generated-files
+ List of files that are generated as part of the build and don't exist in
+ the source tree.
+
+ The build system assumes that each manifest file, test file, and file
+ listed in **head**, **tail**, and **support-files** is static and
+ provided by the source tree (and not automatically generated as part
+ of the build). This variable tells the build system not to make this
+ assumption.
+
+ This variable will likely go away sometime once all generated files are
+ accounted for in the build config.
+
+ If a generated file is not listed in this key, a clobber build will
+ likely fail.
+
+dupe-manifest
+ Record that this manifest duplicates another manifest.
+
+ The common scenario is two manifest files will include a shared
+ manifest file via the ``[include:file]`` special section. The build
+ system enforces that each test file is only provided by a single
+ manifest. Having this key present bypasses that check.
+
+ The value of this key is ignored.
+
+run-if
+ Run this test only if the specified condition is true.
+ See :ref:`manifest_filter_language`.
+
+skip-if
+ Skip this test if the specified condition is true.
+ See :ref:`manifest_filter_language`.
+
+fail-if
+ Expect test failure if the specified condition is true.
+ See :ref:`manifest_filter_language`.
+
+run-sequentially
+ If present, the test should not be run in parallel with other tests.
+
+ Some test harnesses support parallel test execution on separate processes
+ and/or threads (behavior varies by test harness). If this key is present,
+ the test harness should not attempt to run this test in parallel with any
+ other test.
+
+ By convention, the value of this key is a string describing why the test
+ can't be run in parallel.
+
+.. _manifest_filter_language:
+
+Manifest Filter Language
+------------------------
+
+Some manifest keys accept a special filter syntax as their values. These
+values are essentially boolean expressions that are evaluated at test
+execution time.
+
+The expressions can reference a well-defined set of variables, such as
+``os`` and ``debug``. These variables are populated from the
+``mozinfo.json`` file. For the full list of available variables, see
+the :ref:`mozinfo documentation <mozinfo_attributes>`.
+
+See
+`the source <https://hg.mozilla.org/mozilla-central/file/default/testing/mozbase/manifestparser/manifestparser/manifestparser.py>`_ for the full documentation of the
+expression syntax until it is documented here.
+
+.. todo::
+
+ Document manifest filter language.
+
+.. _manifest_file_installation:
+
+File Installation
+-----------------
+
+Files referenced by manifests are automatically installed into the object
+directory into paths defined in
+:py:func:`mozbuild.frontend.emitter.TreeMetadataEmitter._process_test_manifest`.
+
+Relative paths resolving to parent directory (e.g.
+``support-files = ../foo.txt`` have special behavior.
+
+For ``support-files``, the file will be installed to the default destination
+for that manifest. Only the file's base name is used to construct the final
+path: directories are irrelevant. Files starting with ``/`` are an exception,
+these are installed relative to the root of the destination; the base name is
+instead used to select the file..
+
+For all other entry types, the file installation is skipped.
+
+.. _reftest_manifests:
+
+Reftest Manifests
+=================
+
+See `MDN <https://developer.mozilla.org/en-US/docs/Creating_reftest-based_unit_tests>`_.
diff --git a/build/docs/visualstudio.rst b/build/docs/visualstudio.rst
new file mode 100644
index 000000000..3fbf28e94
--- /dev/null
+++ b/build/docs/visualstudio.rst
@@ -0,0 +1,100 @@
+.. _build_visualstudio:
+
+======================
+Visual Studio Projects
+======================
+
+The build system contains alpha support for generating Visual Studio
+project files to aid with development.
+
+To generate Visual Studio project files, you'll need to have a configured tree::
+
+ mach configure
+
+(If you have built recently, your tree is already configured.)
+
+Then, simply generate the Visual Studio build backend::
+
+ mach build-backend -b VisualStudio
+
+If all goes well, the path to the generated Solution (``.sln``) file should be
+printed. You should be able to open that solution with Visual Studio 2010 or
+newer.
+
+Currently, output is hard-coded to the Visual Studio 2010 format. If you open
+the solution in a newer Visual Studio release, you will be prompted to upgrade
+projects. Simply click through the wizard to do that.
+
+Structure of Solution
+=====================
+
+The Visual Studio solution consists of hundreds of projects spanning thousands
+of files. To help with organization, the solution is divided into the following
+trees/folders:
+
+Build Targets
+ This folder contains common build targets. The *full* project is used to
+ perform a full build. The *binaries* project is used to build just binaries.
+ The *visual-studio* project can be built to regenerate the Visual Studio
+ project files.
+
+ Performing the *clean* action on any of these targets will clean the
+ *entire* build output.
+
+Binaries
+ This folder contains common binaries that can be executed from within
+ Visual Studio. If you are building the Firefox desktop application,
+ the *firefox* project will launch firefox.exe. You probably want one of
+ these set to your startup project.
+
+Libraries
+ This folder contains entries for each static library that is produced as
+ part of the build. These roughly correspond to each directory in the tree
+ containing C/C++. e.g. code from ``dom/base`` will be contained in the
+ ``dom_base`` project.
+
+ These projects don't do anything when built. If you build a project here,
+ the *binaries* build target project is built.
+
+Updating Project Files
+======================
+
+As you pull and update the source tree, your Visual Studio files may fall out
+of sync with the build configuration. The tree should still build fine from
+within Visual Studio. But source files may be missing and IntelliSense may not
+have the proper build configuration.
+
+To account for this, you'll want to periodically regenerate the Visual Studio
+project files. You can do this within Visual Studio by building the
+``Build Targets :: visual-studio`` project or by running
+``mach build-backend -b VisualStudio`` from the command line.
+
+Currently, regeneration rewrites the original project files. **If you've made
+any customizations to the solution or projects, they will likely get
+overwritten.** We would like to improve this user experience in the
+future.
+
+Moving Project Files Around
+===========================
+
+The produced Visual Studio solution and project files should be portable.
+If you want to move them to a non-default directory, they should continue
+to work from wherever they are. If they don't, please file a bug.
+
+Invoking mach through Visual Studio
+===================================
+
+It's possible to build the tree via Visual Studio. There is some light magic
+involved here.
+
+Alongside the Visual Studio project files is a batch script named ``mach.bat``.
+This batch script sets the environment variables present in your *MozillaBuild*
+development environment at the time of Visual Studio project generation
+and invokes *mach* inside an msys shell with the arguments specified to the
+batch script. This script essentially allows you to invoke mach commands
+inside the MozillaBuild environment without having to load MozillaBuild.
+
+While projects currently only utilize the ``mach build`` command, the batch
+script does not limit it's use: any mach command can be invoked. Developers
+may abuse this fact to add custom projects and commands that invoke other
+mach commands.
diff --git a/build/dumbmake-dependencies b/build/dumbmake-dependencies
index f38b7e08d..23c90dd7d 100644
--- a/build/dumbmake-dependencies
+++ b/build/dumbmake-dependencies
@@ -1,4 +1,7 @@
toolkit/library
+ dom
+ ipc
+ security/sandbox
ipc
netwerk/build
netwerk
@@ -15,21 +18,19 @@ toolkit/library
gfx
toolkit/components/build
toolkit/components
- security/build
security/manager
- security/dbm
- security/nss
- accessible/build
- accessible
+ security/certverifier
+ security/build
+ accessible
dom
content
layout
editor
parser
js/src
- js/xpconnect
- js/xpconnect/loader
mfbt
+ js/xpconnect
+ js/xpconnect/loader
view
caps
xpfe/appshell
@@ -56,6 +57,7 @@ browser/app
browser/themes
toolkit
toolkit/components
+ toolkit/components/jsdownloads
toolkit/content
toolkit/devtools
toolkit/forgetaboutsite
diff --git a/build/dumpScreen.py b/build/dumpScreen.py
new file mode 100644
index 000000000..70efe0189
--- /dev/null
+++ b/build/dumpScreen.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+"""
+test dumpScreen functionality
+"""
+
+import automationutils
+import optparse
+import os
+import sys
+
+
+def main(args=sys.argv[1:]):
+
+ # parse CLI options
+ usage = '%prog [options] path/to/OBJDIR/dist/bin'
+ parser = optparse.OptionParser(usage=usage)
+ options, args = parser.parse_args(args)
+ if len(args) != 1:
+ parser.error("Please provide utility path")
+ utilityPath = args[0]
+
+ # dump the screen to a data: URL
+ uri = automationutils.dumpScreen(utilityPath)
+
+ # print the uri
+ print uri
+
+if __name__ == '__main__':
+ main()
diff --git a/build/gen_mach_buildprops.py b/build/gen_mach_buildprops.py
new file mode 100644
index 000000000..16a8795ce
--- /dev/null
+++ b/build/gen_mach_buildprops.py
@@ -0,0 +1,123 @@
+#!/usr/bin/python
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import sys
+import os
+import hashlib
+import json
+import re
+import errno
+from argparse import ArgumentParser
+
+def getFileHashAndSize(filename):
+ sha512Hash = 'UNKNOWN'
+ size = 'UNKNOWN'
+
+ try:
+ # open in binary mode to make sure we get consistent results
+ # across all platforms
+ f = open(filename, "rb")
+ shaObj = hashlib.sha512(f.read())
+ sha512Hash = shaObj.hexdigest()
+
+ size = os.path.getsize(filename)
+ except:
+ pass
+
+ return (sha512Hash, size)
+
+def getMarProperties(filename, partial=False):
+ if not os.path.exists(filename):
+ return {}
+ (mar_hash, mar_size) = getFileHashAndSize(filename)
+ martype = 'partial' if partial else 'complete'
+ return {
+ '%sMarFilename' % martype: os.path.basename(filename),
+ '%sMarSize' % martype: mar_size,
+ '%sMarHash' % martype: mar_hash,
+ }
+
+def getUrlProperties(filename, package):
+ # let's create a switch case using name-spaces/dict
+ # rather than a long if/else with duplicate code
+ property_conditions = [
+ # key: property name, value: condition
+ ('testsUrl', lambda m: m.endswith(('tests.tar.bz2', 'tests.zip'))),
+ ('unsignedApkUrl', lambda m: m.endswith('apk') and
+ 'unsigned-unaligned' in m),
+ ('robocopApkUrl', lambda m: m.endswith('apk') and 'robocop' in m),
+ ('jsshellUrl', lambda m: 'jsshell-' in m and m.endswith('.zip')),
+ ('completeMarUrl', lambda m: m.endswith('.complete.mar')),
+ ('partialMarUrl', lambda m: m.endswith('.mar') and '.partial.' in m),
+ ('codeCoverageURL', lambda m: m.endswith('code-coverage-gcno.zip')),
+ ('testPackagesUrl', lambda m: m.endswith('test_packages.json')),
+ ('packageUrl', lambda m: m.endswith(package)),
+ ]
+ url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz|json))$''')
+ properties = {}
+
+ try:
+ with open(filename) as f:
+ for line in f:
+ m = url_re.match(line)
+ if m:
+ m = m.group(1)
+ for prop, condition in property_conditions:
+ if condition(m):
+ properties.update({prop: m})
+ break
+ except IOError as e:
+ if e.errno != errno.ENOENT:
+ raise
+ properties = {prop: 'UNKNOWN' for prop, condition in property_conditions}
+ return properties
+
+def getPartialInfo(props):
+ return [{
+ "from_buildid": props.get("previous_buildid"),
+ "size": props.get("partialMarSize"),
+ "hash": props.get("partialMarHash"),
+ "url": props.get("partialMarUrl"),
+ }]
+
+if __name__ == '__main__':
+ parser = ArgumentParser(description='Generate mach_build_properties.json for automation builds.')
+ parser.add_argument("--complete-mar-file", required=True,
+ action="store", dest="complete_mar_file",
+ help="Path to the complete MAR file, relative to the objdir.")
+ parser.add_argument("--partial-mar-file", required=False,
+ action="store", dest="partial_mar_file",
+ help="Path to the partial MAR file, relative to the objdir.")
+ parser.add_argument("--upload-output", required=True,
+ action="store", dest="upload_output",
+ help="Path to the text output of 'make upload'")
+ parser.add_argument("--upload-files", required=True, nargs="+",
+ action="store", dest="upload_files",
+ help="List of files to be uploaded.")
+ parser.add_argument("--package", required=True,
+ action="store", dest="package",
+ help="Filename of the build package")
+ args = parser.parse_args()
+
+ json_data = getMarProperties(args.complete_mar_file)
+ json_data.update(getUrlProperties(args.upload_output, args.package))
+ if args.partial_mar_file:
+ json_data.update(getMarProperties(args.partial_mar_file, partial=True))
+
+ # Pull the previous buildid from the partial mar filename.
+ res = re.match(r'.*\.([0-9]+)-[0-9]+.mar', args.partial_mar_file)
+ if res:
+ json_data['previous_buildid'] = res.group(1)
+
+ # Set partialInfo to be a collection of the partial mar properties
+ # useful for balrog.
+ json_data['partialInfo'] = getPartialInfo(json_data)
+
+ json_data['uploadFiles'] = args.upload_files
+ json_data['packageFilename'] = args.package
+
+ with open('mach_build_properties.json', 'w') as outfile:
+ json.dump(json_data, outfile, indent=4)
diff --git a/build/gen_test_packages_manifest.py b/build/gen_test_packages_manifest.py
new file mode 100644
index 000000000..5f319a91a
--- /dev/null
+++ b/build/gen_test_packages_manifest.py
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import json
+
+from argparse import ArgumentParser
+
+ALL_HARNESSES = [
+ 'common', # Harnesses without a specific package will look here.
+ 'mochitest',
+ 'reftest',
+ 'webapprt',
+ 'xpcshell',
+ 'cppunittest',
+ 'jittest',
+ 'mozbase',
+ 'web-platform',
+]
+
+PACKAGE_SPECIFIED_HARNESSES = [
+ 'cppunittest',
+ 'mochitest',
+ 'reftest',
+ 'xpcshell',
+ 'web-platform',
+]
+
+
+def parse_args():
+ parser = ArgumentParser(description='Generate a test_packages.json file to tell automation which harnesses require which test packages.')
+ parser.add_argument("--common", required=True,
+ action="store", dest="tests_common",
+ help="Name of the \"common\" archive, a package to be used by all harnesses.")
+ parser.add_argument("--jsshell", required=True,
+ action="store", dest="jsshell",
+ help="Name of the jsshell zip.")
+ for harness in PACKAGE_SPECIFIED_HARNESSES:
+ parser.add_argument("--%s" % harness, required=True,
+ action="store", dest=harness,
+ help="Name of the %s zip." % harness)
+ parser.add_argument("--dest-file", required=True,
+ action="store", dest="destfile",
+ help="Path to the output file to be written.")
+ return parser.parse_args()
+
+def generate_package_data(args):
+ # Generate a dictionary mapping test harness names (exactly as they're known to
+ # mozharness and testsuite-targets.mk, ideally) to the set of archive names that
+ # harness depends on to run.
+ # mozharness will use this file to determine what test zips to download,
+ # which will be an optimization once parts of the main zip are split to harness
+ # specific zips.
+ tests_common = args.tests_common
+ jsshell = args.jsshell
+
+ harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
+ harness_requirements['jittest'].append(jsshell)
+ for harness in PACKAGE_SPECIFIED_HARNESSES:
+ harness_requirements[harness].append(getattr(args, harness))
+ return harness_requirements
+
+if __name__ == '__main__':
+ args = parse_args()
+ packages_data = generate_package_data(args)
+ with open(args.destfile, 'w') as of:
+ json.dump(packages_data, of, indent=4)
diff --git a/build/goanna_templates.mozbuild b/build/goanna_templates.mozbuild
new file mode 100644
index 000000000..b10498201
--- /dev/null
+++ b/build/goanna_templates.mozbuild
@@ -0,0 +1,169 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+@template
+def GoannaBinary(linkage='dependent', msvcrt='dynamic', mozglue=None):
+ '''Template for Goanna-related binaries.
+
+ This template is meant to be used in other templates.
+
+ `linkage` indicates the wanted xpcom linkage type. Valid values are
+ 'dependent', 'standalone' or None. 'dependent' is the default. It is
+ used for e.g. XPCOM components and executables with direct dependencies
+ on libxul. Most executables should use the 'standalone' linkage, which
+ uses the standalone XPCOM glue to load libxul. None means no XPCOM glue
+ or libxul linkage at all.
+
+ `msvcrt` indicates which Microsoft Visual Studio CRT, for Windows build,
+ ought to be linked: 'static' or 'dynamic'.
+
+ `mozglue` indicates whether to link against the mozglue library, and if
+ so, what linkage to apply. Valid values are None (mozglue not linked),
+ 'program' (mozglue linked to an executable program), or 'library' (mozglue
+ linked to a shared library).
+ '''
+ if msvcrt == 'dynamic' or CONFIG['OS_ARCH'] != 'WINNT':
+ xpcomglue = 'xpcomglue'
+ elif msvcrt == 'static':
+ USE_STATIC_LIBS = True
+ xpcomglue = 'xpcomglue_staticruntime'
+ if not CONFIG['GNU_CC']:
+ mozglue = None
+ else:
+ error('msvcrt must be "dynamic" or "static"')
+
+ if linkage == 'dependent':
+ USE_LIBS += [
+ 'mozalloc',
+ 'nspr',
+ '%s_s' % xpcomglue,
+ 'xul',
+ ]
+ elif linkage == 'standalone':
+ DEFINES['XPCOM_GLUE'] = True
+
+ USE_LIBS += [
+ xpcomglue,
+ ]
+ elif linkage != None:
+ error('`linkage` must be "dependent", "standalone" or None')
+
+ if mozglue:
+ if CONFIG['JS_STANDALONE']:
+ pass
+ elif CONFIG['MOZ_CRT']:
+ if msvcrt == 'dynamic':
+ USE_LIBS += ['mozcrt']
+ elif msvcrt == 'static':
+ USE_LIBS += ['mozglue']
+ else:
+ error('`msvcrt` must be "dynamic" or "static"')
+ else:
+ LDFLAGS += CONFIG['MOZ_GLUE_WRAP_LDFLAGS']
+ if mozglue == 'program':
+ USE_LIBS += ['mozglue']
+ if CONFIG['MOZ_GLUE_IN_PROGRAM']:
+ if CONFIG['GNU_CC']:
+ LDFLAGS += ['-rdynamic']
+ if CONFIG['MOZ_MEMORY']:
+ USE_LIBS += ['memory']
+ if CONFIG['MOZ_LINKER']:
+ OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
+ elif mozglue == 'library':
+ if not CONFIG['MOZ_GLUE_IN_PROGRAM']:
+ USE_LIBS += ['mozglue']
+ else:
+ error('`mozglue` must be "program" or "library"')
+
+ if not CONFIG['JS_STANDALONE']:
+ USE_LIBS += [
+ 'fallible',
+ ]
+
+
+@template
+def GoannaProgram(name, linkage='standalone', **kwargs):
+ '''Template for program executables related to Goanna.
+
+ `name` identifies the executable base name.
+
+ See the documentation for `GoannaBinary` for other possible arguments,
+ with the notable difference that the default for `linkage` is 'standalone'.
+ '''
+ Program(name)
+
+ kwargs.setdefault('mozglue', 'program')
+
+ GoannaBinary(linkage=linkage, **kwargs)
+
+
+@template
+def GoannaSimplePrograms(names, **kwargs):
+ '''Template for simple program executables related to Goanna.
+
+ `names` identifies the executable base names for each executable.
+
+ See the documentation for `GoannaBinary` for other possible arguments.
+ '''
+ SimplePrograms(names)
+
+ kwargs.setdefault('mozglue', 'program')
+
+ GoannaBinary(**kwargs)
+
+
+@template
+def GoannaCppUnitTests(names, **kwargs):
+ '''Template for C++ unit tests related to Goanna.
+
+ `names` identifies the executable base names for each executable.
+
+ See the documentation for `GoannaBinary` for other possible arguments.
+ '''
+ CppUnitTests(names)
+
+ kwargs.setdefault('mozglue', 'program')
+
+ GoannaBinary(**kwargs)
+
+
+@template
+def GoannaSharedLibrary(name, **kwargs):
+ '''Template for shared libraries related to Goanna.
+
+ `name` identifies the library base name.
+ See the documentation for `GoannaBinary` for other possible arguments.
+ '''
+ SharedLibrary(name)
+
+ kwargs.setdefault('mozglue', 'library')
+
+ GoannaBinary(**kwargs)
+
+
+@template
+def GoannaFramework(name, **kwargs):
+ '''Template for OSX frameworks related to Goanna.
+
+ `name` identifies the library base name.
+ See the documentation for `GoannaBinary` for other possible arguments.
+ '''
+ Framework(name)
+
+ kwargs.setdefault('mozglue', 'library')
+
+ GoannaBinary(**kwargs)
+
+
+@template
+def XPCOMBinaryComponent(name, **kwargs):
+ '''Template defining an XPCOM binary component for Goanna.
+
+ `name` is the name of the component.
+ '''
+ GoannaSharedLibrary(name, **kwargs)
+
+ IS_COMPONENT = True
diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild
new file mode 100644
index 000000000..282cbc7cb
--- /dev/null
+++ b/build/gyp.mozbuild
@@ -0,0 +1,126 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+gyp_vars = {
+ 'build_with_mozilla': 1,
+ 'build_with_chromium': 0,
+ 'use_official_google_api_keys': 0,
+ 'have_clock_monotonic': 1 if CONFIG['HAVE_CLOCK_MONOTONIC'] else 0,
+ 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0,
+ 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0,
+ 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0,
+ # basic stuff for everything
+ 'include_internal_video_render': 0,
+ 'clang_use_chrome_plugins': 0,
+ 'enable_protobuf': 0,
+ 'include_tests': 0,
+ 'enable_android_opensl': 1,
+ 'enable_android_opensl_output': 0,
+ # use_system_lib* still seems to be in use in trunk/build
+ 'use_system_libjpeg': 0,
+ 'use_system_libvpx': 0,
+ 'build_json': 0,
+ 'build_libjpeg': 0,
+ 'build_libyuv': 0,
+ 'build_libvpx': 0,
+ 'build_ssl': 0,
+ 'libyuv_dir': '/media/libyuv',
+ 'yuv_disable_avx2': 0 if CONFIG['HAVE_X86_AVX2'] else 1,
+ # don't use openssl
+ 'use_openssl': 0,
+
+ # saves 4MB when webrtc_trace is off
+ 'enable_lazy_trace_alloc': 1 if CONFIG['RELEASE_BUILD'] else 0,
+
+ 'use_x11': 1 if CONFIG['MOZ_X11'] else 0,
+ 'use_glib': 1 if CONFIG['GLIB_LIBS'] else 0,
+
+ # turn off mandatory use of NEON and instead use NEON detection
+ 'arm_neon': 0,
+ 'arm_neon_optional': 1,
+
+ 'moz_widget_toolkit_gonk': 0,
+ 'moz_webrtc_omx': 0,
+
+ # (for vp8) chromium sets to 0 also
+ 'use_temporal_layers': 0,
+
+ # Creates AEC internal sample dump files in current directory
+ 'aec_debug_dump': 1,
+
+ # Enable and force use of hardware AEC
+ 'hardware_aec_ns': 1 if CONFIG['MOZ_WEBRTC_HARDWARE_AEC_NS'] else 0,
+
+ # codec enable/disables:
+ 'include_g711': 1,
+ 'include_opus': 1,
+ 'include_g722': 1,
+ 'include_ilbc': 0,
+ 'include_isac': 0,
+ 'include_pcm16b': 1,
+}
+
+os = CONFIG['OS_TARGET']
+
+if os == 'WINNT':
+ gyp_vars.update(
+ MSVS_VERSION=CONFIG['_MSVS_VERSION'],
+ MSVS_OS_BITS=64 if CONFIG['HAVE_64BIT_BUILD'] else 32,
+ )
+elif os == 'Android':
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+ gyp_vars['build_with_gonk'] = 1
+ gyp_vars['moz_widget_toolkit_gonk'] = 1
+ gyp_vars['opus_complexity'] = 1
+ if int(CONFIG['ANDROID_VERSION']) >= 18:
+ gyp_vars['moz_webrtc_omx'] = 1
+ else:
+ gyp_vars.update(
+ gtest_target_type='executable',
+ android_toolchain=CONFIG['ANDROID_TOOLCHAIN'],
+ )
+
+flavors = {
+ 'WINNT': 'win',
+ 'Android': 'linux' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' else 'android',
+ 'Linux': 'linux',
+ 'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios',
+ 'SunOS': 'solaris',
+ 'GNU/kFreeBSD': 'freebsd',
+ 'DragonFly': 'dragonfly',
+ 'FreeBSD': 'freebsd',
+ 'NetBSD': 'netbsd',
+ 'OpenBSD': 'openbsd',
+}
+gyp_vars['OS'] = flavors[os]
+
+arches = {
+ 'x86_64': 'x64',
+ 'x86': 'ia32',
+}
+
+gyp_vars['target_arch'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH'])
+
+if CONFIG['ARM_ARCH']:
+ if int(CONFIG['ARM_ARCH']) < 7:
+ gyp_vars['armv7'] = 0
+ gyp_vars['arm_neon_optional'] = 0
+ elif os == 'Android':
+ gyp_vars['armv7'] = 1
+ else:
+ # CPU detection for ARM works on Android only. armv7 always uses CPU
+ # detection, so we have to set armv7=0 for non-Android target
+ gyp_vars['armv7'] = 0
+ # For libyuv
+ gyp_vars['arm_version'] = int(CONFIG['ARM_ARCH'])
+
+# Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
+if CONFIG['INTEL_ARCHITECTURE']:
+ if not CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3'] or not CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSE4_1']:
+ gyp_vars['yuv_disable_asm'] = 1
+
+if CONFIG['MACOS_SDK_DIR']:
+ gyp_vars['mac_sdk_path'] = CONFIG['MACOS_SDK_DIR']
diff --git a/build/leaktest.py.in b/build/leaktest.py.in
deleted file mode 100644
index 1e991e6de..000000000
--- a/build/leaktest.py.in
+++ /dev/null
@@ -1,50 +0,0 @@
-#literal #!/usr/bin/python
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import SimpleHTTPServer
-import SocketServer
-import threading
-import os
-import sys
-import logging
-from getopt import getopt
-from automation import Automation
-
-PORT = 8888
-SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
-PROFILE_DIRECTORY = os.path.abspath(os.path.join(SCRIPT_DIR, "./leakprofile"))
-os.chdir(SCRIPT_DIR)
-
-class EasyServer(SocketServer.TCPServer):
- allow_reuse_address = True
-
-if __name__ == '__main__':
- automation = Automation()
- DIST_BIN = os.path.join(SCRIPT_DIR, automation.DIST_BIN)
- opts, extraArgs = getopt(sys.argv[1:], 'l:')
- if len(opts) > 0:
- try:
- automation.log.addHandler(logging.FileHandler(opts[0][1], "w"))
- except:
- automation.log.info("Unable to open logfile " + opts[0][1] + \
- "ONLY logging to stdout.")
-
- httpd = EasyServer(("", PORT), SimpleHTTPServer.SimpleHTTPRequestHandler)
- t = threading.Thread(target=httpd.serve_forever)
- t.setDaemon(True)
- t.start()
-
- automation.setServerInfo("localhost", PORT)
- automation.initializeProfile(PROFILE_DIRECTORY)
- browserEnv = automation.environment()
-
- if not "XPCOM_DEBUG_BREAK" in browserEnv:
- browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
- url = "http://localhost:%d/bloatcycle.html" % PORT
- appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
- status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY,
- extraArgs, timeout=1800)
- sys.exit(status)
diff --git a/build/link.py b/build/link.py
deleted file mode 100644
index 19fbfac7b..000000000
--- a/build/link.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from __future__ import with_statement
-import os, subprocess, sys, threading, time
-from win32 import procmem
-
-def measure_vsize_threadfunc(proc, output_file):
- """
- Measure the virtual memory usage of |proc| at regular intervals
- until it exits, then print the maximum value and write it to
- |output_file|.
- """
- maxvsize = 0
- while proc.returncode is None:
- maxvsize, vsize = procmem.get_vmsize(proc._handle)
- time.sleep(0.5)
- print "TinderboxPrint: linker max vsize: %d" % maxvsize
- with open(output_file, "w") as f:
- f.write("%d\n" % maxvsize)
-
-def measure_link_vsize(output_file, args):
- """
- Execute |args|, and measure the maximum virtual memory usage of the process,
- printing it to stdout when finished.
- """
- proc = subprocess.Popen(args)
- t = threading.Thread(target=measure_vsize_threadfunc,
- args=(proc, output_file))
- t.start()
- # Wait for the linker to finish.
- exitcode = proc.wait()
- # ...and then wait for the background thread to finish.
- t.join()
- return exitcode
-
-if __name__ == "__main__":
- if sys.platform != "win32":
- print >>sys.stderr, "link.py is only for use on Windows!"
- sys.exit(1)
- if len(sys.argv) < 3:
- print >>sys.stderr, "Usage: link.py <output filename> <commandline>"
- sys.exit(1)
- sys.exit(measure_link_vsize(sys.argv[1], sys.argv[2:]))
diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py
index 4671b18b0..6d7d44bcb 100644
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -28,18 +28,33 @@ SEARCH_PATHS = [
'python/mach',
'python/mozboot',
'python/mozbuild',
+ 'python/mozversioncontrol',
'python/blessings',
+ 'python/configobj',
+ 'python/jsmin',
'python/psutil',
'python/which',
+ 'python/pystache',
+ 'python/pyyaml/lib',
+ 'build',
'build/pymake',
'config',
+ 'dom/bindings',
+ 'dom/bindings/parser',
+ 'layout/tools/reftest',
'other-licenses/ply',
'xpcom/idl-parser',
'testing',
+ 'testing/taskcluster',
'testing/xpcshell',
+ 'testing/web-platform',
+ 'testing/web-platform/harness',
'testing/marionette/client',
'testing/marionette/client/marionette',
+ 'testing/marionette/transport',
+ 'testing/marionette/driver',
'testing/mozbase/mozcrash',
+ 'testing/mozbase/mozdebug',
'testing/mozbase/mozdevice',
'testing/mozbase/mozfile',
'testing/mozbase/mozhttpd',
@@ -48,22 +63,39 @@ SEARCH_PATHS = [
'testing/mozbase/mozprocess',
'testing/mozbase/mozprofile',
'testing/mozbase/mozrunner',
+ 'testing/mozbase/mozsystemmonitor',
'testing/mozbase/mozinfo',
+ 'testing/mozbase/moztest',
+ 'testing/mozbase/mozversion',
+ 'testing/mozbase/manifestparser',
+ 'xpcom/idl-parser',
]
# Individual files providing mach commands.
MACH_MODULES = [
- 'addon-sdk/mach_commands.py',
+ 'build/valgrind/mach_commands.py',
+ 'dom/bindings/mach_commands.py',
'layout/tools/reftest/mach_commands.py',
+ 'python/mach_commands.py',
'python/mach/mach/commands/commandinfo.py',
'python/mozboot/mozboot/mach_commands.py',
- 'python/mozbuild/mozbuild/config.py',
'python/mozbuild/mozbuild/mach_commands.py',
+ 'python/mozbuild/mozbuild/backend/mach_commands.py',
+ 'python/mozbuild/mozbuild/compilation/codecomplete.py',
'python/mozbuild/mozbuild/frontend/mach_commands.py',
+ 'services/common/tests/mach_commands.py',
+ 'testing/mach_commands.py',
+ 'testing/taskcluster/mach_commands.py',
'testing/marionette/mach_commands.py',
'testing/mochitest/mach_commands.py',
'testing/xpcshell/mach_commands.py',
+ 'testing/talos/mach_commands.py',
+ 'testing/web-platform/mach_commands.py',
+ 'testing/xpcshell/mach_commands.py',
+ 'tools/docs/mach_commands.py',
+ 'tools/mercurial/mach_commands.py',
'tools/mach_commands.py',
+ 'mobile/android/mach_commands.py',
]
@@ -83,6 +115,11 @@ CATEGORIES = {
'long': 'Run tests.',
'priority': 60,
},
+ 'ci': {
+ 'short': 'CI',
+ 'long': 'Taskcluster commands',
+ 'priority': 59
+ },
'devenv': {
'short': 'Development Environment',
'long': 'Set up and configure your development environment.',
@@ -97,6 +134,11 @@ CATEGORIES = {
'short': 'Potpourri',
'long': 'Potent potables and assorted snacks.',
'priority': 10,
+ },
+ 'disabled': {
+ 'short': 'Disabled',
+ 'long': 'The disabled commands are hidden by default. Use -v to display them. These commands are unavailable for your current context, run "mach <command>" to see why.',
+ 'priority': 0,
}
}
@@ -121,38 +163,51 @@ def bootstrap(topsrcdir, mozilla_dir=None):
# case. For default behavior, we educate users and give them an opportunity
# to react. We always exit after creating the directory because users don't
# like surprises.
- state_user_dir = os.path.expanduser('~/.mozbuild')
- state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None)
- if state_env_dir:
- if not os.path.exists(state_env_dir):
- print('Creating global state directory from environment variable: %s'
- % state_env_dir)
- os.makedirs(state_env_dir, mode=0777)
- print('Please re-run mach.')
- sys.exit(1)
- else:
- if not os.path.exists(state_user_dir):
- print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir))
- try:
- for i in range(20, -1, -1):
- time.sleep(1)
- sys.stdout.write('%d ' % i)
- sys.stdout.flush()
- except KeyboardInterrupt:
- sys.exit(1)
-
- print('\nCreating default state directory: %s' % state_user_dir)
- os.mkdir(state_user_dir)
- print('Please re-run mach.')
- sys.exit(1)
-
try:
import mach.main
except ImportError:
sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
import mach.main
- mach = mach.main.Mach(topsrcdir)
+ def populate_context(context, key=None):
+ if key is None:
+ return
+ if key == 'state_dir':
+ state_user_dir = os.path.expanduser('~/.mozbuild')
+ state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None)
+ if state_env_dir:
+ if not os.path.exists(state_env_dir):
+ print('Creating global state directory from environment variable: %s'
+ % state_env_dir)
+ os.makedirs(state_env_dir, mode=0o770)
+ print('Please re-run mach.')
+ sys.exit(1)
+ state_dir = state_env_dir
+ else:
+ if not os.path.exists(state_user_dir):
+ print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir))
+ try:
+ for i in range(20, -1, -1):
+ time.sleep(1)
+ sys.stdout.write('%d ' % i)
+ sys.stdout.flush()
+ except KeyboardInterrupt:
+ sys.exit(1)
+
+ print('\nCreating default state directory: %s' % state_user_dir)
+ os.mkdir(state_user_dir)
+ print('Please re-run mach.')
+ sys.exit(1)
+ state_dir = state_user_dir
+
+ return state_dir
+ if key == 'topdir':
+ return topsrcdir
+ raise AttributeError(key)
+
+ mach = mach.main.Mach(os.getcwd())
+ mach.populate_context_handler = populate_context
+
for category, meta in CATEGORIES.items():
mach.define_category(category, meta['short'], meta['long'],
meta['priority'])
diff --git a/build/macosx/mozconfig.common b/build/macosx/mozconfig.common
index 191f8a3ae..83d680490 100644
--- a/build/macosx/mozconfig.common
+++ b/build/macosx/mozconfig.common
@@ -2,16 +2,24 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+MOZ_AUTOMATION_L10N_CHECK=0
+
+if [ "x$IS_NIGHTLY" = "xyes" ]; then
+ MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
+ MOZ_AUTOMATION_UPDATE_PACKAGING=1
+fi
. "$topsrcdir/build/mozconfig.common"
if [ -d "$topsrcdir/clang" ]; then
# mozilla-central based build
export CC=$topsrcdir/clang/bin/clang
export CXX=$topsrcdir/clang/bin/clang++
+ export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
elif [ -d "$topsrcdir/../clang" ]; then
# comm-central based build
export CC=$topsrcdir/../clang/bin/clang
export CXX=$topsrcdir/../clang/bin/clang++
+ export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
fi
# If not set use the system default clang
@@ -24,12 +32,6 @@ if [ -z "$CXX" ]; then
export CXX=clang++
fi
-mk_add_options MOZ_CO_PROJECT=browser
-ac_add_options --enable-application=browser
-
-ac_add_options --with-ccache
-
-ac_add_options --disable-tests
-ac_add_options --disable-mochitests
+. "$topsrcdir/build/mozconfig.cache"
-ac_add_options --disable-jemalloc
+export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
diff --git a/build/macosx/universal/flight.mk b/build/macosx/universal/flight.mk
index 1d9ca8b13..ec55ba8af 100644
--- a/build/macosx/universal/flight.mk
+++ b/build/macosx/universal/flight.mk
@@ -7,22 +7,51 @@
# the two OBJDIRs.
ifndef OBJDIR
-OBJDIR = $(MOZ_OBJDIR)/$(firstword $(MOZ_BUILD_PROJECTS))
+OBJDIR_ARCH_1 = $(MOZ_OBJDIR)/$(firstword $(MOZ_BUILD_PROJECTS))
+OBJDIR_ARCH_2 = $(MOZ_OBJDIR)/$(word 2,$(MOZ_BUILD_PROJECTS))
+DIST_ARCH_1 = $(OBJDIR_ARCH_1)/dist
+DIST_ARCH_2 = $(OBJDIR_ARCH_2)/dist
+DIST_UNI = $(DIST_ARCH_1)/universal
+OBJDIR = $(OBJDIR_ARCH_1)
endif
-DIST_ARCH = $(OBJDIR)/dist
-DIST_UNI = $(DIST_ARCH)/universal
-
topsrcdir = $(TOPSRCDIR)
DEPTH = $(OBJDIR)
include $(OBJDIR)/config/autoconf.mk
-core_abspath = $(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1))
-
DIST = $(OBJDIR)/dist
postflight_all:
mkdir -p $(DIST_UNI)/$(MOZ_PKG_APPNAME)
-# Stage a package for buildsymbols to be happy.
- $(MAKE) -C $(OBJDIR)/$(MOZ_BUILD_APP)/installer \
+ rm -f $(DIST_ARCH_2)/universal
+ ln -s $(abspath $(DIST_UNI)) $(DIST_ARCH_2)/universal
+# Stage a package for buildsymbols to be happy. Doing so in OBJDIR_ARCH_1
+# actually does a universal staging with both OBJDIR_ARCH_1 and OBJDIR_ARCH_2.
+ $(MAKE) -C $(OBJDIR_ARCH_1)/$(MOZ_BUILD_APP)/installer \
PKG_SKIP_STRIP=1 stage-package
+ifdef ENABLE_TESTS
+# Now, repeat the process for the test package.
+ $(MAKE) -C $(OBJDIR_ARCH_1) UNIVERSAL_BINARY= CHROME_JAR= package-tests
+ $(MAKE) -C $(OBJDIR_ARCH_2) UNIVERSAL_BINARY= CHROME_JAR= package-tests
+ rm -rf $(DIST_UNI)/test-stage
+# automation.py differs because it hardcodes a path to
+# dist/bin. It doesn't matter which one we use.
+ if test -d $(DIST_ARCH_1)/test-stage -a \
+ -d $(DIST_ARCH_2)/test-stage; then \
+ cp $(DIST_ARCH_1)/test-stage/mochitest/automation.py \
+ $(DIST_ARCH_2)/test-stage/mochitest/; \
+ cp -RL $(DIST_ARCH_1)/test-stage/mochitest/extensions/specialpowers \
+ $(DIST_ARCH_2)/test-stage/mochitest/extensions/; \
+ cp $(DIST_ARCH_1)/test-stage/xpcshell/automation.py \
+ $(DIST_ARCH_2)/test-stage/xpcshell/; \
+ cp $(DIST_ARCH_1)/test-stage/reftest/automation.py \
+ $(DIST_ARCH_2)/test-stage/reftest/; \
+ cp -RL $(DIST_ARCH_1)/test-stage/reftest/specialpowers \
+ $(DIST_ARCH_2)/test-stage/reftest/; \
+ $(TOPSRCDIR)/build/macosx/universal/unify \
+ --unify-with-sort "\.manifest$$" \
+ --unify-with-sort "all-test-dirs\.list$$" \
+ $(DIST_ARCH_1)/test-stage \
+ $(DIST_ARCH_2)/test-stage \
+ $(DIST_UNI)/test-stage; fi
+endif
diff --git a/build/macosx/universal/jenkins-build.sh b/build/macosx/universal/jenkins-build.sh
deleted file mode 100644
index fdab1d547..000000000
--- a/build/macosx/universal/jenkins-build.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# This script is invoked by Jenkins to execute
-# incremental builds and upload the produced *.dmg
-# files to the distribution mirror.
-
-# Since it is intended to be checked in and public, please
-# do not commit sensitive information e.g. server or port here.
-
-export PATH=$PATH:/usr/local/bin
-export MOZCONFIG=$(pwd)/build/macosx/universal/mozconfig.$FLAVOR
-
-rm -rf obj-*darwin*/dist
-
-./mach build
-./mach package
-
-pushd obj-*darwin*/dist
-scp -P ${PORT} palemoon-*.dmg ${DIST}/$(ls palemoon-*.dmg | sed "s/\.en-US/-${BUILD_NUMBER}-${FLAVOR}.en-US/")
-popd
diff --git a/build/macosx/universal/mozconfig.debug b/build/macosx/universal/mozconfig
index 983a84de2..fd1b3ee92 100644
--- a/build/macosx/universal/mozconfig.debug
+++ b/build/macosx/universal/mozconfig
@@ -2,11 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-# Mac OS X build mozconfig, x86_64 only, include debug symbols.
+# i386/x86-64 Universal Build mozconfig
-#ac_add_options --enable-debug
-ac_add_options --enable-debug-symbols
-ac_add_options --disable-install-strip
-ac_add_options --disable-strip
+# As used here, arguments in $MOZ_BUILD_PROJECTS are suitable as arguments
+# to gcc's -arch parameter.
+mk_add_options MOZ_BUILD_PROJECTS="i386 x86_64"
. $topsrcdir/build/macosx/universal/mozconfig.common
diff --git a/build/macosx/universal/mozconfig.common b/build/macosx/universal/mozconfig.common
index e35e426ff..518274b51 100644
--- a/build/macosx/universal/mozconfig.common
+++ b/build/macosx/universal/mozconfig.common
@@ -12,7 +12,7 @@ ac_add_app_options x86_64 --target=x86_64-apple-darwin$DARWIN_VERSION
ac_add_app_options i386 --with-unify-dist=../x86_64/dist
ac_add_app_options x86_64 --with-unify-dist=../i386/dist
-ac_add_options --with-macos-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
+ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk
. $topsrcdir/build/macosx/mozconfig.common
@@ -42,17 +42,13 @@ if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "x86_64"; then
AS=$CC
LD=ld
STRIP="strip"
-
- # Let configure know that we mean business.
- if test "$NATIVE_CPU" != "$TARGET_CPU" ; then
- CROSS_COMPILE=1
- fi
+ OTOOL="otool"
# Each per-CPU build should be entirely oblivious to the fact that a
# universal binary will be produced. The exception is packager.mk, which
# needs to know to look for universal bits when building the .dmg.
UNIVERSAL_BINARY=1
- export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP
+ export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP OTOOL
fi
fi
diff --git a/build/macosx/universal/mozconfig.gstreamer b/build/macosx/universal/mozconfig.gstreamer
deleted file mode 100644
index 163cdd2c8..000000000
--- a/build/macosx/universal/mozconfig.gstreamer
+++ /dev/null
@@ -1,3 +0,0 @@
-. build/macosx/universal/mozconfig.debug
-
-ac_add_options --enable-gstreamer=1.0
diff --git a/build/macosx/universal/mozconfig.release b/build/macosx/universal/mozconfig.release
deleted file mode 100644
index 4ccea186a..000000000
--- a/build/macosx/universal/mozconfig.release
+++ /dev/null
@@ -1,14 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# Mac OS X build mozconfig, x86_64 only, release build.
-
-# Please note the restrictions on official branding when using this line.
-ac_add_options --enable-official-branding
-export MOZILLA_OFFICIAL=1
-
-ac_add_options --disable-debug
-ac_add_options --enable-strip
-
-. $topsrcdir/build/macosx/universal/mozconfig.common
diff --git a/build/macosx/universal/unify b/build/macosx/universal/unify
index 81f270218..38dd35414 100755
--- a/build/macosx/universal/unify
+++ b/build/macosx/universal/unify
@@ -139,7 +139,7 @@ recommended.
=head1 LICENSE
-MPL 1.1/GPL 2.0/LGPL 2.1. Your choice
+MPL 2.
=head1 AUTHOR
@@ -1395,7 +1395,7 @@ sub readZipCRCs($) {
if ($$this{'magicInit'}) {
if (defined($$this{'magicErrno'})) {
if (defined($$this{'magicErrMsg'})) {
- complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
+ main::complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
$$this{'path'});
}
$! = $$this{'magicErrno'};
@@ -1409,7 +1409,7 @@ sub readZipCRCs($) {
if (!sysopen($fh, $$this{'path'}, O_RDONLY)) {
$$this{'magicErrno'} = $!;
$$this{'magicErrMsg'} = 'open "'.$$this{'path'}.'": '.$!;
- complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
+ main::complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
$$this{'path'});
return undef;
}
@@ -1419,7 +1419,7 @@ sub readZipCRCs($) {
if (!defined($bytes = sysread($fh, $magic, 4))) {
$$this{'magicErrno'} = $!;
$$this{'magicErrMsg'} = 'read "'.$$this{'path'}.'": '.$!;
- complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
+ main::complain(1, 'FileAttrCache::magic: '.$$this{'magicErrMsg'}.' for:',
$$this{'path'});
close($fh);
return undef;
diff --git a/build/mobile/b2gautomation.py b/build/mobile/b2gautomation.py
index 2caf9308f..4a0c5998c 100644
--- a/build/mobile/b2gautomation.py
+++ b/build/mobile/b2gautomation.py
@@ -2,18 +2,21 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
+import datetime
import mozcrash
import threading
import os
+import posixpath
import Queue
import re
import shutil
+import signal
import tempfile
import time
import traceback
from automation import Automation
-from devicemanager import NetworkTools
+from mozlog.structured import get_default_logger
from mozprocess import ProcessHandlerMixin
@@ -76,7 +79,7 @@ class B2GRemoteAutomation(Automation):
Automation.installExtension(self, extensionSource, profileDir, extensionID)
# Set up what we need for the remote environment
- def environment(self, env=None, xrePath=None):
+ def environment(self, env=None, xrePath=None, debugger=False):
# Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ
if env is None:
@@ -108,7 +111,11 @@ class B2GRemoteAutomation(Automation):
local_dump_dir = tempfile.mkdtemp()
self._devicemanager.getDirectory(remote_dump_dir, local_dump_dir)
try:
- crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
+ logger = get_default_logger()
+ if logger is not None:
+ crashed = mozcrash.log_crashes(logger, local_dump_dir, symbolsPath, test=self.lastTestSeen)
+ else:
+ crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
except:
traceback.print_exc()
finally:
@@ -125,10 +132,6 @@ class B2GRemoteAutomation(Automation):
return app, args
- def getLanIp(self):
- nettools = NetworkTools()
- return nettools.getLanIp()
-
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime,
debuggerInfo, symbolsPath):
""" Wait for tests to finish (as evidenced by a signature string
@@ -136,11 +139,9 @@ class B2GRemoteAutomation(Automation):
output.
"""
timeout = timeout or 120
- responseDueBy = time.time() + timeout
while True:
- currentlog = proc.stdout
+ currentlog = proc.getStdoutLines(timeout)
if currentlog:
- responseDueBy = time.time() + timeout
print currentlog
# Match the test filepath from the last TEST-START line found in the new
# log content. These lines are in the form:
@@ -151,12 +152,24 @@ class B2GRemoteAutomation(Automation):
if hasattr(self, 'logFinish') and self.logFinish in currentlog:
return 0
else:
- if time.time() > responseDueBy:
- self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed "
- "out after %d seconds with no output",
- self.lastTestSeen, int(timeout))
+ self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed "
+ "out after %d seconds with no output",
+ self.lastTestSeen, int(timeout))
+ self._devicemanager.killProcess('/system/b2g/b2g', sig=signal.SIGABRT)
+
+ timeout = 10 # seconds
+ starttime = datetime.datetime.now()
+ while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout):
+ if not self._devicemanager.processExist('/system/b2g/b2g'):
+ break
+ time.sleep(1)
+ else:
+ print "timed out after %d seconds waiting for b2g process to exit" % timeout
return 1
+ self.checkForCrashes(None, symbolsPath)
+ return 1
+
def getDeviceStatus(self, serial=None):
# Get the current status of the device. If we know the device
# serial number, we look for that, otherwise we use the (presumably
@@ -182,7 +195,7 @@ class B2GRemoteAutomation(Automation):
time.sleep(10)
self._devicemanager._checkCmd(['shell', 'start', 'b2g'])
if self._is_emulator:
- self.marionette.emulator.wait_for_port()
+ self.marionette.emulator.wait_for_port(self.marionette.port)
def rebootDevice(self):
# find device's current status and serial number
@@ -232,6 +245,11 @@ class B2GRemoteAutomation(Automation):
self._devicemanager._runCmd(['shell', 'stop', 'b2g'])
time.sleep(5)
+ # For some reason user.js in the profile doesn't get picked up.
+ # Manually copy it over to prefs.js. See bug 1009730 for more details.
+ self._devicemanager.moveTree(posixpath.join(self._remoteProfile, 'user.js'),
+ posixpath.join(self._remoteProfile, 'prefs.js'))
+
# relaunch b2g inside b2g instance
instance = self.B2GInstance(self._devicemanager, env=env)
@@ -245,7 +263,7 @@ class B2GRemoteAutomation(Automation):
'tcp:%s' % self.marionette.port])
if self._is_emulator:
- self.marionette.emulator.wait_for_port()
+ self.marionette.emulator.wait_for_port(self.marionette.port)
else:
time.sleep(5)
@@ -254,17 +272,6 @@ class B2GRemoteAutomation(Automation):
if 'b2g' not in session:
raise Exception("bad session value %s returned by start_session" % session)
- if self._is_emulator:
- # Disable offline status management (bug 777145), otherwise the network
- # will be 'offline' when the mochitests start. Presumably, the network
- # won't be offline on a real device, so we only do this for emulators.
- self.marionette.set_context(self.marionette.CONTEXT_CHROME)
- self.marionette.execute_script("""
- Components.utils.import("resource://gre/modules/Services.jsm");
- Services.io.manageOfflineStatus = false;
- Services.io.offline = false;
- """)
-
if self.context_chrome:
self.marionette.set_context(self.marionette.CONTEXT_CHROME)
else:
@@ -325,16 +332,22 @@ class B2GRemoteAutomation(Automation):
# a dummy value to make the automation happy
return 0
- @property
- def stdout(self):
+ def getStdoutLines(self, timeout):
# Return any lines in the queue used by the
# b2g process handler.
lines = []
+ # get all of the lines that are currently available
while True:
try:
lines.append(self.queue.get_nowait())
except Queue.Empty:
break
+
+ # wait 'timeout' for any additional lines
+ try:
+ lines.append(self.queue.get(True, timeout))
+ except Queue.Empty:
+ pass
return '\n'.join(lines)
def wait(self, timeout=None):
@@ -345,25 +358,3 @@ class B2GRemoteAutomation(Automation):
# this should never happen
raise Exception("'kill' called on B2GInstance")
-
-class B2GDesktopAutomation(Automation):
-
- def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
- """ build the application command line """
-
- cmd = os.path.abspath(app)
- args = []
-
- if debuggerInfo:
- args.extend(debuggerInfo["args"])
- args.append(cmd)
- cmd = os.path.abspath(debuggerInfo["path"])
-
- if self.IS_MAC:
- args.append("-foreground")
-
- profileDirectory = profileDir + "/"
-
- args.extend(("-profile", profileDirectory))
- args.extend(extraArgs)
- return cmd, args
diff --git a/build/mobile/remoteautomation.py b/build/mobile/remoteautomation.py
index c0ab03ed6..7bd4cbffb 100644
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -2,28 +2,35 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+import glob
import time
import re
import os
import tempfile
import shutil
import subprocess
+import sys
from automation import Automation
-from devicemanager import NetworkTools, DMError
+from devicemanager import DMError
+from mozlog.structured import get_default_logger
+import mozcrash
# signatures for logcat messages that we don't care about much
fennecLogcatFilters = [ "The character encoding of the HTML document was not declared",
- "Use of Mutation Events is deprecated. Use MutationObserver instead." ]
+ "Use of Mutation Events is deprecated. Use MutationObserver instead.",
+ "Unexpected value from nativeGetEnabledTags: 0" ]
class RemoteAutomation(Automation):
_devicemanager = None
- def __init__(self, deviceManager, appName = '', remoteLog = None):
+ def __init__(self, deviceManager, appName = '', remoteLog = None,
+ processArgs=None):
self._devicemanager = deviceManager
self._appName = appName
self._remoteProfile = None
self._remoteLog = remoteLog
+ self._processArgs = processArgs or {};
# Default our product to fennec
self._product = "fennec"
@@ -46,74 +53,60 @@ class RemoteAutomation(Automation):
self._remoteLog = logfile
# Set up what we need for the remote environment
- def environment(self, env = None, xrePath = None):
+ def environment(self, env=None, xrePath=None, debugger=False, dmdPath=None, lsanPath=None):
# Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ
if env is None:
env = {}
+ if dmdPath:
+ env['MOZ_REPLACE_MALLOC_LIB'] = os.path.join(dmdPath, 'libdmd.so')
+
# Except for the mochitest results table hiding option, which isn't
# passed to runtestsremote.py as an actual option.
if 'MOZ_HIDE_RESULTS_TABLE' in os.environ:
env['MOZ_HIDE_RESULTS_TABLE'] = os.environ['MOZ_HIDE_RESULTS_TABLE']
+ # Crash on non-local network connections by default.
+ # MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily
+ # enable non-local connections for the purposes of local testing.
+ # Don't override the user's choice here. See bug 1049688.
+ env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1')
+
return env
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath):
- """ Wait for tests to finish (as evidenced by the process exiting),
- or for maxTime elapse, in which case kill the process regardless.
+ """ Wait for tests to finish.
+ If maxTime seconds elapse or no output is detected for timeout
+ seconds, kill the process and fail the test.
"""
# maxTime is used to override the default timeout, we should honor that
- status = proc.wait(timeout = maxTime)
+ status = proc.wait(timeout = maxTime, noOutputTimeout = timeout)
self.lastTestSeen = proc.getLastTestSeen
- if (status == 1 and self._devicemanager.getTopActivity() == proc.procName):
- # Then we timed out, make sure Fennec is dead
+ topActivity = self._devicemanager.getTopActivity()
+ if topActivity == proc.procName:
+ proc.kill(True)
+ if status == 1:
if maxTime:
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
"allowed maximum time of %s seconds" % (self.lastTestSeen, maxTime)
else:
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
"allowed maximum time" % (self.lastTestSeen)
- proc.kill()
+ if status == 2:
+ print "TEST-UNEXPECTED-FAIL | %s | application timed out after %d seconds with no output" \
+ % (self.lastTestSeen, int(timeout))
return status
- def checkForJavaException(self, logcat):
- found_exception = False
- for i, line in enumerate(logcat):
- if "REPORTING UNCAUGHT EXCEPTION" in line or "FATAL EXCEPTION" in line:
- # Strip away the date, time, logcat tag and pid from the next two lines and
- # concatenate the remainder to form a concise summary of the exception.
- #
- # For example:
- #
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 9 ("GoannaBackgroundThread")
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): java.lang.NullPointerException
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): at org.mozilla.goanna.GoannaApp$21.run(GoannaApp.java:1833)
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): at android.os.Handler.handleCallback(Handler.java:587)
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): at android.os.Handler.dispatchMessage(Handler.java:92)
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): at android.os.Looper.loop(Looper.java:123)
- # 01-30 20:15:41.937 E/GoannaAppShell( 1703): at org.mozilla.goanna.util.GoannaBackgroundThread.run(GoannaBackgroundThread.java:31)
- #
- # -> java.lang.NullPointerException at org.mozilla.goanna.GoannaApp$21.run(GoannaApp.java:1833)
- found_exception = True
- logre = re.compile(r".*\): \t?(.*)")
- m = logre.search(logcat[i+1])
- if m and m.group(1):
- top_frame = m.group(1)
- m = logre.search(logcat[i+2])
- if m and m.group(1):
- top_frame = top_frame + m.group(1)
- print "PROCESS-CRASH | java-exception | %s" % top_frame
- break
- return found_exception
-
def deleteANRs(self):
- # delete ANR traces.txt file; usually need root permissions
+ # empty ANR traces.txt file; usually need root permissions
+ # we make it empty and writable so we can test the ANR reporter later
traces = "/data/anr/traces.txt"
try:
- self._devicemanager.shellCheckOutput(['rm', traces], root=True)
+ self._devicemanager.shellCheckOutput(['echo', '', '>', traces], root=True)
+ self._devicemanager.shellCheckOutput(['chmod', '666', traces], root=True)
except DMError:
print "Error deleting %s" % traces
pass
@@ -129,15 +122,59 @@ class RemoteAutomation(Automation):
self.deleteANRs()
except DMError:
print "Error pulling %s" % traces
- pass
+ except IOError:
+ print "Error pulling %s" % traces
else:
print "%s not found" % traces
+ def deleteTombstones(self):
+ # delete any existing tombstone files from device
+ remoteDir = "/data/tombstones"
+ try:
+ self._devicemanager.shellCheckOutput(['rm', '-r', remoteDir], root=True)
+ except DMError:
+ # This may just indicate that the tombstone directory is missing
+ pass
+
+ def checkForTombstones(self):
+ # pull any tombstones from device and move to MOZ_UPLOAD_DIR
+ remoteDir = "/data/tombstones"
+ blobberUploadDir = os.environ.get('MOZ_UPLOAD_DIR', None)
+ if blobberUploadDir:
+ if not os.path.exists(blobberUploadDir):
+ os.mkdir(blobberUploadDir)
+ if self._devicemanager.dirExists(remoteDir):
+ # copy tombstone files from device to local blobber upload directory
+ try:
+ self._devicemanager.shellCheckOutput(['chmod', '777', remoteDir], root=True)
+ self._devicemanager.shellCheckOutput(['chmod', '666', os.path.join(remoteDir, '*')], root=True)
+ self._devicemanager.getDirectory(remoteDir, blobberUploadDir, False)
+ except DMError:
+ # This may just indicate that no tombstone files are present
+ pass
+ self.deleteTombstones()
+ # add a .txt file extension to each tombstone file name, so
+ # that blobber will upload it
+ for f in glob.glob(os.path.join(blobberUploadDir, "tombstone_??")):
+ # add a unique integer to the file name, in case there are
+ # multiple tombstones generated with the same name, for
+ # instance, after multiple robocop tests
+ for i in xrange(1, sys.maxint):
+ newname = "%s.%d.txt" % (f, i)
+ if not os.path.exists(newname):
+ os.rename(f, newname)
+ break
+ else:
+ print "%s does not exist; tombstone check skipped" % remoteDir
+ else:
+ print "MOZ_UPLOAD_DIR not defined; tombstone check skipped"
+
def checkForCrashes(self, directory, symbolsPath):
self.checkForANRs()
+ self.checkForTombstones()
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
- javaException = self.checkForJavaException(logcat)
+ javaException = mozcrash.check_for_java_exception(logcat)
if javaException:
return True
@@ -164,60 +201,43 @@ class RemoteAutomation(Automation):
# return app, ['--environ:NO_EM_RESTART=1'] + args
return app, args
- def getLanIp(self):
- nettools = NetworkTools()
- return nettools.getLanIp()
-
def Process(self, cmd, stdout = None, stderr = None, env = None, cwd = None):
if stdout == None or stdout == -1 or stdout == subprocess.PIPE:
- stdout = self._remoteLog
+ stdout = self._remoteLog
- return self.RProcess(self._devicemanager, cmd, stdout, stderr, env, cwd)
+ return self.RProcess(self._devicemanager, cmd, stdout, stderr, env, cwd, self._appName,
+ **self._processArgs)
# be careful here as this inner class doesn't have access to outer class members
class RProcess(object):
# device manager process
dm = None
- def __init__(self, dm, cmd, stdout = None, stderr = None, env = None, cwd = None):
+ def __init__(self, dm, cmd, stdout=None, stderr=None, env=None, cwd=None, app=None,
+ messageLogger=None):
self.dm = dm
self.stdoutlen = 0
self.lastTestSeen = "remoteautomation.py"
self.proc = dm.launchProcess(cmd, stdout, cwd, env, True)
+ self.messageLogger = messageLogger
+
if (self.proc is None):
- if cmd[0] == 'am':
- self.proc = stdout
- else:
- raise Exception("unable to launch process")
- exepath = cmd[0]
- name = exepath.split('/')[-1]
- self.procName = name
- # Hack for Robocop: Derive the actual process name from the command line.
- # We expect something like:
- # ['am', 'instrument', '-w', '-e', 'class', 'org.mozilla.fennec.tests.testBookmark', 'org.mozilla.roboexample.test/android.test.InstrumentationTestRunner']
- # and want to derive 'org.mozilla.fennec'.
+ if cmd[0] == 'am':
+ self.proc = stdout
+ else:
+ raise Exception("unable to launch process")
+ self.procName = cmd[0].split('/')[-1]
if cmd[0] == 'am' and cmd[1] == "instrument":
- try:
- i = cmd.index("class")
- except ValueError:
- # no "class" argument -- maybe this isn't robocop?
- i = -1
- if (i > 0):
- classname = cmd[i+1]
- parts = classname.split('.')
- try:
- i = parts.index("tests")
- except ValueError:
- # no "tests" component -- maybe this isn't robocop?
- i = -1
- if (i > 0):
- self.procName = '.'.join(parts[0:i])
- print "Robocop derived process name: "+self.procName
+ self.procName = app
+ print "Robocop process name: "+self.procName
# Setting timeout at 1 hour since on a remote device this takes much longer
self.timeout = 3600
# The benefit of the following sleep is unclear; it was formerly 15 seconds
time.sleep(1)
+ # Used to buffer log messages until we meet a line break
+ self.logBuffer = ""
+
@property
def pid(self):
pid = self.dm.processExist(self.procName)
@@ -229,56 +249,111 @@ class RemoteAutomation(Automation):
return 0
return pid
- @property
- def stdout(self):
+ def read_stdout(self):
""" Fetch the full remote log file using devicemanager and return just
- the new log entries since the last call (as a multi-line string).
+ the new log entries since the last call (as a list of messages or lines).
"""
- if self.dm.fileExists(self.proc):
- try:
- t = self.dm.pullFile(self.proc)
- except DMError:
- # we currently don't retry properly in the pullFile
- # function in dmSUT, so an error here is not necessarily
- # the end of the world
- return ''
- newLogContent = t[self.stdoutlen:]
- self.stdoutlen = len(t)
- # Match the test filepath from the last TEST-START line found in the new
- # log content. These lines are in the form:
- # 1234 INFO TEST-START | /filepath/we/wish/to/capture.html\n
+ if not self.dm.fileExists(self.proc):
+ return []
+ try:
+ newLogContent = self.dm.pullFile(self.proc, self.stdoutlen)
+ except DMError:
+ # we currently don't retry properly in the pullFile
+ # function in dmSUT, so an error here is not necessarily
+ # the end of the world
+ return []
+ if not newLogContent:
+ return []
+
+ self.stdoutlen += len(newLogContent)
+
+ if self.messageLogger is None:
testStartFilenames = re.findall(r"TEST-START \| ([^\s]*)", newLogContent)
if testStartFilenames:
self.lastTestSeen = testStartFilenames[-1]
- return newLogContent.strip('\n').strip()
- else:
- return ''
+ print newLogContent
+ return [newLogContent]
+
+ self.logBuffer += newLogContent
+ lines = self.logBuffer.split('\n')
+ if not lines:
+ return
+
+ # We only keep the last (unfinished) line in the buffer
+ self.logBuffer = lines[-1]
+ del lines[-1]
+ messages = []
+ for line in lines:
+ # This passes the line to the logger (to be logged or buffered)
+ # and returns a list of structured messages (dict)
+ parsed_messages = self.messageLogger.write(line)
+ for message in parsed_messages:
+ if message['action'] == 'test_start':
+ self.lastTestSeen = message['test']
+ messages += parsed_messages
+ return messages
@property
def getLastTestSeen(self):
return self.lastTestSeen
- def wait(self, timeout = None):
+ # Wait for the remote process to end (or for its activity to go to background).
+ # While waiting, periodically retrieve the process output and print it.
+ # If the process is still running after *timeout* seconds, return 1;
+ # If the process is still running but no output is received in *noOutputTimeout*
+ # seconds, return 2;
+ # Else, once the process exits/goes to background, return 0.
+ def wait(self, timeout = None, noOutputTimeout = None):
timer = 0
- interval = 5
+ noOutputTimer = 0
+ interval = 20
if timeout == None:
timeout = self.timeout
+ status = 0
while (self.dm.getTopActivity() == self.procName):
- t = self.stdout
- if t != '': print t
+ # retrieve log updates every 60 seconds
+ if timer % 60 == 0:
+ messages = self.read_stdout()
+ if messages:
+ noOutputTimer = 0
+
time.sleep(interval)
timer += interval
+ noOutputTimer += interval
if (timer > timeout):
+ status = 1
+ break
+ if (noOutputTimeout and noOutputTimer > noOutputTimeout):
+ status = 2
break
# Flush anything added to stdout during the sleep
- print self.stdout
-
- if (timer >= timeout):
- return 1
- return 0
-
- def kill(self):
- self.dm.killProcess(self.procName)
+ self.read_stdout()
+
+ return status
+
+ def kill(self, stagedShutdown = False):
+ if stagedShutdown:
+ # Trigger an ANR report with "kill -3" (SIGQUIT)
+ self.dm.killProcess(self.procName, 3)
+ time.sleep(3)
+ # Trigger a breakpad dump with "kill -6" (SIGABRT)
+ self.dm.killProcess(self.procName, 6)
+ # Wait for process to end
+ retries = 0
+ while retries < 3:
+ pid = self.dm.processExist(self.procName)
+ if pid and pid > 0:
+ print "%s still alive after SIGABRT: waiting..." % self.procName
+ time.sleep(5)
+ else:
+ return
+ retries += 1
+ self.dm.killProcess(self.procName, 9)
+ pid = self.dm.processExist(self.procName)
+ if pid and pid > 0:
+ self.dm.killProcess(self.procName)
+ else:
+ self.dm.killProcess(self.procName)
diff --git a/build/mobile/robocop/Actions.java.in b/build/mobile/robocop/Actions.java
index 0d94aa0c9..aef83503d 100644
--- a/build/mobile/robocop/Actions.java.in
+++ b/build/mobile/robocop/Actions.java
@@ -1,12 +1,8 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
-import java.util.List;
-import java.util.ArrayList;
-
+package org.mozilla.goanna;
import android.database.Cursor;
public interface Actions {
@@ -19,6 +15,7 @@ public interface Actions {
public interface EventExpecter {
/** Blocks until the event has been received. Subsequent calls will return immediately. */
public void blockForEvent();
+ public void blockForEvent(long millis, boolean failOnTimeout);
/** Blocks until the event has been received and returns data associated with the event. */
public String blockForEventData();
@@ -49,6 +46,29 @@ public interface Actions {
void sendGoannaEvent(String goannaEvent, String data);
/**
+ * Sends a preferences get event to Goanna.
+ *
+ * @param requestId The id of this request.
+ * @param prefNames The preferences being requested.
+ */
+ void sendPreferencesGetEvent(int requestId, String[] prefNames);
+
+ /**
+ * Sends a preferences observe event to Goanna.
+ *
+ * @param requestId The id of this request.
+ * @param prefNames The preferences being requested.
+ */
+ void sendPreferencesObserveEvent(int requestId, String[] prefNames);
+
+ /**
+ * Sends a preferences remove observers event to Goanna.
+ *
+ * @param requestId The id of this request.
+ */
+ void sendPreferencesRemoveObserversEvent(int requestid);
+
+ /**
* Listens for a goanna event to be sent from the Goanna instance.
* The returned object can be used to test if the event has been
* received. Note that only one event is listened for.
diff --git a/build/mobile/robocop/AndroidManifest.xml.in b/build/mobile/robocop/AndroidManifest.xml.in
index 2d0a79e7e..7e2cf2400 100644
--- a/build/mobile/robocop/AndroidManifest.xml.in
+++ b/build/mobile/robocop/AndroidManifest.xml.in
@@ -8,12 +8,38 @@
<uses-sdk android:minSdkVersion="8" />
<instrumentation
- android:name="@ANDROID_PACKAGE_NAME@.FennecInstrumentationTestRunner"
+ android:name="org.mozilla.goanna.FennecInstrumentationTestRunner"
android:targetPackage="@ANDROID_PACKAGE_NAME@" />
<application
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
+
+ <!-- Fake handlers to ensure that we have some share intents to show in our share handler list -->
+ <activity android:name="org.mozilla.goanna.RobocopShare1"
+ android:label="Robocop fake activity">
+
+ <intent-filter android:label="Fake robocop share handler 1">
+ <action android:name="android.intent.action.SEND" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:mimeType="text/*" />
+ <data android:mimeType="image/*" />
+ </intent-filter>
+
+ </activity>
+
+ <activity android:name="org.mozilla.goanna.RobocopShare2"
+ android:label="Robocop fake activity 2">
+
+ <intent-filter android:label="Fake robocop share handler 2">
+ <action android:name="android.intent.action.SEND" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:mimeType="text/*" />
+ <data android:mimeType="image/*" />
+ </intent-filter>
+
+ </activity>
+
</application>
</manifest>
diff --git a/build/mobile/robocop/Assert.java.in b/build/mobile/robocop/Assert.java
index 878ff06b8..f65541fcd 100644
--- a/build/mobile/robocop/Assert.java.in
+++ b/build/mobile/robocop/Assert.java
@@ -1,9 +1,8 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
public interface Assert {
void dumpLog(String message);
@@ -13,11 +12,11 @@ public interface Assert {
void endTest();
void ok(boolean condition, String name, String diag);
- void is(Object a, Object b, String name);
- void isnot(Object a, Object b, String name);
+ void is(Object actual, Object expected, String name);
+ void isnot(Object actual, Object notExpected, String name);
void todo(boolean condition, String name, String diag);
- void todo_is(Object a, Object b, String name);
- void todo_isnot(Object a, Object b, String name);
+ void todo_is(Object actual, Object expected, String name);
+ void todo_isnot(Object actual, Object notExpected, String name);
void info(String name, String message);
// robocop-specific asserts
diff --git a/build/mobile/robocop/Driver.java.in b/build/mobile/robocop/Driver.java
index 873cdd468..974651607 100644
--- a/build/mobile/robocop/Driver.java.in
+++ b/build/mobile/robocop/Driver.java
@@ -1,11 +1,9 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
-import java.util.List;
import android.app.Activity;
public interface Driver {
@@ -13,10 +11,10 @@ public interface Driver {
* Find the first Element using the given method.
*
* @param activity The activity the element belongs to
- * @param name The name of the element
+ * @param id The resource id of the element
* @return The first matching element on the current context, or null if not found.
*/
- Element findElement(Activity activity, String name);
+ Element findElement(Activity activity, int id);
/**
* Sets up scroll handling so that data is received from the extension.
diff --git a/build/mobile/robocop/Element.java.in b/build/mobile/robocop/Element.java
index 97bb2f873..73219c41f 100644
--- a/build/mobile/robocop/Element.java.in
+++ b/build/mobile/robocop/Element.java
@@ -1,9 +1,8 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
/**
* Element provides access to a specific UI view (android.view.View).
diff --git a/build/mobile/robocop/FennecInstrumentationTestRunner.java.in b/build/mobile/robocop/FennecInstrumentationTestRunner.java
index 6b86fe457..11093775f 100644
--- a/build/mobile/robocop/FennecInstrumentationTestRunner.java.in
+++ b/build/mobile/robocop/FennecInstrumentationTestRunner.java
@@ -1,9 +1,8 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
import android.os.Bundle;
import android.test.InstrumentationTestRunner;
@@ -23,9 +22,9 @@ public class FennecInstrumentationTestRunner extends InstrumentationTestRunner {
// unfortunately we have to make this static because test classes that don't extend
// from ActivityInstrumentationTestCase2 can't get a reference to this class.
- public static Bundle getArguments() {
+ public static Bundle getFennecArguments() {
if (sArguments == null) {
- Log.e("Robocop", "FennecInstrumentationTestCase.getArguments returns null bundle");
+ Log.e("Robocop", "FennecInstrumentationTestCase.getFennecArguments returns null bundle");
}
return sArguments;
}
diff --git a/build/mobile/robocop/FennecMochitestAssert.java.in b/build/mobile/robocop/FennecMochitestAssert.java
index d13bff21b..dd36e97fe 100644
--- a/build/mobile/robocop/FennecMochitestAssert.java.in
+++ b/build/mobile/robocop/FennecMochitestAssert.java
@@ -1,22 +1,24 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
import java.util.LinkedList;
+
import android.os.SystemClock;
public class FennecMochitestAssert implements Assert {
private LinkedList<testInfo> mTestList = new LinkedList<testInfo>();
// Internal state variables to make logging match up with existing mochitests
- private int mLineNumber = 0;
private int mPassed = 0;
private int mFailed = 0;
private int mTodo = 0;
-
+
// Used to write the first line of the test file
private boolean mLogStarted = false;
@@ -26,17 +28,31 @@ public class FennecMochitestAssert implements Assert {
// Measure the time it takes to run test case
private long mStartTime = 0;
- public FennecMochitestAssert() {
- }
+ // Structured logger
+ private StructuredLogger mLogger;
/** Write information to a logfile and logcat */
public void dumpLog(String message) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message);
+ mLogger.info(message);
}
- /** Write information to a logfile and logcat */
public void dumpLog(String message, Throwable t) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t);
+ Writer sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ mLogger.error(message + " - " + sw.toString());
+ }
+
+ /** Write information to a logfile and logcat */
+ static class DumpLogCallback implements StructuredLogger.LoggerCallback {
+ public void call(String output) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, output);
+ }
+ }
+
+
+ public FennecMochitestAssert() {
+ mLogger = new StructuredLogger("robocop", new DumpLogCallback());
}
/** Set the filename used for dumpLog. */
@@ -45,15 +61,13 @@ public class FennecMochitestAssert implements Assert {
String message;
if (!mLogStarted) {
- dumpLog(Integer.toString(mLineNumber++) + " INFO SimpleTest START");
+ mLogger.info("SimpleTest START");
mLogStarted = true;
}
if (mLogTestName != "") {
long diff = SystemClock.uptimeMillis() - mStartTime;
- message = Integer.toString(mLineNumber++) + " INFO TEST-END | " + mLogTestName;
- message += " | finished in " + diff + "ms";
- dumpLog(message);
+ mLogger.testEnd(mLogTestName, "OK", "finished in " + diff + "ms");
mLogTestName = "";
}
}
@@ -63,7 +77,7 @@ public class FennecMochitestAssert implements Assert {
mLogTestName = nameParts[nameParts.length - 1];
mStartTime = SystemClock.uptimeMillis();
- dumpLog(Integer.toString(mLineNumber++) + " INFO TEST-START | " + mLogTestName);
+ mLogger.testStart(mLogTestName);
}
class testInfo {
@@ -71,32 +85,37 @@ public class FennecMochitestAssert implements Assert {
public String mName;
public String mDiag;
public boolean mTodo;
- public testInfo(boolean r, String n, String d, boolean t) {
+ public boolean mInfo;
+ public testInfo(boolean r, String n, String d, boolean t, boolean i) {
mResult = r;
mName = n;
mDiag = d;
mTodo = t;
+ mInfo = i;
}
}
- private void _logMochitestResult(testInfo test, String passString, String failString) {
+ /** Used to log a subtest's result.
+ * test represents the subtest (an assertion).
+ * passStatus and passExpected are the actual status and the expected status if the assertion is true.
+ * failStatus and failExpected are the actual status and the expected status otherwise.
+ */
+ private void _logMochitestResult(testInfo test, String passStatus, String passExpected, String failStatus, String failExpected) {
boolean isError = true;
- String resultString = failString;
if (test.mResult || test.mTodo) {
isError = false;
}
if (test.mResult)
{
- resultString = passString;
+ mLogger.testStatus(mLogTestName, test.mName, passStatus, passExpected, test.mDiag);
+ } else {
+ mLogger.testStatus(mLogTestName, test.mName, failStatus, failExpected, test.mDiag);
}
- String diag = test.mName;
- if (test.mDiag != null) diag += " - " + test.mDiag;
- String message = Integer.toString(mLineNumber++) + " INFO " + resultString + " | " + mLogTestName + " | " + diag;
- dumpLog(message);
-
- if (test.mTodo) {
+ if (test.mInfo) {
+ // do not count TEST-INFO messages
+ } else if (test.mTodo) {
mTodo++;
} else if (isError) {
mFailed++;
@@ -104,6 +123,8 @@ public class FennecMochitestAssert implements Assert {
mPassed++;
}
if (isError) {
+ String message = "TEST-UNEXPECTED-" + failStatus + " | " + mLogTestName + " | "
+ + test.mName + " - " + test.mDiag;
junit.framework.Assert.fail(message);
}
}
@@ -113,38 +134,31 @@ public class FennecMochitestAssert implements Assert {
if (mLogTestName != "") {
long diff = SystemClock.uptimeMillis() - mStartTime;
- message = Integer.toString(mLineNumber++) + " INFO TEST-END | " + mLogTestName;
- message += " | finished in " + diff + "ms";
- dumpLog(message);
+ mLogger.testEnd(mLogTestName, "OK", "finished in " + diff + "ms");
mLogTestName = "";
}
- message = Integer.toString(mLineNumber++) + " INFO TEST-START | Shutdown";
- dumpLog(message);
- message = Integer.toString(mLineNumber++) + " INFO Passed: " + Integer.toString(mPassed);
- dumpLog(message);
- message = Integer.toString(mLineNumber++) + " INFO Failed: " + Integer.toString(mFailed);
- dumpLog(message);
- message = Integer.toString(mLineNumber++) + " INFO Todo: " + Integer.toString(mTodo);
- dumpLog(message);
- message = Integer.toString(mLineNumber++) + " INFO SimpleTest FINISHED";
- dumpLog(message);
+ mLogger.info("TEST-START | Shutdown");
+ mLogger.info("Passed: " + Integer.toString(mPassed));
+ mLogger.info("Failed: " + Integer.toString(mFailed));
+ mLogger.info("Todo: " + Integer.toString(mTodo));
+ mLogger.info("SimpleTest FINISHED");
}
public void ok(boolean condition, String name, String diag) {
- testInfo test = new testInfo(condition, name, diag, false);
- _logMochitestResult(test, "TEST-PASS", "TEST-UNEXPECTED-FAIL");
+ testInfo test = new testInfo(condition, name, diag, false, false);
+ _logMochitestResult(test, "PASS", "PASS", "FAIL", "PASS");
mTestList.add(test);
}
- public void is(Object a, Object b, String name) {
- boolean pass = checkObjectsEqual(a,b);
- ok(pass, name, getEqualString(a,b, pass));
+ public void is(Object actual, Object expected, String name) {
+ boolean pass = checkObjectsEqual(actual, expected);
+ ok(pass, name, getEqualString(actual, expected, pass));
}
-
- public void isnot(Object a, Object b, String name) {
- boolean pass = checkObjectsNotEqual(a,b);
- ok(pass, name, getNotEqualString(a,b,pass));
+
+ public void isnot(Object actual, Object notExpected, String name) {
+ boolean pass = checkObjectsNotEqual(actual, notExpected);
+ ok(pass, name, getNotEqualString(actual, notExpected, pass));
}
public void ispixel(int actual, int r, int g, int b, String name) {
@@ -189,19 +203,19 @@ public class FennecMochitestAssert implements Assert {
}
public void todo(boolean condition, String name, String diag) {
- testInfo test = new testInfo(condition, name, diag, true);
- _logMochitestResult(test, "TEST-UNEXPECTED-PASS", "TEST-KNOWN-FAIL");
+ testInfo test = new testInfo(condition, name, diag, true, false);
+ _logMochitestResult(test, "PASS", "FAIL", "FAIL", "FAIL");
mTestList.add(test);
}
- public void todo_is(Object a, Object b, String name) {
- boolean pass = checkObjectsEqual(a,b);
- todo(pass, name, getEqualString(a,b,pass));
+ public void todo_is(Object actual, Object expected, String name) {
+ boolean pass = checkObjectsEqual(actual, expected);
+ todo(pass, name, getEqualString(actual, expected, pass));
}
- public void todo_isnot(Object a, Object b, String name) {
- boolean pass = checkObjectsNotEqual(a,b);
- todo(pass, name, getNotEqualString(a,b,pass));
+ public void todo_isnot(Object actual, Object notExpected, String name) {
+ boolean pass = checkObjectsNotEqual(actual, notExpected);
+ todo(pass, name, getNotEqualString(actual, notExpected, pass));
}
private boolean checkObjectsEqual(Object a, Object b) {
@@ -242,7 +256,6 @@ public class FennecMochitestAssert implements Assert {
}
public void info(String name, String message) {
- testInfo test = new testInfo(true, name, message, false);
- _logMochitestResult(test, "TEST-INFO", "INFO FAILED?");
+ mLogger.info(name + " | " + message);
}
}
diff --git a/build/mobile/robocop/FennecNativeActions.java b/build/mobile/robocop/FennecNativeActions.java
new file mode 100644
index 000000000..0e005b223
--- /dev/null
+++ b/build/mobile/robocop/FennecNativeActions.java
@@ -0,0 +1,385 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import org.json.JSONObject;
+import org.mozilla.goanna.FennecNativeDriver.LogLevel;
+import org.mozilla.goanna.gfx.LayerView;
+import org.mozilla.goanna.gfx.LayerView.DrawListener;
+import org.mozilla.goanna.mozglue.GoannaLoader;
+import org.mozilla.goanna.sqlite.SQLiteBridge;
+import org.mozilla.goanna.util.GoannaEventListener;
+
+import android.app.Activity;
+import android.app.Instrumentation;
+import android.database.Cursor;
+import android.os.SystemClock;
+import android.text.TextUtils;
+import android.view.KeyEvent;
+
+import com.jayway.android.robotium.solo.Solo;
+
+public class FennecNativeActions implements Actions {
+ private static final String LOGTAG = "FennecNativeActions";
+
+ private Solo mSolo;
+ private Instrumentation mInstr;
+ private Assert mAsserter;
+
+ public FennecNativeActions(Activity activity, Solo robocop, Instrumentation instrumentation, Assert asserter) {
+ mSolo = robocop;
+ mInstr = instrumentation;
+ mAsserter = asserter;
+
+ GoannaLoader.loadSQLiteLibs(activity, activity.getApplication().getPackageResourcePath());
+ }
+
+ class GoannaEventExpecter implements RepeatedEventExpecter {
+ private static final int MAX_WAIT_MS = 180000;
+
+ private volatile boolean mIsRegistered;
+
+ private final String mGoannaEvent;
+ private final GoannaEventListener mListener;
+
+ private volatile boolean mEventEverReceived;
+ private String mEventData;
+ private BlockingQueue<String> mEventDataQueue;
+
+ GoannaEventExpecter(final String goannaEvent) {
+ if (TextUtils.isEmpty(goannaEvent)) {
+ throw new IllegalArgumentException("goannaEvent must not be empty");
+ }
+
+ mGoannaEvent = goannaEvent;
+ mEventDataQueue = new LinkedBlockingQueue<String>();
+
+ final GoannaEventExpecter expecter = this;
+ mListener = new GoannaEventListener() {
+ @Override
+ public void handleMessage(final String event, final JSONObject message) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
+ "handleMessage called for: " + event + "; expecting: " + mGoannaEvent);
+ mAsserter.is(event, mGoannaEvent, "Given message occurred for registered event: " + message);
+
+ expecter.notifyOfEvent(message);
+ }
+ };
+
+ EventDispatcher.getInstance().registerGoannaThreadListener(mListener, mGoannaEvent);
+ mIsRegistered = true;
+ }
+
+ public void blockForEvent() {
+ blockForEvent(MAX_WAIT_MS, true);
+ }
+
+ public void blockForEvent(long millis, boolean failOnTimeout) {
+ if (!mIsRegistered) {
+ throw new IllegalStateException("listener not registered");
+ }
+
+ try {
+ mEventData = mEventDataQueue.poll(millis, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException ie) {
+ FennecNativeDriver.log(LogLevel.ERROR, ie);
+ }
+ if (mEventData == null) {
+ if (failOnTimeout) {
+ FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
+ mAsserter.ok(false, "GoannaEventExpecter",
+ "blockForEvent timeout: "+mGoannaEvent);
+ } else {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
+ "blockForEvent timeout: "+mGoannaEvent);
+ }
+ } else {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
+ "unblocked on expecter for " + mGoannaEvent);
+ }
+ }
+
+ public void blockUntilClear(long millis) {
+ if (!mIsRegistered) {
+ throw new IllegalStateException("listener not registered");
+ }
+ if (millis <= 0) {
+ throw new IllegalArgumentException("millis must be > 0");
+ }
+
+ // wait for at least one event
+ try {
+ mEventData = mEventDataQueue.poll(MAX_WAIT_MS, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException ie) {
+ FennecNativeDriver.log(LogLevel.ERROR, ie);
+ }
+ if (mEventData == null) {
+ FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
+ mAsserter.ok(false, "GoannaEventExpecter", "blockUntilClear timeout");
+ return;
+ }
+ // now wait for a period of millis where we don't get an event
+ while (true) {
+ try {
+ mEventData = mEventDataQueue.poll(millis, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException ie) {
+ FennecNativeDriver.log(LogLevel.INFO, ie);
+ }
+ if (mEventData == null) {
+ // success
+ break;
+ }
+ }
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
+ "unblocked on expecter for " + mGoannaEvent);
+ }
+
+ public String blockForEventData() {
+ blockForEvent();
+ return mEventData;
+ }
+
+ public String blockForEventDataWithTimeout(long millis) {
+ blockForEvent(millis, false);
+ return mEventData;
+ }
+
+ public void unregisterListener() {
+ if (!mIsRegistered) {
+ throw new IllegalStateException("listener not registered");
+ }
+
+ FennecNativeDriver.log(LogLevel.INFO,
+ "EventExpecter: no longer listening for " + mGoannaEvent);
+
+ EventDispatcher.getInstance().unregisterGoannaThreadListener(mListener, mGoannaEvent);
+ mIsRegistered = false;
+ }
+
+ public boolean eventReceived() {
+ return mEventEverReceived;
+ }
+
+ void notifyOfEvent(final JSONObject message) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
+ "received event " + mGoannaEvent);
+
+ mEventEverReceived = true;
+
+ try {
+ mEventDataQueue.put(message.toString());
+ } catch (InterruptedException e) {
+ FennecNativeDriver.log(LogLevel.ERROR,
+ "EventExpecter dropped event: " + message.toString(), e);
+ }
+ }
+ }
+
+ public RepeatedEventExpecter expectGoannaEvent(final String goannaEvent) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG, "waiting for " + goannaEvent);
+ return new GoannaEventExpecter(goannaEvent);
+ }
+
+ public void sendGoannaEvent(final String goannaEvent, final String data) {
+ GoannaAppShell.sendEventToGoanna(GoannaEvent.createBroadcastEvent(goannaEvent, data));
+ }
+
+ public void sendPreferencesGetEvent(int requestId, String[] prefNames) {
+ GoannaAppShell.sendEventToGoanna(GoannaEvent.createPreferencesGetEvent(requestId, prefNames));
+ }
+
+ public void sendPreferencesObserveEvent(int requestId, String[] prefNames) {
+ GoannaAppShell.sendEventToGoanna(GoannaEvent.createPreferencesObserveEvent(requestId, prefNames));
+ }
+
+ public void sendPreferencesRemoveObserversEvent(int requestId) {
+ GoannaAppShell.sendEventToGoanna(GoannaEvent.createPreferencesRemoveObserversEvent(requestId));
+ }
+
+ class PaintExpecter implements RepeatedEventExpecter {
+ private static final int MAX_WAIT_MS = 90000;
+
+ private boolean mPaintDone;
+ private boolean mListening;
+
+ private final LayerView mLayerView;
+ private final DrawListener mDrawListener;
+
+ PaintExpecter() {
+ final PaintExpecter expecter = this;
+ mLayerView = GoannaAppShell.getLayerView();
+ mDrawListener = new DrawListener() {
+ @Override
+ public void drawFinished() {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
+ "Received drawFinished notification");
+ expecter.notifyOfEvent();
+ }
+ };
+ mLayerView.addDrawListener(mDrawListener);
+ mListening = true;
+ }
+
+ private synchronized void notifyOfEvent() {
+ mPaintDone = true;
+ this.notifyAll();
+ }
+
+ public synchronized void blockForEvent(long millis, boolean failOnTimeout) {
+ if (!mListening) {
+ throw new IllegalStateException("draw listener not registered");
+ }
+ long startTime = SystemClock.uptimeMillis();
+ long endTime = 0;
+ while (!mPaintDone) {
+ try {
+ this.wait(millis);
+ } catch (InterruptedException ie) {
+ FennecNativeDriver.log(LogLevel.ERROR, ie);
+ break;
+ }
+ endTime = SystemClock.uptimeMillis();
+ if (!mPaintDone && (endTime - startTime >= millis)) {
+ if (failOnTimeout) {
+ FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
+ mAsserter.ok(false, "PaintExpecter", "blockForEvent timeout");
+ }
+ return;
+ }
+ }
+ }
+
+ public synchronized void blockForEvent() {
+ blockForEvent(MAX_WAIT_MS, true);
+ }
+
+ public synchronized String blockForEventData() {
+ blockForEvent();
+ return null;
+ }
+
+ public synchronized String blockForEventDataWithTimeout(long millis) {
+ blockForEvent(millis, false);
+ return null;
+ }
+
+ public synchronized boolean eventReceived() {
+ return mPaintDone;
+ }
+
+ public synchronized void blockUntilClear(long millis) {
+ if (!mListening) {
+ throw new IllegalStateException("draw listener not registered");
+ }
+ if (millis <= 0) {
+ throw new IllegalArgumentException("millis must be > 0");
+ }
+ // wait for at least one event
+ long startTime = SystemClock.uptimeMillis();
+ long endTime = 0;
+ while (!mPaintDone) {
+ try {
+ this.wait(MAX_WAIT_MS);
+ } catch (InterruptedException ie) {
+ FennecNativeDriver.log(LogLevel.ERROR, ie);
+ break;
+ }
+ endTime = SystemClock.uptimeMillis();
+ if (!mPaintDone && (endTime - startTime >= MAX_WAIT_MS)) {
+ FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
+ mAsserter.ok(false, "PaintExpecter", "blockUtilClear timeout");
+ return;
+ }
+ }
+ // now wait for a period of millis where we don't get an event
+ startTime = SystemClock.uptimeMillis();
+ while (true) {
+ try {
+ this.wait(millis);
+ } catch (InterruptedException ie) {
+ FennecNativeDriver.log(LogLevel.ERROR, ie);
+ break;
+ }
+ endTime = SystemClock.uptimeMillis();
+ if (endTime - startTime >= millis) {
+ // success
+ break;
+ }
+
+ // we got a notify() before we could wait long enough, so we need to start over
+ // Note, moving the goal post might have us race against a "drawFinished" flood
+ startTime = endTime;
+ }
+ }
+
+ public synchronized void unregisterListener() {
+ if (!mListening) {
+ throw new IllegalStateException("listener not registered");
+ }
+
+ FennecNativeDriver.log(LogLevel.INFO,
+ "PaintExpecter: no longer listening for events");
+ mLayerView.removeDrawListener(mDrawListener);
+ mListening = false;
+ }
+ }
+
+ public RepeatedEventExpecter expectPaint() {
+ return new PaintExpecter();
+ }
+
+ public void sendSpecialKey(SpecialKey button) {
+ switch(button) {
+ case DOWN:
+ sendKeyCode(KeyEvent.KEYCODE_DPAD_DOWN);
+ break;
+ case UP:
+ sendKeyCode(KeyEvent.KEYCODE_DPAD_UP);
+ break;
+ case LEFT:
+ sendKeyCode(KeyEvent.KEYCODE_DPAD_LEFT);
+ break;
+ case RIGHT:
+ sendKeyCode(KeyEvent.KEYCODE_DPAD_RIGHT);
+ break;
+ case ENTER:
+ sendKeyCode(KeyEvent.KEYCODE_ENTER);
+ break;
+ case MENU:
+ sendKeyCode(KeyEvent.KEYCODE_MENU);
+ break;
+ case BACK:
+ sendKeyCode(KeyEvent.KEYCODE_BACK);
+ break;
+ default:
+ mAsserter.ok(false, "sendSpecialKey", "Unknown SpecialKey " + button);
+ break;
+ }
+ }
+
+ public void sendKeyCode(int keyCode) {
+ if (keyCode <= 0 || keyCode > KeyEvent.getMaxKeyCode()) {
+ mAsserter.ok(false, "sendKeyCode", "Unknown keyCode " + keyCode);
+ }
+ mInstr.sendCharacterSync(keyCode);
+ }
+
+ @Override
+ public void sendKeys(String input) {
+ mInstr.sendStringSync(input);
+ }
+
+ public void drag(int startingX, int endingX, int startingY, int endingY) {
+ mSolo.drag(startingX, endingX, startingY, endingY, 10);
+ }
+
+ public Cursor querySql(final String dbPath, final String sql) {
+ return new SQLiteBridge(dbPath).rawQuery(sql, null);
+ }
+}
diff --git a/build/mobile/robocop/FennecNativeActions.java.in b/build/mobile/robocop/FennecNativeActions.java.in
deleted file mode 100644
index 7aea059e9..000000000
--- a/build/mobile/robocop/FennecNativeActions.java.in
+++ /dev/null
@@ -1,483 +0,0 @@
-#filter substitution
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package @ANDROID_PACKAGE_NAME@;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationHandler;
-import java.util.concurrent.SynchronousQueue;
-import java.util.ArrayList;
-
-import android.app.Activity;
-import android.content.Context;
-import android.app.Instrumentation;
-import android.database.Cursor;
-import android.os.SystemClock;
-import android.text.TextUtils;
-import android.view.View;
-import android.view.KeyEvent;
-import android.util.Log;
-
-import org.json.*;
-
-import com.jayway.android.robotium.solo.Solo;
-
-import static @ANDROID_PACKAGE_NAME@.FennecNativeDriver.LogLevel;
-
-public class FennecNativeActions implements Actions {
- private Solo mSolo;
- private Instrumentation mInstr;
- private Activity mGoannaApp;
- private Assert mAsserter;
-
- // Objects for reflexive access of fennec classes.
- private ClassLoader mClassLoader;
- private Class mApiClass;
- private Class mEventListenerClass;
- private Class mDrawListenerClass;
- private Method mRegisterEventListener;
- private Method mUnregisterEventListener;
- private Method mBroadcastEvent;
- private Method mSetDrawListener;
- private Method mQuerySql;
- private Object mRobocopApi;
-
- private static final String LOGTAG = "FennecNativeActions";
-
- public FennecNativeActions(Activity activity, Solo robocop, Instrumentation instrumentation, Assert asserter) {
- mSolo = robocop;
- mInstr = instrumentation;
- mGoannaApp = activity;
- mAsserter = asserter;
- // Set up reflexive access of java classes and methods.
- try {
- mClassLoader = activity.getClassLoader();
-
- mApiClass = mClassLoader.loadClass("org.mozilla.goanna.RobocopAPI");
- mEventListenerClass = mClassLoader.loadClass("org.mozilla.goanna.util.GoannaEventListener");
- mDrawListenerClass = mClassLoader.loadClass("org.mozilla.goanna.gfx.GoannaLayerClient$DrawListener");
-
- mRegisterEventListener = mApiClass.getMethod("registerEventListener", String.class, mEventListenerClass);
- mUnregisterEventListener = mApiClass.getMethod("unregisterEventListener", String.class, mEventListenerClass);
- mBroadcastEvent = mApiClass.getMethod("broadcastEvent", String.class, String.class);
- mSetDrawListener = mApiClass.getMethod("setDrawListener", mDrawListenerClass);
- mQuerySql = mApiClass.getMethod("querySql", String.class, String.class);
-
- mRobocopApi = mApiClass.getConstructor(Activity.class).newInstance(activity);
- } catch (Exception e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- }
- }
-
- class wakeInvocationHandler implements InvocationHandler {
- private final GoannaEventExpecter mEventExpecter;
-
- public wakeInvocationHandler(GoannaEventExpecter expecter) {
- mEventExpecter = expecter;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- //Depending on the method, return a completely different type.
- if(methodName.equals("toString")) {
- return this.toString();
- }
- if(methodName.equals("equals")) {
- return
- args[0] == null ? false :
- this.toString().equals(args[0].toString());
- }
- if(methodName.equals("clone")) {
- return this;
- }
- if(methodName.equals("hashCode")) {
- return 314;
- }
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
- "Waking up on "+methodName);
- mEventExpecter.notifyOfEvent(args);
- return null;
- }
- }
-
- class GoannaEventExpecter implements RepeatedEventExpecter {
- private final String mGoannaEvent;
- private Object[] mRegistrationParams;
- private boolean mEventReceived;
- private boolean mEventEverReceived;
- private String mEventData;
- private static final int MAX_WAIT_MS = 90000;
-
- GoannaEventExpecter(String goannaEvent, Object[] registrationParams) {
- if (TextUtils.isEmpty(goannaEvent)) {
- throw new IllegalArgumentException("goannaEvent must not be empty");
- }
- if (registrationParams == null || registrationParams.length == 0) {
- throw new IllegalArgumentException("registrationParams must not be empty");
- }
-
- mGoannaEvent = goannaEvent;
- mRegistrationParams = registrationParams;
- }
-
- public synchronized void blockForEvent() {
- blockForEvent(MAX_WAIT_MS, true);
- }
-
- private synchronized void blockForEvent(long millis, boolean failOnTimeout) {
- if (mRegistrationParams == null) {
- throw new IllegalStateException("listener not registered");
- }
- long startTime = SystemClock.uptimeMillis();
- long endTime = 0;
- while (! mEventReceived) {
- try {
- this.wait(millis);
- } catch (InterruptedException ie) {
- FennecNativeDriver.log(LogLevel.ERROR, ie);
- break;
- }
- endTime = SystemClock.uptimeMillis();
- if (!mEventReceived && (endTime - startTime >= millis)) {
- if (failOnTimeout) {
- FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
- mAsserter.ok(false, "GoannaEventExpecter",
- "blockForEvent timeout: "+mGoannaEvent);
- }
- mEventData = null;
- return;
- }
- }
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
- "unblocked on expecter for " + mGoannaEvent);
- mEventReceived = false;
- }
-
- public synchronized void blockUntilClear(long millis) {
- if (mRegistrationParams == null) {
- throw new IllegalStateException("listener not registered");
- }
- if (millis <= 0) {
- throw new IllegalArgumentException("millis must be > 0");
- }
- // wait for at least one event
- long startTime = SystemClock.uptimeMillis();
- long endTime = 0;
- while (!mEventReceived) {
- try {
- this.wait(MAX_WAIT_MS);
- } catch (InterruptedException ie) {
- FennecNativeDriver.log(LogLevel.ERROR, ie);
- break;
- }
- endTime = SystemClock.uptimeMillis();
- if (!mEventReceived && (endTime - startTime >= MAX_WAIT_MS)) {
- FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
- mAsserter.ok(false, "GoannaEventExpecter", "blockUtilClear timeout");
- return;
- }
- }
- // now wait for a period of millis where we don't get an event
- startTime = SystemClock.uptimeMillis();
- while (true) {
- try {
- this.wait(millis);
- } catch (InterruptedException ie) {
- FennecNativeDriver.log(LogLevel.ERROR, ie);
- break;
- }
- endTime = SystemClock.uptimeMillis();
- if (endTime - startTime >= millis) {
- // success
- break;
- }
- // we got a notify() before we could wait long enough, so we need to start over
- startTime = endTime;
- }
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
- "unblocked on expecter for " + mGoannaEvent);
- mEventReceived = false;
- }
-
- public synchronized String blockForEventData() {
- blockForEvent();
- return mEventData;
- }
-
- public synchronized String blockForEventDataWithTimeout(long millis) {
- blockForEvent(millis, false);
- return mEventData;
- }
-
- public synchronized void unregisterListener() {
- if (mRegistrationParams == null) {
- throw new IllegalStateException("listener not registered");
- }
- try {
- FennecNativeDriver.log(LogLevel.INFO, "EventExpecter: no longer listening for "+mGoannaEvent);
- mUnregisterEventListener.invoke(mRobocopApi, mRegistrationParams);
- mRegistrationParams = null;
- } catch (IllegalAccessException e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- }
- }
-
- public synchronized boolean eventReceived() {
- return mEventEverReceived;
- }
-
- void notifyOfEvent(Object[] args) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
- "received event " + mGoannaEvent);
- synchronized (this) {
- mEventReceived = true;
- mEventEverReceived = true;
- mEventData = args[1].toString();
- this.notifyAll();
- }
- }
- }
-
- public RepeatedEventExpecter expectGoannaEvent(String goannaEvent) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
- "waiting for "+goannaEvent);
- try {
- Object[] finalParams = new Object[2];
- finalParams[0] = goannaEvent;
- GoannaEventExpecter expecter = new GoannaEventExpecter(goannaEvent, finalParams);
- wakeInvocationHandler wIH = new wakeInvocationHandler(expecter);
- Object proxy = Proxy.newProxyInstance(mClassLoader, new Class[] { mEventListenerClass }, wIH);
- finalParams[1] = proxy;
-
- mRegisterEventListener.invoke(mRobocopApi, finalParams);
- return expecter;
- } catch (IllegalAccessException e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- }
- return null;
- }
-
- public void sendGoannaEvent(String goannaEvent, String data) {
- try {
- mBroadcastEvent.invoke(mRobocopApi, goannaEvent, data);
- } catch (IllegalAccessException e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- }
- }
-
- class DrawListenerProxy implements InvocationHandler {
- private final PaintExpecter mPaintExpecter;
-
- DrawListenerProxy(PaintExpecter paintExpecter) {
- mPaintExpecter = paintExpecter;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ("drawFinished".equals(methodName)) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
- "Received drawFinished notification");
- mPaintExpecter.notifyOfEvent(args);
- } else if ("toString".equals(methodName)) {
- return "DrawListenerProxy";
- } else if ("equals".equals(methodName)) {
- return false;
- } else if ("hashCode".equals(methodName)) {
- return 0;
- }
- return null;
- }
- }
-
- class PaintExpecter implements RepeatedEventExpecter {
- private boolean mPaintDone;
- private boolean mListening;
- private static final int MAX_WAIT_MS = 90000;
-
- PaintExpecter() throws IllegalAccessException, InvocationTargetException {
- Object proxy = Proxy.newProxyInstance(mClassLoader, new Class[] { mDrawListenerClass }, new DrawListenerProxy(this));
- mSetDrawListener.invoke(mRobocopApi, proxy);
- mListening = true;
- }
-
- void notifyOfEvent(Object[] args) {
- synchronized (this) {
- mPaintDone = true;
- this.notifyAll();
- }
- }
-
- private synchronized void blockForEvent(long millis, boolean failOnTimeout) {
- if (!mListening) {
- throw new IllegalStateException("draw listener not registered");
- }
- long startTime = SystemClock.uptimeMillis();
- long endTime = 0;
- while (!mPaintDone) {
- try {
- this.wait(millis);
- } catch (InterruptedException ie) {
- FennecNativeDriver.log(LogLevel.ERROR, ie);
- break;
- }
- endTime = SystemClock.uptimeMillis();
- if (!mPaintDone && (endTime - startTime >= millis)) {
- if (failOnTimeout) {
- FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
- mAsserter.ok(false, "PaintExpecter", "blockForEvent timeout");
- }
- return;
- }
- }
- }
-
- public synchronized void blockForEvent() {
- blockForEvent(MAX_WAIT_MS, true);
- }
-
- public synchronized String blockForEventData() {
- blockForEvent();
- return null;
- }
-
- public synchronized String blockForEventDataWithTimeout(long millis) {
- blockForEvent(millis, false);
- return null;
- }
-
- public synchronized boolean eventReceived() {
- return mPaintDone;
- }
-
- public synchronized void blockUntilClear(long millis) {
- if (!mListening) {
- throw new IllegalStateException("draw listener not registered");
- }
- if (millis <= 0) {
- throw new IllegalArgumentException("millis must be > 0");
- }
- // wait for at least one event
- long startTime = SystemClock.uptimeMillis();
- long endTime = 0;
- while (!mPaintDone) {
- try {
- this.wait(MAX_WAIT_MS);
- } catch (InterruptedException ie) {
- FennecNativeDriver.log(LogLevel.ERROR, ie);
- break;
- }
- endTime = SystemClock.uptimeMillis();
- if (!mPaintDone && (endTime - startTime >= MAX_WAIT_MS)) {
- FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
- mAsserter.ok(false, "PaintExpecter", "blockUtilClear timeout");
- return;
- }
- }
- // now wait for a period of millis where we don't get an event
- startTime = SystemClock.uptimeMillis();
- while (true) {
- try {
- this.wait(millis);
- } catch (InterruptedException ie) {
- FennecNativeDriver.log(LogLevel.ERROR, ie);
- break;
- }
- endTime = SystemClock.uptimeMillis();
- if (endTime - startTime >= millis) {
- // success
- break;
- }
- // we got a notify() before we could wait long enough, so we need to start over
- startTime = endTime;
- }
- }
-
- public synchronized void unregisterListener() {
- if (!mListening) {
- throw new IllegalStateException("listener not registered");
- }
- try {
- FennecNativeDriver.log(LogLevel.INFO, "PaintExpecter: no longer listening for events");
- mListening = false;
- mSetDrawListener.invoke(mRobocopApi, (Object)null);
- } catch (Exception e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- }
- }
- }
-
- public RepeatedEventExpecter expectPaint() {
- try {
- return new PaintExpecter();
- } catch (Exception e) {
- FennecNativeDriver.log(LogLevel.ERROR, e);
- return null;
- }
- }
-
- public void sendSpecialKey(SpecialKey button) {
- switch(button) {
- case DOWN:
- sendKeyCode(KeyEvent.KEYCODE_DPAD_DOWN);
- break;
- case UP:
- sendKeyCode(KeyEvent.KEYCODE_DPAD_UP);
- break;
- case LEFT:
- sendKeyCode(KeyEvent.KEYCODE_DPAD_LEFT);
- break;
- case RIGHT:
- sendKeyCode(KeyEvent.KEYCODE_DPAD_RIGHT);
- break;
- case ENTER:
- sendKeyCode(KeyEvent.KEYCODE_ENTER);
- break;
- case MENU:
- sendKeyCode(KeyEvent.KEYCODE_MENU);
- break;
- case BACK:
- sendKeyCode(KeyEvent.KEYCODE_BACK);
- break;
- default:
- mAsserter.ok(false, "sendSpecialKey", "Unknown SpecialKey " + button);
- break;
- }
- }
-
- public void sendKeyCode(int keyCode) {
- if (keyCode <= 0 || keyCode > KeyEvent.getMaxKeyCode()) {
- mAsserter.ok(false, "sendKeyCode", "Unknown keyCode " + keyCode);
- }
- mInstr.sendCharacterSync(keyCode);
- }
-
- @Override
- public void sendKeys(String input) {
- mInstr.sendStringSync(input);
- }
-
- public void drag(int startingX, int endingX, int startingY, int endingY) {
- mSolo.drag(startingX, endingX, startingY, endingY, 10);
- }
-
- public Cursor querySql(String dbPath, String sql) {
- try {
- return (Cursor)mQuerySql.invoke(mRobocopApi, dbPath, sql);
- } catch(InvocationTargetException ex) {
- Log.e(LOGTAG, "Error invoking method", ex);
- } catch(IllegalAccessException ex) {
- Log.e(LOGTAG, "Error using field", ex);
- }
- return null;
- }
-}
diff --git a/build/mobile/robocop/FennecNativeDriver.java.in b/build/mobile/robocop/FennecNativeDriver.java
index 8c36a29d9..097a8f6df 100644
--- a/build/mobile/robocop/FennecNativeDriver.java.in
+++ b/build/mobile/robocop/FennecNativeDriver.java
@@ -1,72 +1,52 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.PrintWriter;
import java.nio.IntBuffer;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationHandler;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.mozilla.goanna.gfx.LayerView;
+import org.mozilla.goanna.gfx.PanningPerfAPI;
+import org.mozilla.goanna.util.GoannaEventListener;
import android.app.Activity;
-import android.opengl.GLSurfaceView;
-import android.view.View;
import android.util.Log;
-
-import org.json.*;
+import android.view.View;
import com.jayway.android.robotium.solo.Solo;
public class FennecNativeDriver implements Driver {
private static final int FRAME_TIME_THRESHOLD = 25; // allow 25ms per frame (40fps)
- // Map of IDs to element names.
- private HashMap mLocators = null;
- private Activity mActivity;
- private Solo mSolo;
- private String mRootPath;
+ private final Activity mActivity;
+ private final Solo mSolo;
+ private final String mRootPath;
- private static String mLogFile = null;
+ private static String mLogFile;
private static LogLevel mLogLevel = LogLevel.INFO;
- // Objects for reflexive access of fennec classes.
- private ClassLoader mClassLoader;
- private Class mApiClass;
- private Class mEventListenerClass;
- private Class mPanningPerfClass;
- private Method mRegisterEventListener;
- private Method mGetPixels;
- private Method mStartFrameRecording;
- private Method mStopFrameRecording;
- private Method mStartCheckerboardRecording;
- private Method mStopCheckerboardRecording;
- private Object mRobocopApi;
-
public enum LogLevel {
DEBUG(1),
INFO(2),
WARN(3),
ERROR(4);
- private int mValue;
+ private final int mValue;
LogLevel(int value) {
mValue = value;
}
@@ -82,29 +62,6 @@ public class FennecNativeDriver implements Driver {
mActivity = activity;
mSolo = robocop;
mRootPath = rootPath;
-
- // Set up table of fennec_ids.
- mLocators = convertTextToTable(getFile(mRootPath + "/fennec_ids.txt"));
-
- // Set up reflexive access of java classes and methods.
- try {
- mClassLoader = activity.getClassLoader();
-
- mApiClass = mClassLoader.loadClass("org.mozilla.goanna.RobocopAPI");
- mEventListenerClass = mClassLoader.loadClass("org.mozilla.goanna.util.GoannaEventListener");
- mPanningPerfClass = mClassLoader.loadClass("org.mozilla.goanna.gfx.PanningPerfAPI");
-
- mRegisterEventListener = mApiClass.getMethod("registerEventListener", String.class, mEventListenerClass);
- mGetPixels = mApiClass.getMethod("getViewPixels", View.class);
- mStartFrameRecording = mPanningPerfClass.getDeclaredMethod("startFrameTimeRecording");
- mStopFrameRecording = mPanningPerfClass.getDeclaredMethod("stopFrameTimeRecording");
- mStartCheckerboardRecording = mPanningPerfClass.getDeclaredMethod("startCheckerboardRecording");
- mStopCheckerboardRecording = mPanningPerfClass.getDeclaredMethod("stopCheckerboardRecording");
-
- mRobocopApi = mApiClass.getConstructor(Activity.class).newInstance(activity);
- } catch (Exception e) {
- log(LogLevel.ERROR, e);
- }
}
//Information on the location of the Goanna Frame.
@@ -115,7 +72,7 @@ public class FennecNativeDriver implements Driver {
private int mGoannaWidth = 1024;
private void getGoannaInfo() {
- View goannaLayout = mActivity.findViewById(Integer.decode((String)mLocators.get("goanna_layout")));
+ View goannaLayout = mActivity.findViewById(R.id.goanna_layout);
if (goannaLayout != null) {
int[] pos = new int[2];
goannaLayout.getLocationOnScreen(pos);
@@ -129,6 +86,7 @@ public class FennecNativeDriver implements Driver {
}
}
+ @Override
public int getGoannaTop() {
if (!mGoannaInfo) {
getGoannaInfo();
@@ -136,6 +94,7 @@ public class FennecNativeDriver implements Driver {
return mGoannaTop;
}
+ @Override
public int getGoannaLeft() {
if (!mGoannaInfo) {
getGoannaInfo();
@@ -143,6 +102,7 @@ public class FennecNativeDriver implements Driver {
return mGoannaLeft;
}
+ @Override
public int getGoannaHeight() {
if (!mGoannaInfo) {
getGoannaInfo();
@@ -150,6 +110,7 @@ public class FennecNativeDriver implements Driver {
return mGoannaHeight;
}
+ @Override
public int getGoannaWidth() {
if (!mGoannaInfo) {
getGoannaInfo();
@@ -157,117 +118,74 @@ public class FennecNativeDriver implements Driver {
return mGoannaWidth;
}
- /** Find the named element in the list of known Fennec views.
+ /** Find the element with given id.
+ *
* @return An Element representing the view, or null if the view is not found.
*/
- public Element findElement(Activity activity, String name) {
- if (name == null) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
- "Can not findElements when passed a null");
- return null;
- }
- if (mLocators.containsKey(name)) {
- return new FennecNativeElement(Integer.decode((String)mLocators.get(name)), activity, mSolo);
- }
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
- "findElement: Element '"+name+"' does not exist in the list");
- return null;
+ @Override
+ public Element findElement(Activity activity, int id) {
+ return new FennecNativeElement(id, activity);
}
+ @Override
public void startFrameRecording() {
- try {
- mStartFrameRecording.invoke(null);
- } catch (IllegalAccessException e) {
- log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- log(LogLevel.ERROR, e);
- }
+ PanningPerfAPI.startFrameTimeRecording();
}
+ @Override
public int stopFrameRecording() {
- try {
- List<Long> frames = (List<Long>)mStopFrameRecording.invoke(null);
- int badness = 0;
- for (int i = 1; i < frames.size(); i++) {
- long frameTime = frames.get(i) - frames.get(i - 1);
- int delay = (int)(frameTime - FRAME_TIME_THRESHOLD);
- // for each frame we miss, add the square of the delay. This
- // makes large delays much worse than small delays.
- if (delay > 0) {
- badness += delay * delay;
- }
+ final List<Long> frames = PanningPerfAPI.stopFrameTimeRecording();
+ int badness = 0;
+ for (int i = 1; i < frames.size(); i++) {
+ long frameTime = frames.get(i) - frames.get(i - 1);
+ int delay = (int)(frameTime - FRAME_TIME_THRESHOLD);
+ // for each frame we miss, add the square of the delay. This
+ // makes large delays much worse than small delays.
+ if (delay > 0) {
+ badness += delay * delay;
}
- // Don't do any averaging of the numbers because really we want to
- // know how bad the jank was at its worst
- return badness;
- } catch (IllegalAccessException e) {
- log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- log(LogLevel.ERROR, e);
}
- // higher values are worse, and the test failing is the worst!
- return Integer.MAX_VALUE;
+ // Don't do any averaging of the numbers because really we want to
+ // know how bad the jank was at its worst
+ return badness;
}
+ @Override
public void startCheckerboardRecording() {
- try {
- mStartCheckerboardRecording.invoke(null);
- } catch (IllegalAccessException e) {
- log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- log(LogLevel.ERROR, e);
- }
+ PanningPerfAPI.startCheckerboardRecording();
}
+ @Override
public float stopCheckerboardRecording() {
- try {
- List<Float> checkerboard = (List<Float>)mStopCheckerboardRecording.invoke(null);
- float total = 0;
- for (float val : checkerboard) {
- total += val;
- }
- return total * 100.0f;
- } catch (IllegalAccessException e) {
- log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- log(LogLevel.ERROR, e);
+ final List<Float> checkerboard = PanningPerfAPI.stopCheckerboardRecording();
+ float total = 0;
+ for (float val : checkerboard) {
+ total += val;
}
-
- return 0.0f;
+ return total * 100.0f;
}
- private View getSurfaceView() {
- ArrayList<View> views = mSolo.getCurrentViews();
- try {
- Class c = Class.forName("org.mozilla.goanna.gfx.LayerView");
- for (View v : views) {
- if (c.isInstance(v)) {
- return v;
- }
+ private LayerView getSurfaceView() {
+ final LayerView layerView = mSolo.getView(LayerView.class, 0);
+
+ if (layerView == null) {
+ log(LogLevel.WARN, "getSurfaceView could not find LayerView");
+ for (final View v : mSolo.getViews()) {
+ log(LogLevel.WARN, " View: " + v);
}
- } catch (ClassNotFoundException e) {
- log(LogLevel.ERROR, e);
- }
- log(LogLevel.WARN, "getSurfaceView could not find LayerView");
- for (View v : views) {
- log(LogLevel.WARN, v.toString());
}
- return null;
+ return layerView;
}
+ @Override
public PaintedSurface getPaintedSurface() {
- View view = getSurfaceView();
+ final LayerView view = getSurfaceView();
if (view == null) {
return null;
}
- IntBuffer pixelBuffer;
- try {
- pixelBuffer = (IntBuffer)mGetPixels.invoke(mRobocopApi, view);
- } catch (Exception e) {
- log(LogLevel.ERROR, e);
- return null;
- }
+
+ final IntBuffer pixelBuffer = view.getPixels();
// now we need to (1) flip the image, because GL likes to do things up-side-down,
// and (2) rearrange the bits from AGBR-8888 to ARGB-8888.
@@ -315,52 +233,38 @@ public class FennecNativeDriver implements Driver {
public int mScrollHeight=0;
public int mPageHeight=10;
- class scrollHandler implements InvocationHandler {
- public scrollHandler(){};
- public Object invoke(Object proxy, Method method, Object[] args) {
- try {
- // Disect the JSON object into the appropriate variables
- JSONObject jo = ((JSONObject)args[1]);
- mScrollHeight = jo.getInt("y");
- mHeight = jo.getInt("cheight");
- // We don't want a height of 0. That means it's a bad response.
- if (mHeight > 0) {
- mPageHeight = jo.getInt("height");
- }
-
- } catch( Throwable e) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN,
- "WARNING: ScrollReceived, but read wrong!");
- }
- return null;
- }
- }
-
+ @Override
public int getScrollHeight() {
return mScrollHeight;
}
+ @Override
public int getPageHeight() {
return mPageHeight;
}
+ @Override
public int getHeight() {
return mHeight;
}
+ @Override
public void setupScrollHandling() {
- //Setup scrollHandler to catch "robocop:scroll" events.
- try {
- Class [] interfaces = new Class[1];
- interfaces[0] = mEventListenerClass;
- Object[] finalParams = new Object[2];
- finalParams[0] = "robocop:scroll";
- finalParams[1] = Proxy.newProxyInstance(mClassLoader, interfaces, new scrollHandler());
- mRegisterEventListener.invoke(mRobocopApi, finalParams);
- } catch (IllegalAccessException e) {
- log(LogLevel.ERROR, e);
- } catch (InvocationTargetException e) {
- log(LogLevel.ERROR, e);
- }
-
+ EventDispatcher.getInstance().registerGoannaThreadListener(new GoannaEventListener() {
+ @Override
+ public void handleMessage(final String event, final JSONObject message) {
+ try {
+ mScrollHeight = message.getInt("y");
+ mHeight = message.getInt("cheight");
+ // We don't want a height of 0. That means it's a bad response.
+ if (mHeight > 0) {
+ mPageHeight = message.getInt("height");
+ }
+ } catch (JSONException e) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN,
+ "WARNING: ScrollReceived, but message does not contain " +
+ "expected fields: " + e);
+ }
+ }
+ }, "robocop:scroll");
}
/**
@@ -383,19 +287,21 @@ public class FennecNativeDriver implements Driver {
log(LogLevel.ERROR, e);
} finally {
try {
- br.close();
+ if (br != null) {
+ br.close();
+ }
} catch (IOException e) {
}
}
- return text.toString();
+ return text.toString();
}
/**
* Takes a string of "key=value" pairs split by \n and creates a hash table.
*/
- public static HashMap convertTextToTable(String data)
+ public static Map<String, String> convertTextToTable(String data)
{
- HashMap retVal = new HashMap();
+ HashMap<String, String> retVal = new HashMap<String, String>();
String[] lines = data.split("\n");
for (int i = 0; i < lines.length; i++) {
@@ -445,7 +351,7 @@ public class FennecNativeDriver implements Driver {
public static void log(LogLevel level, String message, Throwable t) {
if (mLogFile == null) {
- assert(false);
+ throw new RuntimeException("No log file specified!");
}
if (level.isEnabled(mLogLevel)) {
@@ -461,11 +367,14 @@ public class FennecNativeDriver implements Driver {
} catch (IOException ioe) {
Log.e("Robocop", "exception with file writer on: " + mLogFile);
} finally {
- pw.close();
+ if (pw != null) {
+ pw.close();
+ }
}
+
// PrintWriter doesn't throw IOE but sets an error flag instead,
// so check for that
- if (pw.checkError()) {
+ if (pw != null && pw.checkError()) {
Log.e("Robocop", "exception with file writer on: " + mLogFile);
}
}
diff --git a/build/mobile/robocop/FennecNativeElement.java.in b/build/mobile/robocop/FennecNativeElement.java
index a12b0f7db..f26c65200 100644
--- a/build/mobile/robocop/FennecNativeElement.java.in
+++ b/build/mobile/robocop/FennecNativeElement.java
@@ -1,50 +1,40 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
-
-import java.util.List;
+package org.mozilla.goanna;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.TextView;
import android.widget.TextSwitcher;
-import android.app.Instrumentation;
-import com.jayway.android.robotium.solo.Solo;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
+import android.widget.TextView;
public class FennecNativeElement implements Element {
private final Activity mActivity;
- private Integer mId;
- private Solo mSolo;
- // max time to wait for thread synchronization
- private static final int MAX_WAIT_MS = 60000;
+ private final Integer mId;
- public FennecNativeElement(Integer id, Activity activity, Solo solo) {
+ public FennecNativeElement(Integer id, Activity activity) {
mId = id;
mActivity = activity;
- mSolo = solo;
}
+ @Override
public Integer getId() {
return mId;
}
private boolean mClickSuccess;
+ @Override
public boolean click() {
mClickSuccess = false;
RobocopUtils.runOnUiThreadSync(mActivity,
new Runnable() {
+ @Override
public void run() {
- View view = (View)mActivity.findViewById(mId);
+ View view = mActivity.findViewById(mId);
if (view != null) {
if (view.performClick()) {
mClickSuccess = true;
@@ -63,10 +53,12 @@ public class FennecNativeElement implements Element {
private Object mText;
+ @Override
public String getText() {
mText = null;
RobocopUtils.runOnUiThreadSync(mActivity,
new Runnable() {
+ @Override
public void run() {
View v = mActivity.findViewById(mId);
if (v instanceof EditText) {
@@ -105,12 +97,14 @@ public class FennecNativeElement implements Element {
private boolean mDisplayed;
+ @Override
public boolean isDisplayed() {
mDisplayed = false;
RobocopUtils.runOnUiThreadSync(mActivity,
new Runnable() {
+ @Override
public void run() {
- View view = (View)mActivity.findViewById(mId);
+ View view = mActivity.findViewById(mId);
if (view != null) {
mDisplayed = true;
}
diff --git a/build/mobile/robocop/FennecTalosAssert.java.in b/build/mobile/robocop/FennecTalosAssert.java
index 0034da20c..f4008d50e 100644
--- a/build/mobile/robocop/FennecTalosAssert.java.in
+++ b/build/mobile/robocop/FennecTalosAssert.java
@@ -1,13 +1,12 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
public class FennecTalosAssert implements Assert {
-
+
public FennecTalosAssert() { }
/**
@@ -39,14 +38,14 @@ public class FennecTalosAssert implements Assert {
}
}
- public void is(Object a, Object b, String name) {
- boolean pass = (a == null ? b == null : a.equals(b));
- ok(pass, name, "got " + a + ", expected " + b);
+ public void is(Object actual, Object expected, String name) {
+ boolean pass = (actual == null ? expected == null : actual.equals(expected));
+ ok(pass, name, "got " + actual + ", expected " + expected);
}
-
- public void isnot(Object a, Object b, String name) {
- boolean fail = (a == null ? b == null : a.equals(b));
- ok(!fail, name, "got " + a + ", expected not " + b);
+
+ public void isnot(Object actual, Object notExpected, String name) {
+ boolean fail = (actual == null ? notExpected == null : actual.equals(notExpected));
+ ok(!fail, name, "got " + actual + ", expected not " + notExpected);
}
public void ispixel(int actual, int r, int g, int b, String name) {
@@ -61,11 +60,11 @@ public class FennecTalosAssert implements Assert {
throw new UnsupportedOperationException();
}
- public void todo_is(Object a, Object b, String name) {
+ public void todo_is(Object actual, Object expected, String name) {
throw new UnsupportedOperationException();
}
- public void todo_isnot(Object a, Object b, String name) {
+ public void todo_isnot(Object actual, Object notExpected, String name) {
throw new UnsupportedOperationException();
}
diff --git a/build/mobile/robocop/Makefile.in b/build/mobile/robocop/Makefile.in
index 866701526..691b79986 100644
--- a/build/mobile/robocop/Makefile.in
+++ b/build/mobile/robocop/Makefile.in
@@ -2,30 +2,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
mobile-tests := mobile/android/base/tests
TESTPATH := $(topsrcdir)/$(mobile-tests)
dir-tests := $(DEPTH)/$(mobile-tests)
-include $(DEPTH)/config/autoconf.mk
-
ANDROID_APK_NAME := robocop-debug
-ROBOTIUM_PATH = $(srcdir)/robotium-solo-3.6.jar
-
-JAVAFILES = \
- R.java \
+ANDROID_EXTRA_JARS += \
+ $(srcdir)/robotium-solo-4.3.1.jar \
$(NULL)
-RES_FILES = \
- res/values/strings.xml \
- $(NULL)
+ANDROID_ASSETS_DIR := $(TESTPATH)/assets
-_JAVA_HARNESS = \
+_JAVA_HARNESS := \
Actions.java \
Assert.java \
Driver.java \
@@ -37,27 +26,23 @@ _JAVA_HARNESS = \
FennecNativeDriver.java \
FennecNativeElement.java \
RoboCopException.java \
+ RobocopShare1.java \
+ RobocopShare2.java \
RobocopUtils.java \
PaintedSurface.java \
+ StructuredLogger.java \
$(NULL)
-# pre-process harness sources
-PP_TARGETS += java-harness
-java-harness := $(addprefix $(srcdir)/,$(addsuffix .in,$(_JAVA_HARNESS)))
-java-harness-dep := $(addprefix $(CURDIR)/,$(_JAVA_HARNESS))
-java-harness_PATH := $(CURDIR)
-
-# pre-process test sources
-PP_TARGETS += java-tests
-java-tests-src := $(wildcard $(TESTPATH)/*.java.in)
-java-tests-dep := $(patsubst $(TESTPATH)/%.java.in,$(dir-tests)/%.java,$(java-tests-src))
-java-tests := $(java-tests-src)
-java-tests_PATH := $(dir-tests)
+java-harness := $(addprefix $(srcdir)/,$(_JAVA_HARNESS))
+java-tests := \
+ $(wildcard $(TESTPATH)/*.java) \
+ $(wildcard $(TESTPATH)/components/*.java) \
+ $(wildcard $(TESTPATH)/helpers/*.java)
PP_TARGETS += manifest
manifest := $(srcdir)/AndroidManifest.xml.in
manifest_TARGET := AndroidManifest.xml
-
+ANDROID_MANIFEST_FILE := $(CURDIR)/AndroidManifest.xml
# Install robocop configs and helper
INSTALL_TARGETS += robocop
@@ -69,64 +54,49 @@ robocop_FILES := \
$(NULL)
robocop-deps := $(notdir $(robocop_FILES))
-MOCHITEST_ROBOCOP_FILES := \
+ROBOCOP_FILES := \
$(wildcard $(TESTPATH)/*.html) \
$(wildcard $(TESTPATH)/*.jpg) \
$(wildcard $(TESTPATH)/*.sjs) \
$(wildcard $(TESTPATH)/test*.js) \
$(wildcard $(TESTPATH)/robocop*.js) \
$(wildcard $(TESTPATH)/*.xml) \
+ $(wildcard $(TESTPATH)/*.ogg) \
+ $(wildcard $(TESTPATH)/*.mp4) \
+ $(wildcard $(TESTPATH)/*.webm) \
+ $(wildcard $(TESTPATH)/*.swf) \
+ $(wildcard $(TESTPATH)/reader_mode_pages) \
$(NULL)
+ROBOCOP_DEST = $(DEPTH)/_tests/testing/mochitest/tests/robocop/
+INSTALL_TARGETS += ROBOCOP
+
GARBAGE += \
AndroidManifest.xml \
- $(java-tests-dep) \
- $(_JAVA_HARNESS) \
- classes.dex \
- $(ANDROID_APK_NAME).ap_ \
- $(ANDROID_APK_NAME)-unsigned-unaligned.apk \
- $(ANDROID_APK_NAME)-unaligned.apk \
- $(ANDROID_APK_NAME).apk \
$(robocop-deps) \
+ $(testconstants-dep) \
$(NULL)
-DEFINES += \
- -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
+JAVAFILES += \
+ $(java-harness) \
+ $(java-tests) \
+ $(robocop-deps) \
+ $(testconstants-dep) \
$(NULL)
-JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar:$(ROBOTIUM_PATH)
-
include $(topsrcdir)/config/rules.mk
-# Override rules.mk java flags with the android specific ones
-include $(topsrcdir)/config/android-common.mk
-
-GENERATED_DIRS_tools = classes $(dir-tests)
-
tools:: $(ANDROID_APK_NAME).apk
-classes.dex: $(ANDROID_APK_NAME).ap_
-classes.dex: $(robocop-deps)
-classes.dex: $(java-harness-dep)
-classes.dex: $(java-tests-dep)
- $(JAVAC) $(JAVAC_FLAGS) -d classes $(JAVAFILES) $(_JAVA_HARNESS) $(java-tests-dep)
- $(DX) --dex --output=$@ classes $(ROBOTIUM_PATH) $(ANDROID_COMPT_LIB)
-
-$(ANDROID_APK_NAME).ap_: AndroidManifest.xml $(TESTPATH)/assets/*
- $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -I . -S res -A $(TESTPATH)/assets -F $@ -J ./
-
-$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
- cp $< $@
- $(ZIP) -0 $@ classes.dex
-
-$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
- cp $< $@
- $(DEBUG_JARSIGNER) $@
-
-$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
- $(ZIPALIGN) -f -v 4 $< $@
-
-# PP_java-tests not fully usable here
-# Intermediate step toward a library rule.
-$(dir-tests)/%.java: $(TESTPATH)/%.java.in $(call mkdir_deps,$(dir-tests))
- $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $@
+GENERATED_DIRS += $(dir-tests)
+
+# The test APK needs to know the contents of the target APK while not
+# being linked against them. This is a best effort to avoid getting
+# out of sync with base's build config.
+jars_dir := $(DEPTH)/mobile/android/base
+stumbler_jars_dir := $(DEPTH)/mobile/android/stumbler
+JAVA_BOOTCLASSPATH := $(JAVA_BOOTCLASSPATH):$(subst $(NULL) ,:,$(wildcard $(jars_dir)/*.jar)):$(subst $(NULL) ,:,$(wildcard $(stumbler_jars_dir)/*.jar)):$(ANDROID_COMPAT_LIB)
+# We also want to re-compile classes.dex when the associated base
+# content changes.
+classes.dex: $(wildcard $(jars_dir)/*.jar)
+classes.dex: $(wildcard $(stumbler_jars_dir)/*.jar)
diff --git a/build/mobile/robocop/PaintedSurface.java.in b/build/mobile/robocop/PaintedSurface.java
index deca9f12b..6554dce84 100644
--- a/build/mobile/robocop/PaintedSurface.java.in
+++ b/build/mobile/robocop/PaintedSurface.java
@@ -1,16 +1,19 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
-import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
+import android.graphics.Bitmap;
+import android.util.Base64;
+import android.util.Base64OutputStream;
+
public class PaintedSurface {
private String mFileName;
private int mWidth;
@@ -44,6 +47,15 @@ public class PaintedSurface {
return mHeight;
}
+ private int pixelAtIndex(int index) {
+ int b1 = mPixelBuffer.get(index) & 0xFF;
+ int b2 = mPixelBuffer.get(index + 1) & 0xFF;
+ int b3 = mPixelBuffer.get(index + 2) & 0xFF;
+ int b4 = mPixelBuffer.get(index + 3) & 0xFF;
+ int value = (b1 << 24) + (b2 << 16) + (b3 << 8) + (b4 << 0);
+ return value;
+ }
+
public final int getPixelAt(int x, int y) {
if (mPixelBuffer == null) {
throw new RoboCopException("Trying to access PaintedSurface with no active PixelBuffer");
@@ -60,12 +72,27 @@ public class PaintedSurface {
// The rows are reversed so row 0 is at the end and we start with the last row.
// This is why we do mHeight-y;
int index = (x + ((mHeight - y - 1) * mWidth)) * 4;
- int b1 = mPixelBuffer.get(index) & 0xFF;
- int b2 = mPixelBuffer.get(index + 1) & 0xFF;
- int b3 = mPixelBuffer.get(index + 2) & 0xFF;
- int b4 = mPixelBuffer.get(index + 3) & 0xFF;
- int value = (b1 << 24) + (b2 << 16) + (b3 << 8) + (b4 << 0);
- return value;
+ return pixelAtIndex(index);
+ }
+
+ public final String asDataUri() {
+ try {
+ Bitmap bm = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
+ for (int y = 0; y < mHeight; y++) {
+ for (int x = 0; x < mWidth; x++) {
+ int index = (x + ((mHeight - y - 1) * mWidth)) * 4;
+ bm.setPixel(x, y, pixelAtIndex(index));
+ }
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ out.write("data:image/png;base64,".getBytes());
+ Base64OutputStream b64 = new Base64OutputStream(out, Base64.NO_WRAP);
+ bm.compress(Bitmap.CompressFormat.PNG, 100, b64);
+ return new String(out.toByteArray());
+ } catch (Exception e) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
+ throw new RoboCopException("Unable to convert surface to a PNG data:uri");
+ }
}
public void close() {
diff --git a/build/mobile/robocop/README b/build/mobile/robocop/README
index 3de479685..ba567c68b 100644
--- a/build/mobile/robocop/README
+++ b/build/mobile/robocop/README
@@ -1,11 +1,11 @@
Robocop is a Mozilla project which uses Robotium to test Firefox on Android devices.
-Robotium is an open source tool licensed under the Apache 2.0 license and the original
+Robotium is an open source tool licensed under the Apache 2.0 license and the original
source can be found here:
http://code.google.com/p/robotium/
-We are including robotium-solo-3.6.jar as a binary and are not modifying it in any way
-from the original download found at:
+We are including robotium-solo-4.3.1.jar as a binary and are not modifying it in any way
+from the original download found at:
http://code.google.com/p/robotium/
Firefox for Android developers should read the documentation in
diff --git a/build/mobile/robocop/RoboCopException.java.in b/build/mobile/robocop/RoboCopException.java
index 5bff42494..6c7e754a8 100644
--- a/build/mobile/robocop/RoboCopException.java.in
+++ b/build/mobile/robocop/RoboCopException.java
@@ -1,9 +1,8 @@
-#filter substitution
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.goanna;
public class RoboCopException extends RuntimeException {
diff --git a/build/mobile/robocop/RobocopShare1.java b/build/mobile/robocop/RobocopShare1.java
new file mode 100644
index 000000000..5d5ecca5b
--- /dev/null
+++ b/build/mobile/robocop/RobocopShare1.java
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+public class RobocopShare1 extends FragmentActivity {
+ private static Bundle sArguments;
+
+ @Override
+ public void onCreate(Bundle arguments) {
+ super.onCreate(arguments);
+ }
+}
diff --git a/build/mobile/robocop/RobocopShare2.java b/build/mobile/robocop/RobocopShare2.java
new file mode 100644
index 000000000..1aa18f9c0
--- /dev/null
+++ b/build/mobile/robocop/RobocopShare2.java
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+public class RobocopShare2 extends FragmentActivity {
+ private static Bundle sArguments;
+
+ @Override
+ public void onCreate(Bundle arguments) {
+ super.onCreate(arguments);
+ }
+}
diff --git a/build/mobile/robocop/RobocopUtils.java b/build/mobile/robocop/RobocopUtils.java
new file mode 100644
index 000000000..8339152d4
--- /dev/null
+++ b/build/mobile/robocop/RobocopUtils.java
@@ -0,0 +1,58 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import android.app.Activity;
+
+public final class RobocopUtils {
+ private static final int MAX_WAIT_MS = 20000;
+
+ private RobocopUtils() {}
+
+ public static void runOnUiThreadSync(Activity activity, final Runnable runnable) {
+ final AtomicBoolean sentinel = new AtomicBoolean(false);
+
+ // On the UI thread, run the Runnable, then set sentinel to true and wake this thread.
+ activity.runOnUiThread(
+ new Runnable() {
+ @Override
+ public void run() {
+ runnable.run();
+
+ synchronized (sentinel) {
+ sentinel.set(true);
+ sentinel.notifyAll();
+ }
+ }
+ }
+ );
+
+
+ // Suspend this thread, until the other thread completes its work or until a timeout is
+ // reached.
+ long startTimestamp = System.currentTimeMillis();
+
+ synchronized (sentinel) {
+ while (!sentinel.get()) {
+ try {
+ sentinel.wait(MAX_WAIT_MS);
+ } catch (InterruptedException e) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
+ }
+
+ // Abort if we woke up due to timeout (instead of spuriously).
+ if (System.currentTimeMillis() - startTimestamp >= MAX_WAIT_MS) {
+ FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
+ "time-out waiting for UI thread");
+ FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
+
+ return;
+ }
+ }
+ }
+ }
+}
diff --git a/build/mobile/robocop/RobocopUtils.java.in b/build/mobile/robocop/RobocopUtils.java.in
deleted file mode 100644
index f2ab238f3..000000000
--- a/build/mobile/robocop/RobocopUtils.java.in
+++ /dev/null
@@ -1,43 +0,0 @@
-#filter substitution
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package @ANDROID_PACKAGE_NAME@;
-
-import android.app.Activity;
-
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
-
-public final class RobocopUtils {
- private static final int MAX_WAIT_MS = 20000;
-
- private RobocopUtils() {}
-
- public static void runOnUiThreadSync(Activity activity, final Runnable runnable) {
- final SynchronousQueue syncQueue = new SynchronousQueue();
- activity.runOnUiThread(
- new Runnable() {
- public void run() {
- runnable.run();
- try {
- syncQueue.put(new Object());
- } catch (InterruptedException e) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
- }
- }
- });
- try {
- // Wait for the UiThread code to finish running
- if (syncQueue.poll(MAX_WAIT_MS, TimeUnit.MILLISECONDS) == null) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
- "time-out waiting for UI thread");
- FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
- }
- } catch (InterruptedException e) {
- FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
- }
- }
-}
diff --git a/build/mobile/robocop/StructuredLogger.java b/build/mobile/robocop/StructuredLogger.java
new file mode 100644
index 000000000..ddd454148
--- /dev/null
+++ b/build/mobile/robocop/StructuredLogger.java
@@ -0,0 +1,188 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.goanna;
+
+import java.util.HashSet;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.json.JSONObject;
+
+// This implements the structured logging API described here: http://mozbase.readthedocs.org/en/latest/mozlog_structured.html
+public class StructuredLogger {
+ private final static HashSet<String> validTestStatus = new HashSet<String>(Arrays.asList("PASS", "FAIL", "TIMEOUT", "NOTRUN", "ASSERT"));
+ private final static HashSet<String> validTestEnd = new HashSet<String>(Arrays.asList("PASS", "FAIL", "OK", "ERROR", "TIMEOUT",
+ "CRASH", "ASSERT", "SKIP"));
+
+ private String mName;
+ private String mComponent;
+ private LoggerCallback mCallback;
+
+ static public interface LoggerCallback {
+ public void call(String output);
+ }
+
+ /* A default logger callback that prints the JSON output to stdout.
+ * This is not to be used in robocop as we write to a log file. */
+ static class StandardLoggerCallback implements LoggerCallback {
+ public void call(String output) {
+ System.out.println(output);
+ }
+ }
+
+ public StructuredLogger(String name, String component, LoggerCallback callback) {
+ mName = name;
+ mComponent = component;
+ mCallback = callback;
+ }
+
+ public StructuredLogger(String name, String component) {
+ this(name, component, new StandardLoggerCallback());
+ }
+
+ public StructuredLogger(String name, LoggerCallback callback) {
+ this(name, null, callback);
+ }
+
+ public StructuredLogger(String name) {
+ this(name, null, new StandardLoggerCallback());
+ }
+
+ public void suiteStart(List<String> tests, Map<String, Object> runInfo) {
+ HashMap<String, Object> data = new HashMap<String, Object>();
+ data.put("tests", tests);
+ if (runInfo != null) {
+ data.put("run_info", runInfo);
+ }
+ this.logData("suite_start", data);
+ }
+
+ public void suiteStart(List<String> tests) {
+ this.suiteStart(tests, null);
+ }
+
+ public void suiteEnd() {
+ this.logData("suite_end");
+ }
+
+ public void testStart(String test) {
+ HashMap<String, Object> data = new HashMap<String, Object>();
+ data.put("test", test);
+ this.logData("test_start", data);
+ }
+
+ public void testStatus(String test, String subtest, String status, String expected, String message) {
+ status = status.toUpperCase();
+ if (!StructuredLogger.validTestStatus.contains(status)) {
+ throw new IllegalArgumentException("Unrecognized status: " + status);
+ }
+
+ HashMap<String, Object> data = new HashMap<String, Object>();
+ data.put("test", test);
+ data.put("subtest", subtest);
+ data.put("status", status);
+
+ if (message != null) {
+ data.put("message", message);
+ }
+ if (!expected.equals(status)) {
+ data.put("expected", expected);
+ }
+
+ this.logData("test_status", data);
+ }
+
+ public void testStatus(String test, String subtest, String status, String message) {
+ this.testStatus(test, subtest, status, "PASS", message);
+ }
+
+ public void testEnd(String test, String status, String expected, String message, Map<String, Object> extra) {
+ status = status.toUpperCase();
+ if (!StructuredLogger.validTestEnd.contains(status)) {
+ throw new IllegalArgumentException("Unrecognized status: " + status);
+ }
+
+ HashMap<String, Object> data = new HashMap<String, Object>();
+ data.put("test", test);
+ data.put("status", status);
+
+ if (message != null) {
+ data.put("message", message);
+ }
+ if (extra != null) {
+ data.put("extra", extra);
+ }
+ if (!expected.equals(status) && !status.equals("SKIP")) {
+ data.put("expected", expected);
+ }
+
+ this.logData("test_end", data);
+ }
+
+ public void testEnd(String test, String status, String expected, String message) {
+ this.testEnd(test, status, expected, message, null);
+ }
+
+ public void testEnd(String test, String status, String message) {
+ this.testEnd(test, status, "OK", message, null);
+ }
+
+
+ public void debug(String message) {
+ this.log("debug", message);
+ }
+
+ public void info(String message) {
+ this.log("info", message);
+ }
+
+ public void warning(String message) {
+ this.log("warning", message);
+ }
+
+ public void error(String message) {
+ this.log("error", message);
+ }
+
+ public void critical(String message) {
+ this.log("critical", message);
+ }
+
+ private void log(String level, String message) {
+ HashMap<String, Object> data = new HashMap<String, Object>();
+ data.put("message", message);
+ data.put("level", level);
+ this.logData("log", data);
+ }
+
+ private HashMap<String, Object> makeLogData(String action, Map<String, Object> data) {
+ HashMap<String, Object> allData = new HashMap<String, Object>();
+ allData.put("action", action);
+ allData.put("time", System.currentTimeMillis());
+ allData.put("thread", JSONObject.NULL);
+ allData.put("pid", JSONObject.NULL);
+ allData.put("source", mName);
+ if (mComponent != null) {
+ allData.put("component", mComponent);
+ }
+
+ allData.putAll(data);
+
+ return allData;
+ }
+
+ private void logData(String action, Map<String, Object> data) {
+ HashMap<String, Object> logData = this.makeLogData(action, data);
+ JSONObject jsonObject = new JSONObject(logData);
+ mCallback.call(jsonObject.toString());
+ }
+
+ private void logData(String action) {
+ this.logData(action, new HashMap<String, Object>());
+ }
+
+}
diff --git a/build/mobile/robocop/moz.build b/build/mobile/robocop/moz.build
index e6e0c96fe..b3498dfdf 100644
--- a/build/mobile/robocop/moz.build
+++ b/build/mobile/robocop/moz.build
@@ -4,5 +4,17 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-MODULE = 'robocop'
+DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
+main = add_android_eclipse_project('Robocop', OBJDIR + '/AndroidManifest.xml')
+main.package_name = 'org.mozilla.roboexample.test'
+main.res = SRCDIR + '/res'
+main.recursive_make_targets += [OBJDIR + '/AndroidManifest.xml']
+main.extra_jars += [SRCDIR + '/robotium-solo-4.3.1.jar']
+main.assets = TOPSRCDIR + '/mobile/android/base/tests/assets'
+main.referenced_projects += ['Fennec']
+
+main.add_classpathentry('harness', SRCDIR,
+ dstdir='harness/org/mozilla/goanna')
+main.add_classpathentry('src', TOPSRCDIR + '/mobile/android/base/tests',
+ dstdir='src/org/mozilla/goanna/tests')
diff --git a/build/mobile/robocop/robotium-solo-3.6.jar b/build/mobile/robocop/robotium-solo-3.6.jar
deleted file mode 100644
index 4280906d1..000000000
--- a/build/mobile/robocop/robotium-solo-3.6.jar
+++ /dev/null
Binary files differ
diff --git a/build/mobile/robocop/robotium-solo-4.3.1.jar b/build/mobile/robocop/robotium-solo-4.3.1.jar
new file mode 100644
index 000000000..56af9985f
--- /dev/null
+++ b/build/mobile/robocop/robotium-solo-4.3.1.jar
Binary files differ
diff --git a/build/mobile/sutagent/android/CmdWorkerThread.java b/build/mobile/sutagent/android/CmdWorkerThread.java
index 12ce6bfdb..e8037aec0 100644
--- a/build/mobile/sutagent/android/CmdWorkerThread.java
+++ b/build/mobile/sutagent/android/CmdWorkerThread.java
@@ -139,6 +139,10 @@ public class CmdWorkerThread extends Thread
SUTAgentAndroid.log(dc, message);
outputLine = dc.processCommand(inputLine, out, in, cmdOut);
+ if (outputLine == null)
+ {
+ outputLine = "";
+ }
if (outputLine.length() > 0)
{
out.print(outputLine + "\n" + prompt);
diff --git a/build/mobile/sutagent/android/DataWorkerThread.java b/build/mobile/sutagent/android/DataWorkerThread.java
index e572a5c98..f8e3b6c5a 100644
--- a/build/mobile/sutagent/android/DataWorkerThread.java
+++ b/build/mobile/sutagent/android/DataWorkerThread.java
@@ -170,6 +170,10 @@ public class DataWorkerThread extends Thread
if ((inputLine += readLine(in)) != null)
{
outputLine = dc.processCommand(inputLine, out, in, cmdOut);
+ if (outputLine == null)
+ {
+ outputLine = "";
+ }
out.print(outputLine + "\n");
out.flush();
if (outputLine.equals("exit"))
diff --git a/build/mobile/sutagent/android/DoCommand.java b/build/mobile/sutagent/android/DoCommand.java
index 8c7d071ea..8d5fea57a 100644
--- a/build/mobile/sutagent/android/DoCommand.java
+++ b/build/mobile/sutagent/android/DoCommand.java
@@ -107,7 +107,9 @@ public class DoCommand {
String ffxProvider = "org.mozilla.ffxcp";
String fenProvider = "org.mozilla.fencp";
- private final String prgVersion = "SUTAgentAndroid Version 1.18";
+ private static final int DEFAULT_STARTPRG_TIMEOUT_SECONDS = 300;
+
+ public final String prgVersion = "SUTAgentAndroid Version 1.20";
public enum Command
{
@@ -116,6 +118,7 @@ public class DoCommand {
EXECSU ("execsu"),
EXECCWD ("execcwd"),
EXECCWDSU ("execcwdsu"),
+ EXECEXT ("execext"),
ENVRUN ("envrun"),
KILL ("kill"),
PS ("ps"),
@@ -723,7 +726,7 @@ public class DoCommand {
theArgs[lcv - 1] = Argv[lcv];
}
- strReturn = StartPrg2(theArgs, cmdOut, null, false);
+ strReturn = StartPrg2(theArgs, cmdOut, null, false, DEFAULT_STARTPRG_TIMEOUT_SECONDS);
}
else
{
@@ -741,7 +744,7 @@ public class DoCommand {
theArgs[lcv - 1] = Argv[lcv];
}
- strReturn = StartPrg2(theArgs, cmdOut, null, true);
+ strReturn = StartPrg2(theArgs, cmdOut, null, true, DEFAULT_STARTPRG_TIMEOUT_SECONDS);
}
else
{
@@ -759,7 +762,7 @@ public class DoCommand {
theArgs[lcv - 2] = Argv[lcv];
}
- strReturn = StartPrg2(theArgs, cmdOut, Argv[1], false);
+ strReturn = StartPrg2(theArgs, cmdOut, Argv[1], false, DEFAULT_STARTPRG_TIMEOUT_SECONDS);
}
else
{
@@ -777,7 +780,7 @@ public class DoCommand {
theArgs[lcv - 2] = Argv[lcv];
}
- strReturn = StartPrg2(theArgs, cmdOut, Argv[1], true);
+ strReturn = StartPrg2(theArgs, cmdOut, Argv[1], true, DEFAULT_STARTPRG_TIMEOUT_SECONDS);
}
else
{
@@ -796,7 +799,7 @@ public class DoCommand {
}
if (Argv[1].contains("/") || Argv[1].contains("\\") || !Argv[1].contains("."))
- strReturn = StartPrg(theArgs, cmdOut, false);
+ strReturn = StartPrg(theArgs, cmdOut, false, DEFAULT_STARTPRG_TIMEOUT_SECONDS);
else
strReturn = StartJavaPrg(theArgs, null);
}
@@ -806,6 +809,62 @@ public class DoCommand {
}
break;
+ case EXECEXT:
+ // An "extended" exec command with format:
+ // execext [su] [cwd=<path>] [t=<timeout in seconds>] arg1 ...
+ if (Argc >= 2)
+ {
+ boolean su = false;
+ String cwd = null;
+ int timeout = DEFAULT_STARTPRG_TIMEOUT_SECONDS;
+ int extra;
+ for (extra = 1; extra < Argc; extra++)
+ {
+ if (Argv[extra].equals("su"))
+ {
+ su = true;
+ }
+ else if (Argv[extra].startsWith("cwd="))
+ {
+ cwd = Argv[extra].substring(4);
+ }
+ else if (Argv[extra].startsWith("t="))
+ {
+ timeout = Integer.parseInt(Argv[extra].substring(2));
+ if (timeout < 1 || timeout > 4*60*60)
+ {
+ Log.e("SUTAgentAndroid",
+ "invalid execext timeout "+Argv[extra].substring(2)+"; using default instead");
+ timeout = DEFAULT_STARTPRG_TIMEOUT_SECONDS;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (extra < Argc)
+ {
+ String [] theArgs = new String [Argc - extra];
+ for (int lcv = extra; lcv < Argc; lcv++)
+ {
+ theArgs[lcv - extra] = Argv[lcv];
+ }
+
+ strReturn = StartPrg2(theArgs, cmdOut, cwd, su, timeout);
+ }
+ else
+ {
+ strReturn = sErrorPrefix + "No regular arguments for " + Argv[0] + " command!";
+ }
+ }
+ else
+ {
+ strReturn = sErrorPrefix + "Wrong number of arguments for " + Argv[0] + " command!";
+ }
+ break;
+
case KILL:
if (Argc == 2)
strReturn = KillProcess(Argv[1], cmdOut);
@@ -1374,29 +1433,45 @@ private void CancelNotification()
Log.i("SUTAgentAndroid", "Changed permissions on /data/local/tmp to make it writable: " + chmodResult);
}
- public String GetTestRoot()
+ private Boolean _SetTestRoot(String testroot)
{
- String state = Environment.getExternalStorageState();
- // Ensure sdcard is mounted and NOT read only
- if (state.equalsIgnoreCase(Environment.MEDIA_MOUNTED) &&
- (Environment.MEDIA_MOUNTED_READ_ONLY.compareTo(state) != 0))
- {
- return(Environment.getExternalStorageDirectory().getAbsolutePath());
- }
- File tmpFile = new java.io.File("/data/local/tmp/tests");
- try{
- tmpFile.createNewFile();
- } catch (IOException e){
- Log.i("SUTAgentAndroid", "Caught exception creating file in /data/local/tmp: " + e.getMessage());
+ String isWritable = IsDirWritable(testroot);
+ if (isWritable.contains(sErrorPrefix) || isWritable.contains("is not writable")) {
+ Log.w("SUTAgentAndroid", isWritable);
+ Log.w("SUTAgentAndroid", "Unable to set device root to " + testroot);
+ return false;
}
- if (tmpFile.exists())
- {
- tmpFile.delete();
- return("/data/local");
+
+ Log.i("SUTAgentAndroid", "Set device root to " + testroot);
+ SUTAgentAndroid.sTestRoot = testroot;
+ return true;
+ }
+
+ public void SetTestRoot(String testroot)
+ {
+ Boolean success = false;
+ if (!testroot.equals("")) {
+ // Device specified the required testroot.
+ success = _SetTestRoot(testroot);
+ if (!success) {
+ Log.e("SUTAgentAndroid", "Unable to set device root to " + testroot);
}
- Log.e("SUTAgentAndroid", "ERROR: Cannot access world writeable test root");
+ } else {
+ // Detect the testroot.
+ // Attempt external storage.
+ success = _SetTestRoot(Environment.getExternalStorageDirectory().getAbsolutePath());
+ if (!success) {
+ Log.e("SUTAgentAndroid", "Cannot access world writeable test root");
+ }
+ }
+ }
- return(null);
+ public String GetTestRoot()
+ {
+ if (SUTAgentAndroid.sTestRoot.equals("")) {
+ SetTestRoot("");
+ }
+ return SUTAgentAndroid.sTestRoot;
}
public String GetAppRoot(String AppName)
@@ -3382,11 +3457,16 @@ private void CancelNotification()
try {
outThrd3.joinAndStopRedirect(60000);
int nRet3 = pProc.exitValue();
- sRet = "\ninstallation complete [" + nRet3 + "]";
+ if (nRet3 == 0) {
+ sRet = "\ninstallation complete [0]\n";
+ }
+ else {
+ sRet = "\nFailure pm install [" + nRet3 + "]\n";
+ }
}
catch (IllegalThreadStateException itse) {
itse.printStackTrace();
- sRet = "\npm install command timed out";
+ sRet = "\nFailure pm install command timed out\n";
}
try {
out.write(sRet.getBytes());
@@ -3511,23 +3591,14 @@ private void CancelNotification()
prgIntent.setPackage(sArgs[0]);
prgIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ // Get the main activity for this package
try {
- PackageInfo pi = pm.getPackageInfo(sArgs[0], PackageManager.GET_ACTIVITIES | PackageManager.GET_INTENT_FILTERS);
- ActivityInfo [] ai = pi.activities;
- for (int i = 0; i < ai.length; i++)
- {
- ActivityInfo a = ai[i];
- if (a.name.length() > 0)
- {
- prgIntent.setClassName(a.packageName, a.name);
- break;
- }
- }
- }
- catch (NameNotFoundException e)
- {
+ final ComponentName c = pm.getLaunchIntentForPackage(sArgs[0]).getComponent();
+ prgIntent.setClassName(c.getPackageName(), c.getClassName());
+ } catch (Exception e) {
e.printStackTrace();
- }
+ return "Unable to find main activity for package: " + sArgs[0];
+ }
if (sArgs.length > 1)
{
@@ -3603,7 +3674,7 @@ private void CancelNotification()
return (sRet);
}
- public String StartPrg(String [] progArray, OutputStream out, boolean startAsRoot)
+ public String StartPrg(String [] progArray, OutputStream out, boolean startAsRoot, int timeoutSeconds)
{
String sRet = "";
int lcv = 0;
@@ -3634,16 +3705,12 @@ private void CancelNotification()
}
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
- while (lcv < 30) {
- try {
- outThrd.join(10000);
- int nRetCode = pProc.exitValue();
- sRet = "return code [" + nRetCode + "]";
- break;
- }
- catch (IllegalThreadStateException itse) {
- lcv++;
- }
+ try {
+ outThrd.join(timeoutSeconds * 1000);
+ int nRetCode = pProc.exitValue();
+ sRet = "return code [" + nRetCode + "]";
+ }
+ catch (IllegalThreadStateException itse) {
}
outThrd.stopRedirect();
}
@@ -3660,7 +3727,7 @@ private void CancelNotification()
return (sRet);
}
- public String StartPrg2(String [] progArray, OutputStream out, String cwd, boolean startAsRoot)
+ public String StartPrg2(String [] progArray, OutputStream out, String cwd, boolean startAsRoot, int timeoutSeconds)
{
String sRet = "";
@@ -3674,7 +3741,7 @@ private void CancelNotification()
if (!sEnvString.contains("=") && (sEnvString.length() > 0))
{
if (sEnvString.contains("/") || sEnvString.contains("\\") || !sEnvString.contains("."))
- sRet = StartPrg(progArray, out, startAsRoot);
+ sRet = StartPrg(progArray, out, startAsRoot, timeoutSeconds);
else
sRet = StartJavaPrg(progArray, null);
return(sRet);
@@ -3763,18 +3830,12 @@ private void CancelNotification()
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
- lcv = 0;
-
- while (lcv < 30) {
- try {
- outThrd.join(10000);
- int nRetCode = pProc.exitValue();
- sRet = "return code [" + nRetCode + "]";
- lcv = 30;
- }
- catch (IllegalThreadStateException itse) {
- lcv++;
- }
+ try {
+ outThrd.join(timeoutSeconds * 1000);
+ int nRetCode = pProc.exitValue();
+ sRet = "return code [" + nRetCode + "]";
+ }
+ catch (IllegalThreadStateException itse) {
}
outThrd.stopRedirect();
}
@@ -3907,9 +3968,10 @@ private void CancelNotification()
"run [cmdline] - start program no wait\n" +
"exec [env pairs] [cmdline] - start program no wait optionally pass env\n" +
" key=value pairs (comma separated)\n" +
- "execcwd [env pairs] [cmdline] - start program from specified directory\n" +
+ "execcwd <dir> [env pairs] [cmdline] - start program from specified directory\n" +
"execsu [env pairs] [cmdline] - start program as privileged user\n" +
- "execcwdsu [env pairs] [cmdline] - start program from specified directory as privileged user\n" +
+ "execcwdsu <dir> [env pairs] [cmdline] - start program from specified directory as privileged user\n" +
+ "execext [su] [cwd=<dir>] [t=<timeout>] [env pairs] [cmdline] - start program with extended options\n" +
"kill [program name] - kill program no path\n" +
"killall - kill all processes started\n" +
"ps - list of running processes\n" +
@@ -3924,7 +3986,6 @@ private void CancelNotification()
" [memory] - physical, free, available, storage memory\n" +
" for device\n" +
" [processes] - list of running processes see 'ps'\n" +
- "deadman timeout - set the duration for the deadman timer\n" +
"alrt [on/off] - start or stop sysalert behavior\n" +
"disk [arg] - prints disk space info\n" +
"cp file1 file2 - copy file1 to file2\n" +
diff --git a/build/mobile/sutagent/android/Makefile.in b/build/mobile/sutagent/android/Makefile.in
index 8fdc64b0e..5dc76b877 100644
--- a/build/mobile/sutagent/android/Makefile.in
+++ b/build/mobile/sutagent/android/Makefile.in
@@ -2,13 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
ANDROID_APK_NAME := sutAgentAndroid
JAVAFILES = \
@@ -25,55 +18,13 @@ JAVAFILES = \
RunDataThread.java \
SUTAgentAndroid.java \
WifiConfiguration.java \
- R.java \
- $(NULL)
-
-RES_FILES = \
- res/drawable/icon.png \
- res/drawable/ateamlogo.png \
- res/drawable/ic_stat_first.png \
- res/drawable/ic_stat_neterror.png \
- res/drawable/ic_stat_warning.png \
- res/layout/main.xml \
- res/values/strings.xml \
$(NULL)
-GARBAGE += \
- AndroidManifest.xml \
- classes.dex \
- $(ANDROID_APK_NAME).ap_ \
- $(ANDROID_APK_NAME)-unsigned-unaligned.apk \
- $(ANDROID_APK_NAME)-unaligned.apk \
- $(ANDROID_APK_NAME).apk \
+ANDROID_EXTRA_JARS = \
+ $(srcdir)/network-libs/commons-net-2.0.jar \
+ $(srcdir)/network-libs/jmdns.jar \
$(NULL)
-GARBAGE_DIRS += network-libs
-
-EXTRA_JARS = $(srcdir)/network-libs/commons-net-2.0.jar:$(srcdir)/network-libs/jmdns.jar
-
-JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar:$(EXTRA_JARS)
-
include $(topsrcdir)/config/rules.mk
-# include Android specific java flags - using these instead of what's in rules.mk
-include $(topsrcdir)/config/android-common.mk
-
tools:: $(ANDROID_APK_NAME).apk
-
-classes.dex: $(JAVAFILES)
- $(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
- $(DX) --dex --output=$@ classes $(subst :, ,$(EXTRA_JARS))
-
-$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
- $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
-
-$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
- cp $< $@
- $(ZIP) -0 $@ classes.dex
-
-$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
- cp $< $@
- $(DEBUG_JARSIGNER) $@
-
-$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
- $(ZIPALIGN) -f -v 4 $< $@
diff --git a/build/mobile/sutagent/android/R.java b/build/mobile/sutagent/android/R.java
deleted file mode 100644
index 92c351506..000000000
--- a/build/mobile/sutagent/android/R.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.mozilla.SUTAgentAndroid;
-
-public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int ateamlogo=0x7f020000;
- public static final int ic_stat_first=0x7f020001;
- public static final int ic_stat_neterror=0x7f020002;
- public static final int ic_stat_second=0x7f020003;
- public static final int ic_stat_warning=0x7f020004;
- public static final int icon=0x7f020005;
- }
- public static final class id {
- public static final int Button01=0x7f050001;
- public static final int Textview01=0x7f050000;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int foreground_service_started=0x7f040002;
- public static final int hello=0x7f040000;
- }
-}
diff --git a/build/mobile/sutagent/android/SUTAgentAndroid.java b/build/mobile/sutagent/android/SUTAgentAndroid.java
index ab0f995b3..4d58f8802 100644
--- a/build/mobile/sutagent/android/SUTAgentAndroid.java
+++ b/build/mobile/sutagent/android/SUTAgentAndroid.java
@@ -67,6 +67,7 @@ public class SUTAgentAndroid extends Activity
public static int nChargeLevel = 0;
public static int nBatteryTemp = 0;
public static long nCreateTimeMillis = System.currentTimeMillis();
+ public static String sTestRoot = "";
String lineSep = System.getProperty("line.separator");
public PrintWriter dataOut = null;
@@ -162,6 +163,7 @@ public class SUTAgentAndroid extends Activity
DoCommand dc = new DoCommand(getApplication());
+ Log.i("SUTAgentAndroid", dc.prgVersion);
dc.FixDataLocalPermissions();
// Get configuration settings from "ini" file
@@ -177,9 +179,14 @@ public class SUTAgentAndroid extends Activity
SUTAgentAndroid.RegSvrIPPort = dc.GetIniData("Registration Server", "PORT", sIniFile);
SUTAgentAndroid.HardwareID = dc.GetIniData("Registration Server", "HARDWARE", sIniFile);
SUTAgentAndroid.Pool = dc.GetIniData("Registration Server", "POOL", sIniFile);
+ SUTAgentAndroid.sTestRoot = dc.GetIniData("Device", "TestRoot", sIniFile);
SUTAgentAndroid.Abi = android.os.Build.CPU_ABI;
log(dc, "onCreate");
+ dc.SetTestRoot(SUTAgentAndroid.sTestRoot);
+
+ Log.i("SUTAgentAndroid", "Test Root: " + SUTAgentAndroid.sTestRoot);
+
tv = (TextView) this.findViewById(R.id.Textview01);
if (getLocalIpAddress() == null)
@@ -281,7 +288,9 @@ public class SUTAgentAndroid extends Activity
sLocalIPAddr = getLocalIpAddress();
Toast.makeText(getApplication().getApplicationContext(), "SUTAgent [" + sLocalIPAddr + "] ...", Toast.LENGTH_LONG).show();
- String sConfig = "Unique ID: " + sUniqueID + lineSep;
+ String sConfig = dc.prgVersion + lineSep;
+ sConfig += "Test Root: " + sTestRoot + lineSep;
+ sConfig += "Unique ID: " + sUniqueID + lineSep;
sConfig += "HWID: " + hwid + lineSep;
sConfig += "ABI: " + Abi + lineSep;
sConfig += "OS Info" + lineSep;
@@ -589,12 +598,8 @@ public class SUTAgentAndroid extends Activity
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X);
}
- wc.hiddenSSID = false;
wc.status = WifiConfiguration.Status.ENABLED;
- wc.password.setValue("\"password\"");
- wc.identity.setValue("\"bmoss@mozilla.com\"");
-
if (!wifi.isWifiEnabled())
wifi.setWifiEnabled(true);
diff --git a/build/mobile/sutagent/android/WifiConfiguration.java b/build/mobile/sutagent/android/WifiConfiguration.java
index f923d2cb2..56db51da3 100644
--- a/build/mobile/sutagent/android/WifiConfiguration.java
+++ b/build/mobile/sutagent/android/WifiConfiguration.java
@@ -305,7 +305,7 @@ public class WifiConfiguration implements Parcelable {
}
public String toString() {
- StringBuffer sbuf = new StringBuffer();
+ StringBuilder sbuf = new StringBuilder();
if (this.status == WifiConfiguration.Status.CURRENT) {
sbuf.append("* ");
} else if (this.status == WifiConfiguration.Status.DISABLED) {
diff --git a/build/mobile/sutagent/android/fencp/Makefile.in b/build/mobile/sutagent/android/fencp/Makefile.in
index 7b29ea0ba..e833b263d 100644
--- a/build/mobile/sutagent/android/fencp/Makefile.in
+++ b/build/mobile/sutagent/android/fencp/Makefile.in
@@ -2,13 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
ANDROID_APK_NAME := FenCP
JAVAFILES = \
@@ -16,51 +9,8 @@ JAVAFILES = \
FenCP.java \
FenCPFP.java \
FileCursor.java \
- R.java \
- $(NULL)
-
-RES_FILES = \
- res/drawable-hdpi/icon.png \
- res/drawable-ldpi/icon.png \
- res/drawable-mdpi/icon.png \
- res/layout/main.xml \
- res/values/strings.xml \
$(NULL)
-GARBAGE += \
- AndroidManifest.xml \
- classes.dex \
- $(ANDROID_APK_NAME).ap_ \
- $(ANDROID_APK_NAME)-unsigned-unaligned.apk \
- $(ANDROID_APK_NAME)-unaligned.apk \
- $(ANDROID_APK_NAME).apk \
- $(NULL)
-
-GARBAGE_DIRS += network-libs
-
-JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
-
include $(topsrcdir)/config/rules.mk
-# include Android specific java flags - using these instead of what's in rules.mk
-include $(topsrcdir)/config/android-common.mk
-
tools:: $(ANDROID_APK_NAME).apk
-
-classes.dex: $(JAVAFILES)
- $(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
- $(DX) --dex --output=$@ classes
-
-$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
- $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
-
-$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
- cp $< $@
- $(ZIP) -0 $@ classes.dex
-
-$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
- cp $< $@
- $(DEBUG_JARSIGNER) $@
-
-$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
- $(ZIPALIGN) -f -v 4 $< $@
diff --git a/build/mobile/sutagent/android/fencp/R.java b/build/mobile/sutagent/android/fencp/R.java
deleted file mode 100644
index 62f638607..000000000
--- a/build/mobile/sutagent/android/fencp/R.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package org.mozilla.fencp;
-
-public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int icon=0x7f020000;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
- }
-}
diff --git a/build/mobile/sutagent/android/fencp/moz.build b/build/mobile/sutagent/android/fencp/moz.build
index bba1d688b..c271ec390 100644
--- a/build/mobile/sutagent/android/fencp/moz.build
+++ b/build/mobile/sutagent/android/fencp/moz.build
@@ -3,6 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'FenCP'
-
diff --git a/build/mobile/sutagent/android/ffxcp/Makefile.in b/build/mobile/sutagent/android/ffxcp/Makefile.in
index 2cabb7579..ba51e14bc 100644
--- a/build/mobile/sutagent/android/ffxcp/Makefile.in
+++ b/build/mobile/sutagent/android/ffxcp/Makefile.in
@@ -2,13 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
ANDROID_APK_NAME := FfxCP
JAVAFILES = \
@@ -16,51 +9,8 @@ JAVAFILES = \
ffxcp.java \
FfxCPFP.java \
FileCursor.java \
- R.java \
- $(NULL)
-
-RES_FILES = \
- res/drawable-hdpi/icon.png \
- res/drawable-ldpi/icon.png \
- res/drawable-mdpi/icon.png \
- res/layout/main.xml \
- res/values/strings.xml \
$(NULL)
-GARBAGE += \
- AndroidManifest.xml \
- classes.dex \
- $(ANDROID_APK_NAME).ap_ \
- $(ANDROID_APK_NAME)-unsigned-unaligned.apk \
- $(ANDROID_APK_NAME)-unaligned.apk \
- $(ANDROID_APK_NAME).apk \
- $(NULL)
-
-GARBAGE_DIRS += network-libs
-
-JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
-
include $(topsrcdir)/config/rules.mk
-# include Android specific java flags - using these instead of what's in rules.mk
-include $(topsrcdir)/config/android-common.mk
-
tools:: $(ANDROID_APK_NAME).apk
-
-classes.dex: $(JAVAFILES)
- $(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
- $(DX) --dex --output=$@ classes
-
-$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
- $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
-
-$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
- cp $< $@
- $(ZIP) -0 $@ classes.dex
-
-$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
- cp $< $@
- $(DEBUG_JARSIGNER) $@
-
-$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
- $(ZIPALIGN) -f -v 4 $< $@
diff --git a/build/mobile/sutagent/android/ffxcp/R.java b/build/mobile/sutagent/android/ffxcp/R.java
deleted file mode 100644
index 5366cc5c8..000000000
--- a/build/mobile/sutagent/android/ffxcp/R.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package org.mozilla.ffxcp;
-
-public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int icon=0x7f020000;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
- }
-}
diff --git a/build/mobile/sutagent/android/ffxcp/moz.build b/build/mobile/sutagent/android/ffxcp/moz.build
index 11b4ec2cd..c271ec390 100644
--- a/build/mobile/sutagent/android/ffxcp/moz.build
+++ b/build/mobile/sutagent/android/ffxcp/moz.build
@@ -3,6 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'FfxCP'
-
diff --git a/build/mobile/sutagent/android/moz.build b/build/mobile/sutagent/android/moz.build
index 58a08666c..c271ec390 100644
--- a/build/mobile/sutagent/android/moz.build
+++ b/build/mobile/sutagent/android/moz.build
@@ -3,6 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'sutAgentAndroid'
-
diff --git a/build/mobile/sutagent/android/watcher/Makefile.in b/build/mobile/sutagent/android/watcher/Makefile.in
index c711e75ce..fc8f9e5c3 100644
--- a/build/mobile/sutagent/android/watcher/Makefile.in
+++ b/build/mobile/sutagent/android/watcher/Makefile.in
@@ -2,70 +2,16 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
ANDROID_APK_NAME := Watcher
JAVAFILES = \
IWatcherService.java \
RedirOutputThread.java \
- R.java \
WatcherMain.java \
WatcherReceiver.java \
WatcherService.java \
$(NULL)
-RES_FILES = \
- res/drawable-hdpi/icon.png \
- res/drawable-hdpi/ateamlogo.png \
- res/drawable-ldpi/icon.png \
- res/drawable-ldpi/ateamlogo.png \
- res/drawable-mdpi/icon.png \
- res/drawable-mdpi/ateamlogo.png \
- res/layout/main.xml \
- res/values/strings.xml \
- $(NULL)
-
-GARBAGE += \
- AndroidManifest.xml \
- classes.dex \
- $(ANDROID_APK_NAME).ap_ \
- $(ANDROID_APK_NAME)-unsigned-unaligned.apk \
- $(ANDROID_APK_NAME)-unaligned.apk \
- $(ANDROID_APK_NAME).apk \
- $(NULL)
-
-GARBAGE_DIRS += res classes network-libs
-
-JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
-
include $(topsrcdir)/config/rules.mk
-# include Android specific java flags - using these instead of what's in rules.mk
-include $(topsrcdir)/config/android-common.mk
-
tools:: $(ANDROID_APK_NAME).apk
-
-classes.dex: $(JAVAFILES)
- $(NSINSTALL) -D classes
- $(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
- $(DX) --dex --output=$@ classes
-
-$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
- $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
-
-$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
- cp $< $@
- $(ZIP) -0 $@ classes.dex
-
-$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
- cp $< $@
- $(DEBUG_JARSIGNER) $@
-
-$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
- $(ZIPALIGN) -f -v 4 $< $@
diff --git a/build/mobile/sutagent/android/watcher/R.java b/build/mobile/sutagent/android/watcher/R.java
deleted file mode 100644
index b1917c0bd..000000000
--- a/build/mobile/sutagent/android/watcher/R.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.mozilla.watcher;
-
-public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int ateamlogo=0x7f020000;
- public static final int icon=0x7f020001;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int foreground_service_started=0x7f040002;
- public static final int hello=0x7f040000;
- }
-}
diff --git a/build/mobile/sutagent/android/watcher/RedirOutputThread.java b/build/mobile/sutagent/android/watcher/RedirOutputThread.java
index 440e726a0..f72289a87 100644
--- a/build/mobile/sutagent/android/watcher/RedirOutputThread.java
+++ b/build/mobile/sutagent/android/watcher/RedirOutputThread.java
@@ -101,7 +101,6 @@ public class RedirOutputThread extends Thread
}
catch (IOException e)
{
-// Toast.makeText(SUTAgentAndroid.me.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
diff --git a/build/mobile/sutagent/android/watcher/WatcherService.java b/build/mobile/sutagent/android/watcher/WatcherService.java
index 4b5554256..7a6b5e9d5 100644
--- a/build/mobile/sutagent/android/watcher/WatcherService.java
+++ b/build/mobile/sutagent/android/watcher/WatcherService.java
@@ -43,13 +43,11 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.provider.Settings;
import android.util.Log;
-import android.view.Gravity;
-import android.widget.Toast;
import android.os.Environment;
public class WatcherService extends Service
{
- private final String prgVersion = "Watcher Version 1.16";
+ private final String prgVersion = "Watcher Version 1.17";
private final String LOGTAG = "Watcher";
String sErrorPrefix = "##Installer Error## ";
@@ -135,16 +133,16 @@ public class WatcherService extends Service
try {
if (nStayOn != 0) {
if (!Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB)) {
- doToast("Screen couldn't be set to Always On [stay on while plugged in]");
+ Log.e(LOGTAG, "Screen couldn't be set to Always On [stay on while plugged in]");
}
}
} catch (Exception e) {
e.printStackTrace();
String sExcept = e.getMessage();
- doToast("Screen couldn't be set to Always On [exception " + sExcept + "]");
+ Log.e(LOGTAG, "Screen couldn't be set to Always On [exception " + sExcept + "]");
}
- doToast("WatcherService created");
+ Log.i(LOGTAG, "WatcherService created");
}
public String GetIniData(String sSection, String sKey, String sFile, String sDefault)
@@ -228,7 +226,7 @@ public class WatcherService extends Service
{
if (!this.bStartedTimer)
{
- doToast("WatcherService started");
+ Log.i(LOGTAG, "WatcherService started");
myTimer = new Timer();
Date startSchedule = new Date(System.currentTimeMillis() + lDelay);
myTimer.schedule(new MyTime(), startSchedule, lPeriod);
@@ -237,11 +235,11 @@ public class WatcherService extends Service
}
else
{
- doToast("WatcherService unknown command");
+ Log.w(LOGTAG, "WatcherService unknown command");
}
}
else
- doToast("WatcherService created");
+ Log.w(LOGTAG, "WatcherService intent had null command");
}
public void writeVersion() {
@@ -280,7 +278,7 @@ public class WatcherService extends Service
@Override
public void onDestroy() {
super.onDestroy();
- doToast("WatcherService destroyed");
+ Log.i(LOGTAG, "WatcherService destroyed");
if (pwl != null)
pwl.release();
stopForegroundCompat(R.string.foreground_service_started);
@@ -447,14 +445,6 @@ public class WatcherService extends Service
}
}
- public void doToast(String sMsg)
- {
- Log.i(LOGTAG, sMsg);
- Toast toast = Toast.makeText(this, sMsg, Toast.LENGTH_LONG);
- toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 100);
- toast.show();
- }
-
public void CheckMem()
{
System.gc();
diff --git a/build/mobile/sutagent/android/watcher/moz.build b/build/mobile/sutagent/android/watcher/moz.build
index d45d52c91..c271ec390 100644
--- a/build/mobile/sutagent/android/watcher/moz.build
+++ b/build/mobile/sutagent/android/watcher/moz.build
@@ -3,6 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'Watcher'
-
diff --git a/build/moz-automation.mk b/build/moz-automation.mk
new file mode 100644
index 000000000..8c953198c
--- /dev/null
+++ b/build/moz-automation.mk
@@ -0,0 +1,124 @@
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ifneq (,$(filter automation/%,$(MAKECMDGOALS)))
+ifeq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION))))
+MAKEFLAGS += --output-sync=target
+else
+.NOTPARALLEL:
+endif
+endif
+
+include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
+include $(topsrcdir)/toolkit/mozapps/installer/upload-files.mk
+
+# Clear out DIST_FILES if it was set by upload-files.mk (for Android builds)
+DIST_FILES =
+
+# Log file from the 'make upload' step. We need this to parse out the URLs of
+# the uploaded files.
+AUTOMATION_UPLOAD_OUTPUT = $(DIST)/automation-upload.txt
+
+# Helper variables to convert from MOZ_AUTOMATION_* variables to the
+# corresponding the make target
+tier_BUILD_SYMBOLS = buildsymbols
+tier_L10N_CHECK = l10n-check
+tier_PRETTY_L10N_CHECK = pretty-l10n-check
+tier_INSTALLER = installer
+tier_PRETTY_INSTALLER = pretty-installer
+tier_PACKAGE = package
+tier_PRETTY_PACKAGE = pretty-package
+tier_PACKAGE_TESTS = package-tests
+tier_PRETTY_PACKAGE_TESTS = pretty-package-tests
+tier_UPDATE_PACKAGING = update-packaging
+tier_PRETTY_UPDATE_PACKAGING = pretty-update-packaging
+tier_UPLOAD_SYMBOLS = uploadsymbols
+tier_UPLOAD = upload
+
+# Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in
+# TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted
+# here in the order that they will be executed (since mach doesn't know of the
+# dependencies between them).
+moz_automation_symbols = \
+ PACKAGE_TESTS \
+ PRETTY_PACKAGE_TESTS \
+ BUILD_SYMBOLS \
+ UPLOAD_SYMBOLS \
+ PACKAGE \
+ PRETTY_PACKAGE \
+ INSTALLER \
+ PRETTY_INSTALLER \
+ UPDATE_PACKAGING \
+ PRETTY_UPDATE_PACKAGING \
+ L10N_CHECK \
+ PRETTY_L10N_CHECK \
+ UPLOAD \
+ $(NULL)
+MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$(MOZ_AUTOMATION_$(sym))),$(tier_$(sym))))
+
+# Dependencies between automation build steps
+automation/uploadsymbols: automation/buildsymbols
+
+automation/update-packaging: automation/package
+automation/update-packaging: automation/installer
+automation/pretty-update-packaging: automation/pretty-package
+automation/pretty-update-packaging: automation/pretty-installer
+
+automation/l10n-check: automation/package
+automation/l10n-check: automation/installer
+automation/pretty-l10n-check: automation/pretty-package
+automation/pretty-l10n-check: automation/pretty-installer
+
+automation/upload: automation/installer
+automation/upload: automation/package
+automation/upload: automation/package-tests
+automation/upload: automation/buildsymbols
+automation/upload: automation/update-packaging
+
+# automation/{pretty-}package should depend on build (which is implicit due to
+# the way client.mk invokes automation/build), but buildsymbols changes the
+# binaries/libs, and that's what we package/test.
+automation/pretty-package: automation/buildsymbols
+
+# The installer and packager both run stage-package, and may conflict
+# with each other.
+automation/installer: automation/package
+
+# The 'pretty' versions of targets run before the regular ones to avoid
+# conflicts in writing to the same files.
+automation/installer: automation/pretty-installer
+automation/package: automation/pretty-package
+automation/package-tests: automation/pretty-package-tests
+automation/l10n-check: automation/pretty-l10n-check
+automation/update-packaging: automation/pretty-update-packaging
+
+automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
+ $(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT) --upload-files $(abspath $(UPLOAD_FILES)) --package $(PACKAGE)
+
+# We need the log from make upload to grep it for urls in order to set
+# properties.
+AUTOMATION_EXTRA_CMDLINE-upload = 2>&1 | tee $(AUTOMATION_UPLOAD_OUTPUT)
+
+# Note: We have to force -j1 here, at least until bug 1036563 is fixed.
+AUTOMATION_EXTRA_CMDLINE-l10n-check = -j1
+AUTOMATION_EXTRA_CMDLINE-pretty-l10n-check = -j1
+
+# And force -j1 here until bug 1077670 is fixed.
+AUTOMATION_EXTRA_CMDLINE-package-tests = -j1
+AUTOMATION_EXTRA_CMDLINE-pretty-package-tests = -j1
+
+# The commands only run if the corresponding MOZ_AUTOMATION_* variable is
+# enabled. This means, for example, if we enable MOZ_AUTOMATION_UPLOAD, then
+# 'buildsymbols' will only run if MOZ_AUTOMATION_BUILD_SYMBOLS is also set.
+# However, the target automation/buildsymbols will still be executed in this
+# case because it is a prerequisite of automation/upload.
+define automation_commands
+$(call BUILDSTATUS,TIER_START $1)
+@$(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
+$(call BUILDSTATUS,TIER_FINISH $1)
+endef
+
+automation/%:
+ $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call automation_commands,$*))
diff --git a/build/moz.build b/build/moz.build
index 6d6e8ecbb..74728007c 100644
--- a/build/moz.build
+++ b/build/moz.build
@@ -4,15 +4,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# This cannot be named "build" because of bug 922191.
+SPHINX_TREES['buildsystem'] = 'docs'
+
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['win32']
else:
DIRS += ['unix']
-if CONFIG['STLPORT_SOURCES']:
+if CONFIG['OS_TARGET'] == 'Android' and not CONFIG['MOZ_ANDROID_LIBSTDCXX']:
DIRS += ['stlport']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
+ DIRS += ['annotationProcessors']
TEST_DIRS += [
'mobile/sutagent/android',
'mobile/sutagent/android/watcher',
@@ -21,5 +25,26 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
'mobile/robocop',
]
-MODULE = 'build'
+for var in ('GRE_MILESTONE', 'MOZ_APP_VERSION', 'MOZ_APP_BASENAME',
+ 'MOZ_APP_VENDOR', 'MOZ_APP_ID', 'MAR_CHANNEL_ID',
+ 'ACCEPTED_MAR_CHANNEL_IDS', 'MOZ_APP_REMOTINGNAME'):
+ DEFINES[var] = CONFIG[var]
+
+if CONFIG['MOZ_APP_DISPLAYNAME'] != CONFIG['MOZ_APP_BASENAME']:
+ DEFINES['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME']
+
+if CONFIG['MOZ_BUILD_APP'] == 'browser':
+ DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True
+if CONFIG['MOZ_APP_PROFILE']:
+ DEFINES['MOZ_APP_PROFILE'] = CONFIG['MOZ_APP_PROFILE']
+
+for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR',
+ 'MOZ_APP_STATIC_INI'):
+ if CONFIG[var]:
+ DEFINES[var] = True
+
+if CONFIG['MOZ_BUILD_APP'] == 'browser':
+ PYTHON_UNIT_TESTS += [
+ 'compare-mozconfig/compare-mozconfigs-wrapper.py',
+ ]
diff --git a/build/mozconfig.automation b/build/mozconfig.automation
new file mode 100644
index 000000000..b65f0fa40
--- /dev/null
+++ b/build/mozconfig.automation
@@ -0,0 +1,32 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Common mozconfig for automation builds.
+#
+# We export MOZ_AUTOMATION_* variables here to trigger various steps in
+# automation builds. For example, if MOZ_AUTOMATION_PACKAGE is set, then the
+# package step will run. This file contains the default settings, which can be
+# overridden by setting them earlier in the appropriate mozconfig.
+
+mk_add_options "export MOZ_AUTOMATION_BUILD_SYMBOLS=${MOZ_AUTOMATION_BUILD_SYMBOLS-1}"
+mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
+mk_add_options "export MOZ_AUTOMATION_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
+mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
+mk_add_options "export MOZ_AUTOMATION_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
+mk_add_options "export MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-0}"
+mk_add_options "export MOZ_AUTOMATION_UPLOAD=${MOZ_AUTOMATION_UPLOAD-1}"
+mk_add_options "export MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-0}"
+
+# If we are also building with MOZ_PKG_PRETTYNAMES, set the corresponding
+# stages.
+if test "$MOZ_AUTOMATION_PRETTY" = "1"; then
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
+
+ # Note that we always build the update packaging with pretty names even if
+ # we don't build it without, so this is set to 1.
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_UPDATE_PACKAGING=1"
+fi
diff --git a/build/mozconfig.cache b/build/mozconfig.cache
new file mode 100644
index 000000000..c003f5f6e
--- /dev/null
+++ b/build/mozconfig.cache
@@ -0,0 +1,80 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Setup for build cache
+
+# Avoid duplication if the file happens to be included twice.
+if test -z "$bucket"; then
+
+read branch platform master <<EOF
+$(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
+EOF
+
+bucket=
+if test -z "$SCCACHE_DISABLE" -a -z "$no_sccache"; then
+ case "${branch}" in
+ try)
+ case "${master}" in
+ *scl1.mozilla.com*|*.scl3.mozilla.com*)
+ bucket=mozilla-releng-s3-cache-us-west-1-try
+ ;;
+ *use1.mozilla.com*)
+ bucket=mozilla-releng-s3-cache-us-east-1-try
+ ;;
+ *usw2.mozilla.com*)
+ bucket=mozilla-releng-s3-cache-us-west-2-try
+ ;;
+ esac
+ ;;
+ b2g-inbound|mozilla-inbound|fx-team)
+ case "${master}" in
+ *use1.mozilla.com*)
+ if test -z "$MOZ_PGO"; then
+ bucket=mozilla-releng-s3-cache-us-east-1-prod
+ fi
+ ;;
+ *usw2.mozilla.com*)
+ if test -z "$MOZ_PGO"; then
+ bucket=mozilla-releng-s3-cache-us-west-2-prod
+ fi
+ ;;
+ esac
+ ;;
+ esac
+fi
+
+if test -z "$bucket"; then
+ case "$platform" in
+ win*) : ;;
+ *)
+ ac_add_options --with-ccache
+ esac
+else
+ mk_add_options "export SCCACHE_BUCKET=$bucket"
+ case "$master" in
+ *use1.mozilla.com*|*usw2.mozilla.com*)
+ mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
+ ;;
+ esac
+ ac_add_options "--with-compiler-wrapper=python2.7 $topsrcdir/sccache/sccache.py"
+ mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
+ mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
+ mk_add_options "export UPLOAD_EXTRA_FILES+=sccache.log.gz"
+ case "$platform" in
+ win*)
+ # sccache supports a special flag to create depfiles.
+ export _DEPEND_CFLAGS='-deps$(MDDEPDIR)/$(@F).pp'
+ # Windows builds have a default wrapper that needs to be overridden
+ mk_add_options "export CC_WRAPPER="
+ mk_add_options "export CXX_WRAPPER="
+ # For now, sccache doesn't support separate PDBs so force debug info to be
+ # in object files.
+ mk_add_options "export COMPILE_PDB_FLAG="
+ mk_add_options "export HOST_PDB_FLAG="
+ mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"
+ ;;
+ esac
+fi
+
+fi
diff --git a/build/mozconfig.common b/build/mozconfig.common
index e329737d3..84cbdf22b 100644
--- a/build/mozconfig.common
+++ b/build/mozconfig.common
@@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-# Common mozconfig for all users
+# Common mozconfig for official builds.
#
# Add options to this file that will be inherited by all in-tree mozconfigs.
# This is useful for eg try builds with nondefault options that apply to all
@@ -11,3 +11,7 @@
# of this file.
mk_add_options AUTOCLOBBER=1
+
+ac_add_options --enable-release
+
+. "$topsrcdir/build/mozconfig.automation"
diff --git a/build/mozconfig.vs-common b/build/mozconfig.vs-common
new file mode 100644
index 000000000..ca5df2f3a
--- /dev/null
+++ b/build/mozconfig.vs-common
@@ -0,0 +1,4 @@
+# Pymake needs Windows-style paths. Use cmd.exe to hack around this.
+mk_export_correct_style() {
+ mk_add_options "export $1=$(cmd.exe //c echo %$1%)"
+}
diff --git a/build/mozconfig.vs2010-common b/build/mozconfig.vs2010-common
deleted file mode 100644
index 9806ae242..000000000
--- a/build/mozconfig.vs2010-common
+++ /dev/null
@@ -1,8 +0,0 @@
-# Pymake needs Windows-style paths. Use cmd.exe to hack around this.
-mk_export_correct_style() {
- if test -n "${_PYMAKE}"; then
- mk_add_options "export $1=$(cmd.exe //c echo %$1%)"
- else
- mk_add_options "export $1=$(eval echo \$$1)"
- fi
-}
diff --git a/build/mozconfig.win-common b/build/mozconfig.win-common
new file mode 100644
index 000000000..6eec31036
--- /dev/null
+++ b/build/mozconfig.win-common
@@ -0,0 +1,11 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if [ "x$IS_NIGHTLY" = "xyes" ]; then
+ MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
+ MOZ_AUTOMATION_UPDATE_PACKAGING=1
+fi
+MOZ_AUTOMATION_INSTALLER=1
+
+export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=c:/builds/crash-stats-api.token
diff --git a/build/package/Makefile.in b/build/package/Makefile.in
deleted file mode 100644
index 163fab806..000000000
--- a/build/package/Makefile.in
+++ /dev/null
@@ -1,77 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-# This makefile doesn't do anything by default. Use one of the special targets
-# below to stage and build packages.
-
-include $(topsrcdir)/config/rules.mk
-
-ifdef MOZ_DEBUG
-APP_NAME = MozillaDebug
-else
-APP_NAME = Mozilla
-endif
-
-# override these variables in special situations
-STAGE_DIR = $(DEPTH)/stage$(if $*,/$*)
-STAGE_MACAPP_DIR = $(DEPTH)/stage$(if $*,/$*)/$(APP_NAME).app
-XPI_FILE = $(DIST)/xpi/$*.xpi
-ZIP_FILE = $(DIST)/$*.zip
-TGZ_FILE = $(DIST)/$*.tar.gz
-BZ2_FILE = $(DIST)/$*.tar.bz2
-DMG_FILE = $(DIST)/$*.dmg
-
-PACKAGE_LIST = $(srcdir)/packages.list
-PACKAGE_FLAGS =
-HANDLERS = xptmerge touch optional preprocess exec
-MAPPINGS = dist/bin=bin xpiroot/=
-
-MACAPP_MAPPINGS = dist/bin=Contents/MacOS approot=Contents
-
-dump-packages:
- @$(PERL) $(srcdir)/dump-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -u $(PACKAGE_FLAGS)
-
-# This rule will stage any one package. If you need to stage multiple packages or
-# do ^packages (subtraction packages) use the stage-packages rule and set PACKAGES
-# on the command line
-stage-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(addprefix -c ,$(HANDLERS)) -d $(PACKAGE_FLAGS) $*
-
-stagemacapp-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_MACAPP_DIR) $(addprefix -m ,$(MACAPP_MAPPINGS)) $(addprefix -c ,$(HANDLERS)) -d $(PACKAGE_FLAGS) $*
-
-makexpi-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(addprefix -c ,$(HANDLERS)) --make-package xpi=$(XPI_FILE) -d $(PACKAGE_FLAGS) $*
-
-makezip-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(addprefix -c ,$(HANDLERS)) --make-package zip=$(ZIP_FILE) -d $(PACKAGE_FLAGS) $*
-
-maketgz-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(addprefix -c ,$(HANDLERS)) --make-package tgz=$(TGZ_FILE) -d $(PACKAGE_FLAGS) $*
-
-makebz2-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(addprefix -c ,$(HANDLERS)) --make-package bz2=$(BZ2_FILE) -d $(PACKAGE_FLAGS) $*
-
-makedmg-%:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MACAPP_MAPPINGS)) $(addprefix -c ,$(HANDLERS)) --make-package dmg=$(DMG_FILE) -d $(PACKAGE_FLAGS) $*
-
-ifndef PACKAGES
-stage-packages makexpi-packages:
- @echo "Please set PACKAGES on the makefile command line or environment."
-
-else #PACKAGES
-stage-packages:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(apprefix -c ,$(HANDLERS)) $(PACKAGE_FLAGS) $(PACKAGES)
-
-makexpi-packages:
- $(PERL) $(srcdir)/stage-packages.pl -o $(DEPTH) -l $(PACKAGE_LIST) -s $(STAGE_DIR) $(addprefix -m ,$(MAPPINGS)) $(apprefix -c ,$(HANDLERS)) --make-package xpi=$(XPI_FILE) -d $(PACKAGE_FLAGS) $(PACKAGES)
-
-endif
diff --git a/build/package/mac_osx/pkg-dmg b/build/package/mac_osx/pkg-dmg
index 9e8728a1a..d3b27da7d 100755
--- a/build/package/mac_osx/pkg-dmg
+++ b/build/package/mac_osx/pkg-dmg
@@ -225,7 +225,7 @@ later are recommended.
=head1 LICENSE
-MPL 1.1/GPL 2.0/LGPL 2.1. Your choice.
+MPL 2.
=head1 AUTHOR
diff --git a/build/pgo/certs/alternateroot.ca b/build/pgo/certs/alternateroot.ca
new file mode 100644
index 000000000..058b9f56d
--- /dev/null
+++ b/build/pgo/certs/alternateroot.ca
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC2jCCAcKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDExtBbHRl
+cm5hdGUgVHJ1c3RlZCBBdXRob3JpdHkwHhcNMTQwOTI1MjEyMTU0WhcNMjQwOTI1
+MjEyMTU0WjAmMSQwIgYDVQQDExtBbHRlcm5hdGUgVHJ1c3RlZCBBdXRob3JpdHkw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDBT+BwAhO52IWgSIdZZifU
+9LHOs3IR/+8DCC0WP5d/OuyKlZ6Rqd0tsd3i7durhQyjHSbLf2lJStcnFjcVEbEn
+NI76RuvlN8xLLn5eV+2Ayr4cZYKztudwRmw+DV/iYAiMSy0hs7m3ssfX7qpoi1aN
+RjUanwU0VTCPQhF1bEKAC2du+C5Z8e92zN5t87w7bYr7lt+m8197XliXEu+0s9Rg
+nGwGaZ296BIRz6NOoJYTa43n06LU1I1+Z4d6lPdzUFrSR0GBaMhUSurUBtOin3yW
+iMhg1VHX/KwqGc4als5GyCVXy8HGrA/0zQPOhetxrlhEVAdK/xBt7CZvByj1Rcc7
+AgMBAAGjEzARMA8GA1UdEwQIMAYBAf8CAQAwDQYJKoZIhvcNAQELBQADggEBAJq/
+hogSRqzPWTwX4wTn/DVSNdWwFLv53qep9YrSMJ8ZsfbfK9Es4VP4dBLRQAVMJ0Z5
+mW1I6d/n0KayTanuUBvemYdxPi/qQNSs8UJcllqdhqWzmzAg6a0LxrMnEeKzPBPD
+6q8PwQ7tYP+B4sBN9tnnsnyPgti9ZiNZn5FwXZliHXseQ7FE9/SqHlLw5LXW3YtK
+juti6RmuV6fq3j+D4oeC5vb1mKgIyoTqGN6ze57v8RHi+pQ8Q+kmoUn/L3Z2YmFe
+4SKN/4WoyXr8TdejpThGOCGCAd3565s5gOx5QfSQX11P8NZKO8hcN0tme3VzmGpH
+K0Z/6MTmdpNaTwQ6odk=
+-----END CERTIFICATE-----
diff --git a/build/pgo/certs/cert8.db b/build/pgo/certs/cert8.db
index aa38b3b0d..bfc718af6 100644
--- a/build/pgo/certs/cert8.db
+++ b/build/pgo/certs/cert8.db
Binary files differ
diff --git a/build/pgo/certs/evroot.ca b/build/pgo/certs/evroot.ca
deleted file mode 100644
index df220e446..000000000
--- a/build/pgo/certs/evroot.ca
+++ /dev/null
@@ -1,32 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIFljCCBH6gAwIBAgIJAK/FPSJmJkkyMA0GCSqGSIb3DQEBBQUAMIHhMQswCQYD
-VQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxIzAh
-BgNVBAoTGk1vemlsbGEgLSBFViBkZWJ1ZyB0ZXN0IENBMR0wGwYDVQQLExRTZWN1
-cml0eSBFbmdpbmVlcmluZzEmMCQGA1UEAxMdRVYgVGVzdGluZyAodW50cnVzdHdv
-cnRoeSkgQ0ExEzARBgNVBCkTCmV2LXRlc3QtY2ExLDAqBgkqhkiG9w0BCQEWHWNo
-YXJsYXRhbkB0ZXN0aW5nLmV4YW1wbGUuY29tMB4XDTEzMDIxNDE3NDkwMFoXDTIz
-MDIxMjE3NDkwMFowgeExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UE
-BxMNTW91bnRhaW4gVmlldzEjMCEGA1UEChMaTW96aWxsYSAtIEVWIGRlYnVnIHRl
-c3QgQ0ExHTAbBgNVBAsTFFNlY3VyaXR5IEVuZ2luZWVyaW5nMSYwJAYDVQQDEx1F
-ViBUZXN0aW5nICh1bnRydXN0d29ydGh5KSBDQTETMBEGA1UEKRMKZXYtdGVzdC1j
-YTEsMCoGCSqGSIb3DQEJARYdY2hhcmxhdGFuQHRlc3RpbmcuZXhhbXBsZS5jb20w
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCk+k5mvnrxhVdVnhaxCeDG
-ZC5kcC8951K3xTkh2JMtUpSQL2IoGLOZOWTNY+2wGNyHbdJjKDv1d0bzZfz3yDkB
-AbY6OcxS4WkwccKsyIzkdacpYWhi7kEFevm9p7TI8jdrpKmItrlqfZKfteh+K+DF
-XZF7xp6zpoUis6dykmk5v8RivpCZl7HIlsOW0wSqCocXWH/WWFgAQyozjW8MgGOL
-/eV2aLsx+yg7it9GMMtyidggwvlYM7O8vY0gJqQKXntbHq1zV7jIJ3bXzJceur+G
-Ce4HvsRHAQUSl6jUfm00aKkqS+1t3svZURIKM6qWAuIKMGcspv+L8lyn1KImG8M5
-AgMBAAGjggFNMIIBSTAdBgNVHQ4EFgQUyJg651hwk+3BV0rQvQZv9n2bWPYwggEY
-BgNVHSMEggEPMIIBC4AUyJg651hwk+3BV0rQvQZv9n2bWPahgeekgeQwgeExCzAJ
-BgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEj
-MCEGA1UEChMaTW96aWxsYSAtIEVWIGRlYnVnIHRlc3QgQ0ExHTAbBgNVBAsTFFNl
-Y3VyaXR5IEVuZ2luZWVyaW5nMSYwJAYDVQQDEx1FViBUZXN0aW5nICh1bnRydXN0
-d29ydGh5KSBDQTETMBEGA1UEKRMKZXYtdGVzdC1jYTEsMCoGCSqGSIb3DQEJARYd
-Y2hhcmxhdGFuQHRlc3RpbmcuZXhhbXBsZS5jb22CCQCvxT0iZiZJMjAMBgNVHRME
-BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAcKVLC9MbdSZjzkVBseCm6t49aIIBm
-xQrsTNV2Gnp5eIXBfUhNAfD0zbBcKHK9AfHmNT8ZK6iABjiOrnn6yQNufW5MMdNx
-+/4FtTmdlBPLpyuBY7re+XbIaPxr/jB9jJ1pmh52xH3wMkO7ATDQ2fqFnODFrUKS
-UpXzuydPnsCdu32KPSnewIrkDB10Sah7vw3uwASO2GWqaFtUDFWGpt6rYQTcOF8g
-7a6Zj0johBMQFHE3HDRebWxiOf21ppN/tvv0gtGiA0ZIXBezeLaJ+Hob1xTbi4sw
-sGYDKHPCrLuTZWXmkv0rAIkLLK4VHbsA5xYPQNJJsTpX3u0Z0vZxJd9/
------END CERTIFICATE-----
diff --git a/build/pgo/certs/key3.db b/build/pgo/certs/key3.db
index a99595c52..bc41b88d8 100644
--- a/build/pgo/certs/key3.db
+++ b/build/pgo/certs/key3.db
Binary files differ
diff --git a/build/pgo/index.html b/build/pgo/index.html
index 4801f4815..ccfa00d00 100644
--- a/build/pgo/index.html
+++ b/build/pgo/index.html
@@ -2,157 +2,43 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- function quitHook()
- {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "http://" + location.host + "/server/shutdown", true);
- xhr.onreadystatechange = function (event)
- {
- if (xhr.readyState == 4)
- goQuitApplication();
- };
- xhr.send(null);
- }
-
- function canQuitApplication()
- {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- if (!os)
- {
- return true;
- }
-
- try
- {
- var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
- os.notifyObservers(cancelQuit, "quit-application-requested", null);
-
- // Something aborted the quit process.
- if (cancelQuit.data)
- {
- return false;
- }
- }
- catch (ex)
- {
- }
- os.notifyObservers(null, "quit-application-granted", null);
- return true;
- }
-
- function goQuitApplication()
- {
- const privs = 'UniversalXPConnect';
-
- try
- {
- netscape.security.PrivilegeManager.enablePrivilege(privs);
- }
- catch(ex)
- {
- throw('goQuitApplication: privilege failure ' + ex);
- }
-
- if (!canQuitApplication())
- {
- return false;
- }
-
- const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
- const kAppShell = '@mozilla.org/appshell/appShellService;1';
- var appService;
- var forceQuit;
-
- if (kAppStartup in Components.classes)
- {
- appService = Components.classes[kAppStartup].
- getService(Components.interfaces.nsIAppStartup);
- forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
-
- }
- else if (kAppShell in Components.classes)
- {
- appService = Components.classes[kAppShell].
- getService(Components.interfaces.nsIAppShellService);
- forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
- }
- else
- {
- throw 'goQuitApplication: no AppStartup/appShell';
- }
-
- var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
-
- var windowManagerInterface = windowManager.
- QueryInterface(Components.interfaces.nsIWindowMediator);
-
- var enumerator = windowManagerInterface.getEnumerator(null);
-
- while (enumerator.hasMoreElements())
- {
- var domWindow = enumerator.getNext();
- if (("tryToClose" in domWindow) && !domWindow.tryToClose())
- {
- return false;
- }
- domWindow.close();
- }
-
- try
- {
- appService.quit(forceQuit);
- }
- catch(ex)
- {
- throw('goQuitApplication: ' + ex);
- }
-
- return true;
- }
-
+
var list =
[
"blueprint/sample.html",
"blueprint/forms.html",
"blueprint/grid.html",
"blueprint/elements.html",
- "js-input/3d-cube.html",
- "js-input/3d-morph.html",
- "js-input/3d-raytrace.html",
"js-input/3d-thingy.html",
- "js-input/access-binary-trees.html",
- "js-input/access-fannkuch.html",
- "js-input/access-nbody.html",
- "js-input/access-nsieve.html",
- "js-input/bitops-3bit-bits-in-byte.html",
- "js-input/bitops-bits-in-byte.html",
- "js-input/bitops-bitwise-and.html",
- "js-input/bitops-nsieve-bits.html",
- "js-input/controlflow-recursive.html",
- "js-input/crypto-aes.html",
- "js-input/crypto-md5.html",
- "js-input/crypto-sha1.html",
"js-input/crypto-otp.html",
- "js-input/date-format-tofte.html",
- "js-input/date-format-xparb.html",
- "js-input/math-cordic.html",
- "js-input/math-partial-sums.html",
- "js-input/math-spectral-norm.html",
- "js-input/regexp-dna.html",
- "js-input/string-base64.html",
- "js-input/string-fasta.html",
- "js-input/string-tagcloud.html",
- "js-input/string-unpack-code.html",
- "js-input/string-validate-input.html",
- "http://acid3.acidtests.org/",
- "http://www.webvizbench.com/",
- "https://www.google.com/",
- "http://wolfbeast.deviantart.com"
+ "js-input/sunspider/3d-cube.html",
+ "js-input/sunspider/3d-morph.html",
+ "js-input/sunspider/3d-raytrace.html",
+ "js-input/sunspider/access-binary-trees.html",
+ "js-input/sunspider/access-fannkuch.html",
+ "js-input/sunspider/access-nbody.html",
+ "js-input/sunspider/access-nsieve.html",
+ "js-input/sunspider/bitops-3bit-bits-in-byte.html",
+ "js-input/sunspider/bitops-bits-in-byte.html",
+ "js-input/sunspider/bitops-bitwise-and.html",
+ "js-input/sunspider/bitops-nsieve-bits.html",
+ "js-input/sunspider/controlflow-recursive.html",
+ "js-input/sunspider/crypto-aes.html",
+ "js-input/sunspider/crypto-md5.html",
+ "js-input/sunspider/crypto-sha1.html",
+ "js-input/sunspider/date-format-tofte.html",
+ "js-input/sunspider/date-format-xparb.html",
+ "js-input/sunspider/math-cordic.html",
+ "js-input/sunspider/math-partial-sums.html",
+ "js-input/sunspider/math-spectral-norm.html",
+ "js-input/sunspider/regexp-dna.html",
+ "js-input/sunspider/string-base64.html",
+ "js-input/sunspider/string-fasta.html",
+ "js-input/sunspider/string-tagcloud.html",
+ "js-input/sunspider/string-unpack-code.html",
+ "js-input/sunspider/string-validate-input.html"
];
- var interval = 8000; //3000; // 15000
+ var interval = 1000;
var idx = 0;
var w;
@@ -161,11 +47,12 @@
window.setTimeout(loadURL, interval);
};
function loadURL () {
- w.location.href = list[idx++];
+ w.close();
+ w = window.open(list[idx++]);
if (idx < list.length) {
- window.setTimeout(loadURL, interval);
+ window.setTimeout(loadURL, interval);
} else {
- window.setTimeout(goQuitApplication, interval);
+ window.setTimeout(Quitter.quit, interval);
}
}
var i;
diff --git a/build/pgo/js-input/3d-cube.html b/build/pgo/js-input/sunspider/3d-cube.html
index 453167d44..453167d44 100644
--- a/build/pgo/js-input/3d-cube.html
+++ b/build/pgo/js-input/sunspider/3d-cube.html
diff --git a/build/pgo/js-input/3d-morph.html b/build/pgo/js-input/sunspider/3d-morph.html
index aca991d39..aca991d39 100644
--- a/build/pgo/js-input/3d-morph.html
+++ b/build/pgo/js-input/sunspider/3d-morph.html
diff --git a/build/pgo/js-input/3d-raytrace.html b/build/pgo/js-input/sunspider/3d-raytrace.html
index 2097d4238..2097d4238 100644
--- a/build/pgo/js-input/3d-raytrace.html
+++ b/build/pgo/js-input/sunspider/3d-raytrace.html
diff --git a/build/pgo/js-input/access-binary-trees.html b/build/pgo/js-input/sunspider/access-binary-trees.html
index c2c6cf3d9..c2c6cf3d9 100644
--- a/build/pgo/js-input/access-binary-trees.html
+++ b/build/pgo/js-input/sunspider/access-binary-trees.html
diff --git a/build/pgo/js-input/access-fannkuch.html b/build/pgo/js-input/sunspider/access-fannkuch.html
index 02b306ff2..02b306ff2 100644
--- a/build/pgo/js-input/access-fannkuch.html
+++ b/build/pgo/js-input/sunspider/access-fannkuch.html
diff --git a/build/pgo/js-input/access-nbody.html b/build/pgo/js-input/sunspider/access-nbody.html
index 4ef73c855..4ef73c855 100644
--- a/build/pgo/js-input/access-nbody.html
+++ b/build/pgo/js-input/sunspider/access-nbody.html
diff --git a/build/pgo/js-input/access-nsieve.html b/build/pgo/js-input/sunspider/access-nsieve.html
index c3ed067f1..c3ed067f1 100644
--- a/build/pgo/js-input/access-nsieve.html
+++ b/build/pgo/js-input/sunspider/access-nsieve.html
diff --git a/build/pgo/js-input/bitops-3bit-bits-in-byte.html b/build/pgo/js-input/sunspider/bitops-3bit-bits-in-byte.html
index c40be94ef..c40be94ef 100644
--- a/build/pgo/js-input/bitops-3bit-bits-in-byte.html
+++ b/build/pgo/js-input/sunspider/bitops-3bit-bits-in-byte.html
diff --git a/build/pgo/js-input/bitops-bits-in-byte.html b/build/pgo/js-input/sunspider/bitops-bits-in-byte.html
index 4022c777f..4022c777f 100644
--- a/build/pgo/js-input/bitops-bits-in-byte.html
+++ b/build/pgo/js-input/sunspider/bitops-bits-in-byte.html
diff --git a/build/pgo/js-input/bitops-bitwise-and.html b/build/pgo/js-input/sunspider/bitops-bitwise-and.html
index cca513040..cca513040 100644
--- a/build/pgo/js-input/bitops-bitwise-and.html
+++ b/build/pgo/js-input/sunspider/bitops-bitwise-and.html
diff --git a/build/pgo/js-input/bitops-nsieve-bits.html b/build/pgo/js-input/sunspider/bitops-nsieve-bits.html
index 1849f9da2..1849f9da2 100644
--- a/build/pgo/js-input/bitops-nsieve-bits.html
+++ b/build/pgo/js-input/sunspider/bitops-nsieve-bits.html
diff --git a/build/pgo/js-input/controlflow-recursive.html b/build/pgo/js-input/sunspider/controlflow-recursive.html
index 9a9651d4b..9a9651d4b 100644
--- a/build/pgo/js-input/controlflow-recursive.html
+++ b/build/pgo/js-input/sunspider/controlflow-recursive.html
diff --git a/build/pgo/js-input/crypto-aes.html b/build/pgo/js-input/sunspider/crypto-aes.html
index 12f26b2fb..12f26b2fb 100644
--- a/build/pgo/js-input/crypto-aes.html
+++ b/build/pgo/js-input/sunspider/crypto-aes.html
diff --git a/build/pgo/js-input/crypto-md5.html b/build/pgo/js-input/sunspider/crypto-md5.html
index 8395107ce..8395107ce 100644
--- a/build/pgo/js-input/crypto-md5.html
+++ b/build/pgo/js-input/sunspider/crypto-md5.html
diff --git a/build/pgo/js-input/crypto-sha1.html b/build/pgo/js-input/sunspider/crypto-sha1.html
index 01d0b56f3..01d0b56f3 100644
--- a/build/pgo/js-input/crypto-sha1.html
+++ b/build/pgo/js-input/sunspider/crypto-sha1.html
diff --git a/build/pgo/js-input/date-format-tofte.html b/build/pgo/js-input/sunspider/date-format-tofte.html
index b8e477342..b8e477342 100644
--- a/build/pgo/js-input/date-format-tofte.html
+++ b/build/pgo/js-input/sunspider/date-format-tofte.html
diff --git a/build/pgo/js-input/date-format-xparb.html b/build/pgo/js-input/sunspider/date-format-xparb.html
index dd35713d1..dd35713d1 100644
--- a/build/pgo/js-input/date-format-xparb.html
+++ b/build/pgo/js-input/sunspider/date-format-xparb.html
diff --git a/build/pgo/js-input/math-cordic.html b/build/pgo/js-input/sunspider/math-cordic.html
index ec28f9ddd..ec28f9ddd 100644
--- a/build/pgo/js-input/math-cordic.html
+++ b/build/pgo/js-input/sunspider/math-cordic.html
diff --git a/build/pgo/js-input/math-partial-sums.html b/build/pgo/js-input/sunspider/math-partial-sums.html
index b78b96248..b78b96248 100644
--- a/build/pgo/js-input/math-partial-sums.html
+++ b/build/pgo/js-input/sunspider/math-partial-sums.html
diff --git a/build/pgo/js-input/math-spectral-norm.html b/build/pgo/js-input/sunspider/math-spectral-norm.html
index 2949f9d78..2949f9d78 100644
--- a/build/pgo/js-input/math-spectral-norm.html
+++ b/build/pgo/js-input/sunspider/math-spectral-norm.html
diff --git a/build/pgo/js-input/regexp-dna.html b/build/pgo/js-input/sunspider/regexp-dna.html
index a49021967..a49021967 100644
--- a/build/pgo/js-input/regexp-dna.html
+++ b/build/pgo/js-input/sunspider/regexp-dna.html
diff --git a/build/pgo/js-input/string-base64.html b/build/pgo/js-input/sunspider/string-base64.html
index a09439b53..53280ef2b 100644
--- a/build/pgo/js-input/string-base64.html
+++ b/build/pgo/js-input/sunspider/string-base64.html
@@ -38,43 +38,9 @@
var _sunSpiderStartDate = new Date();
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla XML-RPC Client component.
- *
- * The Initial Developer of the Original Code is
- * Digital Creations 2, Inc.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Martijn Pieters <mj@digicool.com> (original author)
- * Samuel Sieb <samuel@sieb.net>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// From: http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js#956
diff --git a/build/pgo/js-input/string-fasta.html b/build/pgo/js-input/sunspider/string-fasta.html
index 240e60147..240e60147 100644
--- a/build/pgo/js-input/string-fasta.html
+++ b/build/pgo/js-input/sunspider/string-fasta.html
diff --git a/build/pgo/js-input/string-tagcloud.html b/build/pgo/js-input/sunspider/string-tagcloud.html
index 893a927ac..893a927ac 100644
--- a/build/pgo/js-input/string-tagcloud.html
+++ b/build/pgo/js-input/sunspider/string-tagcloud.html
diff --git a/build/pgo/js-input/string-unpack-code.html b/build/pgo/js-input/sunspider/string-unpack-code.html
index fc832429a..fc832429a 100644
--- a/build/pgo/js-input/string-unpack-code.html
+++ b/build/pgo/js-input/sunspider/string-unpack-code.html
diff --git a/build/pgo/js-input/string-validate-input.html b/build/pgo/js-input/sunspider/string-validate-input.html
index 72cf920b2..72cf920b2 100644
--- a/build/pgo/js-input/string-validate-input.html
+++ b/build/pgo/js-input/sunspider/string-validate-input.html
diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py
index 8b26ed232..473f7074d 100755
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -17,6 +17,7 @@ import shutil
import tempfile
from datetime import datetime
from mozbuild.base import MozbuildObject
+from buildconfig import substs
PORT = 8888
@@ -48,11 +49,20 @@ if __name__ == '__main__':
prefs[pref] = Preferences.cast(prefs[pref])
profile = FirefoxProfile(profile=profilePath,
preferences=prefs,
- #addons=[os.path.join(here, 'extension')],
+ addons=[os.path.join(build.distdir, 'xpi-stage', 'quitter')],
locations=locations)
env = os.environ.copy()
+ env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
env["XPCOM_DEBUG_BREAK"] = "warn"
+
+ # For VC12, make sure we can find the right bitness of pgort120.dll
+ if "VS120COMNTOOLS" in env and not substs["HAVE_64BIT_BUILD"]:
+ vc12dir = os.path.abspath(os.path.join(env["VS120COMNTOOLS"],
+ "../../VC/bin"))
+ if os.path.exists(vc12dir):
+ env["PATH"] = vc12dir + ";" + env["PATH"]
+
jarlog = os.getenv("JARLOG_FILE")
if jarlog:
env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
diff --git a/build/pgo/server-locations.txt b/build/pgo/server-locations.txt
index 98c7d3f34..b39966142 100644
--- a/build/pgo/server-locations.txt
+++ b/build/pgo/server-locations.txt
@@ -20,7 +20,8 @@
# number is the default for the protocol.
#
# Unrecognized options are ignored. Recognized options are "primary" and
-# "privileged", "nocert", "cert=some_cert_nickname", "redir=hostname".
+# "privileged", "nocert", "cert=some_cert_nickname", "redir=hostname" and
+# "failHandshake".
#
# "primary" denotes a location which is the canonical location of
# the server; this location is the one assumed for requests which don't
@@ -32,6 +33,9 @@
# "nocert" makes sense only for https:// hosts and means there is not
# any certificate automatically generated for this host.
#
+# "failHandshake" causes the tls handshake to fail (by sending a client hello to
+# the client).
+#
# "cert=nickname" tells the pgo server to use a particular certificate
# for this host. The certificate is referenced by its nickname that must
# not contain any spaces. The certificate key files (PKCS12 modules)
@@ -60,6 +64,10 @@ http://127.0.0.1:80 privileged
http://127.0.0.1:8888 privileged
http://test:80 privileged
http://mochi.test:8888 privileged
+http://test1.mochi.test:8888
+http://sub1.test1.mochi.test:8888
+http://sub2.xn--lt-uia.mochi.test:8888
+http://test2.mochi.test:8888
http://example.org:80 privileged
http://test1.example.org:80 privileged
http://test2.example.org:80 privileged
@@ -83,6 +91,7 @@ http://sub1.test2.example.com:80 privileged
http://sub2.test1.example.com:80 privileged
http://sub2.test2.example.com:80 privileged
http://noxul.example.com:80 privileged,noxul
+http://example.net:80 privileged
https://example.com:443 privileged
https://test1.example.com:443 privileged
@@ -101,8 +110,6 @@ https://mismatch.expired.example.com:443 privileged,cert=expired
https://mismatch.untrusted.example.com:443 privileged,cert=untrusted
https://untrusted-expired.example.com:443 privileged,cert=untrustedandexpired
https://mismatch.untrusted-expired.example.com:443 privileged,cert=untrustedandexpired
-https://ev-valid.example.com:443 privileged,cert=evvalid
-https://ev-invalid.example.com:443 priviliged,cert=evinvalid
# This is here so that we don't load the default live bookmark over
# the network in every test suite.
@@ -110,7 +117,7 @@ http://fxfeeds.mozilla.com:80
# Prevent safebrowsing tests from hitting the network for its-a-trap.html and
# its-an-attack.html.
-http://www.mozilla.org:80
+http://www.itisatrap.org:80
#
# These are subdomains of <ält.example.org>.
@@ -154,10 +161,12 @@ https://sub.sectest1.example.org:443
# Used while testing the url-classifier
#
http://malware.example.com:80
+http://tracking.example.com:80
+http://not-tracking.example.com:80
+http://tracking.example.org:80
# Bug 483437, 484111
https://www.bank1.com:443 privileged,cert=escapeattack1
-https://www.bank2.com:443 privileged,cert=escapeattack2
#
# CONNECT for redirproxy results in a 302 redirect to
@@ -207,3 +216,31 @@ https://www2.w3c-test.org:443
https://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:443
https://xn--lve-6lad.w3c-test.org:443
http://test.w3.org:80
+
+# Hosts for testing TLD-based fallback encoding
+http://example.tw:80 privileged
+http://example.cn:80 privileged
+http://example.co.jp:80 privileged
+http://example.fi:80 privileged
+
+# Hosts for testing marketplace apps installations
+https://marketplace.firefox.com:443 privileged
+https://marketplace-dev.allizom.org:443 privileged
+https://marketplace.allizom.org:443 privileged
+
+# Host for HPKP
+https://include-subdomains.pinning-dynamic.example.com:443 privileged,cert=dynamicPinningGood
+https://bad.include-subdomains.pinning-dynamic.example.com:443 privileged,cert=dynamicPinningBad
+
+# Host for static pin tests
+https://badchain.include-subdomains.pinning.example.com:443 privileged,cert=staticPinningBad
+https://fail-handshake.example.com:443 privileged,failHandshake
+
+# Hosts for sha1 console warning tests
+https://sha1ee.example.com:443 privileged,cert=sha1_end_entity
+https://sha256ee.example.com:443 privileged,cert=sha256_end_entity
+
+# Hosts for ssl3/rc4 console warning tests
+https://ssl3.example.com:443 privileged,ssl3
+https://rc4.example.com:443 privileged,rc4
+https://ssl3rc4.example.com:443 privileged,ssl3,rc4
diff --git a/build/pymake/make.py b/build/pymake/make.py
index 3ce623d4e..0857f3f8c 100755
--- a/build/pymake/make.py
+++ b/build/pymake/make.py
@@ -12,18 +12,24 @@ import pymake.command, pymake.process
import gc
if __name__ == '__main__':
+ if 'TINDERBOX_OUTPUT' in os.environ:
+ # When building on mozilla build slaves, execute mozmake instead. Until bug
+ # 978211, this is the easiest, albeit hackish, way to do this.
+ import subprocess
+ mozmake = os.path.join(os.path.dirname(__file__), '..', '..',
+ 'mozmake.exe')
+ cmd = [mozmake]
+ cmd.extend(sys.argv[1:])
+ shell = os.environ.get('SHELL')
+ if shell and not shell.lower().endswith('.exe'):
+ cmd += ['SHELL=%s.exe' % shell]
+ sys.exit(subprocess.call(cmd))
+
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
gc.disable()
- # This is meant as a temporary workaround until issues with many targets
- # and prerequisites is addressed. Bug 874210 tracks.
- try:
- sys.setrecursionlimit(2 * sys.getrecursionlimit())
- except Exception:
- print >>sys.stderr, 'Unable to increase Python recursion limit.'
-
pymake.command.main(sys.argv[1:], os.environ, os.getcwd(), cb=sys.exit)
pymake.process.ParallelContext.spin()
assert False, "Not reached"
diff --git a/build/pymake/pymake/data.py b/build/pymake/pymake/data.py
index 7100c0dcf..dcd7e9225 100644
--- a/build/pymake/pymake/data.py
+++ b/build/pymake/pymake/data.py
@@ -504,13 +504,13 @@ class Variables(object):
return (None, None, None)
- def set(self, name, flavor, source, value):
+ def set(self, name, flavor, source, value, force=False):
assert flavor in (self.FLAVOR_RECURSIVE, self.FLAVOR_SIMPLE)
assert source in (self.SOURCE_OVERRIDE, self.SOURCE_COMMANDLINE, self.SOURCE_MAKEFILE, self.SOURCE_ENVIRONMENT, self.SOURCE_AUTOMATIC, self.SOURCE_IMPLICIT)
assert isinstance(value, str_type), "expected str, got %s" % type(value)
prevflavor, prevsource, prevvalue = self.get(name)
- if prevsource is not None and source > prevsource:
+ if prevsource is not None and source > prevsource and not force:
# TODO: give a location for this warning
_log.info("not setting variable '%s', set by higher-priority source to value '%s'" % (name, prevvalue))
return
@@ -573,7 +573,8 @@ class Pattern(object):
def __init__(self, s):
r = []
i = 0
- while i < len(s):
+ slen = len(s)
+ while i < slen:
c = s[i]
if c == '\\':
nc = s[i + 1]
@@ -779,7 +780,8 @@ class RemakeTargetParallel(object):
return
self.currunning = True
- self.rlist.pop(0).runcommands(self.indent, self.commandscb)
+ rule = self.rlist.pop(0)
+ self.makefile.context.defer(rule.runcommands, self.indent, self.commandscb)
def commandscb(self, error):
assert error in (True, False)
@@ -843,11 +845,15 @@ class RemakeRuleContext(object):
self._depfinishedserial(False, False)
def _startdepparallel(self, d):
+ dep, weak = d
+ if weak:
+ depfinished = self._weakdepfinishedparallel
+ else:
+ depfinished = self._depfinishedparallel
if self.makefile.error:
depfinished(True, False)
else:
- dep, weak = d
- dep.make(self.makefile, self.targetstack, weak and self._weakdepfinishedparallel or self._depfinishedparallel)
+ dep.make(self.makefile, self.targetstack, depfinished)
def _weakdepfinishedparallel(self, error, didanything):
if error:
@@ -1474,8 +1480,20 @@ class Rule(object):
def getcommands(self, target, makefile):
assert isinstance(target, Target)
-
- return getcommandsforrule(self, target, makefile, self.prerequisites, stem=None)
+ # Prerequisites are merged if the target contains multiple rules and is
+ # not a terminal (double colon) rule. See
+ # https://www.gnu.org/software/make/manual/make.html#Multiple-Targets.
+ prereqs = []
+ prereqs.extend(self.prerequisites)
+
+ if not self.doublecolon:
+ for rule in target.rules:
+ # The current rule comes first, which is already in prereqs so
+ # we don't need to add it again.
+ if rule != self:
+ prereqs.extend(rule.prerequisites)
+
+ return getcommandsforrule(self, target, makefile, prereqs, stem=None)
# TODO: $* in non-pattern rules?
class PatternRuleInstance(object):
diff --git a/build/pymake/pymake/functions.py b/build/pymake/pymake/functions.py
index 85dbafb96..e53fb5472 100644
--- a/build/pymake/pymake/functions.py
+++ b/build/pymake/pymake/functions.py
@@ -649,7 +649,11 @@ class ForEachFunction(Function):
else:
fd.write(' ')
- v.set(vname, data.Variables.FLAVOR_SIMPLE, data.Variables.SOURCE_AUTOMATIC, w)
+ # The $(origin) of the local variable must be "automatic" to
+ # conform with GNU make. However, automatic variables have low
+ # priority. So, we must force its assignment to occur.
+ v.set(vname, data.Variables.FLAVOR_SIMPLE,
+ data.Variables.SOURCE_AUTOMATIC, w, force=True)
e.resolve(makefile, v, fd, setting)
class CallFunction(Function):
diff --git a/build/pymake/pymake/parser.py b/build/pymake/pymake/parser.py
index ad977a9dd..4bff53368 100644
--- a/build/pymake/pymake/parser.py
+++ b/build/pymake/pymake/parser.py
@@ -361,7 +361,7 @@ def _checktime(path, stmts):
return True
-_parsecache = util.MostUsedCache(15, _parsefile, _checktime)
+_parsecache = util.MostUsedCache(50, _parsefile, _checktime)
def parsefile(pathname):
"""
@@ -372,9 +372,15 @@ def parsefile(pathname):
pathname = os.path.realpath(pathname)
return _parsecache.get(pathname)
+# colon followed by anything except a slash (Windows path detection)
+_depfilesplitter = re.compile(r':(?![\\/])')
+# simple variable references
+_vars = re.compile('\$\((\w+)\)')
+
def parsedepfile(pathname):
"""
Parse a filename listing only depencencies into a parserdata.StatementList.
+ Simple variable references are allowed in such files.
"""
def continuation_iter(lines):
current_line = []
@@ -391,12 +397,29 @@ def parsedepfile(pathname):
if current_line:
yield ''.join(current_line)
+ def get_expansion(s):
+ if '$' in s:
+ expansion = data.Expansion()
+ # for an input like e.g. "foo $(bar) baz",
+ # _vars.split returns ["foo", "bar", "baz"]
+ # every other element is a variable name.
+ for i, element in enumerate(_vars.split(s)):
+ if i % 2:
+ expansion.appendfunc(functions.VariableRef(None,
+ data.StringExpansion(element, None)))
+ elif element:
+ expansion.appendstr(element)
+
+ return expansion
+
+ return data.StringExpansion(s, None)
+
pathname = os.path.realpath(pathname)
stmts = parserdata.StatementList()
for line in continuation_iter(open(pathname).readlines()):
- target, deps = line.split(":", 1)
- stmts.append(parserdata.Rule(data.StringExpansion(target, None),
- data.StringExpansion(deps, None), False))
+ target, deps = _depfilesplitter.split(line, 1)
+ stmts.append(parserdata.Rule(get_expansion(target),
+ get_expansion(deps), False))
return stmts
def parsestring(s, filename):
diff --git a/build/pymake/pymake/parserdata.py b/build/pymake/pymake/parserdata.py
index 0d3f147dc..7b2e5443d 100644
--- a/build/pymake/pymake/parserdata.py
+++ b/build/pymake/pymake/parserdata.py
@@ -93,7 +93,7 @@ def parsecommandlineargs(args):
value=val, valueloc=Location('<command-line>', i, len(vname) + len(t)),
targetexp=None, source=data.Variables.SOURCE_COMMANDLINE))
else:
- r.append(a)
+ r.append(data.stripdotslash(a))
return stmts, r, ' '.join(overrides)
@@ -171,12 +171,11 @@ class Rule(Statement):
# Skip targets with no rules and no dependencies
if not deps:
return
- targets = self.targetexp.resolvesplit(makefile, makefile.variables)
- assert len(targets) == 1
- target = targets[0]
- rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=True)
- makefile.gettarget(target).addrule(rule)
- makefile.foundtarget(target)
+ targets = data.stripdotslashes(self.targetexp.resolvesplit(makefile, makefile.variables))
+ rule = data.Rule(list(data.stripdotslashes(deps)), self.doublecolon, loc=self.targetexp.loc, weakdeps=True)
+ for target in targets:
+ makefile.gettarget(target).addrule(rule)
+ makefile.foundtarget(target)
context.currule = rule
def _execute(self, makefile, context):
diff --git a/build/pymake/pymake/process.py b/build/pymake/pymake/process.py
index 7aaf65689..01cadf5a9 100644
--- a/build/pymake/pymake/process.py
+++ b/build/pymake/pymake/process.py
@@ -6,6 +6,7 @@ parsing command lines into argv and making sure that no shell magic is being use
#TODO: ship pyprocessing?
import multiprocessing
import subprocess, shlex, re, logging, sys, traceback, os, imp, glob
+import site
from collections import deque
# XXXkhuey Work around http://bugs.python.org/issue1731717
subprocess._cleanup = lambda: None
@@ -33,7 +34,7 @@ def tokens2re(tokens):
return re.compile('(?:%s|%s)' % (nonescaped, r'(?P<escape>\\\\)'))
_unquoted_tokens = tokens2re({
- 'whitespace': r'[\t\r\n ]',
+ 'whitespace': r'[\t\r\n ]+',
'quote': r'[\'"]',
'comment': '#',
'special': r'[<>&|`~(){}$;]',
@@ -59,7 +60,7 @@ class ClineSplitter(list):
"""
def __init__(self, cline, cwd):
self.cwd = cwd
- self.arg = ''
+ self.arg = None
self.cline = cline
self.glob = False
self._parse_unquoted()
@@ -68,6 +69,8 @@ class ClineSplitter(list):
"""
Push the given string as part of the current argument
"""
+ if self.arg is None:
+ self.arg = ''
self.arg += str
def _next(self):
@@ -75,7 +78,7 @@ class ClineSplitter(list):
Finalize current argument, effectively adding it to the list.
Perform globbing if needed.
"""
- if not self.arg:
+ if self.arg is None:
return
if self.glob:
if os.path.isabs(self.arg):
@@ -92,7 +95,7 @@ class ClineSplitter(list):
self.glob = False
else:
self.append(self.arg)
- self.arg = ''
+ self.arg = None
def _parse_unquoted(self):
"""
@@ -108,7 +111,8 @@ class ClineSplitter(list):
break
# The beginning of the string, up to the found token, is part of
# the current argument
- self._push(self.cline[:m.start()])
+ if m.start():
+ self._push(self.cline[:m.start()])
self.cline = self.cline[m.end():]
match = dict([(name, value) for name, value in m.groupdict().items() if value])
@@ -142,7 +146,8 @@ class ClineSplitter(list):
self._push(m.group(0))
else:
raise Exception, "Shouldn't reach here"
- self._next()
+ if self.arg:
+ self._next()
def _parse_quoted(self):
# Single quoted strings are preserved, except for the final quote
@@ -341,30 +346,6 @@ class PythonException(Exception):
def __str__(self):
return self.message
-def load_module_recursive(module, path):
- """
- Emulate the behavior of __import__, but allow
- passing a custom path to search for modules.
- """
- bits = module.split('.')
- oldsyspath = sys.path
- for i, bit in enumerate(bits):
- dotname = '.'.join(bits[:i+1])
- try:
- f, path, desc = imp.find_module(bit, path)
- # Add the directory the module was found in to sys.path
- if path != '':
- abspath = os.path.abspath(path)
- if not os.path.isdir(abspath):
- abspath = os.path.dirname(path)
- sys.path = [abspath] + sys.path
- m = imp.load_module(dotname, f, path, desc)
- if f is None:
- path = m.__path__
- except ImportError:
- return
- finally:
- sys.path = oldsyspath
class PythonJob(Job):
"""
@@ -384,16 +365,28 @@ class PythonJob(Job):
# os.environ is a magic dictionary. Setting it to something else
# doesn't affect the environment of subprocesses, so use clear/update
oldenv = dict(os.environ)
+
+ # sys.path is adjusted for the entire lifetime of the command
+ # execution. This ensures any delayed imports will still work.
+ oldsyspath = list(sys.path)
try:
os.chdir(self.cwd)
os.environ.clear()
os.environ.update(self.env)
+
+ sys.path = []
+ for p in sys.path + self.pycommandpath:
+ site.addsitedir(p)
+ sys.path.extend(oldsyspath)
+
if self.module not in sys.modules:
- load_module_recursive(self.module,
- sys.path + self.pycommandpath)
- if self.module not in sys.modules:
- print >>sys.stderr, "No module named '%s'" % self.module
- return -127
+ try:
+ __import__(self.module)
+ except Exception as e:
+ print >>sys.stderr, 'Error importing %s: %s' % (
+ self.module, e)
+ return -127
+
m = sys.modules[self.module]
if self.method not in m.__dict__:
print >>sys.stderr, "No method named '%s' in module %s" % (self.method, self.module)
@@ -419,6 +412,12 @@ class PythonJob(Job):
finally:
os.environ.clear()
os.environ.update(oldenv)
+ sys.path = oldsyspath
+ # multiprocessing exits via os._exit, make sure that all output
+ # from command gets written out before that happens.
+ sys.stdout.flush()
+ sys.stderr.flush()
+
return 0
def job_runner(job):
diff --git a/build/pymake/tests/cmd-stripdotslash.mk b/build/pymake/tests/cmd-stripdotslash.mk
new file mode 100644
index 000000000..ce5ed4244
--- /dev/null
+++ b/build/pymake/tests/cmd-stripdotslash.mk
@@ -0,0 +1,5 @@
+all:
+ $(MAKE) -f $(TESTPATH)/cmd-stripdotslash.mk ./foo
+
+./foo:
+ @echo TEST-PASS
diff --git a/build/pymake/tests/empty-arg.mk b/build/pymake/tests/empty-arg.mk
new file mode 100644
index 000000000..616e5b694
--- /dev/null
+++ b/build/pymake/tests/empty-arg.mk
@@ -0,0 +1,2 @@
+all:
+ @ sh -c 'if [ $$# = 3 ] ; then echo TEST-PASS; else echo TEST-FAIL; fi' -- a "" b
diff --git a/build/pymake/tests/foreach-local-variable.mk b/build/pymake/tests/foreach-local-variable.mk
new file mode 100644
index 000000000..2551621eb
--- /dev/null
+++ b/build/pymake/tests/foreach-local-variable.mk
@@ -0,0 +1,8 @@
+# This test ensures that a local variable in a $(foreach) is bound to
+# the local value, not a global value.
+i := dummy
+
+all:
+ test "$(foreach i,foo bar,found:$(i))" = "found:foo found:bar"
+ test "$(i)" = "dummy"
+ @echo TEST-PASS
diff --git a/build/pymake/tests/includedeps-stripdotslash.deps b/build/pymake/tests/includedeps-stripdotslash.deps
new file mode 100644
index 000000000..352fca1bb
--- /dev/null
+++ b/build/pymake/tests/includedeps-stripdotslash.deps
@@ -0,0 +1 @@
+./test: TEST-PASS
diff --git a/build/pymake/tests/includedeps-stripdotslash.mk b/build/pymake/tests/includedeps-stripdotslash.mk
new file mode 100644
index 000000000..ee942e6db
--- /dev/null
+++ b/build/pymake/tests/includedeps-stripdotslash.mk
@@ -0,0 +1,8 @@
+#T gmake skip
+
+test:
+ @echo $<
+
+includedeps $(TESTPATH)/includedeps-stripdotslash.deps
+
+TEST-PASS:
diff --git a/build/pymake/tests/includedeps-variables.deps b/build/pymake/tests/includedeps-variables.deps
new file mode 100644
index 000000000..ba69e9b6c
--- /dev/null
+++ b/build/pymake/tests/includedeps-variables.deps
@@ -0,0 +1 @@
+$(FILE)1: filemissing
diff --git a/build/pymake/tests/includedeps-variables.mk b/build/pymake/tests/includedeps-variables.mk
new file mode 100644
index 000000000..314618da4
--- /dev/null
+++ b/build/pymake/tests/includedeps-variables.mk
@@ -0,0 +1,10 @@
+#T gmake skip
+
+FILE = includedeps-variables
+
+all: $(FILE)1
+
+includedeps $(TESTPATH)/includedeps-variables.deps
+
+filemissing:
+ @echo TEST-PASS
diff --git a/build/pymake/tests/multiple-rules-prerequisite-merge.mk b/build/pymake/tests/multiple-rules-prerequisite-merge.mk
new file mode 100644
index 000000000..480d3b58c
--- /dev/null
+++ b/build/pymake/tests/multiple-rules-prerequisite-merge.mk
@@ -0,0 +1,25 @@
+# When a target is defined multiple times, the prerequisites should get
+# merged.
+
+default: foo bar baz
+
+foo:
+ test "$<" = "foo.in1"
+ @echo TEST-PASS
+
+foo: foo.in1
+
+bar: bar.in1
+ test "$<" = "bar.in1"
+ test "$^" = "bar.in1 bar.in2"
+ @echo TEST-PASS
+
+bar: bar.in2
+
+baz: baz.in2
+baz: baz.in1
+ test "$<" = "baz.in1"
+ test "$^" = "baz.in1 baz.in2"
+ @echo TEST-PASS
+
+foo.in1 bar.in1 bar.in2 baz.in1 baz.in2:
diff --git a/build/pymake/tests/native-command-delay-load.mk b/build/pymake/tests/native-command-delay-load.mk
new file mode 100644
index 000000000..a9f3774eb
--- /dev/null
+++ b/build/pymake/tests/native-command-delay-load.mk
@@ -0,0 +1,12 @@
+#T gmake skip
+
+# This test exists to verify that sys.path is adjusted during command
+# execution and that delay importing a module will work.
+
+CMD = %pycmd delayloadfn
+PYCOMMANDPATH = $(TESTPATH) $(TESTPATH)/subdir
+
+all:
+ $(CMD)
+ @echo TEST-PASS
+
diff --git a/build/pymake/tests/pycmd.py b/build/pymake/tests/pycmd.py
index 20ed2fed0..83b9b966b 100644
--- a/build/pymake/tests/pycmd.py
+++ b/build/pymake/tests/pycmd.py
@@ -33,3 +33,6 @@ def asplode_return(args):
def asplode_raise(args):
raise Exception(args[0])
+
+def delayloadfn(args):
+ import delayload
diff --git a/build/pymake/tests/subdir/delayload.py b/build/pymake/tests/subdir/delayload.py
new file mode 100644
index 000000000..bdd6669db
--- /dev/null
+++ b/build/pymake/tests/subdir/delayload.py
@@ -0,0 +1 @@
+# This module exists to test delay importing of modules at run-time.
diff --git a/build/release/info.py b/build/release/info.py
new file mode 100644
index 000000000..9f42edd5a
--- /dev/null
+++ b/build/release/info.py
@@ -0,0 +1,218 @@
+from datetime import datetime
+import os
+from os import path
+import re
+import shutil
+import sys
+from urllib2 import urlopen
+
+from release.paths import makeCandidatesDir
+
+import logging
+log = logging.getLogger(__name__)
+
+# If version has two parts with no trailing specifiers like "rc", we
+# consider it a "final" release for which we only create a _RELEASE tag.
+FINAL_RELEASE_REGEX = "^\d+\.\d+$"
+
+
+class ConfigError(Exception):
+ pass
+
+
+def getBuildID(platform, product, version, buildNumber, nightlyDir='nightly',
+ server='stage.mozilla.org'):
+ infoTxt = makeCandidatesDir(product, version, buildNumber, nightlyDir,
+ protocol='http', server=server) + \
+ '%s_info.txt' % platform
+ try:
+ buildInfo = urlopen(infoTxt).read()
+ except:
+ log.error("Failed to retrieve %s" % infoTxt)
+ raise
+
+ for line in buildInfo.splitlines():
+ key, value = line.rstrip().split('=', 1)
+ if key == 'buildID':
+ return value
+
+
+def findOldBuildIDs(product, version, buildNumber, platforms,
+ nightlyDir='nightly', server='stage.mozilla.org'):
+ ids = {}
+ if buildNumber <= 1:
+ return ids
+ for n in range(1, buildNumber):
+ for platform in platforms:
+ if platform not in ids:
+ ids[platform] = []
+ try:
+ id = getBuildID(platform, product, version, n, nightlyDir,
+ server)
+ ids[platform].append(id)
+ except Exception, e:
+ log.error("Hit exception: %s" % e)
+ return ids
+
+
+def getReleaseConfigName(product, branch, version=None, staging=False):
+ # XXX: Horrible hack for bug 842741. Because Thunderbird release
+ # and esr both build out of esr17 repositories we'll bump the wrong
+ # config for release without this.
+ if product == 'thunderbird' and 'esr17' in branch and version and 'esr' not in version:
+ cfg = 'release-thunderbird-comm-release.py'
+ else:
+ cfg = 'release-%s-%s.py' % (product, branch)
+ if staging:
+ cfg = 'staging_%s' % cfg
+ return cfg
+
+
+def readReleaseConfig(configfile, required=[]):
+ return readConfig(configfile, keys=['releaseConfig'], required=required)
+
+
+def readBranchConfig(dir, localconfig, branch, required=[]):
+ shutil.copy(localconfig, path.join(dir, "localconfig.py"))
+ oldcwd = os.getcwd()
+ os.chdir(dir)
+ sys.path.append(".")
+ try:
+ return readConfig("config.py", keys=['BRANCHES', branch],
+ required=required)
+ finally:
+ os.chdir(oldcwd)
+ sys.path.remove(".")
+
+
+def readConfig(configfile, keys=[], required=[]):
+ c = {}
+ execfile(configfile, c)
+ for k in keys:
+ c = c[k]
+ items = c.keys()
+ err = False
+ for key in required:
+ if key not in items:
+ err = True
+ log.error("Required item `%s' missing from %s" % (key, c))
+ if err:
+ raise ConfigError("Missing at least one item in config, see above")
+ return c
+
+
+def isFinalRelease(version):
+ return bool(re.match(FINAL_RELEASE_REGEX, version))
+
+
+def getBaseTag(product, version):
+ product = product.upper()
+ version = version.replace('.', '_')
+ return '%s_%s' % (product, version)
+
+
+def getTags(baseTag, buildNumber, buildTag=True):
+ t = ['%s_RELEASE' % baseTag]
+ if buildTag:
+ t.append('%s_BUILD%d' % (baseTag, int(buildNumber)))
+ return t
+
+
+def getRuntimeTag(tag):
+ return "%s_RUNTIME" % tag
+
+
+def getReleaseTag(tag):
+ return "%s_RELEASE" % tag
+
+
+def generateRelbranchName(version, prefix='GECKO'):
+ return '%s%s_%s_RELBRANCH' % (
+ prefix, version.replace('.', ''),
+ datetime.now().strftime('%Y%m%d%H'))
+
+
+def getReleaseName(product, version, buildNumber):
+ return '%s-%s-build%s' % (product.title(), version, str(buildNumber))
+
+
+def getRepoMatchingBranch(branch, sourceRepositories):
+ for sr in sourceRepositories.values():
+ if branch in sr['path']:
+ return sr
+ return None
+
+
+def fileInfo(filepath, product):
+ """Extract information about a release file. Returns a dictionary with the
+ following keys set:
+ 'product', 'version', 'locale', 'platform', 'contents', 'format',
+ 'pathstyle'
+
+ 'contents' is one of 'complete', 'installer'
+ 'format' is one of 'mar' or 'exe'
+ 'pathstyle' is either 'short' or 'long', and refers to if files are all in
+ one directory, with the locale as part of the filename ('short' paths,
+ firefox 3.0 style filenames), or if the locale names are part of the
+ directory structure, but not the file name itself ('long' paths,
+ firefox 3.5+ style filenames)
+ """
+ try:
+ # Mozilla 1.9.0 style (aka 'short') paths
+ # e.g. firefox-3.0.12.en-US.win32.complete.mar
+ filename = os.path.basename(filepath)
+ m = re.match("^(%s)-([0-9.]+)\.([-a-zA-Z]+)\.(win32)\.(complete|installer)\.(mar|exe)$" % product, filename)
+ if not m:
+ raise ValueError("Could not parse: %s" % filename)
+ return {'product': m.group(1),
+ 'version': m.group(2),
+ 'locale': m.group(3),
+ 'platform': m.group(4),
+ 'contents': m.group(5),
+ 'format': m.group(6),
+ 'pathstyle': 'short',
+ 'leading_path': '',
+ }
+ except:
+ # Mozilla 1.9.1 and on style (aka 'long') paths
+ # e.g. update/win32/en-US/firefox-3.5.1.complete.mar
+ # win32/en-US/Firefox Setup 3.5.1.exe
+ ret = {'pathstyle': 'long'}
+ if filepath.endswith('.mar'):
+ ret['format'] = 'mar'
+ m = re.search("update/(win32|linux-i686|linux-x86_64|mac|mac64)/([-a-zA-Z]+)/(%s)-(\d+\.\d+(?:\.\d+)?(?:\w+(?:\d+)?)?)\.(complete)\.mar" % product, filepath)
+ if not m:
+ raise ValueError("Could not parse: %s" % filepath)
+ ret['platform'] = m.group(1)
+ ret['locale'] = m.group(2)
+ ret['product'] = m.group(3)
+ ret['version'] = m.group(4)
+ ret['contents'] = m.group(5)
+ ret['leading_path'] = ''
+ elif filepath.endswith('.exe'):
+ ret['format'] = 'exe'
+ ret['contents'] = 'installer'
+ # EUballot builds use a different enough style of path than others
+ # that we can't catch them in the same regexp
+ if filepath.find('win32-EUballot') != -1:
+ ret['platform'] = 'win32'
+ m = re.search("(win32-EUballot/)([-a-zA-Z]+)/((?i)%s) Setup (\d+\.\d+(?:\.\d+)?(?:\w+\d+)?(?:\ \w+\ \d+)?)\.exe" % product, filepath)
+ if not m:
+ raise ValueError("Could not parse: %s" % filepath)
+ ret['leading_path'] = m.group(1)
+ ret['locale'] = m.group(2)
+ ret['product'] = m.group(3).lower()
+ ret['version'] = m.group(4)
+ else:
+ m = re.search("(partner-repacks/[-a-zA-Z0-9_]+/|)(win32|mac|linux-i686)/([-a-zA-Z]+)/((?i)%s) Setup (\d+\.\d+(?:\.\d+)?(?:\w+(?:\d+)?)?(?:\ \w+\ \d+)?)\.exe" % product, filepath)
+ if not m:
+ raise ValueError("Could not parse: %s" % filepath)
+ ret['leading_path'] = m.group(1)
+ ret['platform'] = m.group(2)
+ ret['locale'] = m.group(3)
+ ret['product'] = m.group(4).lower()
+ ret['version'] = m.group(5)
+ else:
+ raise ValueError("Unknown filetype for %s" % filepath)
+
+ return ret
diff --git a/build/release/sanity.py b/build/release/sanity.py
new file mode 100644
index 000000000..cd89eb3d7
--- /dev/null
+++ b/build/release/sanity.py
@@ -0,0 +1,124 @@
+import difflib
+import logging
+import re
+import urllib2
+from util.commands import run_cmd, get_output
+from util.hg import get_repo_name, make_hg_url
+from subprocess import CalledProcessError
+
+log = logging.getLogger(__name__)
+
+
+def check_buildbot():
+ """check if buildbot command works"""
+ try:
+ run_cmd(['buildbot', '--version'])
+ except CalledProcessError:
+ log.error("FAIL: buildbot command doesn't work", exc_info=True)
+ raise
+
+
+def find_version(contents, versionNumber):
+ """Given an open readable file-handle look for the occurrence
+ of the version # in the file"""
+ ret = re.search(re.compile(re.escape(versionNumber), re.DOTALL), contents)
+ return ret
+
+
+def locale_diff(locales1, locales2):
+ """ accepts two lists and diffs them both ways, returns any differences
+ found """
+ diff_list = [locale for locale in locales1 if not locale in locales2]
+ diff_list.extend(locale for locale in locales2 if not locale in locales1)
+ return diff_list
+
+
+def get_buildbot_username_param():
+ cmd = ['buildbot', 'sendchange', '--help']
+ output = get_output(cmd)
+ if "-W, --who=" in output:
+ return "--who"
+ else:
+ return "--username"
+
+
+def sendchange(branch, revision, username, master, products):
+ """Send the change to buildbot to kick off the release automation"""
+ if isinstance(products, basestring):
+ products = [products]
+ cmd = [
+ 'buildbot',
+ 'sendchange',
+ get_buildbot_username_param(),
+ username,
+ '--master',
+ master,
+ '--branch',
+ branch,
+ '-p',
+ 'products:%s' % ','.join(products),
+ '-p',
+ 'script_repo_revision:%s' % revision,
+ 'release_build'
+ ]
+ logging.info("Executing: %s" % cmd)
+ run_cmd(cmd)
+
+
+def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform,
+ mozconfigWhitelist={}):
+ """Compares mozconfig to nightly_mozconfig and compare to an optional
+ whitelist of known differences. mozconfig_pair and nightly_mozconfig_pair
+ are pairs containing the mozconfig's identifier and the list of lines in
+ the mozconfig."""
+
+ # unpack the pairs to get the names, the names are just for
+ # identifying the mozconfigs when logging the error messages
+ mozconfig_name, mozconfig_lines = mozconfig_pair
+ nightly_mozconfig_name, nightly_mozconfig_lines = nightly_mozconfig_pair
+
+ missing_args = mozconfig_lines == [] or nightly_mozconfig_lines == []
+ if missing_args:
+ log.info("Missing mozconfigs to compare for %s" % platform)
+ return False
+
+ success = True
+
+ diffInstance = difflib.Differ()
+ diff_result = diffInstance.compare(mozconfig_lines, nightly_mozconfig_lines)
+ diffList = list(diff_result)
+
+ for line in diffList:
+ clean_line = line[1:].strip()
+ if (line[0] == '-' or line[0] == '+') and len(clean_line) > 1:
+ # skip comment lines
+ if clean_line.startswith('#'):
+ continue
+ # compare to whitelist
+ message = ""
+ if line[0] == '-':
+ if platform in mozconfigWhitelist.get('release', {}):
+ if clean_line in \
+ mozconfigWhitelist['release'][platform]:
+ continue
+ elif line[0] == '+':
+ if platform in mozconfigWhitelist.get('nightly', {}):
+ if clean_line in \
+ mozconfigWhitelist['nightly'][platform]:
+ continue
+ else:
+ log.warning("%s not in %s %s!" % (
+ clean_line, platform,
+ mozconfigWhitelist['nightly'][platform]))
+ else:
+ log.error("Skipping line %s!" % line)
+ continue
+ message = "found in %s but not in %s: %s"
+ if line[0] == '-':
+ log.error(message % (mozconfig_name,
+ nightly_mozconfig_name, clean_line))
+ else:
+ log.error(message % (nightly_mozconfig_name,
+ mozconfig_name, clean_line))
+ success = False
+ return success
diff --git a/build/sanitizers/lsan_suppressions.txt b/build/sanitizers/lsan_suppressions.txt
new file mode 100644
index 000000000..6cde3dcd4
--- /dev/null
+++ b/build/sanitizers/lsan_suppressions.txt
@@ -0,0 +1,105 @@
+### !!! Please do not add suppressions for new leaks in Goanna code, unless they are intentional !!!
+
+###
+### Some of these leak in every test run.
+###
+
+# LSan runs with a shallow stack depth and no debug symbols, so some small intentional
+# leaks in system libraries show up with this. You do not want this enabled
+# when running locally with a deep stack, as it can catch too much.
+leak:libc.so
+
+# nsComponentManagerImpl intentionally leaks factory entries, and probably some other stuff.
+leak:nsComponentManagerImpl
+# These two variants are needed when fast unwind is disabled and stack depth is limited.
+leak:mozJSComponentLoader::LoadModule
+leak:nsNativeModuleLoader::LoadModule
+
+# Bug 981220 - Pixman fails to free TLS memory.
+leak:pixman_implementation_lookup_composite
+
+# Bug 987918 - Font shutdown leaks when CLEANUP_MEMORY is not enabled.
+leak:libfontconfig.so
+leak:GI___strdup
+# The symbol is really __GI___strdup, but if you have the leading _, it doesn't suppress it.
+
+# Bug 1078015 - If the process terminates during a PR_Sleep, LSAN detects a leak
+leak:PR_Sleep
+
+###
+### Bug 979928 - WebRTC leaks. m2, m3.
+###
+
+# WebRTC leaks added for Mochitest 2.
+leak:NR_reg_init
+# nr_reg_local_init should be redundant with NR_reg_init, but with 34 on Aurora
+# we get less stack frames for some reason.
+leak:nr_reg_local_init
+leak:r_log_register
+leak:nr_reg_set
+
+# Additional WebRTC leak suppressions added for Mochitest 3.
+leak:mozilla::TransportLayerDtls::Setup
+
+###
+### Many leaks only affect some test suites. The suite annotations are not checked.
+###
+
+# Bug 981195 - Small leak in the parser. m4
+leak:ObjectGroup::fixPlainObjectGroup
+
+# Bug 982111 - WebM is leaking. m1
+leak:nestegg_read_packet
+
+# Bug 987385 - Various plugin leaks. m3
+leak:mozilla::plugins::PPluginInstanceParent::CallNPP_HandleEvent
+leak:mozilla::plugins::PPluginModuleParent::OnCallReceived
+
+# Bug 987925 - Small leak under PK11_ChangePW. m5
+leak:sec_asn1e_allocate_item
+leak:PORT_Strdup_Util
+
+# Bug 1021302 - Leak of fds allocated in nsSocketTransport::BuildSocket(). m1, m5, dt, oth
+leak:nsSocketTransport::BuildSocket
+leak:nsServerSocket::OnSocketReady
+
+# Bug 1021350 - Small leak under event_base_once. m1, m4, bc3
+leak:event_base_once
+
+# Bug 1021854 - nsFileStreamBase::DoOpen() leaking fds. bc1, oth
+leak:nsLocalFile::OpenNSPRFileDesc
+
+# Bug 1022010 - Small leak under _render_glyph_outline. bc1
+leak:_render_glyph_outline
+
+# Bug 1023548 - Small leak under SECITEM_AllocItem_Util. bc1, bc3
+leak:SECITEM_AllocItem_Util
+
+# This is a one-time leak, so it is probably okay to ignore. bc1, oth
+leak:GlobalPrinters::InitializeGlobalPrinters
+leak:nsPSPrinterList::GetPrinterList
+
+# Bug 1028456 - More leaks with _PR_Getfd, in nsLocalFile::CopyToNative and do_create. bc1, bc3
+leak:_PR_Getfd
+
+# Bug 1028483 - The XML parser sometimes leaks an object. bc3
+leak:processInternalEntity
+
+###
+### Leaks with system libraries in their stacks. These show up across a number of tests.
+### Better symbols and disabling fast stackwalking may help diagnose these.
+###
+
+leak:libcairo.so
+leak:libdl.so
+leak:libdricore.so
+leak:libGL.so
+leak:libglib-2.0.so
+leak:libp11-kit.so
+leak:libpulse.so
+leak:libpulsecommon-1.1.so
+leak:libresolv.so
+leak:libstdc++.so
+leak:libXrandr.so
+leak:pthread_setspecific_internal
+leak:swrast_dri.so
diff --git a/build/sanitizers/tsan_suppressions.txt b/build/sanitizers/tsan_suppressions.txt
new file mode 100644
index 000000000..3ea562e67
--- /dev/null
+++ b/build/sanitizers/tsan_suppressions.txt
@@ -0,0 +1,21 @@
+# Bug 931149
+race:DoImageDataComplete
+
+# Bug 939786
+race:_pt_root
+
+# Bug 939788
+# Tracked by http://code.google.com/p/thread-sanitizer/issues/detail?id=40
+race:ELMCreationDetector
+
+# Bug 939790
+race:xpcom/components/nsComponentManager.h
+
+# Bug 939807
+race:ComputeUTCTime
+
+# Bug 939805
+race:g_variant_type_info_get
+
+# Bug 844759
+race:js::gc::ArenaLists::allocateFromArenaInline
diff --git a/build/sccache.mk b/build/sccache.mk
new file mode 100644
index 000000000..c57befe3d
--- /dev/null
+++ b/build/sccache.mk
@@ -0,0 +1,18 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ifdef OBJDIR
+BASE_DIR = $(OBJDIR)
+else
+# OSX Universal builds only do upload in the first MOZ_BUILD_PROJECTS
+BASE_DIR = $(MOZ_OBJDIR)/$(firstword $(MOZ_BUILD_PROJECTS))
+endif
+
+preflight_all:
+ # Terminate any sccache server that might still be around
+ -python2.7 $(TOPSRCDIR)/sccache/sccache.py > /dev/null 2>&1
+
+postflight_all:
+ # Terminate sccache server. This prints sccache stats.
+ -python2.7 $(TOPSRCDIR)/sccache/sccache.py 2>&1 | gzip > $(BASE_DIR)/dist/sccache.log.gz
diff --git a/build/stlport/Android.mk b/build/stlport/Android.mk
new file mode 100644
index 000000000..fb5f9720b
--- /dev/null
+++ b/build/stlport/Android.mk
@@ -0,0 +1,133 @@
+LOCAL_PATH := $(call my-dir)
+
+# Normally, we distribute the NDK with prebuilt binaries of STLport
+# in $LOCAL_PATH/libs/<abi>/. However,
+#
+
+STLPORT_FORCE_REBUILD := $(strip $(STLPORT_FORCE_REBUILD))
+ifndef STLPORT_FORCE_REBUILD
+ ifeq (,$(strip $(wildcard $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libstlport_static$(TARGET_LIB_EXTENSION))))
+ $(call __ndk_info,WARNING: Rebuilding STLport libraries from sources!)
+ $(call __ndk_info,You might want to use $$NDK/build/tools/build-cxx-stl.sh --stl=stlport)
+ $(call __ndk_info,in order to build prebuilt versions to speed up your builds!)
+ STLPORT_FORCE_REBUILD := true
+ endif
+endif
+
+libstlport_path := $(LOCAL_PATH)
+
+libstlport_src_files := \
+ src/dll_main.cpp \
+ src/fstream.cpp \
+ src/strstream.cpp \
+ src/sstream.cpp \
+ src/ios.cpp \
+ src/stdio_streambuf.cpp \
+ src/istream.cpp \
+ src/ostream.cpp \
+ src/iostream.cpp \
+ src/codecvt.cpp \
+ src/collate.cpp \
+ src/ctype.cpp \
+ src/monetary.cpp \
+ src/num_get.cpp \
+ src/num_put.cpp \
+ src/num_get_float.cpp \
+ src/num_put_float.cpp \
+ src/numpunct.cpp \
+ src/time_facets.cpp \
+ src/messages.cpp \
+ src/locale.cpp \
+ src/locale_impl.cpp \
+ src/locale_catalog.cpp \
+ src/facets_byname.cpp \
+ src/complex.cpp \
+ src/complex_io.cpp \
+ src/complex_trig.cpp \
+ src/string.cpp \
+ src/bitset.cpp \
+ src/allocators.cpp \
+ src/c_locale.c \
+ src/cxa.c \
+
+libstlport_cflags := -D_GNU_SOURCE
+libstlport_cppflags := -fuse-cxa-atexit
+libstlport_c_includes := $(libstlport_path)/stlport
+
+#It is much more practical to include the sources of GAbi++ in our builds
+# of STLport. This is similar to what the GNU libstdc++ does (it includes
+# its own copy of libsupc++)
+#
+# This simplifies usage, since you only have to list a single library
+# as a dependency, instead of two, especially when using the standalone
+# toolchain.
+#
+include $(dir $(LOCAL_PATH))/gabi++/sources.mk
+
+libstlport_c_includes += $(libgabi++_c_includes)
+ifneq ($(strip $(filter-out $(NDK_KNOWN_ARCHS),$(TARGET_ARCH))),)
+libgabi++_src_files := src/delete.cc \
+ src/new.cc
+endif
+
+ifneq ($(STLPORT_FORCE_REBUILD),true)
+
+$(call ndk_log,Using prebuilt STLport libraries)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := stlport_static
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
+# For armeabi*, choose thumb mode unless LOCAL_ARM_MODE := arm
+ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
+ifneq (arm,$(LOCAL_ARM_MODE))
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/thumb/lib$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
+endif
+endif
+LOCAL_EXPORT_C_INCLUDES := $(libstlport_c_includes)
+LOCAL_CPP_FEATURES := rtti
+include $(PREBUILT_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := stlport_shared
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE)$(TARGET_SONAME_EXTENSION)
+# For armeabi*, choose thumb mode unless LOCAL_ARM_MODE := arm
+$(info TARGET_ARCH_ABI=$(TARGET_ARCH_ABI))
+$(info LOCAL_ARM_MODE=$(LOCAL_ARM_MODE))
+ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
+ifneq (arm,$(LOCAL_ARM_MODE))
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/thumb/lib$(LOCAL_MODULE)$(TARGET_SONAME_EXTENSION)
+endif
+endif
+LOCAL_EXPORT_C_INCLUDES := $(libstlport_c_includes)
+LOCAL_CPP_FEATURES := rtti
+include $(PREBUILT_SHARED_LIBRARY)
+
+else # STLPORT_FORCE_REBUILD == true
+
+$(call ndk_log,Rebuilding STLport libraries from sources)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := stlport_static
+LOCAL_CPP_EXTENSION := .cpp .cc
+LOCAL_SRC_FILES := $(libstlport_src_files)
+LOCAL_SRC_FILES += $(libgabi++_src_files:%=../gabi++/%)
+LOCAL_CFLAGS := $(libstlport_cflags)
+LOCAL_CPPFLAGS := $(libstlport_cppflags)
+LOCAL_C_INCLUDES := $(libstlport_c_includes)
+LOCAL_EXPORT_C_INCLUDES := $(libstlport_c_includes)
+LOCAL_CPP_FEATURES := rtti exceptions
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := stlport_shared
+LOCAL_CPP_EXTENSION := .cpp .cc
+LOCAL_SRC_FILES := $(libstlport_src_files)
+LOCAL_SRC_FILES += $(libgabi++_src_files:%=../gabi++/%)
+LOCAL_CFLAGS := $(libstlport_cflags)
+LOCAL_CPPFLAGS := $(libstlport_cppflags)
+LOCAL_C_INCLUDES := $(libstlport_c_includes)
+LOCAL_EXPORT_C_INCLUDES := $(libstlport_c_includes)
+LOCAL_CPP_FEATURES := rtti exceptions
+include $(BUILD_SHARED_LIBRARY)
+
+endif # STLPORT_FORCE_REBUILD == true
diff --git a/build/stlport/LICENSE b/build/stlport/LICENSE
new file mode 100644
index 000000000..684627083
--- /dev/null
+++ b/build/stlport/LICENSE
@@ -0,0 +1,27 @@
+Boris Fomitchev grants Licensee a non-exclusive, non-transferable, royalty-free license to use STLport and its documentation without fee.
+
+By downloading, using, or copying STLport or any portion thereof, Licensee agrees to abide by the intellectual property laws and all other applicable laws of the United States of America, and to all of the terms and conditions of this Agreement.
+
+Licensee shall maintain the following copyright and permission notices on STLport sources and its documentation unchanged :
+
+Copyright 1999,2000 Boris Fomitchev
+
+This material is provided "as is", with absolutely no warranty expressed or implied. Any use is at your own risk.
+Permission to use or copy this software for any purpose is hereby granted without fee, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice.
+The Licensee may distribute binaries compiled with STLport (whether original or modified) without any royalties or restrictions.
+
+The Licensee may distribute original or modified STLport sources, provided that:
+
+The conditions indicated in the above permission notice are met;
+The following copyright notices are retained when present, and conditions provided in accompanying permission notices are met :
+Copyright 1994 Hewlett-Packard Company
+
+Copyright 1996,97 Silicon Graphics Computer Systems, Inc.
+
+Copyright 1997 Moscow Center for SPARC Technology.
+
+Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Hewlett-Packard Company makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
+
+Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Silicon Graphics makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
+
+Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Moscow Center for SPARC Technology makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
diff --git a/build/stlport/MODULE_LICENSE_BSD_LIKE b/build/stlport/MODULE_LICENSE_BSD_LIKE
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/build/stlport/MODULE_LICENSE_BSD_LIKE
diff --git a/build/stlport/Makefile.in b/build/stlport/Makefile.in
index d26b7bbdf..bf071bfbf 100644
--- a/build/stlport/Makefile.in
+++ b/build/stlport/Makefile.in
@@ -2,27 +2,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
MODULES = stlport
-FORCE_STATIC_LIB = 1
-STL_FLAGS =
# Force to build a static library, instead of a fake library, without
# installing it in dist/lib.
-LIBRARY = $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
-
-VPATH += $(STLPORT_SOURCES)/src
-
-CSRCS = $(notdir $(wildcard $(STLPORT_SOURCES)/src/*.c))
+NO_EXPAND_LIBS = 1
include $(topsrcdir)/config/rules.mk
-DEFINES += -D_GNU_SOURCE
CXXFLAGS += -fuse-cxa-atexit
-INCLUDES += -I$(STLPORT_SOURCES)/stlport
diff --git a/build/stlport/README b/build/stlport/README
new file mode 100644
index 000000000..8f602fe66
--- /dev/null
+++ b/build/stlport/README
@@ -0,0 +1,69 @@
+STLport for Android
+
+WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+
+ This feature is currently in beta. In case of issue
+ please contact the android-ndk support forum or
+ file bugs at http://b.android.com
+
+WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+
+This directory contains a port of STLport for Android, which provides
+a simple STL implementation. Note that it currently does not support
+C++ exceptions and RTTI. Support for wchar_t and locales is probably buggy.
+
+You can either use it as a static or shared library.
+
+1/ The static library is recommended if you will only produce
+ one shared library for your project. All necessary STLport functions
+ will be added to it. This option should also generate smaller
+ overall binaries.
+
+2/ The shared library, is recommended if you want to produce
+ several shared libraries in your project, because it avoids copying the
+ same STLport functions to each one of them, and having different instances
+ of the same global variables (which can easily conflict or result in
+ undefined behaviour).
+
+To use the *static* library, define APP_STL in your Application.mk as follows:
+
+ APP_STL := stlport_static
+
+To use the *shared* library, use "stlport_shared" instead:
+
+ APP_STL := stlport_shared
+
+Note that, in this case, you will need, in your application, to explicitely
+load the 'stlport_shared' library before any library that depends on it.
+For example:
+
+ static {
+ System.loadLibrary("stlport_shared");
+ System.loadLibrary("foo");
+ System.loadLibrary("bar");
+ }
+
+If both libfoo.so and libbar.so depend on STLport.
+
+You can build the STLport unit test program by doing the following:
+
+ cd $NDK
+ tests/run-tests.sh --test=test-stlport
+
+If you have an Android device connected to your machine, this will
+automatically try to run the generated test command. Note that for now
+a few tests are still failing (mostly related to wchar_t and locales).
+
+They should be fixed hopefully by a later release of this library.
+
+The NDK comes with prebuilt binaries for this library to speed up development.
+You can however rebuild them from sources in your own application build by
+defining STLPORT_FORCE_REBUILD to 'true' in your Application.mk as in:
+
+ STLPORT_FORCE_REBUILD := true
+
+
+VERSION INFORMATION: This module is based on STLport version 5.2.0
+
diff --git a/build/stlport/README.android b/build/stlport/README.android
new file mode 100644
index 000000000..a35c955bf
--- /dev/null
+++ b/build/stlport/README.android
@@ -0,0 +1,9 @@
+Version: 5.2.1
+
+Changes:
+ * Added _android.h included by _system.h
+ * Do not use linux float functions in num_get_float.cpp as Android does not
+ have them.
+ * _mbstate_t.h cannot define its own mbstate_t as bionic already defines
+ it.
+ * _pair.h needs to define bionic's (sgi's) internal pair header guard.
diff --git a/build/stlport/README.mozilla b/build/stlport/README.mozilla
new file mode 100644
index 000000000..15c09bcb2
--- /dev/null
+++ b/build/stlport/README.mozilla
@@ -0,0 +1,11 @@
+This copy of STLport was taken from the Android NDK git repository:
+https://android.googlesource.com/platform/ndk.git
+under sources/cxx-stl/stlport/.
+The last changes to that directory come from commit ba4baa4
+
+The overrides/ directory contains Mozilla-specific overrides to the standard
+ C++ headers found in the NDK.
+
+The following patches are applied on top:
+- android-mozilla-config.patch: Adjusts Android-specific configuration
+ to the mozilla codebase use of the STL.
diff --git a/build/stlport/README.original b/build/stlport/README.original
new file mode 100644
index 000000000..a759495ff
--- /dev/null
+++ b/build/stlport/README.original
@@ -0,0 +1,64 @@
+**********************************************************************
+* README file for STLport 5.0 *
+* *
+**********************************************************************
+
+This directory contains the STLport-5.0 release.
+
+What's inside :
+
+README - this file
+INSTALL - installation instructions
+
+bin - installation directory for STLport unit tests;
+ it may contain more subdirs, if you use
+ crosscompilation
+build/lib - build directory for STLport library (if you use
+ STLport iostreams and/or locale only)
+build/test/unit - build directory for regression (unit) tests
+build/test/eh - build directory for exception handling tests
+stlport - main STLport include directory
+src - source for iostreams implementation and other parts
+ that aren't pure template code
+lib - installation directory for STLport library (if you
+ use STLport iostreams and/or locale only);
+ it may contain more subdirs, if you use
+ crosscompilation
+test/unit - unit (regression) tests
+test/eh - exception handling test using STLport iostreams
+etc - miscellanous files (ChangeLog, TODO, scripts, etc.)
+
+GETTING STLPORT
+
+To download the latest version of STLport, please be sure to visit
+https://sourceforge.net/project/showfiles.php?group_id=146814
+
+LEGALESE
+
+This software is being distributed under the following terms:
+
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999-2003
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+
+**********************************************************************
diff --git a/build/stlport/android-mozilla-config.patch b/build/stlport/android-mozilla-config.patch
new file mode 100644
index 000000000..61a0d7a1a
--- /dev/null
+++ b/build/stlport/android-mozilla-config.patch
@@ -0,0 +1,82 @@
+diff --git a/stlport/stl/config/_android.h b/stlport/stl/config/_android.h
+--- a/stlport/stl/config/_android.h
++++ b/stlport/stl/config/_android.h
+@@ -10,18 +10,18 @@
+ #define _PTHREADS
+
+ // Don't have native <cplusplus> headers
+ #define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+ // Use unix for streams
+ #define _STLP_USE_UNIX_IO 1
+
+-// We do have rtti support now through GAbi++
+-#undef _STLP_NO_RTTI
++// We don't want rtti support
++#define _STLP_NO_RTTI 1
+
+ // C library is in the global namespace.
+ #define _STLP_VENDOR_GLOBAL_CSTD 1
+
+ // Don't have underlying local support.
+ #undef _STLP_REAL_LOCALE_IMPLEMENTED
+
+ // No pthread_spinlock_t in Android
+@@ -32,48 +32,42 @@
+
+ // Little endian platform.
+ #define _STLP_LITTLE_ENDIAN 1
+
+ // No <exception> headers
+ #undef _STLP_NO_EXCEPTION_HEADER
+
+ // No throwing exceptions
+-#undef _STLP_NO_EXCEPTIONS
+-
++#define _STLP_NO_EXCEPTIONS 1
++#define _STLP_NO_EXCEPTION_HEADER 1
+
+ // No need to define our own namespace
+ #define _STLP_NO_OWN_NAMESPACE 1
+
+ // Use __new_alloc instead of __node_alloc, so we don't need static functions.
+ #define _STLP_USE_SIMPLE_NODE_ALLOC 1
+
+ // Don't use extern versions of range errors, so we don't need to
+ // compile as a library.
+ #define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
+
+ // The system math library doesn't have long double variants, e.g
+ // sinl, cosl, etc
+ #define _STLP_NO_VENDOR_MATH_L 1
+
+-// Define how to include our native headers.
+-#define _STLP_NATIVE_HEADER(header) <usr/include/header>
+-#define _STLP_NATIVE_C_HEADER(header) <../include/header>
+-#define _STLP_NATIVE_CPP_C_HEADER(header) <../../gabi++/include/header>
+-#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../../gabi++/include/header>
+-#define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <usr/include/header>
+-
+ // Include most of the gcc settings.
+ #include <stl/config/_gcc.h>
+
+ // Do not use glibc, Android is missing some things.
+ #undef _STLP_USE_GLIBC
+
+ // No exceptions.
+-#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+-#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
++#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT 1
++#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT 1
+
+-#ifndef _ANDROID_NDK_BLAZE_
+-// Android does have include_next but it doesn't work well in our build system.
+-#undef _STLP_HAS_INCLUDE_NEXT
+-#endif
++#define _STLP_HAS_INCLUDE_NEXT 1
++
++// Use operator new instead of stlport own node allocator
++#undef _STLP_USE_NEWALLOC
++#define _STLP_USE_NEWALLOC 1
+
+ #endif /* __stl_config__android_h */
diff --git a/build/stlport/moz.build b/build/stlport/moz.build
index a39456035..72c8eb4cd 100644
--- a/build/stlport/moz.build
+++ b/build/stlport/moz.build
@@ -4,11 +4,64 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-CONFIGURE_SUBST_FILES += ['stl/config/_android.h']
+Library('stlport')
+# Keep the same name as the NDK-provided library, while using a shorter
+# name for the Library for convenience in moz.build.
+STATIC_LIBRARY_NAME = 'stlport_static'
-CPP_SOURCES += [
- '$(notdir $(wildcard $(STLPORT_SOURCES)/src/*.cpp))',
+FORCE_STATIC_LIB = True
+
+SOURCES += [
+ 'src/allocators.cpp',
+ 'src/bitset.cpp',
+ 'src/codecvt.cpp',
+ 'src/collate.cpp',
+ 'src/complex.cpp',
+ 'src/complex_io.cpp',
+ 'src/complex_trig.cpp',
+ 'src/ctype.cpp',
+ 'src/dll_main.cpp',
+ 'src/facets_byname.cpp',
+ 'src/fstream.cpp',
+ 'src/ios.cpp',
+ 'src/iostream.cpp',
+ 'src/istream.cpp',
+ 'src/locale.cpp',
+ 'src/locale_catalog.cpp',
+ 'src/locale_impl.cpp',
+ 'src/messages.cpp',
+ 'src/monetary.cpp',
+ 'src/num_get.cpp',
+ 'src/num_get_float.cpp',
+ 'src/num_put.cpp',
+ 'src/num_put_float.cpp',
+ 'src/numpunct.cpp',
+ 'src/ostream.cpp',
+ 'src/sstream.cpp',
+ 'src/stdio_streambuf.cpp',
+ 'src/string.cpp',
+ 'src/strstream.cpp',
+ 'src/time_facets.cpp',
+]
+
+SOURCES += [
+ 'src/c_locale.c',
+ 'src/cxa.c',
+]
+
+DEFINES['_GNU_SOURCE'] = True
+
+LOCAL_INCLUDES += [
+ 'stlport',
]
-LIBRARY_NAME = 'stlport_static'
+DISABLE_STL_WRAPPING = True
+NO_VISIBILITY_FLAGS = True
+# Suppress warnings in third-party code.
+if CONFIG['GNU_CXX']:
+ CXXFLAGS += [
+ '-Wno-empty-body',
+ '-Wno-type-limits',
+ '-Wno-unused-local-typedefs',
+ ]
diff --git a/build/stlport/overrides/new b/build/stlport/overrides/new
new file mode 100644
index 000000000..34feec8a6
--- /dev/null
+++ b/build/stlport/overrides/new
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
+ * This header is taken from $ndk/sources/cxx-stl/system/include/new,
+ * and it fixes a bug in the NDK header where the nothrow versions of
+ * placement new and delete are not specified with 'throw()'. This bug
+ * causes GCC to not null-check the results from these functions.
+ */
+#ifndef __NEW__
+#define __NEW__
+
+#include <cstddef>
+
+extern "C++" {
+
+namespace std {
+ struct nothrow_t {};
+ extern const nothrow_t nothrow;
+}
+
+void* operator new(std::size_t);
+void* operator new[](std::size_t);
+void operator delete(void*);
+void operator delete[](void*);
+void* operator new(std::size_t, const std::nothrow_t&) throw();
+void* operator new[](std::size_t, const std::nothrow_t&) throw();
+void operator delete(void*, const std::nothrow_t&) throw();
+void operator delete[](void*, const std::nothrow_t&) throw();
+
+inline void* operator new(std::size_t, void* p) { return p; }
+inline void* operator new[](std::size_t, void* p) { return p; }
+
+// these next two are not really required, since exceptions are off
+inline void operator delete(void*, void*) { }
+inline void operator delete[](void*, void*) { }
+
+} // extern C++
+
+#endif // __NEW__
diff --git a/build/stlport/src/_stdio_file.h b/build/stlport/src/_stdio_file.h
new file mode 100644
index 000000000..d913fc448
--- /dev/null
+++ b/build/stlport/src/_stdio_file.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STDIO_FILE_H
+#define _STLP_STDIO_FILE_H
+
+/* This file provides a low-level interface between the internal
+ * representation of struct FILE, from the C stdio library, and
+ * the C++ I/O library. */
+
+#ifndef _STLP_CSTDIO
+# include <cstdio>
+#endif
+#ifndef _STLP_CSTDDEF
+# include <cstddef>
+#endif
+
+#if defined (__MSL__)
+# include <unix.h> /* get the definition of fileno */
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_WCE)
+
+inline int _FILE_fd(const FILE *__f) {
+ /* Check if FILE is one of the three standard streams
+ We do this check first, because invoking _fileno() on one of them
+ causes a terminal window to be created. This also happens if you do
+ any IO on them, but merely retrieving the filedescriptor shouldn't
+ already do that.
+
+ Obviously this is pretty implementation-specific because it requires
+ that indeed the first three FDs are always the same, but that is not
+ only common but almost guaranteed. */
+ for (int __fd = 0; __fd != 3; ++__fd) {
+ if (__f == _getstdfilex(__fd))
+ return __fd;
+ }
+
+ /* Normal files. */
+ return (int)::_fileno((FILE*)__f);
+}
+
+# elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
+
+inline int _FILE_fd(const FILE *__f) { return __f->__file; }
+
+# elif defined (__sun) && defined (_LP64)
+
+inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; }
+
+#elif defined (__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */ || \
+ defined (__MVS__) || \
+ defined (_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */
+
+inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE*, __f)); }
+
+#elif defined (_STLP_USE_GLIBC)
+
+inline int _FILE_fd(const FILE *__f) { return __f->_fileno; }
+
+#elif defined (__BORLANDC__)
+
+inline int _FILE_fd(const FILE *__f) { return __f->fd; }
+
+#elif defined (__MWERKS__)
+
+/* using MWERKS-specific defines here to detect other OS targets
+ * dwa: I'm not sure they provide fileno for all OS's, but this should
+ * work for Win32 and WinCE
+
+ * Hmm, at least for Novell NetWare __dest_os == __mac_os true too..
+ * May be both __dest_os and __mac_os defined and empty? - ptr */
+# if __dest_os == __mac_os
+inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); }
+# else
+inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); }
+# endif
+
+#elif defined (__QNXNTO__) || defined (__WATCOMC__) || defined (__EMX__)
+
+inline int _FILE_fd(const FILE *__f) { return __f->_handle; }
+
+#elif defined (__Lynx__)
+
+/* the prototypes are taken from LynxOS patch for STLport 4.0 */
+inline int _FILE_fd(const FILE *__f) { return __f->_fd; }
+
+#else /* The most common access to file descriptor. */
+
+inline int _FILE_fd(const FILE *__f) { return __f->_file; }
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STDIO_FILE_H */
+
+/* Local Variables:
+ * mode:C++
+ * End: */
diff --git a/build/stlport/src/acquire_release.h b/build/stlport/src/acquire_release.h
new file mode 100644
index 000000000..5ea73da1a
--- /dev/null
+++ b/build/stlport/src/acquire_release.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef ACQUIRE_RELEASE_H
+#define ACQUIRE_RELEASE_H
+
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_Locale_ctype* _STLP_CALL __acquire_ctype(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_codecvt* _STLP_CALL __acquire_codecvt(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_numeric* _STLP_CALL __acquire_numeric(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_collate* _STLP_CALL __acquire_collate(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_monetary* _STLP_CALL __acquire_monetary(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_time* _STLP_CALL __acquire_time(const char* &name, char *buf, _Locale_name_hint*, int *__err_code);
+_Locale_messages* _STLP_CALL __acquire_messages(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+
+void _STLP_CALL __release_ctype(_Locale_ctype* cat);
+void _STLP_CALL __release_codecvt(_Locale_codecvt* cat);
+void _STLP_CALL __release_numeric(_Locale_numeric* cat);
+void _STLP_CALL __release_collate(_Locale_collate* cat);
+void _STLP_CALL __release_monetary(_Locale_monetary* cat);
+void _STLP_CALL __release_time(_Locale_time* __time);
+void _STLP_CALL __release_messages(_Locale_messages* cat);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* ACQUIRE_RELEASE_H */
diff --git a/build/stlport/src/aligned_buffer.h b/build/stlport/src/aligned_buffer.h
new file mode 100644
index 000000000..6ff6ca6b9
--- /dev/null
+++ b/build/stlport/src/aligned_buffer.h
@@ -0,0 +1,21 @@
+#ifndef ALIGNED_BUFFER_H
+#define ALIGNED_BUFFER_H
+
+_STLP_BEGIN_NAMESPACE
+// this is for fake initialization
+template<class T>
+union _Stl_aligned_buffer {
+ char buf[sizeof(T)];
+ struct { double a; double b; } padding;
+
+ T* operator&() {
+ return __REINTERPRET_CAST(T*, this);
+ }
+
+ T const* operator&() const {
+ return __REINTERPRET_CAST(T const*, this);
+ }
+};
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/build/stlport/src/allocators.cpp b/build/stlport/src/allocators.cpp
new file mode 100644
index 000000000..8bbcca86b
--- /dev/null
+++ b/build/stlport/src/allocators.cpp
@@ -0,0 +1,1121 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <memory>
+
+#if defined (__GNUC__) && (defined (__CYGWIN__) || defined (__MINGW32__))
+# include <malloc.h>
+#endif
+
+#if defined (_STLP_PTHREADS) && !defined (_STLP_NO_THREADS)
+# include <pthread_alloc>
+# include <cerrno>
+#endif
+
+#include <stl/_threads.h>
+
+#include "lock_free_slist.h"
+
+#if defined (__WATCOMC__)
+# pragma warning 13 9
+# pragma warning 367 9
+# pragma warning 368 9
+#endif
+
+#if defined (_STLP_SGI_THREADS)
+ // We test whether threads are in use before locking.
+ // Perhaps this should be moved into stl_threads.h, but that
+ // probably makes it harder to avoid the procedure call when
+ // it isn't needed.
+extern "C" {
+ extern int __us_rsthread_malloc;
+}
+#endif
+
+// Specialised debug form of new operator which does not provide "false"
+// memory leaks when run with debug CRT libraries.
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1020 && defined (_STLP_DEBUG_ALLOC)) && !defined (_STLP_WCE)
+# include <crtdbg.h>
+inline char* __stlp_new_chunk(size_t __bytes) {
+ void *__chunk = _STLP_CHECK_NULL_ALLOC(::operator new(__bytes, __FILE__, __LINE__));
+ return __STATIC_CAST(char*, __chunk);
+}
+inline void __stlp_delete_chunck(void* __p) { ::operator delete(__p, __FILE__, __LINE__); }
+#else
+# ifdef _STLP_NODE_ALLOC_USE_MALLOC
+# include <cstdlib>
+inline char* __stlp_new_chunk(size_t __bytes) {
+ // do not use _STLP_CHECK_NULL_ALLOC, this macro is dedicated to new operator.
+ void *__chunk = _STLP_VENDOR_CSTD::malloc(__bytes);
+ if (__chunk == 0) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return __STATIC_CAST(char*, __chunk);
+}
+inline void __stlp_delete_chunck(void* __p) { _STLP_VENDOR_CSTD::free(__p); }
+# else
+inline char* __stlp_new_chunk(size_t __bytes)
+{ return __STATIC_CAST(char*, _STLP_STD::__stl_new(__bytes)); }
+inline void __stlp_delete_chunck(void* __p) { _STLP_STD::__stl_delete(__p); }
+# endif
+#endif
+
+/* This is an additional atomic operations to the ones already defined in
+ * stl/_threads.h, platform should try to support it to improve performance.
+ * __add_atomic_t _STLP_ATOMIC_ADD(volatile __add_atomic_t* __target, __add_atomic_t __val) :
+ * does *__target = *__target + __val and returns the old *__target value */
+typedef long __add_atomic_t;
+typedef unsigned long __uadd_atomic_t;
+
+#if defined (__GNUC__) && defined (__i386__)
+inline long _STLP_atomic_add_gcc_x86(long volatile* p, long addend) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (addend)
+ :"cc");
+ return result + addend;
+}
+# define _STLP_ATOMIC_ADD(__dst, __val) _STLP_atomic_add_gcc_x86(__dst, __val)
+#elif defined (_STLP_WIN32THREADS)
+// The Win32 API function InterlockedExchangeAdd is not available on Windows 95.
+# if !defined (_STLP_WIN95_LIKE)
+# if defined (_STLP_NEW_PLATFORM_SDK)
+# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__dst, __val)
+# else
+# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__CONST_CAST(__add_atomic_t*, __dst), __val)
+# endif
+# endif
+#endif
+
+#if defined (__OS400__)
+// dums 02/05/2007: is it really necessary ?
+enum { _ALIGN = 16, _ALIGN_SHIFT = 4 };
+#else
+enum { _ALIGN = 2 * sizeof(void*), _ALIGN_SHIFT = 2 + sizeof(void*) / 4 };
+#endif
+
+#define _S_FREELIST_INDEX(__bytes) ((__bytes - size_t(1)) >> (int)_ALIGN_SHIFT)
+
+_STLP_BEGIN_NAMESPACE
+
+// malloc_alloc out-of-memory handling
+static __oom_handler_type __oom_handler = __STATIC_CAST(__oom_handler_type, 0);
+
+#ifdef _STLP_THREADS
+_STLP_mutex __oom_handler_lock;
+#endif
+
+void* _STLP_CALL __malloc_alloc::allocate(size_t __n)
+{
+ void *__result = malloc(__n);
+ if ( 0 == __result ) {
+ __oom_handler_type __my_malloc_handler;
+
+ for (;;) {
+ {
+#ifdef _STLP_THREADS
+ _STLP_auto_lock _l( __oom_handler_lock );
+#endif
+ __my_malloc_handler = __oom_handler;
+ }
+ if ( 0 == __my_malloc_handler) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ (*__my_malloc_handler)();
+ __result = malloc(__n);
+ if ( __result )
+ return __result;
+ }
+ }
+ return __result;
+}
+
+__oom_handler_type _STLP_CALL __malloc_alloc::set_malloc_handler(__oom_handler_type __f)
+{
+#ifdef _STLP_THREADS
+ _STLP_auto_lock _l( __oom_handler_lock );
+#endif
+ __oom_handler_type __old = __oom_handler;
+ __oom_handler = __f;
+ return __old;
+}
+
+// *******************************************************
+// Default node allocator.
+// With a reasonable compiler, this should be roughly as fast as the
+// original STL class-specific allocators, but with less fragmentation.
+//
+// Important implementation properties:
+// 1. If the client request an object of size > _MAX_BYTES, the resulting
+// object will be obtained directly from malloc.
+// 2. In all other cases, we allocate an object of size exactly
+// _S_round_up(requested_size). Thus the client has enough size
+// information that we can return the object to the proper free list
+// without permanently losing part of the object.
+//
+
+#define _STLP_NFREELISTS 16
+
+#if defined (_STLP_LEAKS_PEDANTIC) && defined (_STLP_USE_DYNAMIC_LIB)
+/*
+ * We can only do cleanup of the node allocator memory pool if we are
+ * sure that the STLport library is used as a shared one as it guaranties
+ * the unicity of the node allocator instance. Without that guaranty node
+ * allocator instances might exchange memory blocks making the implementation
+ * of a cleaning process much more complicated.
+ */
+# define _STLP_DO_CLEAN_NODE_ALLOC
+#endif
+
+/* When STLport is used without multi threaded safety we use the node allocator
+ * implementation with locks as locks becomes no-op. The lock free implementation
+ * always use system specific atomic operations which are slower than 'normal'
+ * ones.
+ */
+#if defined (_STLP_THREADS) && \
+ defined (_STLP_HAS_ATOMIC_FREELIST) && defined (_STLP_ATOMIC_ADD)
+/*
+ * We have an implementation of the atomic freelist (_STLP_atomic_freelist)
+ * for this architecture and compiler. That means we can use the non-blocking
+ * implementation of the node-allocation engine.*/
+# define _STLP_USE_LOCK_FREE_IMPLEMENTATION
+#endif
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+# if defined (_STLP_THREADS)
+
+class _Node_Alloc_Lock {
+ static _STLP_STATIC_MUTEX& _S_Mutex() {
+ static _STLP_STATIC_MUTEX mutex _STLP_MUTEX_INITIALIZER;
+ return mutex;
+ }
+public:
+ _Node_Alloc_Lock() {
+# if defined (_STLP_SGI_THREADS)
+ if (__us_rsthread_malloc)
+# endif
+ _S_Mutex()._M_acquire_lock();
+ }
+
+ ~_Node_Alloc_Lock() {
+# if defined (_STLP_SGI_THREADS)
+ if (__us_rsthread_malloc)
+# endif
+ _S_Mutex()._M_release_lock();
+ }
+};
+
+# else
+
+class _Node_Alloc_Lock {
+public:
+ _Node_Alloc_Lock() { }
+ ~_Node_Alloc_Lock() { }
+};
+
+# endif
+
+struct _Node_alloc_obj {
+ _Node_alloc_obj * _M_next;
+};
+#endif
+
+class __node_alloc_impl {
+ static inline size_t _STLP_CALL _S_round_up(size_t __bytes)
+ { return (((__bytes) + (size_t)_ALIGN-1) & ~((size_t)_ALIGN - 1)); }
+
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ typedef _STLP_atomic_freelist::item _Obj;
+ typedef _STLP_atomic_freelist _Freelist;
+ typedef _STLP_atomic_freelist _ChunkList;
+
+ // Header of blocks of memory that have been allocated as part of
+ // a larger chunk but have not yet been chopped up into nodes.
+ struct _FreeBlockHeader : public _STLP_atomic_freelist::item {
+ char* _M_end; // pointer to end of free memory
+ };
+#else
+ typedef _Node_alloc_obj _Obj;
+ typedef _Obj* _STLP_VOLATILE _Freelist;
+ typedef _Obj* _ChunkList;
+#endif
+
+private:
+ // Returns an object of size __n, and optionally adds to size __n free list.
+ static _Obj* _S_refill(size_t __n);
+ // Allocates a chunk for nobjs of size __p_size. nobjs may be reduced
+ // if it is inconvenient to allocate the requested number.
+ static char* _S_chunk_alloc(size_t __p_size, int& __nobjs);
+ // Chunk allocation state.
+ static _Freelist _S_free_list[_STLP_NFREELISTS];
+ // Amount of total allocated memory
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ static _STLP_VOLATILE __add_atomic_t _S_heap_size;
+#else
+ static size_t _S_heap_size;
+#endif
+
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ // List of blocks of free memory
+ static _STLP_atomic_freelist _S_free_mem_blocks;
+#else
+ // Start of the current free memory buffer
+ static char* _S_start_free;
+ // End of the current free memory buffer
+ static char* _S_end_free;
+#endif
+
+#if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+public:
+ // Methods to report alloc/dealloc calls to the counter system.
+# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ typedef _STLP_VOLATILE __stl_atomic_t _AllocCounter;
+# else
+ typedef __stl_atomic_t _AllocCounter;
+# endif
+ static _AllocCounter& _STLP_CALL _S_alloc_counter();
+ static void _S_alloc_call();
+ static void _S_dealloc_call();
+
+private:
+ // Free all the allocated chuncks of memory
+ static void _S_chunk_dealloc();
+ // Beginning of the linked list of allocated chunks of memory
+ static _ChunkList _S_chunks;
+#endif /* _STLP_DO_CLEAN_NODE_ALLOC */
+
+public:
+ /* __n must be > 0 */
+ static void* _M_allocate(size_t& __n);
+ /* __p may not be 0 */
+ static void _M_deallocate(void *__p, size_t __n);
+};
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+void* __node_alloc_impl::_M_allocate(size_t& __n) {
+ __n = _S_round_up(__n);
+ _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n);
+ _Obj *__r;
+
+ // Acquire the lock here with a constructor call.
+ // This ensures that it is released in exit or during stack
+ // unwinding.
+ _Node_Alloc_Lock __lock_instance;
+
+ if ( (__r = *__my_free_list) != 0 ) {
+ *__my_free_list = __r->_M_next;
+ } else {
+ __r = _S_refill(__n);
+ }
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_alloc_call();
+# endif
+ // lock is released here
+ return __r;
+}
+
+void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) {
+ _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n);
+ _Obj * __pobj = __STATIC_CAST(_Obj*, __p);
+
+ // acquire lock
+ _Node_Alloc_Lock __lock_instance;
+ __pobj->_M_next = *__my_free_list;
+ *__my_free_list = __pobj;
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_dealloc_call();
+# endif
+ // lock is released here
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+# define _STLP_OFFSET sizeof(_Obj)
+# else
+# define _STLP_OFFSET 0
+# endif
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+/* We hold the allocation lock. */
+char* __node_alloc_impl::_S_chunk_alloc(size_t _p_size, int& __nobjs) {
+ char* __result;
+ size_t __total_bytes = _p_size * __nobjs;
+ size_t __bytes_left = _S_end_free - _S_start_free;
+
+ if (__bytes_left > 0) {
+ if (__bytes_left >= __total_bytes) {
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ }
+
+ if (__bytes_left >= _p_size) {
+ __nobjs = (int)(__bytes_left / _p_size);
+ __total_bytes = _p_size * __nobjs;
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ }
+
+ // Try to make use of the left-over piece.
+ _Obj* _STLP_VOLATILE* __my_free_list = _S_free_list + _S_FREELIST_INDEX(__bytes_left);
+ __REINTERPRET_CAST(_Obj*, _S_start_free)->_M_next = *__my_free_list;
+ *__my_free_list = __REINTERPRET_CAST(_Obj*, _S_start_free);
+ _S_start_free = _S_end_free = 0;
+ }
+
+ size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size) + _STLP_OFFSET;
+
+ _STLP_TRY {
+ _S_start_free = __stlp_new_chunk(__bytes_to_get);
+ }
+#if defined (_STLP_USE_EXCEPTIONS)
+ catch (const _STLP_STD::bad_alloc&) {
+ _Obj* _STLP_VOLATILE* __my_free_list;
+ _Obj* __p;
+ // Try to do with what we have. That can't hurt.
+ // We do not try smaller requests, since that tends
+ // to result in disaster on multi-process machines.
+ for (size_t __i = _p_size; __i <= (size_t)_MAX_BYTES; __i += (size_t)_ALIGN) {
+ __my_free_list = _S_free_list + _S_FREELIST_INDEX(__i);
+ __p = *__my_free_list;
+ if (0 != __p) {
+ *__my_free_list = __p -> _M_next;
+ _S_start_free = __REINTERPRET_CAST(char*, __p);
+ _S_end_free = _S_start_free + __i;
+ return _S_chunk_alloc(_p_size, __nobjs);
+ // Any leftover piece will eventually make it to the
+ // right free list.
+ }
+ }
+ __bytes_to_get = __total_bytes + _STLP_OFFSET;
+ _S_start_free = __stlp_new_chunk(__bytes_to_get);
+ }
+#endif
+
+ _S_heap_size += __bytes_to_get >> 4;
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ __REINTERPRET_CAST(_Obj*, _S_start_free)->_M_next = _S_chunks;
+ _S_chunks = __REINTERPRET_CAST(_Obj*, _S_start_free);
+# endif
+ _S_end_free = _S_start_free + __bytes_to_get;
+ _S_start_free += _STLP_OFFSET;
+ return _S_chunk_alloc(_p_size, __nobjs);
+}
+
+/* Returns an object of size __n, and optionally adds to size __n free list.*/
+/* We assume that __n is properly aligned. */
+/* We hold the allocation lock. */
+_Node_alloc_obj* __node_alloc_impl::_S_refill(size_t __n) {
+ int __nobjs = 20;
+ char* __chunk = _S_chunk_alloc(__n, __nobjs);
+
+ if (1 == __nobjs) return __REINTERPRET_CAST(_Obj*, __chunk);
+
+ _Obj* _STLP_VOLATILE* __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n);
+ _Obj* __result;
+ _Obj* __current_obj;
+ _Obj* __next_obj;
+
+ /* Build free list in chunk */
+ __result = __REINTERPRET_CAST(_Obj*, __chunk);
+ *__my_free_list = __next_obj = __REINTERPRET_CAST(_Obj*, __chunk + __n);
+ for (--__nobjs; --__nobjs; ) {
+ __current_obj = __next_obj;
+ __next_obj = __REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __next_obj) + __n);
+ __current_obj->_M_next = __next_obj;
+ }
+ __next_obj->_M_next = 0;
+ return __result;
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+void __node_alloc_impl::_S_alloc_call()
+{ ++_S_alloc_counter(); }
+
+void __node_alloc_impl::_S_dealloc_call() {
+ __stl_atomic_t &counter = _S_alloc_counter();
+ if (--counter == 0)
+ { _S_chunk_dealloc(); }
+}
+
+/* We deallocate all the memory chunks */
+void __node_alloc_impl::_S_chunk_dealloc() {
+ _Obj *__pcur = _S_chunks, *__pnext;
+ while (__pcur != 0) {
+ __pnext = __pcur->_M_next;
+ __stlp_delete_chunck(__pcur);
+ __pcur = __pnext;
+ }
+ _S_chunks = 0;
+ _S_start_free = _S_end_free = 0;
+ _S_heap_size = 0;
+ memset(__REINTERPRET_CAST(char*, __CONST_CAST(_Obj**, &_S_free_list[0])), 0, _STLP_NFREELISTS * sizeof(_Obj*));
+}
+# endif
+
+#else
+
+void* __node_alloc_impl::_M_allocate(size_t& __n) {
+ __n = _S_round_up(__n);
+ _Obj* __r = _S_free_list[_S_FREELIST_INDEX(__n)].pop();
+ if (__r == 0)
+ { __r = _S_refill(__n); }
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_alloc_call();
+# endif
+ return __r;
+}
+
+void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) {
+ _S_free_list[_S_FREELIST_INDEX(__n)].push(__STATIC_CAST(_Obj*, __p));
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_dealloc_call();
+# endif
+}
+
+/* Returns an object of size __n, and optionally adds additional ones to */
+/* freelist of objects of size __n. */
+/* We assume that __n is properly aligned. */
+__node_alloc_impl::_Obj* __node_alloc_impl::_S_refill(size_t __n) {
+ int __nobjs = 20;
+ char* __chunk = _S_chunk_alloc(__n, __nobjs);
+
+ if (__nobjs <= 1)
+ return __REINTERPRET_CAST(_Obj*, __chunk);
+
+ // Push all new nodes (minus first one) onto freelist
+ _Obj* __result = __REINTERPRET_CAST(_Obj*, __chunk);
+ _Obj* __cur_item = __result;
+ _Freelist* __my_freelist = _S_free_list + _S_FREELIST_INDEX(__n);
+ for (--__nobjs; __nobjs != 0; --__nobjs) {
+ __cur_item = __REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __cur_item) + __n);
+ __my_freelist->push(__cur_item);
+ }
+ return __result;
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+# define _STLP_OFFSET _ALIGN
+# else
+# define _STLP_OFFSET 0
+# endif
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+char* __node_alloc_impl::_S_chunk_alloc(size_t _p_size, int& __nobjs) {
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ //We are going to add a small memory block to keep all the allocated blocks
+ //address, we need to do so respecting the memory alignment. The following
+ //static assert checks that the reserved block is big enough to store a pointer.
+ _STLP_STATIC_ASSERT(sizeof(_Obj) <= _ALIGN)
+# endif
+ char* __result = 0;
+ __add_atomic_t __total_bytes = __STATIC_CAST(__add_atomic_t, _p_size) * __nobjs;
+
+ _FreeBlockHeader* __block = __STATIC_CAST(_FreeBlockHeader*, _S_free_mem_blocks.pop());
+ if (__block != 0) {
+ // We checked a block out and can now mess with it with impugnity.
+ // We'll put the remainder back into the list if we're done with it below.
+ char* __buf_start = __REINTERPRET_CAST(char*, __block);
+ __add_atomic_t __bytes_left = __block->_M_end - __buf_start;
+
+ if ((__bytes_left < __total_bytes) && (__bytes_left >= __STATIC_CAST(__add_atomic_t, _p_size))) {
+ // There's enough left for at least one object, but not as much as we wanted
+ __result = __buf_start;
+ __nobjs = (int)(__bytes_left/_p_size);
+ __total_bytes = __STATIC_CAST(__add_atomic_t, _p_size) * __nobjs;
+ __bytes_left -= __total_bytes;
+ __buf_start += __total_bytes;
+ }
+ else if (__bytes_left >= __total_bytes) {
+ // The block has enough left to satisfy all that was asked for
+ __result = __buf_start;
+ __bytes_left -= __total_bytes;
+ __buf_start += __total_bytes;
+ }
+
+ if (__bytes_left != 0) {
+ // There is still some memory left over in block after we satisfied our request.
+ if ((__result != 0) && (__bytes_left >= (__add_atomic_t)sizeof(_FreeBlockHeader))) {
+ // We were able to allocate at least one object and there is still enough
+ // left to put remainder back into list.
+ _FreeBlockHeader* __newblock = __REINTERPRET_CAST(_FreeBlockHeader*, __buf_start);
+ __newblock->_M_end = __block->_M_end;
+ _S_free_mem_blocks.push(__newblock);
+ }
+ else {
+ // We were not able to allocate enough for at least one object.
+ // Shove into freelist of nearest (rounded-down!) size.
+ size_t __rounded_down = _S_round_up(__bytes_left + 1) - (size_t)_ALIGN;
+ if (__rounded_down > 0)
+ _S_free_list[_S_FREELIST_INDEX(__rounded_down)].push((_Obj*)__buf_start);
+ }
+ }
+ if (__result != 0)
+ return __result;
+ }
+
+ // We couldn't satisfy it from the list of free blocks, get new memory.
+ __add_atomic_t __bytes_to_get = 2 * __total_bytes +
+ __STATIC_CAST(__add_atomic_t,
+ _S_round_up(__STATIC_CAST(__uadd_atomic_t, _STLP_ATOMIC_ADD(&_S_heap_size, 0)))) +
+ _STLP_OFFSET;
+ _STLP_TRY {
+ __result = __stlp_new_chunk(__bytes_to_get);
+ }
+#if defined (_STLP_USE_EXCEPTIONS)
+ catch (const bad_alloc&) {
+ // Allocation failed; try to canibalize from freelist of a larger object size.
+ for (size_t __i = _p_size; __i <= (size_t)_MAX_BYTES; __i += (size_t)_ALIGN) {
+ _Obj* __p = _S_free_list[_S_FREELIST_INDEX(__i)].pop();
+ if (0 != __p) {
+ if (__i < sizeof(_FreeBlockHeader)) {
+ // Not enough to put into list of free blocks, divvy it up here.
+ // Use as much as possible for this request and shove remainder into freelist.
+ __nobjs = (int)(__i/_p_size);
+ __total_bytes = __nobjs * __STATIC_CAST(__add_atomic_t, _p_size);
+ size_t __bytes_left = __i - __total_bytes;
+ size_t __rounded_down = _S_round_up(__bytes_left+1) - (size_t)_ALIGN;
+ if (__rounded_down > 0) {
+ _S_free_list[_S_FREELIST_INDEX(__rounded_down)].push(__REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __p) + __total_bytes));
+ }
+ return __REINTERPRET_CAST(char*, __p);
+ }
+ else {
+ // Add node to list of available blocks and recursively allocate from it.
+ _FreeBlockHeader* __newblock = (_FreeBlockHeader*)__p;
+ __newblock->_M_end = __REINTERPRET_CAST(char*, __p) + __i;
+ _S_free_mem_blocks.push(__newblock);
+ return _S_chunk_alloc(_p_size, __nobjs);
+ }
+ }
+ }
+
+ // We were not able to find something in a freelist, try to allocate a smaller amount.
+ __bytes_to_get = __total_bytes + _STLP_OFFSET;
+ __result = __stlp_new_chunk(__bytes_to_get);
+
+ // This should either throw an exception or remedy the situation.
+ // Thus we assume it succeeded.
+ }
+#endif
+ // Alignment check
+ _STLP_VERBOSE_ASSERT(((__REINTERPRET_CAST(size_t, __result) & __STATIC_CAST(size_t, _ALIGN - 1)) == 0),
+ _StlMsg_DBA_DELETED_TWICE)
+ _STLP_ATOMIC_ADD(&_S_heap_size, __bytes_to_get >> 4);
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ // We have to track the allocated memory chunks for release on exit.
+ _S_chunks.push(__REINTERPRET_CAST(_Obj*, __result));
+ __result += _ALIGN;
+ __bytes_to_get -= _ALIGN;
+# endif
+
+ if (__bytes_to_get > __total_bytes) {
+ // Push excess memory allocated in this chunk into list of free memory blocks
+ _FreeBlockHeader* __freeblock = __REINTERPRET_CAST(_FreeBlockHeader*, __result + __total_bytes);
+ __freeblock->_M_end = __result + __bytes_to_get;
+ _S_free_mem_blocks.push(__freeblock);
+ }
+ return __result;
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+void __node_alloc_impl::_S_alloc_call()
+{ _STLP_ATOMIC_INCREMENT(&_S_alloc_counter()); }
+
+void __node_alloc_impl::_S_dealloc_call() {
+ _STLP_VOLATILE __stl_atomic_t *pcounter = &_S_alloc_counter();
+ if (_STLP_ATOMIC_DECREMENT(pcounter) == 0)
+ _S_chunk_dealloc();
+}
+
+/* We deallocate all the memory chunks */
+void __node_alloc_impl::_S_chunk_dealloc() {
+ // Note: The _Node_alloc_helper class ensures that this function
+ // will only be called when the (shared) library is unloaded or the
+ // process is shutdown. It's thus not possible that another thread
+ // is currently trying to allocate a node (we're not thread-safe here).
+ //
+
+ // Clear the free blocks and all freelistst. This makes sure that if
+ // for some reason more memory is allocated again during shutdown
+ // (it'd also be really nasty to leave references to deallocated memory).
+ _S_free_mem_blocks.clear();
+ _S_heap_size = 0;
+
+ for (size_t __i = 0; __i < _STLP_NFREELISTS; ++__i) {
+ _S_free_list[__i].clear();
+ }
+
+ // Detach list of chunks and free them all
+ _Obj* __chunk = _S_chunks.clear();
+ while (__chunk != 0) {
+ _Obj* __next = __chunk->_M_next;
+ __stlp_delete_chunck(__chunk);
+ __chunk = __next;
+ }
+}
+# endif
+
+#endif
+
+#if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+struct __node_alloc_cleaner {
+ ~__node_alloc_cleaner()
+ { __node_alloc_impl::_S_dealloc_call(); }
+};
+
+# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_STLP_VOLATILE __stl_atomic_t& _STLP_CALL
+# else
+__stl_atomic_t& _STLP_CALL
+# endif
+__node_alloc_impl::_S_alloc_counter() {
+ static _AllocCounter _S_counter = 1;
+ static __node_alloc_cleaner _S_node_alloc_cleaner;
+ return _S_counter;
+}
+#endif
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_Node_alloc_obj * _STLP_VOLATILE
+__node_alloc_impl::_S_free_list[_STLP_NFREELISTS]
+= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+// The 16 zeros are necessary to make version 4.1 of the SunPro
+// compiler happy. Otherwise it appears to allocate too little
+// space for the array.
+#else
+_STLP_atomic_freelist __node_alloc_impl::_S_free_list[_STLP_NFREELISTS];
+_STLP_atomic_freelist __node_alloc_impl::_S_free_mem_blocks;
+#endif
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+char *__node_alloc_impl::_S_start_free = 0;
+char *__node_alloc_impl::_S_end_free = 0;
+#endif
+
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_STLP_VOLATILE __add_atomic_t
+#else
+size_t
+#endif
+__node_alloc_impl::_S_heap_size = 0;
+
+#if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_STLP_atomic_freelist __node_alloc_impl::_S_chunks;
+# else
+_Node_alloc_obj* __node_alloc_impl::_S_chunks = 0;
+# endif
+#endif
+
+void * _STLP_CALL __node_alloc::_M_allocate(size_t& __n)
+{ return __node_alloc_impl::_M_allocate(__n); }
+
+void _STLP_CALL __node_alloc::_M_deallocate(void *__p, size_t __n)
+{ __node_alloc_impl::_M_deallocate(__p, __n); }
+
+#if defined (_STLP_PTHREADS) && !defined (_STLP_NO_THREADS)
+
+# define _STLP_DATA_ALIGNMENT 8
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// *******************************************************
+// __perthread_alloc implementation
+union _Pthread_alloc_obj {
+ union _Pthread_alloc_obj * __free_list_link;
+ char __client_data[_STLP_DATA_ALIGNMENT]; /* The client sees this. */
+};
+
+// Pthread allocators don't appear to the client to have meaningful
+// instances. We do in fact need to associate some state with each
+// thread. That state is represented by _Pthread_alloc_per_thread_state.
+
+struct _Pthread_alloc_per_thread_state {
+ typedef _Pthread_alloc_obj __obj;
+ enum { _S_NFREELISTS = _MAX_BYTES / _STLP_DATA_ALIGNMENT };
+
+ // Free list link for list of available per thread structures.
+ // When one of these becomes available for reuse due to thread
+ // termination, any objects in its free list remain associated
+ // with it. The whole structure may then be used by a newly
+ // created thread.
+ _Pthread_alloc_per_thread_state() : __next(0)
+ { memset((void *)__CONST_CAST(_Pthread_alloc_obj**, __free_list), 0, (size_t)_S_NFREELISTS * sizeof(__obj *)); }
+ // Returns an object of size __n, and possibly adds to size n free list.
+ void *_M_refill(size_t __n);
+
+ _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
+ _Pthread_alloc_per_thread_state *__next;
+ // this data member is only to be used by per_thread_allocator, which returns memory to the originating thread.
+ _STLP_mutex _M_lock;
+};
+
+// Pthread-specific allocator.
+class _Pthread_alloc_impl {
+public: // but only for internal use:
+ typedef _Pthread_alloc_per_thread_state __state_type;
+ typedef char value_type;
+
+ // Allocates a chunk for nobjs of size size. nobjs may be reduced
+ // if it is inconvenient to allocate the requested number.
+ static char *_S_chunk_alloc(size_t __size, size_t &__nobjs, __state_type*);
+
+ enum {_S_ALIGN = _STLP_DATA_ALIGNMENT};
+
+ static size_t _S_round_up(size_t __bytes)
+ { return (((__bytes) + (int)_S_ALIGN - 1) & ~((int)_S_ALIGN - 1)); }
+ static size_t _S_freelist_index(size_t __bytes)
+ { return (((__bytes) + (int)_S_ALIGN - 1) / (int)_S_ALIGN - 1); }
+
+private:
+ // Chunk allocation state. And other shared state.
+ // Protected by _S_chunk_allocator_lock.
+ static _STLP_STATIC_MUTEX _S_chunk_allocator_lock;
+ static char *_S_start_free;
+ static char *_S_end_free;
+ static size_t _S_heap_size;
+ static __state_type *_S_free_per_thread_states;
+ static pthread_key_t _S_key;
+ static bool _S_key_initialized;
+ // Pthread key under which per thread state is stored.
+ // Allocator instances that are currently unclaimed by any thread.
+ static void _S_destructor(void *instance);
+ // Function to be called on thread exit to reclaim per thread
+ // state.
+ static __state_type *_S_new_per_thread_state();
+public:
+ // Return a recycled or new per thread state.
+ static __state_type *_S_get_per_thread_state();
+private:
+ // ensure that the current thread has an associated
+ // per thread state.
+ class _M_lock;
+ friend class _M_lock;
+ class _M_lock {
+ public:
+ _M_lock () { _S_chunk_allocator_lock._M_acquire_lock(); }
+ ~_M_lock () { _S_chunk_allocator_lock._M_release_lock(); }
+ };
+
+public:
+
+ /* n must be > 0 */
+ static void * allocate(size_t& __n);
+
+ /* p may not be 0 */
+ static void deallocate(void *__p, size_t __n);
+
+ // boris : versions for per_thread_allocator
+ /* n must be > 0 */
+ static void * allocate(size_t& __n, __state_type* __a);
+
+ /* p may not be 0 */
+ static void deallocate(void *__p, size_t __n, __state_type* __a);
+
+ static void * reallocate(void *__p, size_t __old_sz, size_t& __new_sz);
+};
+
+/* Returns an object of size n, and optionally adds to size n free list.*/
+/* We assume that n is properly aligned. */
+/* We hold the allocation lock. */
+void *_Pthread_alloc_per_thread_state::_M_refill(size_t __n) {
+ typedef _Pthread_alloc_obj __obj;
+ size_t __nobjs = 128;
+ char * __chunk = _Pthread_alloc_impl::_S_chunk_alloc(__n, __nobjs, this);
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+ __obj * __current_obj, * __next_obj;
+ size_t __i;
+
+ if (1 == __nobjs) {
+ return __chunk;
+ }
+
+ __my_free_list = __free_list + _Pthread_alloc_impl::_S_freelist_index(__n);
+
+ /* Build free list in chunk */
+ __result = (__obj *)__chunk;
+ *__my_free_list = __next_obj = (__obj *)(__chunk + __n);
+ for (__i = 1; ; ++__i) {
+ __current_obj = __next_obj;
+ __next_obj = (__obj *)((char *)__next_obj + __n);
+ if (__nobjs - 1 == __i) {
+ __current_obj -> __free_list_link = 0;
+ break;
+ } else {
+ __current_obj -> __free_list_link = __next_obj;
+ }
+ }
+ return __result;
+}
+
+void _Pthread_alloc_impl::_S_destructor(void *__instance) {
+ _M_lock __lock_instance; // Need to acquire lock here.
+ _Pthread_alloc_per_thread_state* __s = (_Pthread_alloc_per_thread_state*)__instance;
+ __s -> __next = _S_free_per_thread_states;
+ _S_free_per_thread_states = __s;
+}
+
+_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_new_per_thread_state() {
+ /* lock already held here. */
+ if (0 != _S_free_per_thread_states) {
+ _Pthread_alloc_per_thread_state *__result = _S_free_per_thread_states;
+ _S_free_per_thread_states = _S_free_per_thread_states -> __next;
+ return __result;
+ }
+ else {
+ return new _Pthread_alloc_per_thread_state;
+ }
+}
+
+_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_get_per_thread_state() {
+ int __ret_code;
+ __state_type* __result;
+
+ if (_S_key_initialized && (__result = (__state_type*) pthread_getspecific(_S_key)))
+ return __result;
+
+ /*REFERENCED*/
+ _M_lock __lock_instance; // Need to acquire lock here.
+ if (!_S_key_initialized) {
+ if (pthread_key_create(&_S_key, _S_destructor)) {
+ _STLP_THROW_BAD_ALLOC; // failed
+ }
+ _S_key_initialized = true;
+ }
+
+ __result = _S_new_per_thread_state();
+ __ret_code = pthread_setspecific(_S_key, __result);
+ if (__ret_code) {
+ if (__ret_code == ENOMEM) {
+ _STLP_THROW_BAD_ALLOC;
+ } else {
+ // EINVAL
+ _STLP_ABORT();
+ }
+ }
+ return __result;
+}
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+char *_Pthread_alloc_impl::_S_chunk_alloc(size_t __p_size, size_t &__nobjs, _Pthread_alloc_per_thread_state *__a) {
+ typedef _Pthread_alloc_obj __obj;
+ {
+ char * __result;
+ size_t __total_bytes;
+ size_t __bytes_left;
+ /*REFERENCED*/
+ _M_lock __lock_instance; // Acquire lock for this routine
+
+ __total_bytes = __p_size * __nobjs;
+ __bytes_left = _S_end_free - _S_start_free;
+ if (__bytes_left >= __total_bytes) {
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ } else if (__bytes_left >= __p_size) {
+ __nobjs = __bytes_left/__p_size;
+ __total_bytes = __p_size * __nobjs;
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ } else {
+ size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size);
+ // Try to make use of the left-over piece.
+ if (__bytes_left > 0) {
+ __obj * volatile * __my_free_list = __a->__free_list + _S_freelist_index(__bytes_left);
+ ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
+ *__my_free_list = (__obj *)_S_start_free;
+ }
+# ifdef _SGI_SOURCE
+ // Try to get memory that's aligned on something like a
+ // cache line boundary, so as to avoid parceling out
+ // parts of the same line to different threads and thus
+ // possibly different processors.
+ {
+ const int __cache_line_size = 128; // probable upper bound
+ __bytes_to_get &= ~(__cache_line_size-1);
+ _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
+ if (0 == _S_start_free) {
+ _S_start_free = (char *)__malloc_alloc::allocate(__bytes_to_get);
+ }
+ }
+# else /* !SGI_SOURCE */
+ _S_start_free = (char *)__malloc_alloc::allocate(__bytes_to_get);
+# endif
+ _S_heap_size += __bytes_to_get >> 4;
+ _S_end_free = _S_start_free + __bytes_to_get;
+ }
+ }
+ // lock is released here
+ return _S_chunk_alloc(__p_size, __nobjs, __a);
+}
+
+
+/* n must be > 0 */
+void *_Pthread_alloc_impl::allocate(size_t& __n) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+ __state_type* __a;
+
+ if (__n > _MAX_BYTES) {
+ return __malloc_alloc::allocate(__n);
+ }
+
+ __n = _S_round_up(__n);
+ __a = _S_get_per_thread_state();
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __result = *__my_free_list;
+ if (__result == 0) {
+ void *__r = __a->_M_refill(__n);
+ return __r;
+ }
+ *__my_free_list = __result->__free_list_link;
+ return __result;
+};
+
+/* p may not be 0 */
+void _Pthread_alloc_impl::deallocate(void *__p, size_t __n) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj *__q = (__obj *)__p;
+ __obj * volatile * __my_free_list;
+ __state_type* __a;
+
+ if (__n > _MAX_BYTES) {
+ __malloc_alloc::deallocate(__p, __n);
+ return;
+ }
+
+ __a = _S_get_per_thread_state();
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __q -> __free_list_link = *__my_free_list;
+ *__my_free_list = __q;
+}
+
+// boris : versions for per_thread_allocator
+/* n must be > 0 */
+void *_Pthread_alloc_impl::allocate(size_t& __n, __state_type* __a) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+
+ if (__n > _MAX_BYTES) {
+ return __malloc_alloc::allocate(__n);
+ }
+ __n = _S_round_up(__n);
+
+ // boris : here, we have to lock per thread state, as we may be getting memory from
+ // different thread pool.
+ _STLP_auto_lock __lock(__a->_M_lock);
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __result = *__my_free_list;
+ if (__result == 0) {
+ void *__r = __a->_M_refill(__n);
+ return __r;
+ }
+ *__my_free_list = __result->__free_list_link;
+ return __result;
+};
+
+/* p may not be 0 */
+void _Pthread_alloc_impl::deallocate(void *__p, size_t __n, __state_type* __a) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj *__q = (__obj *)__p;
+ __obj * volatile * __my_free_list;
+
+ if (__n > _MAX_BYTES) {
+ __malloc_alloc::deallocate(__p, __n);
+ return;
+ }
+
+ // boris : here, we have to lock per thread state, as we may be returning memory from
+ // different thread.
+ _STLP_auto_lock __lock(__a->_M_lock);
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __q -> __free_list_link = *__my_free_list;
+ *__my_free_list = __q;
+}
+
+void *_Pthread_alloc_impl::reallocate(void *__p, size_t __old_sz, size_t& __new_sz) {
+ void * __result;
+ size_t __copy_sz;
+
+ if (__old_sz > _MAX_BYTES && __new_sz > _MAX_BYTES) {
+ return realloc(__p, __new_sz);
+ }
+
+ if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return __p;
+ __result = allocate(__new_sz);
+ __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
+ memcpy(__result, __p, __copy_sz);
+ deallocate(__p, __old_sz);
+ return __result;
+}
+
+_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_free_per_thread_states = 0;
+pthread_key_t _Pthread_alloc_impl::_S_key = 0;
+_STLP_STATIC_MUTEX _Pthread_alloc_impl::_S_chunk_allocator_lock _STLP_MUTEX_INITIALIZER;
+bool _Pthread_alloc_impl::_S_key_initialized = false;
+char *_Pthread_alloc_impl::_S_start_free = 0;
+char *_Pthread_alloc_impl::_S_end_free = 0;
+size_t _Pthread_alloc_impl::_S_heap_size = 0;
+
+void * _STLP_CALL _Pthread_alloc::allocate(size_t& __n)
+{ return _Pthread_alloc_impl::allocate(__n); }
+void _STLP_CALL _Pthread_alloc::deallocate(void *__p, size_t __n)
+{ _Pthread_alloc_impl::deallocate(__p, __n); }
+void * _STLP_CALL _Pthread_alloc::allocate(size_t& __n, __state_type* __a)
+{ return _Pthread_alloc_impl::allocate(__n, __a); }
+void _STLP_CALL _Pthread_alloc::deallocate(void *__p, size_t __n, __state_type* __a)
+{ _Pthread_alloc_impl::deallocate(__p, __n, __a); }
+void * _STLP_CALL _Pthread_alloc::reallocate(void *__p, size_t __old_sz, size_t& __new_sz)
+{ return _Pthread_alloc_impl::reallocate(__p, __old_sz, __new_sz); }
+_Pthread_alloc_per_thread_state* _STLP_CALL _Pthread_alloc::_S_get_per_thread_state()
+{ return _Pthread_alloc_impl::_S_get_per_thread_state(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef _S_FREELIST_INDEX
diff --git a/build/stlport/src/bitset.cpp b/build/stlport/src/bitset.cpp
new file mode 100644
index 000000000..90f179915
--- /dev/null
+++ b/build/stlport/src/bitset.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <bitset>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// ------------------------------------------------------------
+// Lookup tables for find and count operations.
+
+size_t _Bs_G::_S_count(const unsigned char *__first,
+ const unsigned char *__last)
+{
+ static const unsigned char _bit_count[256] = {
+ 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
+ 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
+ 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
+ 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */
+ 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */
+ 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */
+ 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */
+ 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */
+ 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */
+ 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */
+ 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */
+ 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */
+ 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */
+ 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */
+ 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */
+ 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */
+ 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */
+ 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */
+ 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */
+ 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */
+ 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */
+ 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */
+ 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */
+ 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */
+ 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */
+ 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */
+ 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */
+ 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */
+ 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */
+ 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */
+ 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */
+ 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */
+ 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */
+ 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */
+ 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */
+ 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */
+ 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */
+ 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */
+ 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */
+ 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */
+ 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */
+ 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */
+ 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */
+ 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */
+ 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */
+ 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */
+ 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */
+ 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */
+ 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */
+ 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
+ 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
+ 8 /* 255 */
+ };
+
+ size_t __result(0);
+ while ( __first < __last ) {
+ __result += _bit_count[*(__first++)];
+ }
+ return __result;
+}
+
+unsigned char _Bs_G::_S_first_one(unsigned char __byte)
+{
+ static const unsigned char _first_one[256] = {
+ 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
+ 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
+ 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
+ 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */
+ 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */
+ 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */
+ 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */
+ 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */
+ 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */
+ 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */
+ 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */
+ 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */
+ 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */
+ 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */
+ 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */
+ 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */
+ 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */
+ 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */
+ 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */
+ 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */
+ 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */
+ 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */
+ 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */
+ 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */
+ 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */
+ 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */
+ 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */
+ 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */
+ 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */
+ 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */
+ 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */
+ 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */
+ 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */
+ 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */
+ 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */
+ 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */
+ 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */
+ 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */
+ 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */
+ 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */
+ 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */
+ 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */
+ 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */
+ 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */
+ 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */
+ 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */
+ 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */
+ 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */
+ 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */
+ 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
+ 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
+ 0, /* 255 */
+ };
+ return _first_one[__byte];
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/c_locale.c b/build/stlport/src/c_locale.c
new file mode 100644
index 000000000..376e22e49
--- /dev/null
+++ b/build/stlport/src/c_locale.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include "c_locale.h"
+
+#if defined (_STLP_WIN32) && !defined (_STLP_WCE)
+# include "c_locale_win32/c_locale_win32.c"
+#elif defined (_STLP_USE_GLIBC2_LOCALIZATION)
+# include "c_locale_glibc/c_locale_glibc2.c" /* glibc 2.2 and newer */
+#else
+# include "c_locale_dummy/c_locale_dummy.c"
+#endif
diff --git a/build/stlport/src/c_locale.h b/build/stlport/src/c_locale.h
new file mode 100644
index 000000000..36d996112
--- /dev/null
+++ b/build/stlport/src/c_locale.h
@@ -0,0 +1,450 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * It is impossible to write the C++ locale library in terms of locales
+ * as defined in the C standard. Instead, we write the C++ locale and I/O
+ * library in terms of a low level C-like interface. This file defines
+ * that interface.
+ *
+ * The low-level locale interface can't be written portably; there
+ * must be a version of it for each platform that the C++ library
+ * is ported to. On many systems this interface may be a thin wrapper
+ * for existing functionality.
+ */
+
+#ifndef _STLP_C_LOCALE_IMPL_H
+#define _STLP_C_LOCALE_IMPL_H
+
+#include "stlport_prefix.h"
+
+#include <wchar.h> /* for mbstate_t */
+#include <stl/c_locale.h>
+
+struct _Locale_name_hint;
+
+#if defined (_GNU_SOURCE) && defined (__GLIBC__) && \
+ ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
+# define _STLP_USE_GLIBC2_LOCALIZATION
+# include <nl_types.h>
+typedef nl_catd nl_catd_type;
+#else
+typedef int nl_catd_type;
+#endif
+
+/*
+ * A number: the maximum length of a simple locale name.
+ * (i.e. a name like like en_US, as opposed to a name like
+ * en_US/de_AT/de_AT/es_MX/en_US/en_US) */
+#define _Locale_MAX_SIMPLE_NAME 256
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Typedefs:
+ */
+typedef unsigned short int _Locale_mask_t;
+
+/* Function called during STLport library load phase. Might contain any
+ * code necessary to the platform localization layer.
+ */
+void _Locale_init(void);
+
+/* Function called during STLport library unload. Might contain any
+ * code necessary to the platform localization layer.
+ */
+void _Locale_final(void);
+
+/* Create a category of the locale with the given name.
+ *
+ * The char* argument is a simple (not a composite) locale name, which may
+ * neither be an empty string nor a null pointer.
+ *
+ * These functions return NULL to indicate failure. Failure reason should be reported
+ * using the __err_code pointer.
+ */
+struct _Locale_ctype* _Locale_ctype_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_codecvt* _Locale_codecvt_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_numeric* _Locale_numeric_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_time* _Locale_time_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_collate* _Locale_collate_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_monetary* _Locale_monetary_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_messages* _Locale_messages_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+
+/* Give error reason on failure of one of the _Locale_*_create functions. Available
+ * reasons are:
+ * 0: No specific error reason has been reported.
+ * 1: No platform support for the given facet.
+ * 2: Unknown locale name
+ * 3: No platform API for localization support.
+ * 4: No more memory
+ */
+#define _STLP_LOC_UNDEFINED 0
+#define _STLP_LOC_UNSUPPORTED_FACET_CATEGORY 1
+#define _STLP_LOC_UNKNOWN_NAME 2
+#define _STLP_LOC_NO_PLATFORM_SUPPORT 3
+#define _STLP_LOC_NO_MEMORY 4
+
+/* Release a category of a locale
+ *
+ * These functions are used to release a category acquired with the
+ * according _Locale_*_create() functions.
+ */
+void _Locale_ctype_destroy(struct _Locale_ctype *);
+void _Locale_codecvt_destroy(struct _Locale_codecvt *);
+void _Locale_numeric_destroy(struct _Locale_numeric *);
+void _Locale_time_destroy(struct _Locale_time *);
+void _Locale_collate_destroy(struct _Locale_collate *);
+void _Locale_monetary_destroy(struct _Locale_monetary *);
+void _Locale_messages_destroy(struct _Locale_messages *);
+
+/*
+ * Returns the name of the user's default locale in each
+ * category, as a null-terminated string. A NULL value
+ * means the default "C" locale.
+ */
+const char * _Locale_ctype_default(char * __buf);
+const char * _Locale_numeric_default(char * __buf);
+const char * _Locale_time_default(char * __buf);
+const char * _Locale_collate_default(char * __buf);
+const char * _Locale_monetary_default(char * __buf);
+const char * _Locale_messages_default(char * __buf);
+
+/* Retrieve the name of the given category
+ *
+ * __buf points to a buffer that can hold at least _Locale_MAX_SIMPLE_NAME
+ * characters. These functions store the name, as a null-terminated
+ * string, in __buf. This function can't fail, at worst name is truncated.
+ */
+char const* _Locale_ctype_name(const struct _Locale_ctype *, char* __buf);
+char const* _Locale_codecvt_name(const struct _Locale_codecvt *, char* __buf);
+char const* _Locale_numeric_name(const struct _Locale_numeric *, char* __buf);
+char const* _Locale_time_name(const struct _Locale_time *, char* __buf);
+char const* _Locale_collate_name(const struct _Locale_collate *, char* __buf);
+char const* _Locale_monetary_name(const struct _Locale_monetary *, char* __buf);
+char const* _Locale_messages_name(const struct _Locale_messages *, char* __buf);
+
+/*
+ * cname is a (possibly composite) locale name---i.e. a name that can
+ * be passed to setlocale. __buf points to an array large enough to
+ * store at least _Locale_MAX_SIMPLE_NAME characters, and each of these
+ * functions extracts the name of a single category, stores it in buf
+ * as a null-terminated string, and returns buf.
+ */
+char const* _Locale_extract_ctype_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_numeric_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_time_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_collate_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_monetary_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_messages_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+
+/* Functions to improve locale creation process. For some locale API (Win32)
+ * you need to find a locale identification from the name which can be a
+ * rather expensive operation especially if you do so for all facets of a
+ * locale. Those functions can be used to extract from a API dependent facet
+ * struct the information necessary to skip this lookup process for other
+ * facets creation. If not supported those function should return NULL.
+ */
+struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype*);
+struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric*);
+struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time*);
+struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate*);
+struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary*);
+struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages*);
+
+/*
+ * FUNCTIONS THAT USE CTYPE
+ */
+
+/*
+ * Narrow character functions:
+ */
+
+/*
+ * Returns a pointer to the beginning of the ctype table. The table is
+ * at least 257 bytes long; if p is the pointer returned by this
+ * function, then p[c] is valid if c is EOF or if p is any value of
+ * type unsigned char.
+ */
+const _Locale_mask_t * _Locale_ctype_table(struct _Locale_ctype *);
+
+/*
+ * c is either EOF, or an unsigned char value.
+ */
+int _Locale_toupper(struct _Locale_ctype *, int /* c */);
+int _Locale_tolower(struct _Locale_ctype *, int /* c */);
+
+
+#ifndef _STLP_NO_WCHAR_T
+/*
+ * Wide character functions:
+ */
+_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *, wint_t, _Locale_mask_t);
+wint_t _WLocale_tolower(struct _Locale_ctype *, wint_t);
+wint_t _WLocale_toupper(struct _Locale_ctype *, wint_t);
+
+/*
+ * Multibyte functions:
+ */
+
+/*
+ * Returns the number of bytes of the longest allowed multibyte
+ * character in the current encoding.
+ */
+int _WLocale_mb_cur_max(struct _Locale_codecvt *);
+
+/*
+ * Returns the number of bytes of the shortest allowed multibyte
+ * character in the current encoding.
+ */
+int _WLocale_mb_cur_min(struct _Locale_codecvt *);
+
+/*
+ * Returns 1 if the current multibyte encoding is stateless
+ * and does not require the use of an mbstate_t value.
+ */
+int _WLocale_is_stateless(struct _Locale_codecvt *);
+
+/*
+ * Almost identical to mbrtowc, from 4.6.5.3.2 of NA1. The only
+ * important difference is that mbrtowc treats null wide characters
+ * as special, and we don't. Specifically: examines the characters
+ * in [from, from + n), extracts a single wide character, and stores
+ * it in *to. Modifies shift_state if appropriate. The return value,
+ * which is always positive, is the number of characters extracted from
+ * the input sequence. Return value is (size_t) -1 if there was an
+ * encoding error in the input sequence, and (size_t) -2 if
+ * [from, from + n) is correct but not complete. None of the pointer
+ * arguments may be null pointers.
+ */
+size_t _WLocale_mbtowc(struct _Locale_codecvt *,
+ wchar_t * /* to */,
+ const char * /* from */, size_t /* n */,
+ mbstate_t *);
+
+/*
+ * Again, very similar to wcrtomb. The differences are that (1) it
+ * doesn't treat null characters as special; and (2) it stores at most
+ * n characters. Converts c to a multibyte sequence, stores that
+ * sequence in the array 'to', and returns the length of the sequence.
+ * Modifies shift_state if appropriate. The return value is (size_t) -1
+ * if c is not a valid wide character, and (size_t) -2 if the length of
+ * the multibyte character sequence is greater than n.
+ */
+size_t _WLocale_wctomb(struct _Locale_codecvt *,
+ char *, size_t,
+ const wchar_t,
+ mbstate_t *);
+
+/*
+ * Inserts whatever characters are necessary to restore st to an
+ * initial shift state. Sets *next to buf + m, where m is the number
+ * of characters inserted. (0 <= m <= n.) Returns m to indicate
+ * success, (size_t) -1 to indicate error, (size_t) -2 to indicate
+ * partial success (more than n characters needed). For success or partial
+ * success, sets *next to buf + m.
+ */
+size_t _WLocale_unshift(struct _Locale_codecvt *,
+ mbstate_t *,
+ char *, size_t, char **);
+#endif
+
+/*
+ * FUNCTIONS THAT USE COLLATE
+ */
+
+/*
+ * Compares the two sequences [s1, s1 + n1) and [s2, s2 + n2). Neither
+ * sequence is assumed to be null-terminated, and null characters
+ * aren't special. If the two sequences are the same up through
+ * min(n1, n2), then the sequence that compares less is whichever one
+ * is shorter.
+ */
+int _Locale_strcmp(struct _Locale_collate *,
+ const char * /* s1 */, size_t /* n1 */,
+ const char * /* s2 */, size_t /* n2 */);
+#ifndef _STLP_NO_WCHAR_T
+int _WLocale_strcmp(struct _Locale_collate *,
+ const wchar_t * /* s1 */, size_t /* n1 */,
+ const wchar_t * /* s2 */, size_t /* n2 */);
+#endif
+
+/*
+ * Creates a transformed version of the string [s2, s2 + n2). The
+ * string may contain embedded null characters; nulls aren't special.
+ * The transformed string begins at s1, and contains at most n1
+ * characters. The return value is the length of the transformed
+ * string. If the return value is greater than n1 then this is an
+ * error condition: it indicates that there wasn't enough space. In
+ * that case, the contents of [s1, s1 + n1) is unspecified.
+*/
+size_t _Locale_strxfrm(struct _Locale_collate *,
+ char * /* s1 */, size_t /* n1 */,
+ const char * /* s2 */, size_t /* n2 */);
+
+#ifndef _STLP_NO_WCHAR_T
+size_t _WLocale_strxfrm(struct _Locale_collate *,
+ wchar_t * /* s1 */, size_t /* n1 */,
+ const wchar_t * /* s2 */, size_t /* n2 */);
+#endif
+
+
+/*
+ * FUNCTIONS THAT USE NUMERIC
+ */
+
+/*
+ * Equivalent to the first three fields in struct lconv. (C standard,
+ * section 7.4.)
+ */
+char _Locale_decimal_point(struct _Locale_numeric *);
+char _Locale_thousands_sep(struct _Locale_numeric *);
+const char * _Locale_grouping(struct _Locale_numeric *);
+
+#ifndef _STLP_NO_WCHAR_T
+wchar_t _WLocale_decimal_point(struct _Locale_numeric *);
+wchar_t _WLocale_thousands_sep(struct _Locale_numeric *);
+#endif
+
+/*
+ * Return "true" and "false" in English locales, and something
+ * appropriate in non-English locales.
+ */
+const char * _Locale_true(struct _Locale_numeric *);
+const char * _Locale_false(struct _Locale_numeric *);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_true(struct _Locale_numeric *, wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_false(struct _Locale_numeric *, wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * FUNCTIONS THAT USE MONETARY
+ */
+
+/*
+ * Return the obvious fields of struct lconv.
+ */
+const char * _Locale_int_curr_symbol(struct _Locale_monetary *);
+const char * _Locale_currency_symbol(struct _Locale_monetary *);
+char _Locale_mon_decimal_point(struct _Locale_monetary *);
+char _Locale_mon_thousands_sep(struct _Locale_monetary *);
+const char * _Locale_mon_grouping(struct _Locale_monetary *);
+const char * _Locale_positive_sign(struct _Locale_monetary *);
+const char * _Locale_negative_sign(struct _Locale_monetary *);
+char _Locale_int_frac_digits(struct _Locale_monetary *);
+char _Locale_frac_digits(struct _Locale_monetary *);
+int _Locale_p_cs_precedes(struct _Locale_monetary *);
+int _Locale_p_sep_by_space(struct _Locale_monetary *);
+int _Locale_p_sign_posn(struct _Locale_monetary *);
+int _Locale_n_cs_precedes(struct _Locale_monetary *);
+int _Locale_n_sep_by_space(struct _Locale_monetary *);
+int _Locale_n_sign_posn(struct _Locale_monetary *);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_int_curr_symbol(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_currency_symbol(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary *);
+wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary *);
+const wchar_t * _WLocale_positive_sign(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_negative_sign(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * FUNCTIONS THAT USE TIME
+ */
+
+/*
+ * month is in the range [0, 12).
+ */
+const char * _Locale_full_monthname(struct _Locale_time *, int /* month */);
+const char * _Locale_abbrev_monthname(struct _Locale_time *, int /* month */);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_full_monthname(struct _Locale_time *, int /* month */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time *, int /* month */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * day is in the range [0, 7). Sunday is 0.
+ */
+const char * _Locale_full_dayofweek(struct _Locale_time *, int /* day */);
+const char * _Locale_abbrev_dayofweek(struct _Locale_time *, int /* day */);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_full_dayofweek(struct _Locale_time *, int /* day */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time *, int /* day */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+const char * _Locale_d_t_fmt(struct _Locale_time *);
+const char * _Locale_d_fmt(struct _Locale_time *);
+const char * _Locale_t_fmt(struct _Locale_time *);
+const char * _Locale_long_d_t_fmt(struct _Locale_time*);
+const char * _Locale_long_d_fmt(struct _Locale_time*);
+
+const char * _Locale_am_str(struct _Locale_time *);
+const char * _Locale_pm_str(struct _Locale_time *);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_am_str(struct _Locale_time *,
+ wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_pm_str(struct _Locale_time *,
+ wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * FUNCTIONS THAT USE MESSAGES
+ */
+
+/*
+ * Very similar to catopen, except that it uses the given message
+ * category to determine which catalog to open.
+ */
+nl_catd_type _Locale_catopen(struct _Locale_messages*, const char*);
+
+/* Complementary to _Locale_catopen.
+ * The catalog must be a value that was returned by a previous call
+ * to _Locale_catopen.
+ */
+void _Locale_catclose(struct _Locale_messages*, nl_catd_type);
+
+/*
+ * Returns a string, identified by a set index and a message index,
+ * from an opened message catalog. Returns the supplied default if
+ * no such string exists.
+ */
+const char * _Locale_catgets(struct _Locale_messages *, nl_catd_type,
+ int, int,const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _STLP_C_LOCALE_IMPL_H */
diff --git a/build/stlport/src/c_locale_dummy/c_locale_dummy.c b/build/stlport/src/c_locale_dummy/c_locale_dummy.c
new file mode 100644
index 000000000..01708ee9e
--- /dev/null
+++ b/build/stlport/src/c_locale_dummy/c_locale_dummy.c
@@ -0,0 +1,531 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* This is a "stub" implementation of the "c_locale.h" interface,
+ intended for operating systems where we have not yet written
+ a real implementation. A C++ library using this stub implementation
+ is still standard-conforming, since the C++ standard does not require
+ that any locales other than "C" be supported.
+*/
+
+#include <string.h>
+#include <wchar.h>
+#include <ctype.h>
+#include <wctype.h>
+#include <limits.h>
+
+#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C)
+# if !defined (_STLP_NO_WCHAR_T)
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C)
+# endif
+#else
+# define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C)
+# if !defined (_STLP_NO_WCHAR_T)
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C)
+# endif
+#endif
+
+static const char *_C_name = "C";
+static const char *_empty_str = "";
+#ifndef _STLP_NO_WCHAR_T
+#if defined(WCHAR_MAX) && WCHAR_MAX == 255
+static const wchar_t *_empty_wstr = "";
+#else
+static const wchar_t *_empty_wstr = L"";
+#endif
+#endif
+
+static _Locale_mask_t ctable[256];
+
+/* Framework functions */
+
+void _Locale_init(void) {
+ /* Ctype table for the ASCII character set. */
+ char c;
+ /* We might never reach 128 when char is signed. */
+ for (c = 0; /* c != 128 */; ++c) {
+ if (isalpha(c)) ctable[(unsigned char)c] |= _Locale_ALPHA;
+ if (iscntrl(c)) ctable[(unsigned char)c] |= _Locale_CNTRL;
+ if (isdigit(c)) ctable[(unsigned char)c] |= _Locale_DIGIT;
+ if (isprint(c)) ctable[(unsigned char)c] |= _Locale_PRINT;
+ if (ispunct(c)) ctable[(unsigned char)c] |= _Locale_PUNCT;
+ if (isspace(c)) ctable[(unsigned char)c] |= _Locale_SPACE;
+ if (isxdigit(c)) ctable[(unsigned char)c] |= _Locale_XDIGIT;
+ if (isupper(c)) ctable[(unsigned char)c] |= _Locale_UPPER;
+ if (islower(c)) ctable[(unsigned char)c] |= _Locale_LOWER;
+ if (c == 127) break;
+ }
+
+ /* ASCII is a 7-bit code, so everything else is non-ASCII. */
+ memset(&(ctable[128]), 0, 128 * sizeof(_Locale_mask_t));
+}
+
+void _Locale_final(void)
+{}
+
+void* _Locale_create(const char* name, int *__err_code) {
+ if (name[0] == 'C' && name[1] == 0)
+ { return (void*)0x1; }
+ *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
+}
+
+struct _Locale_ctype* _Locale_ctype_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_ctype*)_Locale_create(name, __err_code); }
+
+struct _Locale_codecvt* _Locale_codecvt_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_codecvt*)_Locale_create(name, __err_code); }
+
+struct _Locale_numeric* _Locale_numeric_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_numeric*)_Locale_create(name, __err_code); }
+
+struct _Locale_time* _Locale_time_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_time*)_Locale_create(name, __err_code); }
+
+struct _Locale_collate* _Locale_collate_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_collate*)_Locale_create(name, __err_code); }
+
+struct _Locale_monetary* _Locale_monetary_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_monetary*)_Locale_create(name, __err_code); }
+
+struct _Locale_messages* _Locale_messages_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_messages*)_Locale_create(name, __err_code); }
+
+const char *_Locale_ctype_default(char* buf) { return _C_name; }
+const char *_Locale_numeric_default(char * buf) { return _C_name; }
+const char *_Locale_time_default(char* buf) { return _C_name; }
+const char *_Locale_collate_default(char* buf) { return _C_name; }
+const char *_Locale_monetary_default(char* buf) { return _C_name; }
+const char *_Locale_messages_default(char* buf) { return _C_name; }
+
+char const* _Locale_ctype_name(const struct _Locale_ctype *lctype, char* buf)
+{ return _C_name; }
+
+char const* _Locale_codecvt_name(const struct _Locale_codecvt *lcodecvt, char* buf)
+{ return _C_name; }
+
+char const* _Locale_numeric_name(const struct _Locale_numeric *lnum, char* buf)
+{ return _C_name; }
+
+char const* _Locale_time_name(const struct _Locale_time *ltime, char* buf)
+{ return _C_name; }
+
+char const* _Locale_collate_name(const struct _Locale_collate *lcol, char* buf)
+{ return _C_name; }
+
+char const* _Locale_monetary_name(const struct _Locale_monetary *lmon, char* buf)
+{ return _C_name; }
+
+char const* _Locale_messages_name(const struct _Locale_messages *lmes, char* buf)
+{ return _C_name; }
+
+void _Locale_ctype_destroy(struct _Locale_ctype *lctype) {}
+void _Locale_codecvt_destroy(struct _Locale_codecvt *lcodecvt) {}
+void _Locale_numeric_destroy(struct _Locale_numeric *lnum) {}
+void _Locale_time_destroy(struct _Locale_time *ltime) {}
+void _Locale_collate_destroy(struct _Locale_collate *lcol) {}
+void _Locale_monetary_destroy(struct _Locale_monetary *lmon) {}
+void _Locale_messages_destroy(struct _Locale_messages *lmes) {}
+
+static char const* _Locale_extract_name(const char* name, int *__err_code) {
+ // When the request is the default locale or the "C" locale we answer "C".
+ if (name[0] == 0 ||
+ (name[0] == 'C' && name[1] == 0))
+ { return _C_name; }
+ *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
+}
+
+char const* _Locale_extract_ctype_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_numeric_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_time_name(const char*name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_collate_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_monetary_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_messages_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
+{ return 0; }
+
+/* ctype */
+const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lctype)
+ return ctable;
+}
+
+int _Locale_toupper(struct _Locale_ctype*lctype, int c)
+{ return toupper(c); }
+
+int _Locale_tolower(struct _Locale_ctype*lctype, int c)
+{ return tolower(c); }
+
+#ifndef _STLP_NO_WCHAR_T
+_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *lctype, wint_t wc, _Locale_mask_t mask) {
+ _Locale_mask_t ret = 0;
+ if ((mask & _Locale_ALPHA) != 0 && iswalpha(wc))
+ ret |= _Locale_ALPHA;
+
+ if ((mask & _Locale_CNTRL) != 0 && iswcntrl(wc))
+ ret |= _Locale_CNTRL;
+
+ if ((mask & _Locale_DIGIT) != 0 && iswdigit(wc))
+ ret |= _Locale_DIGIT;
+
+ if ((mask & _Locale_PRINT) != 0 && iswprint(wc))
+ ret |= _Locale_PRINT;
+
+ if ((mask & _Locale_PUNCT) != 0 && iswpunct(wc))
+ ret |= _Locale_PUNCT;
+
+ if ((mask & _Locale_SPACE) != 0 && iswspace(wc))
+ ret |= _Locale_SPACE;
+
+ if ((mask & _Locale_XDIGIT) != 0 && iswxdigit(wc))
+ ret |= _Locale_XDIGIT;
+
+ if ((mask & _Locale_UPPER) != 0 && iswupper(wc))
+ ret |= _Locale_UPPER;
+
+ if ((mask & _Locale_LOWER) != 0 && iswlower(wc))
+ ret |= _Locale_LOWER;
+
+ return ret;
+}
+
+wint_t _WLocale_tolower(struct _Locale_ctype *lctype, wint_t wc)
+{ return towlower(wc); }
+
+wint_t _WLocale_toupper(struct _Locale_ctype *lctype, wint_t wc)
+{ return towupper(wc); }
+
+int _WLocale_mb_cur_max (struct _Locale_codecvt *lcodecvt) { return 1; }
+int _WLocale_mb_cur_min (struct _Locale_codecvt *lcodecvt) { return 1; }
+int _WLocale_is_stateless (struct _Locale_codecvt *lcodecvt) { return 1; }
+
+size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt,
+ wchar_t *to,
+ const char *from, size_t n,
+ mbstate_t *st)
+{ *to = *from; return 1; }
+
+size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt,
+ char *to, size_t n,
+ const wchar_t c,
+ mbstate_t *st)
+{ *to = (char)c; return 1; }
+
+size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt,
+ mbstate_t *st,
+ char *buf, size_t n, char ** next)
+{ *next = buf; return 0; }
+#endif
+
+/* Collate */
+ int _Locale_strcmp(struct _Locale_collate* lcol,
+ const char* s1, size_t n1, const char* s2, size_t n2) {
+ int ret = 0;
+ char buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ _STLP_STRNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
+ _STLP_STRNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = strcmp(buf1, buf2);
+ if (ret != 0) return ret < 0 ? -1 : 1;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+
+int _WLocale_strcmp(struct _Locale_collate* lcol,
+ const wchar_t* s1, size_t n1, const wchar_t* s2, size_t n2) {
+ int ret = 0;
+ wchar_t buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ _STLP_WCSNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
+ _STLP_WCSNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = wcscmp(buf1, buf2);
+ if (ret != 0) return ret < 0 ? -1 : 1;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
+}
+
+#endif
+
+size_t _Locale_strxfrm(struct _Locale_collate* lcol,
+ char* dest, size_t dest_n,
+ const char* src, size_t src_n) {
+ if (dest != 0) {
+ _STLP_STRNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
+ }
+ return src_n;
+}
+
+#ifndef _STLP_NO_WCHAR_T
+
+size_t _WLocale_strxfrm(struct _Locale_collate* lcol,
+ wchar_t* dest, size_t dest_n,
+ const wchar_t* src, size_t src_n) {
+ if (dest != 0) {
+ _STLP_WCSNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
+ }
+ return src_n;
+}
+
+#endif
+
+/* Numeric */
+
+char _Locale_decimal_point(struct _Locale_numeric* lnum)
+{ return '.'; }
+char _Locale_thousands_sep(struct _Locale_numeric* lnum)
+{ return ','; }
+const char* _Locale_grouping(struct _Locale_numeric * lnum)
+{ return _empty_str; }
+const char * _Locale_true(struct _Locale_numeric * lnum)
+{ return "true"; }
+const char * _Locale_false(struct _Locale_numeric * lnum)
+{ return "false"; }
+
+#ifndef _STLP_NO_WCHAR_T
+wchar_t _WLocale_decimal_point(struct _Locale_numeric* lnum)
+{ return L'.'; }
+wchar_t _WLocale_thousands_sep(struct _Locale_numeric* lnum)
+{ return L','; }
+#if defined(WCHAR_MAX) && WCHAR_MAX == 255
+const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
+{ return "true"; }
+const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
+{ return "false"; }
+#else
+const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
+{ return L"true"; }
+const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
+{ return L"false"; }
+#endif
+#endif
+
+/* Monetary */
+
+const char* _Locale_int_curr_symbol(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+const char* _Locale_currency_symbol(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+char _Locale_mon_decimal_point(struct _Locale_monetary * lmon)
+{ return '.'; }
+char _Locale_mon_thousands_sep(struct _Locale_monetary * lmon)
+{ return ','; }
+const char* _Locale_mon_grouping(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+const char* _Locale_positive_sign(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+const char* _Locale_negative_sign(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+char _Locale_int_frac_digits(struct _Locale_monetary * lmon)
+{ return 0; }
+char _Locale_frac_digits(struct _Locale_monetary * lmon)
+{ return 0; }
+int _Locale_p_cs_precedes(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_p_sep_by_space(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_p_sign_posn(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_n_cs_precedes(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_n_sep_by_space(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_n_sign_posn(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t* _WLocale_int_curr_symbol(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+const wchar_t* _WLocale_currency_symbol(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * lmon)
+{ return L'.'; }
+wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * lmon)
+{ return L','; }
+const wchar_t* _WLocale_positive_sign(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+const wchar_t* _WLocale_negative_sign(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+#endif
+
+/* Time */
+static const char* full_monthname[] =
+{ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December" };
+const char * _Locale_full_monthname(struct _Locale_time * ltime, int n)
+{ return full_monthname[n]; }
+
+static const char* abbrev_monthname[] =
+{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+const char * _Locale_abbrev_monthname(struct _Locale_time * ltime, int n)
+{ return abbrev_monthname[n]; }
+
+static const char* full_dayname[] =
+{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
+const char * _Locale_full_dayofweek(struct _Locale_time * ltime, int n)
+{ return full_dayname[n]; }
+
+static const char* abbrev_dayname[] =
+{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+const char * _Locale_abbrev_dayofweek(struct _Locale_time * ltime, int n)
+{ return abbrev_dayname[n]; }
+
+const char* _Locale_d_t_fmt(struct _Locale_time* ltime)
+{ return "%m/%d/%y"; }
+const char* _Locale_d_fmt(struct _Locale_time* ltime)
+{ return "%m/%d/%y"; }
+const char* _Locale_t_fmt(struct _Locale_time* ltime)
+{ return "%H:%M:%S"; }
+const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime)
+{ return _empty_str; }
+const char* _Locale_long_d_fmt(struct _Locale_time* ltime)
+{ return _empty_str; }
+const char* _Locale_am_str(struct _Locale_time* ltime)
+{ return "AM"; }
+const char* _Locale_pm_str(struct _Locale_time* ltime)
+{ return "PM"; }
+
+#ifndef _STLP_NO_WCHAR_T
+#if defined(WCHAR_MAX) && WCHAR_MAX == 255
+static const wchar_t* full_wmonthname[] =
+{ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December" };
+const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return full_wmonthname[n]; }
+
+static const wchar_t* abbrev_wmonthname[] =
+{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return abbrev_wmonthname[n]; }
+
+static const wchar_t* full_wdayname[] =
+{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
+const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return full_wdayname[n]; }
+
+static const wchar_t* abbrev_wdayname[] =
+{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return abbrev_wdayname[n]; }
+
+const wchar_t* _WLocale_am_str(struct _Locale_time* ltime,
+ wchar_t* buf, size_t bufSize)
+{ return "AM"; }
+const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime,
+ wchar_t* buf, size_t bufSize)
+{ return "PM"; }
+#else /* WCHAR_MAX != 255 */
+static const wchar_t* full_wmonthname[] =
+{ L"January", L"February", L"March", L"April", L"May", L"June",
+ L"July", L"August", L"September", L"October", L"November", L"December" };
+const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return full_wmonthname[n]; }
+
+static const wchar_t* abbrev_wmonthname[] =
+{ L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
+ L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" };
+const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return abbrev_wmonthname[n]; }
+
+static const wchar_t* full_wdayname[] =
+{ L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday" };
+const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return full_wdayname[n]; }
+
+static const wchar_t* abbrev_wdayname[] =
+{ L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" };
+const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return abbrev_wdayname[n]; }
+
+const wchar_t* _WLocale_am_str(struct _Locale_time* ltime,
+ wchar_t* buf, size_t bufSize)
+{ return L"AM"; }
+const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime,
+ wchar_t* buf, size_t bufSize)
+{ return L"PM"; }
+#endif /* WCHAR_MAX != 255 */
+#endif
+
+/* Messages */
+
+nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* name)
+{ return -1; }
+void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {}
+const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat,
+ int setid, int msgid, const char *dfault)
+{ return dfault; }
diff --git a/build/stlport/src/c_locale_glibc/c_locale_glibc2.c b/build/stlport/src/c_locale_glibc/c_locale_glibc2.c
new file mode 100644
index 000000000..0cf8279d5
--- /dev/null
+++ b/build/stlport/src/c_locale_glibc/c_locale_glibc2.c
@@ -0,0 +1,705 @@
+#include <locale.h>
+#include <langinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include <string.h>
+#include <stdint.h>
+
+static const char *_empty_str = "";
+static const char *_C_name = "C";
+
+static wchar_t* _ToWChar(const char* buf, wchar_t *wbuf, size_t wbufSize) {
+ wchar_t *wcur = wbuf;
+ wchar_t *wend = wbuf + wbufSize - 1;
+ for (; wcur != wend && *buf != 0; ++buf, ++wcur)
+ *wcur = *buf;
+ *wcur = 0;
+ return wbuf;
+}
+
+#if 0
+struct _Locale_ctype
+{
+ locale_t __cloc;
+};
+
+struct _Locale_numeric
+{
+ locale_t __cloc;
+};
+
+struct _Locale_time
+{
+ locale_t __cloc;
+};
+
+struct _Locale_collate
+{
+ locale_t __cloc;
+};
+
+struct _Locale_monetary
+{
+ locale_t __cloc;
+};
+
+struct _Locale_messages
+{
+ locale_t __cloc;
+};
+#endif
+
+void _Locale_init()
+{}
+
+void _Locale_final()
+{}
+
+struct _Locale_ctype *_Locale_ctype_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_ctype*)newlocale(LC_CTYPE_MASK, nm, NULL);
+}
+
+struct _Locale_codecvt *_Locale_codecvt_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ // Glibc do not support multibyte manipulation for the moment, it simply implements "C".
+ if (nm[0] == 'C' && nm[1] == 0)
+ { return (struct _Locale_codecvt*)0x01; }
+ *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
+}
+
+struct _Locale_numeric *_Locale_numeric_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_numeric*)newlocale(LC_NUMERIC_MASK, nm, NULL);
+}
+
+struct _Locale_time *_Locale_time_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_time*)newlocale(LC_TIME_MASK, nm, NULL);
+}
+
+struct _Locale_collate *_Locale_collate_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_collate*)newlocale(LC_COLLATE_MASK, nm, NULL);
+}
+
+struct _Locale_monetary *_Locale_monetary_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_monetary*)newlocale(LC_MONETARY_MASK, nm, NULL);
+}
+
+struct _Locale_messages *_Locale_messages_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_messages*)newlocale(LC_MESSAGES_MASK, nm, NULL);
+}
+
+/*
+ try to see locale category LC should be used from environment;
+ according POSIX, the order is
+ 1. LC_ALL
+ 2. category (LC_CTYPE, LC_NUMERIC, ... )
+ 3. LANG
+ If set nothing, return "C" (this really implementation-specific).
+*/
+static const char *_Locale_aux_default( const char *LC, char *nm )
+{
+ char *name = getenv( "LC_ALL" );
+
+ if ( name != NULL && *name != 0 ) {
+ return name;
+ }
+ name = getenv( LC );
+ if ( name != NULL && *name != 0 ) {
+ return name;
+ }
+ name = getenv( "LANG" );
+ if ( name != NULL && *name != 0 ) {
+ return name;
+ }
+
+ return _C_name;
+}
+
+const char *_Locale_ctype_default( char *nm )
+{
+ return _Locale_aux_default( "LC_CTYPE", nm );
+}
+
+const char *_Locale_numeric_default( char *nm )
+{
+ return _Locale_aux_default( "LC_NUMERIC", nm );
+}
+
+const char *_Locale_time_default( char *nm )
+{
+ return _Locale_aux_default( "LC_TIME", nm );
+}
+
+const char *_Locale_collate_default( char *nm )
+{
+ return _Locale_aux_default( "LC_COLLATE", nm );
+}
+
+const char *_Locale_monetary_default( char *nm )
+{
+ return _Locale_aux_default( "LC_MONETARY", nm );
+}
+
+const char *_Locale_messages_default( char *nm )
+{
+ return _Locale_aux_default( "LC_MESSAGES", nm );
+}
+
+char const*_Locale_ctype_name( const struct _Locale_ctype *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_CTYPE];
+}
+
+char const*_Locale_codecvt_name( const struct _Locale_codecvt *__loc, char *buf )
+{
+ return _C_name;
+}
+
+char const*_Locale_numeric_name( const struct _Locale_numeric *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_NUMERIC];
+}
+
+char const*_Locale_time_name( const struct _Locale_time *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_TIME];
+}
+
+char const*_Locale_collate_name( const struct _Locale_collate *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_COLLATE];
+}
+
+char const*_Locale_monetary_name( const struct _Locale_monetary *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_MONETARY];
+}
+
+char const*_Locale_messages_name( const struct _Locale_messages *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_MESSAGES];
+}
+
+void _Locale_ctype_destroy( struct _Locale_ctype *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_codecvt_destroy( struct _Locale_codecvt *__loc )
+{}
+
+void _Locale_numeric_destroy( struct _Locale_numeric *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_time_destroy( struct _Locale_time *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_collate_destroy( struct _Locale_collate *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_monetary_destroy( struct _Locale_monetary *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_messages_destroy( struct _Locale_messages* __loc )
+{ freelocale((locale_t)__loc); }
+
+/*
+ * locale loc expected either locale name indeed (platform-specific)
+ * or string like "LC_CTYPE=LocaleNameForCType;LC_NUMERIC=LocaleNameForNum;"
+ *
+ */
+
+static char const*__Extract_locale_name( const char *loc, const char *category, char *buf )
+{
+ char *expr;
+ size_t len_name;
+
+ if( loc[0]=='L' && loc[1]=='C' && loc[2]=='_') {
+ expr = strstr( (char*)loc, category );
+ if ( expr == NULL )
+ return NULL; /* Category not found. */
+ ++expr;
+ len_name = strcspn( expr, ";" );
+ len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1 : len_name;
+ strncpy( buf, expr, len_name );
+ buf[len_name] = 0;
+ return buf;
+ }
+ return loc;
+}
+
+char const*_Locale_extract_ctype_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_CTYPE=", buf ); }
+
+char const*_Locale_extract_numeric_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_NUMERIC=", buf ); }
+
+char const*_Locale_extract_time_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_TIME=", buf ); }
+
+char const*_Locale_extract_collate_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_COLLATE=", buf ); }
+
+char const*_Locale_extract_monetary_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_MONETARY=", buf ); }
+
+char const*_Locale_extract_messages_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_MESSAGES=", buf ); }
+
+struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
+{ return 0; }
+
+/* ctype */
+
+const _Locale_mask_t *_Locale_ctype_table( struct _Locale_ctype *__loc )
+{
+ /* return table with masks (upper, lower, alpha, etc.) */
+ _STLP_STATIC_ASSERT( sizeof(_Locale_mask_t) == sizeof(((locale_t)__loc)->__ctype_b[0]) )
+ return ((locale_t)__loc)->__ctype_b;
+}
+
+int _Locale_toupper( struct _Locale_ctype *__loc, int c )
+{ return ((locale_t)__loc)->__ctype_toupper[c]; }
+
+int _Locale_tolower( struct _Locale_ctype *__loc, int c )
+{ return ((locale_t)__loc)->__ctype_tolower[c]; }
+
+#if !defined (_STLP_NO_WCHAR_T)
+_Locale_mask_t _WLocale_ctype( struct _Locale_ctype *__loc, wint_t wc, _Locale_mask_t __mask )
+{
+ _Locale_mask_t ret = 0;
+ if ((__mask & _Locale_ALPHA) != 0 && iswalpha_l(wc, (locale_t)__loc))
+ ret |= _Locale_ALPHA;
+
+ if ((__mask & _Locale_CNTRL) != 0 && iswcntrl_l(wc, (locale_t)__loc))
+ ret |= _Locale_CNTRL;
+
+ if ((__mask & _Locale_DIGIT) != 0 && iswdigit_l(wc, (locale_t)__loc))
+ ret |= _Locale_DIGIT;
+
+ if ((__mask & _Locale_PRINT) != 0 && iswprint_l(wc, (locale_t)__loc))
+ ret |= _Locale_PRINT;
+
+ if ((__mask & _Locale_PUNCT) != 0 && iswpunct_l(wc, (locale_t)__loc))
+ ret |= _Locale_PUNCT;
+
+ if ((__mask & _Locale_SPACE) != 0 && iswspace_l(wc, (locale_t)__loc))
+ ret |= _Locale_SPACE;
+
+ if ((__mask & _Locale_XDIGIT) != 0 && iswxdigit_l(wc, (locale_t)__loc))
+ ret |= _Locale_XDIGIT;
+
+ if ((__mask & _Locale_UPPER) != 0 && iswupper_l(wc, (locale_t)__loc))
+ ret |= _Locale_UPPER;
+
+ if ((__mask & _Locale_LOWER) != 0 && iswlower_l(wc, (locale_t)__loc))
+ ret |= _Locale_LOWER;
+
+ return ret;
+}
+
+wint_t _WLocale_tolower( struct _Locale_ctype *__loc, wint_t c )
+{
+ return towlower_l( c, ((locale_t)__loc) );
+}
+
+wint_t _WLocale_toupper( struct _Locale_ctype *__loc, wint_t c )
+{
+ return towupper_l( c, ((locale_t)__loc) );
+}
+#endif
+
+int _WLocale_mb_cur_max( struct _Locale_codecvt * lcodecvt) { return 1; }
+int _WLocale_mb_cur_min( struct _Locale_codecvt * lcodecvt) { return 1; }
+int _WLocale_is_stateless( struct _Locale_codecvt * lcodecvt) { return 1; }
+
+#if !defined (_STLP_NO_WCHAR_T)
+size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt,
+ wchar_t *to,
+ const char *from, size_t n,
+ mbstate_t *st)
+{ *to = *from; return 1; }
+
+size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt,
+ char *to, size_t n,
+ const wchar_t c,
+ mbstate_t *st)
+{ *to = (char)c; return 1; }
+#endif
+
+size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt,
+ mbstate_t *st,
+ char *buf, size_t n, char ** next)
+{ *next = buf; return 0; }
+
+/* Collate */
+int _Locale_strcmp(struct _Locale_collate * __loc,
+ const char *s1, size_t n1,
+ const char *s2, size_t n2) {
+ int ret = 0;
+ char buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ strncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
+ strncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = strcoll_l(buf1, buf2, (locale_t)__loc);
+ if (ret != 0) return ret;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+int _WLocale_strcmp(struct _Locale_collate *__loc,
+ const wchar_t *s1, size_t n1,
+ const wchar_t *s2, size_t n2) {
+ int ret = 0;
+ wchar_t buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ wcsncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
+ wcsncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = wcscoll_l(buf1, buf2, (locale_t)__loc);
+ if (ret != 0) return ret;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret;
+}
+
+#endif
+
+size_t _Locale_strxfrm(struct _Locale_collate *__loc,
+ char *dest, size_t dest_n,
+ const char *src, size_t src_n )
+{
+ const char *real_src;
+ char *buf = NULL;
+ size_t result;
+
+ if (src_n == 0)
+ {
+ if (dest != NULL) dest[0] = 0;
+ return 0;
+ }
+ if (src[src_n] != 0) {
+ buf = malloc(src_n + 1);
+ strncpy(buf, src, src_n);
+ buf[src_n] = 0;
+ real_src = buf;
+ }
+ else
+ real_src = src;
+ result = strxfrm_l(dest, real_src, dest_n, (locale_t)__loc);
+ if (buf != NULL) free(buf);
+ return result;
+}
+
+# ifndef _STLP_NO_WCHAR_T
+
+size_t _WLocale_strxfrm( struct _Locale_collate *__loc,
+ wchar_t *dest, size_t dest_n,
+ const wchar_t *src, size_t src_n )
+{
+ const wchar_t *real_src;
+ wchar_t *buf = NULL;
+ size_t result;
+
+ if (src_n == 0)
+ {
+ if (dest != NULL) dest[0] = 0;
+ return 0;
+ }
+ if (src[src_n] != 0) {
+ buf = malloc((src_n + 1) * sizeof(wchar_t));
+ wcsncpy(buf, src, src_n);
+ buf[src_n] = 0;
+ real_src = buf;
+ }
+ else
+ real_src = src;
+ result = wcsxfrm_l(dest, real_src, dest_n, (locale_t)__loc);
+ if (buf != NULL) free(buf);
+ return result;
+}
+
+# endif
+
+/* Numeric */
+
+char _Locale_decimal_point(struct _Locale_numeric *__loc)
+{
+ return *(nl_langinfo_l(RADIXCHAR, (locale_t)__loc));
+}
+
+char _Locale_thousands_sep(struct _Locale_numeric *__loc)
+{
+ return *(nl_langinfo_l(THOUSEP, (locale_t)__loc));
+}
+
+const char* _Locale_grouping(struct _Locale_numeric *__loc)
+{
+ return (_Locale_thousands_sep(__loc) != 0 ) ? (nl_langinfo_l(GROUPING, (locale_t)__loc)) : _empty_str;
+}
+
+const char *_Locale_true(struct _Locale_numeric *__loc)
+{
+ return nl_langinfo_l(YESSTR, (locale_t)__loc);
+}
+
+const char *_Locale_false(struct _Locale_numeric *__loc)
+{
+ return nl_langinfo_l(NOSTR, (locale_t)__loc);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+wchar_t _WLocale_decimal_point(struct _Locale_numeric *__loc)
+{ return (wchar_t)_Locale_decimal_point(__loc); }
+wchar_t _WLocale_thousands_sep(struct _Locale_numeric *__loc)
+{ return (wchar_t)_Locale_thousands_sep(__loc); }
+const wchar_t *_WLocale_true(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_true(__loc), buf, bufSize); }
+const wchar_t *_WLocale_false(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_false(__loc), buf, bufSize); }
+#endif
+
+/* Monetary */
+
+const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(INT_CURR_SYMBOL, (locale_t)__loc);
+}
+
+const char *_Locale_currency_symbol(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(CURRENCY_SYMBOL, (locale_t)__loc);
+}
+
+char _Locale_mon_decimal_point(struct _Locale_monetary * __loc)
+{
+ return *(nl_langinfo_l(MON_DECIMAL_POINT,(locale_t)__loc));
+}
+
+char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(MON_THOUSANDS_SEP, (locale_t)__loc));
+}
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t *_WLocale_int_curr_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_int_curr_symbol(__loc), buf, bufSize); }
+const wchar_t *_WLocale_currency_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_currency_symbol(__loc), buf, bufSize); }
+wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * __loc)
+{ return (wchar_t)_Locale_mon_decimal_point(__loc); }
+wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * __loc)
+{ return (wchar_t)_Locale_mon_thousands_sep(__loc); }
+const wchar_t *_WLocale_positive_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_positive_sign(__loc), buf, bufSize); }
+const wchar_t *_WLocale_negative_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_negative_sign(__loc), buf, bufSize); }
+#endif
+
+const char *_Locale_mon_grouping(struct _Locale_monetary *__loc)
+{
+ return (_Locale_mon_thousands_sep( __loc ) != 0 ) ? nl_langinfo_l(MON_GROUPING, (locale_t)__loc) : _empty_str;
+}
+
+const char *_Locale_positive_sign(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(POSITIVE_SIGN, (locale_t)__loc);
+}
+
+const char *_Locale_negative_sign(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(NEGATIVE_SIGN, (locale_t)__loc);
+}
+
+char _Locale_int_frac_digits(struct _Locale_monetary *__loc)
+{
+ /* We are forced to manually handled the "C" locale for consistency with
+ * the default implementation in STLport. */
+ const char* lname = ((locale_t)__loc)->__names[LC_MONETARY];
+ if (lname[0] == 'C' && lname[1] == 0)
+ return 0;
+ return *(nl_langinfo_l(INT_FRAC_DIGITS, (locale_t)__loc));
+}
+
+char _Locale_frac_digits(struct _Locale_monetary *__loc)
+{
+ /* We are forced to manually handled the "C" locale for consistency with
+ * the default implementation in STLport. */
+ const char* lname = ((locale_t)__loc)->__names[LC_MONETARY];
+ if (lname[0] == 'C' && lname[1] == 0)
+ return 0;
+ return *(nl_langinfo_l(FRAC_DIGITS, (locale_t)__loc));
+}
+
+/* 1 if currency_symbol precedes a positive value, 0 if succeeds */
+int _Locale_p_cs_precedes(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(P_CS_PRECEDES, (locale_t)__loc));
+}
+
+/* 1 if a space separates currency_symbol from a positive value. */
+int _Locale_p_sep_by_space(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(P_SEP_BY_SPACE, (locale_t)__loc));
+}
+
+/*
+ * 0 Parentheses surround the quantity and currency_symbol
+ * 1 The sign string precedes the quantity and currency_symbol
+ * 2 The sign string succeeds the quantity and currency_symbol.
+ * 3 The sign string immediately precedes the currency_symbol.
+ * 4 The sign string immediately succeeds the currency_symbol.
+ */
+int _Locale_p_sign_posn(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(P_SIGN_POSN, (locale_t)__loc));
+}
+
+/* 1 if currency_symbol precedes a negative value, 0 if succeeds */
+int _Locale_n_cs_precedes(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(N_CS_PRECEDES, (locale_t)__loc));
+}
+
+/* 1 if a space separates currency_symbol from a negative value. */
+int _Locale_n_sep_by_space(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(N_SEP_BY_SPACE, (locale_t)__loc));
+}
+
+/*
+ * 0 Parentheses surround the quantity and currency_symbol
+ * 1 The sign string precedes the quantity and currency_symbol
+ * 2 The sign string succeeds the quantity and currency_symbol.
+ * 3 The sign string immediately precedes the currency_symbol.
+ * 4 The sign string immediately succeeds the currency_symbol.
+ */
+int _Locale_n_sign_posn(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(N_SIGN_POSN, (locale_t)__loc));
+}
+
+
+/* Time */
+const char *_Locale_full_monthname(struct _Locale_time *__loc, int _m )
+{
+ return nl_langinfo_l(MON_1 + _m, (locale_t)__loc);
+}
+
+const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m )
+{
+ return nl_langinfo_l(ABMON_1 + _m, (locale_t)__loc);
+}
+
+const char *_Locale_full_dayofweek(struct _Locale_time *__loc, int _d )
+{
+ return nl_langinfo_l(DAY_1 + _d, (locale_t)__loc);
+}
+
+const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d )
+{
+ return nl_langinfo_l(ABDAY_1 + _d, (locale_t)__loc);
+}
+
+const char *_Locale_d_t_fmt(struct _Locale_time *__loc)
+{
+ return nl_langinfo_l(D_T_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_d_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(D_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_t_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(T_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_long_d_t_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(ERA_D_T_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_long_d_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(ERA_D_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_am_str(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(AM_STR, (locale_t)__loc);
+}
+
+const char *_Locale_pm_str(struct _Locale_time* __loc )
+{
+ return nl_langinfo_l(PM_STR, (locale_t)__loc);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t *_WLocale_full_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_full_monthname(__loc, _m), buf, bufSize); }
+const wchar_t *_WLocale_abbrev_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_abbrev_monthname(__loc, _m), buf, bufSize); }
+const wchar_t *_WLocale_full_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_full_dayofweek(__loc, _d), buf, bufSize); }
+const wchar_t *_WLocale_abbrev_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_abbrev_dayofweek(__loc, _d), buf, bufSize); }
+const wchar_t *_WLocale_am_str(struct _Locale_time *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_am_str(__loc), buf, bufSize); }
+const wchar_t *_WLocale_pm_str(struct _Locale_time* __loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_pm_str(__loc), buf, bufSize); }
+#endif
+
+/* Messages */
+
+nl_catd_type _Locale_catopen(struct _Locale_messages *__loc, const char *__cat_name )
+{
+ return catopen( __cat_name, NL_CAT_LOCALE );
+}
+
+void _Locale_catclose(struct _Locale_messages *__loc, nl_catd_type __cat )
+{
+ catclose( __cat );
+}
+
+const char *_Locale_catgets(struct _Locale_messages *__loc, nl_catd_type __cat,
+ int __setid, int __msgid, const char *dfault)
+{
+ return catgets( __cat, __setid, __msgid, dfault );
+}
diff --git a/build/stlport/src/c_locale_win32/c_locale_win32.c b/build/stlport/src/c_locale_win32/c_locale_win32.c
new file mode 100644
index 000000000..dab958d17
--- /dev/null
+++ b/build/stlport/src/c_locale_win32/c_locale_win32.c
@@ -0,0 +1,1786 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Written 2000
+ * Anton Lapach
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include <limits.h>
+#if defined (_STLP_MSVC) || defined (__ICL)
+# include <memory.h>
+#endif
+#include <string.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_STRCPY(D, DS, S) strcpy_s(D, DS, S)
+# define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C)
+# define _STLP_STRCAT(D, DS, S) strcat_s(D, DS, S)
+#else
+# define _STLP_STRCPY(D, DS, S) strcpy(D, S)
+# define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C)
+# define _STLP_STRCAT(D, DS, S) strcat(D, S)
+#endif
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* Framework functions */
+/*
+ locale :: "lang[_country[.code_page]]"
+ | ".code_page"
+ | ""
+ | NULL
+
+*/
+
+typedef struct _LOCALECONV {
+ const char* name;
+ const char* abbrev;
+} LOCALECONV;
+
+#define MAX_LANG_LEN 64 /* max language name length */
+#define MAX_CTRY_LEN 64 /* max country name length */
+#define MAX_MODIFIER_LEN 0 /* max modifier name length - n/a */
+#define MAX_LC_LEN (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
+ /* max entire locale string length */
+#define MAX_CP_LEN 5 /* max code page name length */
+
+#if !defined (LANG_INVARIANT)
+# define LANG_INVARIANT 0x7f
+# define _STLP_LANG_INVARIANT_DEFINED
+#endif
+
+#ifndef CP_UTF7
+# define CP_UTF7 65000
+#endif
+
+#ifndef CP_UTF8
+# define CP_UTF8 65001
+#endif
+
+#define INVARIANT_LCID MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
+
+static const char *_C_name = "C";
+
+/* non-NLS language string table */
+static LOCALECONV __rg_language[] = {
+ {"american", "ENU"},
+ {"american english", "ENU"},
+ {"american-english", "ENU"},
+ {"australian", "ENA"},
+ {"belgian", "NLB"},
+ {"canadian", "ENC"},
+ {"chh", "ZHH"},
+ {"chi", "ZHI"},
+ {"chinese", "CHS"},
+ {"chinese-hongkong", "ZHH"},
+ {"chinese-simplified", "CHS"},
+ {"chinese-singapore", "ZHI"},
+ {"chinese-traditional", "CHT"},
+ {"dutch-belgian", "NLB"},
+ {"english-american", "ENU"},
+ {"english-aus", "ENA"},
+ {"english-belize", "ENL"},
+ {"english-can", "ENC"},
+ {"english-caribbean", "ENB"},
+ {"english-ire", "ENI"},
+ {"english-jamaica", "ENJ"},
+ {"english-nz", "ENZ"},
+ {"english-south africa", "ENS"},
+ {"english-trinidad y tobago", "ENT"},
+ {"english-uk", "ENG"},
+ {"english-us", "ENU"},
+ {"english-usa", "ENU"},
+ {"french-belgian", "FRB"},
+ {"french-canadian", "FRC"},
+ {"french-luxembourg", "FRL"},
+ {"french-swiss", "FRS"},
+ {"german-austrian", "DEA"},
+ {"german-lichtenstein", "DEC"},
+ {"german-luxembourg", "DEL"},
+ {"german-swiss", "DES"},
+ {"irish-english", "ENI"},
+ {"italian-swiss", "ITS"},
+ {"norwegian", "NOR"},
+ {"norwegian-bokmal", "NOR"},
+ {"norwegian-nynorsk", "NON"},
+ {"portuguese-brazilian", "PTB"},
+ {"spanish-argentina", "ESS"},
+ {"spanish-bolivia", "ESB"},
+ {"spanish-chile", "ESL"},
+ {"spanish-colombia", "ESO"},
+ {"spanish-costa rica", "ESC"},
+ {"spanish-dominican republic", "ESD"},
+ {"spanish-ecuador", "ESF"},
+ {"spanish-el salvador", "ESE"},
+ {"spanish-guatemala", "ESG"},
+ {"spanish-honduras", "ESH"},
+ {"spanish-mexican", "ESM"},
+ {"spanish-modern", "ESN"},
+ {"spanish-nicaragua", "ESI"},
+ {"spanish-panama", "ESA"},
+ {"spanish-paraguay", "ESZ"},
+ {"spanish-peru", "ESR"},
+ {"spanish-puerto rico", "ESU"},
+ {"spanish-uruguay", "ESY"},
+ {"spanish-venezuela", "ESV"},
+ {"swedish-finland", "SVF"},
+ {"swiss", "DES"},
+ {"uk", "ENG"},
+ {"us", "ENU"},
+ {"usa", "ENU"}
+};
+
+/* non-NLS country string table */
+static LOCALECONV __rg_country[] = {
+ {"america", "USA"},
+ {"britain", "GBR"},
+ {"china", "CHN"},
+ {"czech", "CZE"},
+ {"england", "GBR"},
+ {"great britain", "GBR"},
+ {"holland", "NLD"},
+ {"hong-kong", "HKG"},
+ {"new-zealand", "NZL"},
+ {"nz", "NZL"},
+ {"pr china", "CHN"},
+ {"pr-china", "CHN"},
+ {"puerto-rico", "PRI"},
+ {"slovak", "SVK"},
+ {"south africa", "ZAF"},
+ {"south korea", "KOR"},
+ {"south-africa", "ZAF"},
+ {"south-korea", "KOR"},
+ {"trinidad & tobago", "TTO"},
+ {"uk", "GBR"},
+ {"united-kingdom", "GBR"},
+ {"united-states", "USA"},
+ {"us", "USA"},
+};
+
+typedef struct _Locale_name_hint {
+ LCID id;
+} _Locale_lcid_t;
+
+typedef struct _Locale_ctype {
+ _Locale_lcid_t lc;
+ UINT cp;
+ unsigned short ctable[256];
+} _Locale_ctype_t;
+
+typedef struct _Locale_numeric {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+ char decimal_point[4];
+ char thousands_sep[4];
+ char *grouping;
+} _Locale_numeric_t;
+
+typedef struct _Locale_time {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+ char *month[12];
+ char *abbrev_month[12];
+ char *dayofweek[7];
+ char *abbrev_dayofweek[7];
+ char *date_time_format;
+ char *long_date_time_format;
+ char *date_format;
+ char *long_date_format;
+ char *time_format;
+ char am[9];
+ char pm[9];
+} _Locale_time_t;
+
+typedef struct _Locale_collate {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+} _Locale_collate_t;
+
+typedef struct _Locale_monetary {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+ char decimal_point[4];
+ char thousands_sep[4];
+ char *grouping;
+ char int_curr_symbol[5]; /* 3 + 1 + 1 */
+ char curr_symbol[6];
+ char negative_sign[5];
+ char positive_sign[5];
+ int frac_digits;
+ int int_frac_digits;
+} _Locale_monetary_t;
+
+/* Internal function */
+static void __FixGrouping(char *grouping);
+static const char* __ConvertName(const char* lname, LOCALECONV* ConvTable, int TableSize);
+static int __ParseLocaleString(const char* lname, char* lang, char* ctry, char* page);
+static int __GetLCID(const char* lang, const char* ctry, LCID* lcid);
+static int __GetLCIDFromName(const char* lname, LCID* lcid, char *cp, _Locale_lcid_t *hint);
+static char const* __GetLocaleName(LCID lcid, const char* cp, char* buf);
+static char const* __Extract_locale_name(const char* loc, const char* category, char* buf);
+static char const* __TranslateToSystem(const char* lname, char* buf, _Locale_lcid_t* hint, int *__err_code);
+static void __GetLocaleInfoUsingACP(LCID lcid, const char* cp, LCTYPE lctype, char* buf, int buf_size, wchar_t* wbuf, int wbuf_size);
+static int __intGetACP(LCID lcid);
+static int __intGetOCP(LCID lcid);
+static int __GetDefaultCP(LCID lcid);
+static char* __ConvertToCP(int from_cp, int to_cp, const char *from, size_t size, size_t *ret_buf_size);
+static void my_ltoa(long __x, char* buf);
+
+void my_ltoa(long __x, char* buf) {
+ char rbuf[64];
+ char* ptr = rbuf;
+
+ if (__x == 0)
+ *ptr++ = '0';
+ else {
+ for (; __x != 0; __x /= 10)
+ *ptr++ = (char)(__x % 10) + '0';
+ }
+ while(ptr > rbuf) *buf++ = *--ptr;
+ /* psw */
+ *buf = '\0';
+}
+
+#if defined (__cplusplus)
+_STLP_BEGIN_NAMESPACE
+extern "C" {
+#endif
+
+_Locale_lcid_t* _Locale_get_ctype_hint(_Locale_ctype_t* ltype)
+{ return (ltype != 0) ? &ltype->lc : 0; }
+_Locale_lcid_t* _Locale_get_numeric_hint(_Locale_numeric_t* lnumeric)
+{ return (lnumeric != 0) ? &lnumeric->lc : 0; }
+_Locale_lcid_t* _Locale_get_time_hint(_Locale_time_t* ltime)
+{ return (ltime != 0) ? &ltime->lc : 0; }
+_Locale_lcid_t* _Locale_get_collate_hint(_Locale_collate_t* lcollate)
+{ return (lcollate != 0) ? &lcollate->lc : 0; }
+_Locale_lcid_t* _Locale_get_monetary_hint(_Locale_monetary_t* lmonetary)
+{ return (lmonetary != 0) ? &lmonetary->lc : 0; }
+_Locale_lcid_t* _Locale_get_messages_hint(struct _Locale_messages* lmessages) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmessages)
+ return 0;
+}
+
+#define MAP(x, y) if ((mask & x) != 0) ret |= (y)
+unsigned short MapCtypeMask(unsigned short mask) {
+ unsigned short ret = 0;
+ MAP(C1_UPPER, _Locale_UPPER | _Locale_PRINT);
+ MAP(C1_LOWER, _Locale_LOWER | _Locale_PRINT);
+ MAP(C1_DIGIT, _Locale_DIGIT | _Locale_PRINT);
+ MAP(C1_SPACE, _Locale_SPACE | _Locale_PRINT);
+ MAP(C1_PUNCT, _Locale_PUNCT | _Locale_PRINT);
+ /* MAP(C1_BLANK, ?); */
+ MAP(C1_XDIGIT, _Locale_XDIGIT | _Locale_PRINT);
+ MAP(C1_ALPHA, _Locale_ALPHA | _Locale_PRINT);
+ if ((mask & C1_CNTRL) != 0) { ret |= _Locale_CNTRL; ret &= ~_Locale_PRINT; }
+ return ret;
+}
+
+static void MapCtypeMasks(unsigned short *cur, unsigned short *end) {
+ for (; cur != end; ++cur) {
+ *cur = MapCtypeMask(*cur);
+ }
+}
+
+_Locale_ctype_t* _Locale_ctype_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ char cp_name[MAX_CP_LEN + 1];
+ int NativeCP;
+ unsigned char Buffer[256];
+ unsigned char *ptr;
+ CPINFO CPInfo;
+ int i;
+ wchar_t *wbuffer;
+ int BufferSize;
+
+ _Locale_ctype_t *ltype = (_Locale_ctype_t*)malloc(sizeof(_Locale_ctype_t));
+
+ if (!ltype) { *__err_code = _STLP_LOC_NO_MEMORY; return ltype; }
+ memset(ltype, 0, sizeof(_Locale_ctype_t));
+
+ if (__GetLCIDFromName(name, &ltype->lc.id, cp_name, lc_hint) == -1)
+ { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if ( ltype->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
+ { ltype->lc.id = 0x409; }
+#endif
+
+ ltype->cp = atoi(cp_name);
+
+ NativeCP = __GetDefaultCP(ltype->lc.id);
+
+ /* Make table with all characters. */
+ for (i = 0; i < 256; ++i) Buffer[i] = (unsigned char)i;
+
+ if (!GetCPInfo(NativeCP, &CPInfo)) { free(ltype); return NULL; }
+
+ if (CPInfo.MaxCharSize > 1) {
+ for (ptr = (unsigned char*)CPInfo.LeadByte; *ptr && *(ptr + 1); ptr+=2)
+ for (i = *ptr; i <= *(ptr + 1); ++i) Buffer[i] = 0;
+ }
+
+ if ((UINT)NativeCP != ltype->cp) {
+ OSVERSIONINFO ver_info;
+ ver_info.dwOSVersionInfoSize = sizeof(ver_info);
+ GetVersionEx(&ver_info);
+ if (ver_info.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+ /* Convert character sequence to Unicode. */
+ BufferSize = MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, (const char*)Buffer, 256, NULL, 0);
+ if (!BufferSize) { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+ wbuffer = (wchar_t*)malloc(BufferSize * sizeof(wchar_t));
+ if (!wbuffer) { free(ltype); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, (const char*)Buffer, 256, wbuffer, BufferSize);
+
+ GetStringTypeW(CT_CTYPE1, wbuffer, 256, ltype->ctable);
+ MapCtypeMasks(ltype->ctable, ltype->ctable + 256);
+ free(wbuffer);
+ }
+ else {
+ unsigned short ctable[256];
+ unsigned char TargetBuffer[256];
+ GetStringTypeA(ltype->lc.id, CT_CTYPE1, (const char*)Buffer, 256, ctable);
+
+ /* Convert character sequence to target code page. */
+ BufferSize = MultiByteToWideChar(NativeCP, MB_PRECOMPOSED, (const char*)Buffer, 256, NULL, 0);
+ if (!BufferSize) { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+ wbuffer = (wchar_t*)malloc(BufferSize * sizeof(wchar_t));
+ if (!wbuffer) { free(ltype); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ MultiByteToWideChar(NativeCP, MB_PRECOMPOSED, (const char*)Buffer, 256, wbuffer, BufferSize);
+ if (!WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuffer, BufferSize, (char*)TargetBuffer, 256, NULL, FALSE))
+ { free(wbuffer); free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ free(wbuffer);
+
+ /* Translate ctype table. */
+ for (i = 0; i < 256; ++i) {
+ if (!TargetBuffer[i]) continue;
+ ltype->ctable[TargetBuffer[i]] = MapCtypeMask(ctable[i]);
+ }
+ }
+ }
+ else {
+ GetStringTypeA(ltype->lc.id, CT_CTYPE1, (const char*)Buffer, 256, ltype->ctable);
+ MapCtypeMasks(ltype->ctable, ltype->ctable + 256);
+ }
+ return ltype;
+}
+
+_Locale_numeric_t* _Locale_numeric_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ wchar_t wbuf[4];
+ char *GroupingBuffer;
+ int BufferSize;
+
+ _Locale_numeric_t *lnum = (_Locale_numeric_t*)malloc(sizeof(_Locale_numeric_t));
+ if (!lnum) { *__err_code = _STLP_LOC_NO_MEMORY; return lnum; }
+ memset(lnum, 0, sizeof(_Locale_numeric_t));
+
+ if (__GetLCIDFromName(name, &lnum->lc.id, lnum->cp, lc_hint) == -1)
+ { free(lnum); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if (lnum->lc.id != INVARIANT_LCID) {
+#endif
+ __GetLocaleInfoUsingACP(lnum->lc.id, lnum->cp, LOCALE_SDECIMAL, lnum->decimal_point, 4, wbuf, 4);
+ __GetLocaleInfoUsingACP(lnum->lc.id, lnum->cp, LOCALE_STHOUSAND, lnum->thousands_sep, 4, wbuf, 4);
+#if defined (__BORLANDC__)
+ }
+ else
+ lnum->decimal_point[0] = '.';
+#endif
+
+ if (lnum->lc.id != INVARIANT_LCID) {
+ BufferSize = GetLocaleInfoA(lnum->lc.id, LOCALE_SGROUPING, NULL, 0);
+ GroupingBuffer = (char*)malloc(BufferSize);
+ if (!GroupingBuffer) { free(lnum); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ GetLocaleInfoA(lnum->lc.id, LOCALE_SGROUPING, GroupingBuffer, BufferSize);
+ __FixGrouping(GroupingBuffer);
+ lnum->grouping = GroupingBuffer;
+ }
+ else {
+ lnum->grouping = (char*)malloc(1);
+ if (!lnum->grouping) { free(lnum); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ lnum->grouping[0] = 0;
+ }
+
+ return lnum;
+}
+
+static int __ConvertDate(const char *NTDate, char *buffer, int buf_size) {
+ /* This function will return an incomplete buffer if buffer is not long enough */
+ const char *cur_char;
+ char *cur_output, *end_output;
+
+ /* Correct time format. */
+ cur_char = NTDate;
+ cur_output = buffer;
+ end_output = cur_output + buf_size;
+ buf_size = 0;
+ while (*cur_char) {
+ if (cur_output && (cur_output == end_output)) break;
+ switch (*cur_char) {
+ case 'd':
+ {
+ if (*(cur_char + 1) == 'd') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (*(cur_char + 2) == 'd') {
+ if (*(cur_char + 3) == 'd') {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'A'; }
+ buf_size += 2;
+ cur_char += 3;
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'a'; }
+ buf_size += 2;
+ cur_char += 2;
+ }
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'd'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'd'; }
+ buf_size += 3;
+ }
+ }
+ break;
+ case 'M':
+ {
+ if (*(cur_char + 1) == 'M') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (*(cur_char + 2) == 'M') {
+ if (*(cur_char + 3) == 'M') {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'B'; }
+ buf_size += 2;
+ cur_char += 3;
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'b'; }
+ buf_size += 2;
+ cur_char += 2;
+ }
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'm'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'm'; }
+ buf_size += 3;
+ }
+ }
+ break;
+ case 'y':
+ {
+ if (*(cur_char + 1) == 'y') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (*(cur_char + 2) == 'y' && *(cur_char + 3) == 'y') {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'Y'; }
+ buf_size += 2;
+ cur_char += 3;
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'y'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'y'; }
+ buf_size += 3;
+ }
+ }
+ break;
+ case '%':
+ {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '%'; }
+ buf_size += 2;
+ }
+ break;
+ case '\'':
+ {
+ ++cur_char;
+ while (*cur_char != '\'' && *cur_char != 0 && (cur_output == NULL || cur_output != end_output)) {
+ if (cur_output) { *cur_output++ = *cur_char; }
+ ++cur_char;
+ buf_size += 1;
+ }
+ }
+ break;
+ default:
+ {
+ if (cur_output) { *(cur_output++) = *cur_char; }
+ buf_size += 1;
+ }
+ break;
+ }
+ if (*cur_char == 0) break;
+ ++cur_char;
+ }
+
+ if (!cur_output || cur_output != end_output) {
+ if (cur_output) *cur_output = 0;
+ buf_size += 1;
+ }
+ else {
+ /* We trunc result */
+ *(--cur_output) = 0;
+ }
+
+ return buf_size;
+}
+
+static int __ConvertTime(const char *NTTime, char *buffer, int buf_size) {
+ const char *cur_char;
+ char *cur_output, *end_output;
+ cur_char = NTTime;
+ cur_output = buffer;
+ end_output = cur_output + buf_size;
+ buf_size = 0;
+ while (*cur_char) {
+ switch(*cur_char) {
+ case 'h':
+ if (*(cur_char + 1) == 'h') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'I'; }
+ buf_size += 2;
+ ++cur_char;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'I'; }
+ buf_size += 3;
+ }
+ break;
+ case 'H':
+ if (*(cur_char + 1) == 'H') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'H'; }
+ buf_size += 2;
+ ++cur_char;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'H'; }
+ buf_size += 3;
+ }
+ break;
+ case 'm':
+ if (*(cur_char + 1) == 'm') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'M'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'M'; }
+ buf_size += 3;
+ }
+ break;
+ case 's':
+ if (*(cur_char + 1) == 's') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'S'; }
+ buf_size += 2;
+ ++cur_char;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'S'; }
+ buf_size += 3;
+ }
+ break;
+ case 't':
+ if (*(cur_char + 1) == 't')
+ ++cur_char;
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'p'; }
+ buf_size += 2;
+ break;
+ case '%':
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++)='%'; *(cur_output++)='%'; }
+ buf_size += 2;
+ break;
+ case '\'':
+ ++cur_char;
+ while (*cur_char != '\'' && *cur_char != 0 && (!cur_output || (cur_output != end_output))) {
+ if (cur_output) *cur_output++ = *cur_char;
+ ++cur_char;
+ buf_size += 1;
+ }
+ break;
+ default:
+ if (cur_output) { *(cur_output++) = *cur_char; }
+ buf_size += 1;
+ break;
+ }
+ if (*cur_char == 0) break;
+ ++cur_char;
+ }
+
+ if (!cur_output || cur_output != end_output) {
+ if (cur_output) *cur_output = 0;
+ buf_size += 1;
+ }
+ else {
+ /* We trunc result */
+ *(--cur_output) = 0;
+ }
+
+ return buf_size;
+}
+
+_Locale_time_t* _Locale_time_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ int size, month, dayofweek;
+ size_t length;
+ char fmt80[80];
+ wchar_t wbuf80[80];
+
+ _Locale_time_t *ltime = (_Locale_time_t*)malloc(sizeof(_Locale_time_t));
+
+ if (!ltime) { *__err_code = _STLP_LOC_NO_MEMORY; return ltime; }
+ memset(ltime, 0, sizeof(_Locale_time_t));
+
+ if (__GetLCIDFromName(name, &ltime->lc.id, ltime->cp, lc_hint) == -1)
+ { free(ltime); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if ( ltime->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
+ { ltime->lc.id = 0x409; }
+#endif
+
+ for (month = LOCALE_SMONTHNAME1; month <= LOCALE_SMONTHNAME12; ++month) { /* Small hack :-) */
+ size = GetLocaleInfoA(ltime->lc.id, month, NULL, 0);
+ ltime->month[month - LOCALE_SMONTHNAME1] = (char*)malloc(size);
+ if (!ltime->month[month - LOCALE_SMONTHNAME1])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, month, ltime->month[month - LOCALE_SMONTHNAME1], size, wbuf80, 80);
+ }
+
+ for (month = LOCALE_SABBREVMONTHNAME1; month <= LOCALE_SABBREVMONTHNAME12; ++month) {
+ size = GetLocaleInfoA(ltime->lc.id, month, NULL, 0);
+ ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1] = (char*)malloc(size);
+ if (!ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, month, ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1], size, wbuf80, 80);
+ }
+
+ for (dayofweek = LOCALE_SDAYNAME1; dayofweek <= LOCALE_SDAYNAME7; ++dayofweek) {
+ int dayindex = ( dayofweek != LOCALE_SDAYNAME7 ) ? dayofweek - LOCALE_SDAYNAME1 + 1 : 0;
+ size = GetLocaleInfoA(ltime->lc.id, dayofweek, NULL, 0);
+ ltime->dayofweek[dayindex] = (char*)malloc(size);
+ if (!ltime->dayofweek[dayindex])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, dayofweek, ltime->dayofweek[dayindex], size, wbuf80, 80);
+ }
+
+ for (dayofweek = LOCALE_SABBREVDAYNAME1; dayofweek <= LOCALE_SABBREVDAYNAME7; ++dayofweek) {
+ int dayindex = ( dayofweek != LOCALE_SABBREVDAYNAME7 ) ? dayofweek - LOCALE_SABBREVDAYNAME1 + 1 : 0;
+ size = GetLocaleInfoA(ltime->lc.id, dayofweek, NULL, 0);
+ ltime->abbrev_dayofweek[dayindex] = (char*)malloc(size);
+ if (!ltime->abbrev_dayofweek[dayindex])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, dayofweek, ltime->abbrev_dayofweek[dayindex], size, wbuf80, 80);
+ }
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_SSHORTDATE, fmt80, 80, wbuf80, 80);
+ size = __ConvertDate(fmt80, NULL, 0);
+ ltime->date_format = (char*)malloc(size);
+ if (!ltime->date_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __ConvertDate(fmt80, ltime->date_format, size);
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_SLONGDATE, fmt80, 80, wbuf80, 80);
+ size = __ConvertDate(fmt80, NULL, 0);
+ ltime->long_date_format = (char*)malloc(size);
+ if (!ltime->long_date_format)
+ { _Locale_time_destroy(ltime);*__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __ConvertDate(fmt80, ltime->long_date_format, size);
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_STIMEFORMAT, fmt80, 80, wbuf80, 80);
+ size = __ConvertTime(fmt80, NULL, 0);
+ ltime->time_format = (char*)malloc(size);
+ if (!ltime->time_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __ConvertTime(fmt80, ltime->time_format, size);
+
+ /* NT doesn't provide this information, we must simulate. */
+ length = strlen(ltime->date_format) + strlen(ltime->time_format) + 1 /* space */ + 1 /* trailing 0 */;
+ ltime->date_time_format = (char*)malloc(length);
+ if (!ltime->date_time_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ _STLP_STRCPY(ltime->date_time_format, length, ltime->date_format);
+ _STLP_STRCAT(ltime->date_time_format, length, " ");
+ _STLP_STRCAT(ltime->date_time_format, length, ltime->time_format);
+
+ /* NT doesn't provide this information, we must simulate. */
+ length = strlen(ltime->long_date_format) + strlen(ltime->time_format) + 1 /* space */ + 1 /* trailing 0 */;
+ ltime->long_date_time_format = (char*)malloc(length);
+ if (!ltime->long_date_time_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ _STLP_STRCPY(ltime->long_date_time_format, length, ltime->long_date_format);
+ _STLP_STRCAT(ltime->long_date_time_format, length, " ");
+ _STLP_STRCAT(ltime->long_date_time_format, length, ltime->time_format);
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_S1159, ltime->am, 9, wbuf80, 80);
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_S2359, ltime->pm, 9, wbuf80, 80);
+
+ return ltime;
+}
+
+_Locale_collate_t* _Locale_collate_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ _Locale_collate_t *lcol = (_Locale_collate_t*)malloc(sizeof(_Locale_collate_t));
+ if (!lcol) { *__err_code = _STLP_LOC_NO_MEMORY; return lcol; }
+ memset(lcol, 0, sizeof(_Locale_collate_t));
+
+ if (__GetLCIDFromName(name, &lcol->lc.id, lcol->cp, lc_hint) == -1)
+ { free(lcol); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if ( lcol->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
+ { lcol->lc.id = 0x409; }
+#endif
+
+ return lcol;
+}
+
+_Locale_monetary_t* _Locale_monetary_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ char *GroupingBuffer;
+ int BufferSize;
+ char FracDigits[3];
+ wchar_t wbuf[6];
+
+ _Locale_monetary_t *lmon = (_Locale_monetary_t*)malloc(sizeof(_Locale_monetary_t));
+ if (!lmon) { *__err_code = _STLP_LOC_NO_MEMORY; return lmon; }
+ memset(lmon, 0, sizeof(_Locale_monetary_t));
+
+ if (__GetLCIDFromName(name, &lmon->lc.id, lmon->cp, lc_hint) == -1)
+ { free(lmon); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ if (lmon->lc.id != INVARIANT_LCID) {
+ /* Extract information about monetary system */
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SDECIMAL, lmon->decimal_point, 4, wbuf, 6);
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_STHOUSAND, lmon->thousands_sep, 4, wbuf, 6);
+
+ BufferSize = GetLocaleInfoA(lmon->lc.id, LOCALE_SGROUPING, NULL, 0);
+ GroupingBuffer = (char*)malloc(BufferSize);
+ if (!GroupingBuffer)
+ { lmon->grouping = NULL; *__err_code = _STLP_LOC_NO_MEMORY; return lmon; }
+ GetLocaleInfoA(lmon->lc.id, LOCALE_SGROUPING, GroupingBuffer, BufferSize);
+ __FixGrouping(GroupingBuffer);
+ lmon->grouping = GroupingBuffer;
+
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SCURRENCY, lmon->curr_symbol, 6, wbuf, 6);
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SNEGATIVESIGN, lmon->negative_sign, 5, wbuf, 6);
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SPOSITIVESIGN, lmon->positive_sign, 5, wbuf, 6);
+
+ GetLocaleInfoA(lmon->lc.id, LOCALE_ICURRDIGITS, FracDigits, 3);
+ lmon->frac_digits = atoi(FracDigits);
+
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IINTLCURRDIGITS, FracDigits, 3);
+ lmon->int_frac_digits = atoi(FracDigits);
+
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SINTLSYMBOL, lmon->int_curr_symbol, 5, wbuf, 6);
+ /* Even if Platform SDK documentation says that the returned symbol should
+ * be a 3 letters symbol followed by a seperation character, experimentation
+ * has shown that no seperation character is ever appended. We are adding it
+ * ourself to conform to the POSIX specification.
+ */
+ if (lmon->int_curr_symbol[3] == 0) {
+ lmon->int_curr_symbol[3] = ' ';
+ lmon->int_curr_symbol[4] = 0;
+ }
+ }
+ /* else it is already ok */
+
+ return lmon;
+}
+
+struct _Locale_messages* _Locale_messages_create(const char *name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ /* The Win32 API has no support for messages facet */
+ _STLP_MARK_PARAMETER_AS_UNUSED(name)
+ _STLP_MARK_PARAMETER_AS_UNUSED(lc_hint)
+ *__err_code = _STLP_LOC_UNSUPPORTED_FACET_CATEGORY;
+ return NULL;
+}
+
+static const char* _Locale_common_default(char* buf) {
+ char cp[MAX_CP_LEN + 1];
+ int CodePage = __GetDefaultCP(LOCALE_USER_DEFAULT);
+ my_ltoa(CodePage, cp);
+ return __GetLocaleName(LOCALE_USER_DEFAULT, cp, buf);
+}
+
+const char* _Locale_ctype_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_numeric_default(char * buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_time_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_collate_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_monetary_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_messages_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+char const* _Locale_ctype_name(const _Locale_ctype_t* ltype, char* buf) {
+ char cp_buf[MAX_CP_LEN + 1];
+ my_ltoa(ltype->cp, cp_buf);
+ return __GetLocaleName(ltype->lc.id, cp_buf, buf);
+}
+
+char const* _Locale_numeric_name(const _Locale_numeric_t* lnum, char* buf)
+{ return __GetLocaleName(lnum->lc.id, lnum->cp, buf); }
+
+char const* _Locale_time_name(const _Locale_time_t* ltime, char* buf)
+{ return __GetLocaleName(ltime->lc.id, ltime->cp, buf); }
+
+char const* _Locale_collate_name(const _Locale_collate_t* lcol, char* buf)
+{ return __GetLocaleName(lcol->lc.id, lcol->cp, buf); }
+
+char const* _Locale_monetary_name(const _Locale_monetary_t* lmon, char* buf)
+{ return __GetLocaleName(lmon->lc.id, lmon->cp, buf); }
+
+char const* _Locale_messages_name(const struct _Locale_messages* lmes, char* buf) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(buf)
+ return NULL;
+}
+
+void _Locale_ctype_destroy(_Locale_ctype_t* ltype) {
+ if (!ltype) return;
+
+ free(ltype);
+}
+
+void _Locale_numeric_destroy(_Locale_numeric_t* lnum) {
+ if (!lnum) return;
+
+ if (lnum->grouping) free(lnum->grouping);
+ free(lnum);
+}
+
+void _Locale_time_destroy(_Locale_time_t* ltime) {
+ int i;
+ if (!ltime) return;
+
+ for (i = 0; i < 12; ++i) {
+ if (ltime->month[i]) free(ltime->month[i]);
+ if (ltime->abbrev_month[i]) free(ltime->abbrev_month[i]);
+ }
+
+ for (i = 0; i < 7; ++i) {
+ if (ltime->dayofweek[i]) free(ltime->dayofweek[i]);
+ if (ltime->abbrev_dayofweek[i]) free(ltime->abbrev_dayofweek[i]);
+ }
+
+ if (ltime->date_format) free(ltime->date_format);
+ if (ltime->long_date_format) free(ltime->long_date_format);
+ if (ltime->time_format) free(ltime->time_format);
+ if (ltime->date_time_format) free(ltime->date_time_format);
+ if (ltime->long_date_time_format) free(ltime->long_date_time_format);
+
+ free(ltime);
+}
+
+void _Locale_collate_destroy(_Locale_collate_t* lcol) {
+ if (!lcol) return;
+
+ free(lcol);
+}
+
+void _Locale_monetary_destroy(_Locale_monetary_t* lmon) {
+ if (!lmon) return;
+
+ if (lmon->grouping) free(lmon->grouping);
+ free(lmon);
+}
+
+void _Locale_messages_destroy(struct _Locale_messages* lmes)
+{ _STLP_MARK_PARAMETER_AS_UNUSED(lmes) }
+
+static char const* _Locale_extract_category_name(const char* name, const char* category, char* buf,
+ _Locale_lcid_t* hint, int *__err_code) {
+ const char* cname = __Extract_locale_name(name, category, buf);
+ if (cname == 0 || (cname[0] == 'C' && cname[1] == 0)) {
+ return cname;
+ }
+ return __TranslateToSystem(cname, buf, hint, __err_code);
+}
+
+char const* _Locale_extract_ctype_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_CTYPE", buf, hint, __err_code); }
+
+char const* _Locale_extract_numeric_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_NUMERIC", buf, hint, __err_code); }
+
+char const* _Locale_extract_time_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_TIME", buf, hint, __err_code); }
+
+char const* _Locale_extract_collate_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_COLLATE", buf, hint, __err_code); }
+
+char const* _Locale_extract_monetary_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_MONETARY", buf, hint, __err_code); }
+
+char const* _Locale_extract_messages_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code) {
+ if (cname[0] == 'L' && cname[1] == 'C' && cname[2] == '_') {
+ return _C_name;
+ }
+ if (cname[0] == 'C' && cname[1] == 0) {
+ return _C_name;
+ }
+ return __TranslateToSystem(cname, buf, hint, __err_code);
+}
+
+/* ctype */
+
+const _Locale_mask_t* _Locale_ctype_table(_Locale_ctype_t* ltype) {
+ _STLP_STATIC_ASSERT(sizeof(_Locale_mask_t) == sizeof(ltype->ctable[0]))
+ return (const _Locale_mask_t*)ltype->ctable;
+}
+
+int _Locale_toupper(_Locale_ctype_t* ltype, int c) {
+ char buf[2], out_buf[2];
+ buf[0] = (char)c; buf[1] = 0;
+ if ((UINT)__GetDefaultCP(ltype->lc.id) == ltype->cp) {
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_UPPERCASE, buf, 2, out_buf, 2);
+ return out_buf[0];
+ }
+ else {
+ wchar_t wbuf[2];
+ MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, buf, 2, wbuf, 2);
+ WideCharToMultiByte(__GetDefaultCP(ltype->lc.id), WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, buf, 2, NULL, FALSE);
+
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_UPPERCASE, buf, 2, out_buf, 2);
+
+ MultiByteToWideChar(__GetDefaultCP(ltype->lc.id), MB_PRECOMPOSED, out_buf, 2, wbuf, 2);
+ WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, out_buf, 2, NULL, FALSE);
+ return out_buf[0];
+ }
+}
+
+int _Locale_tolower(_Locale_ctype_t* ltype, int c) {
+ char buf[2], out_buf[2];
+ buf[0] = (char)c; buf[1] = 0;
+ if ((UINT)__GetDefaultCP(ltype->lc.id) == ltype->cp) {
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, buf, 2, out_buf, 2);
+ return out_buf[0];
+ }
+ else {
+ wchar_t wbuf[2];
+ MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, buf, 2, wbuf, 2);
+ WideCharToMultiByte(__GetDefaultCP(ltype->lc.id), WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, buf, 2, NULL, FALSE);
+
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, buf, 2, out_buf, 2);
+
+ MultiByteToWideChar(__GetDefaultCP(ltype->lc.id), MB_PRECOMPOSED, out_buf, 2, wbuf, 2);
+ WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, out_buf, 2, NULL, FALSE);
+ return out_buf[0];
+ }
+}
+
+#ifndef CSTR_EQUAL /* VC5SP3*/
+# define CSTR_EQUAL 2
+#endif
+#ifndef CSTR_LESS_THAN /* VC5SP3 */
+# define CSTR_LESS_THAN 1
+#endif
+
+static DWORD max_DWORD = 0xffffffff;
+static DWORD trim_size_t_to_DWORD(size_t n) { return n < (size_t)max_DWORD ? (DWORD)n : max_DWORD; }
+
+/* Collate */
+/* This function takes care of the potential size_t DWORD different size. */
+static int _Locale_strcmp_auxA(_Locale_collate_t* lcol,
+ const char* s1, size_t n1,
+ const char* s2, size_t n2) {
+ int result = CSTR_EQUAL;
+ while (n1 > 0 || n2 > 0) {
+ DWORD size1 = trim_size_t_to_DWORD(n1);
+ DWORD size2 = trim_size_t_to_DWORD(n2);
+ result = CompareStringA(lcol->lc.id, 0, s1, size1, s2, size2);
+ if (result != CSTR_EQUAL)
+ break;
+ n1 -= size1;
+ n2 -= size2;
+ }
+ return result;
+}
+
+int _Locale_strcmp(_Locale_collate_t* lcol,
+ const char* s1, size_t n1,
+ const char* s2, size_t n2) {
+ int result;
+ if (__GetDefaultCP(lcol->lc.id) == atoi(lcol->cp)) {
+ result = _Locale_strcmp_auxA(lcol, s1, n1, s2, n2);
+ }
+ else {
+ char *buf1, *buf2;
+ size_t size1, size2;
+ buf1 = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), s1, n1, &size1);
+ buf2 = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), s2, n2, &size2);
+
+ result = _Locale_strcmp_auxA(lcol, buf1, size1, buf2, size2);
+ free(buf1); free(buf2);
+ }
+ return (result == CSTR_EQUAL) ? 0 : (result == CSTR_LESS_THAN) ? -1 : 1;
+}
+
+size_t _Locale_strxfrm(_Locale_collate_t* lcol,
+ char* dst, size_t dst_size,
+ const char* src, size_t src_size) {
+ int result;
+
+ /* The Windows API do not support transformation of very long strings (src_size > INT_MAX)
+ * In this case the result will just be the input string:
+ */
+ if (src_size > INT_MAX) {
+ if (dst != 0) {
+ _STLP_STRNCPY(dst, dst_size, src, src_size);
+ }
+ return src_size;
+ }
+ if (dst_size > INT_MAX) {
+ /* now that we know that src_size <= INT_MAX we can safely decrease dst_size to INT_MAX. */
+ dst_size = INT_MAX;
+ }
+
+ if (__GetDefaultCP(lcol->lc.id) == atoi(lcol->cp))
+ result = LCMapStringA(lcol->lc.id, LCMAP_SORTKEY, src, (int)src_size, dst, (int)dst_size);
+ else {
+ char *buf;
+ size_t size;
+ buf = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), src, src_size, &size);
+
+ result = LCMapStringA(lcol->lc.id, LCMAP_SORTKEY, buf, (int)size, dst, (int)dst_size);
+ free(buf);
+ }
+ return result != 0 ? result - 1 : 0;
+}
+
+/* Numeric */
+static const char* __true_name = "true";
+static const char* __false_name = "false";
+
+char _Locale_decimal_point(_Locale_numeric_t* lnum)
+{ return lnum->decimal_point[0]; }
+
+char _Locale_thousands_sep(_Locale_numeric_t* lnum)
+{ return lnum->thousands_sep[0]; }
+
+const char* _Locale_grouping(_Locale_numeric_t * lnum) {
+ if (!lnum->grouping) return "";
+ else return lnum->grouping;
+}
+
+const char * _Locale_true(_Locale_numeric_t * lnum) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ return __true_name; /* NT does't provide information about this */
+}
+
+const char * _Locale_false(_Locale_numeric_t * lnum) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ return __false_name; /* NT does't provide information about this */
+}
+
+/* Monetary */
+const char* _Locale_int_curr_symbol(_Locale_monetary_t * lmon)
+{ return lmon->int_curr_symbol; }
+
+const char* _Locale_currency_symbol(_Locale_monetary_t * lmon)
+{ return lmon->curr_symbol; }
+
+char _Locale_mon_decimal_point(_Locale_monetary_t * lmon)
+{ return lmon->decimal_point[0]; }
+
+char _Locale_mon_thousands_sep(_Locale_monetary_t * lmon)
+{ return lmon->thousands_sep[0]; }
+
+const char* _Locale_mon_grouping(_Locale_monetary_t * lmon) {
+ if (!lmon->grouping) return "";
+ else return lmon->grouping;
+}
+
+const char* _Locale_positive_sign(_Locale_monetary_t * lmon)
+{ return lmon->positive_sign; }
+
+const char* _Locale_negative_sign(_Locale_monetary_t * lmon)
+{ return lmon->negative_sign; }
+
+char _Locale_int_frac_digits(_Locale_monetary_t * lmon)
+{ return (char)lmon->int_frac_digits; }
+
+char _Locale_frac_digits(_Locale_monetary_t * lmon)
+{ return (char)lmon->frac_digits; }
+
+int _Locale_p_cs_precedes(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSYMPRECEDES, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_p_sep_by_space(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSEPBYSPACE, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_p_sign_posn(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ if (lmon->lc.id != INVARIANT_LCID) {
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSIGNPOSN, loc_data, 2);
+ return atoi(loc_data);
+ }
+ else {
+ return CHAR_MAX;
+ }
+}
+
+int _Locale_n_cs_precedes(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSYMPRECEDES, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_n_sep_by_space(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSEPBYSPACE, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_n_sign_posn(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ if (lmon->lc.id != INVARIANT_LCID) {
+ GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSIGNPOSN, loc_data, 2);
+ return atoi(loc_data);
+ }
+ else {
+ return CHAR_MAX;
+ }
+}
+
+/* Time */
+const char * _Locale_full_monthname(_Locale_time_t * ltime, int month) {
+ const char **names = (const char**)ltime->month;
+ return names[month];
+}
+
+const char * _Locale_abbrev_monthname(_Locale_time_t * ltime, int month) {
+ const char **names = (const char**)ltime->abbrev_month;
+ return names[month];
+}
+
+const char * _Locale_full_dayofweek(_Locale_time_t * ltime, int day) {
+ const char **names = (const char**)ltime->dayofweek;
+ return names[day];
+}
+
+const char * _Locale_abbrev_dayofweek(_Locale_time_t * ltime, int day) {
+ const char **names = (const char**)ltime->abbrev_dayofweek;
+ return names[day];
+}
+
+const char* _Locale_d_t_fmt(_Locale_time_t* ltime)
+{ return ltime->date_time_format; }
+
+const char* _Locale_long_d_t_fmt(_Locale_time_t* ltime)
+{ return ltime->long_date_time_format; }
+
+const char* _Locale_d_fmt(_Locale_time_t* ltime)
+{ return ltime->date_format; }
+
+const char* _Locale_long_d_fmt(_Locale_time_t* ltime)
+{ return ltime->long_date_format; }
+
+const char* _Locale_t_fmt(_Locale_time_t* ltime)
+{ return ltime->time_format; }
+
+const char* _Locale_am_str(_Locale_time_t* ltime)
+{ return ltime->am; }
+
+const char* _Locale_pm_str(_Locale_time_t* ltime)
+{ return ltime->pm; }
+
+/* Messages */
+nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* cat_name) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(cat_name)
+ return -1;
+}
+void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&cat)
+}
+const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat,
+ int setid, int msgid, const char *dfault) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&cat)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&setid)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&msgid)
+ return dfault;
+}
+
+#ifdef __cplusplus
+} /* extern C */
+_STLP_END_NAMESPACE
+#endif
+
+void __FixGrouping(char *grouping) {
+ /* This converts NT version which uses '0' instead of 0, etc ; to ANSI */
+ char *g = grouping;
+ char building_group = 0;
+ char repeat_last = 0;
+ /* Check there is a grouping info otherwise we would add a useless CHAR_MAX */
+ if (*g) {
+ for (; *g; ++g) {
+ if (*g > '0' && *g <= '9') {
+ if (!building_group) {
+ *grouping = *g - '0';
+ building_group = 1;
+ }
+ else {
+ /* Known issue: grouping might roll. */
+ *grouping = *grouping * 10 + *g - '0';
+ }
+ }
+ else if (*g == '0') {
+ if (!building_group) {
+ repeat_last = 1;
+ }
+ else
+ /* Known issue: grouping might roll. */
+ *grouping *= 10;
+ }
+ else if (*g == ';') {
+ /* Stop adding to the current group */
+ building_group = 0;
+ ++grouping;
+ }
+ /* else we ignore the character */
+ }
+
+ if (!repeat_last)
+ *grouping++ = CHAR_MAX;
+ *grouping = 0;
+ }
+}
+
+const char* __ConvertName(const char* lname, LOCALECONV* ConvTable, int TableSize) {
+ int i;
+ int cmp;
+ int low = 0;
+ int high = TableSize - 1;
+
+ /* typical binary search - do until no more to search or match */
+ while (low <= high) {
+ i = (low + high) / 2;
+
+ if ((cmp = lstrcmpiA(lname, (*(ConvTable + i)).name)) == 0)
+ return (*(ConvTable + i)).abbrev;
+ else if (cmp < 0)
+ high = i - 1;
+ else
+ low = i + 1;
+ }
+ return lname;
+}
+
+int __ParseLocaleString(const char* lname,
+ char* lang, char* ctry, char* page) {
+ int param = 0;
+ size_t len;
+ size_t tmpLen;
+
+ if (lname[0] == 0)
+ return 0;
+
+ /* We look for the first country separator '_' */
+ len = strcspn(lname, "_");
+ if (lname[len] == '_') {
+ if (len == 0 || len > MAX_LANG_LEN) return -1; /* empty lang is invalid*/
+ _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len);
+ lname += len + 1;
+ ++param;
+ }
+
+ /* We look for the last code page separator '.' */
+ len = -1;
+ tmpLen = strcspn(lname, ".");
+ while (lname[tmpLen] == '.') {
+ len = tmpLen; ++tmpLen;
+ tmpLen += strcspn(lname + tmpLen, ".");
+ }
+ if (len != -1) { /* Means that we found a '.' */
+ if (param == 0) {
+ /* We have no lang yet so we have to fill it first, no country */
+ if (len > MAX_LANG_LEN) return -1;
+ if (len == 0) {
+ /* No language nor country, only code page */
+ ++param;
+ }
+ else
+ { _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len); }
+ ++param;
+ }
+ else {
+ /* We already have a lang so we are now looking for the country: */
+ if (len == 0) return -1; /* We forbid locale name with the "_." motif in it */
+ if (len > MAX_CTRY_LEN) return -1;
+ _STLP_STRNCPY(ctry, MAX_CTRY_LEN + 1, lname, len);
+ }
+ ++param;
+ lname += len + 1;
+ }
+
+ /* We look for ',' for compatibility with POSIX */
+ len = strcspn(lname, ",");
+ switch (param) {
+ case 0:
+ if (len > MAX_LANG_LEN) return -1;
+ _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len);
+ break;
+ case 1:
+ if (len > MAX_CTRY_LEN) return -1;
+ _STLP_STRNCPY(ctry, MAX_CTRY_LEN + 1, lname, len);
+ break;
+ default:
+ if (len > MAX_CP_LEN) return -1;
+ _STLP_STRNCPY(page, MAX_CP_LEN + 1, lname, len);
+ break;
+ }
+
+ /* ',' POSIX modifier is not used in NT */
+ return 0;
+}
+
+/* Data necessary for find LCID*/
+static CRITICAL_SECTION __criticalSection;
+static int __FindFlag;
+static LCID __FndLCID;
+static const char* __FndLang;
+static const char* __FndCtry;
+
+void _Locale_init()
+{ InitializeCriticalSection(&__criticalSection); }
+
+void _Locale_final()
+{ DeleteCriticalSection(&__criticalSection); }
+
+static LCID LocaleFromHex(const char* locale) {
+ unsigned long result = 0;
+ int digit;
+ while (*locale) {
+ result <<= 4;
+ digit = (*locale >= '0' && *locale <= '9') ? *locale - '0':
+ (*locale >= 'A' && *locale <= 'F') ? (*locale - 'A') + 10
+ : (*locale - 'a') + 10;
+ result += digit;
+ ++locale;
+ }
+ return (LCID)result;
+}
+
+static BOOL CALLBACK EnumLocalesProcA(LPSTR locale) {
+ LCID lcid = LocaleFromHex(locale);
+ int LangFlag = 0, CtryFlag = !__FndCtry;
+ static char Lang[MAX_LANG_LEN], Ctry[MAX_CTRY_LEN];
+
+ GetLocaleInfoA(lcid, LOCALE_SENGLANGUAGE, Lang, MAX_LANG_LEN);
+ if (lstrcmpiA(Lang, __FndLang) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SABBREVLANGNAME, Lang, MAX_LANG_LEN);
+ if (lstrcmpiA(Lang, __FndLang) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, Lang, MAX_LANG_LEN);
+ if (lstrcmpiA(Lang, __FndLang) == 0) LangFlag = 1;
+ }
+ else LangFlag = 1;
+ }
+ else LangFlag = 1;
+
+ if (__FndCtry) {
+ GetLocaleInfoA(lcid, LOCALE_SENGCOUNTRY, Ctry, MAX_CTRY_LEN);
+ if (lstrcmpiA(Ctry, __FndCtry) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SABBREVCTRYNAME, Ctry, MAX_CTRY_LEN);
+ if (lstrcmpiA(Ctry, __FndCtry) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, Ctry, MAX_CTRY_LEN);
+ if (lstrcmpiA(Ctry, __FndCtry) == 0) CtryFlag = 1;
+ }
+ else CtryFlag = 1;
+ }
+ else
+ CtryFlag = 1;
+ }
+
+ if (LangFlag && CtryFlag) {
+ __FindFlag = 1;
+ __FndLCID = lcid;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+int __GetLCID(const char* lang, const char* ctry, LCID* lcid) {
+ int ret;
+ EnterCriticalSection(&__criticalSection);
+
+ __FindFlag = 0;
+ __FndLang = lang;
+ __FndCtry = ctry;
+ EnumSystemLocalesA(EnumLocalesProcA, LCID_INSTALLED);
+
+ if (__FindFlag != 0) *lcid = __FndLCID;
+ ret = __FindFlag != 0 ? 0 : -1;
+
+ LeaveCriticalSection(&__criticalSection);
+ return ret;
+}
+
+int __GetLCIDFromName(const char* lname, LCID* lcid, char* cp, _Locale_lcid_t *hint) {
+ char lang[MAX_LANG_LEN + 1], ctry[MAX_CTRY_LEN + 1], page[MAX_CP_LEN + 1];
+ int result = 0;
+ if (lname == NULL || lname[0] == 0) {
+ *lcid = LOCALE_USER_DEFAULT;
+ return 0;
+ }
+
+ memset(lang, 0, MAX_LANG_LEN + 1);
+ memset(ctry, 0, MAX_CTRY_LEN + 1);
+ memset(page, 0, MAX_CP_LEN + 1);
+ if (__ParseLocaleString(lname, lang, ctry, page) == -1) return -1;
+
+ if (hint != 0) {
+ *lcid = hint->id;
+ }
+ else {
+ if (lang[0] == 0 && ctry[0] == 0)
+ *lcid = LOCALE_USER_DEFAULT; /* Only code page given. */
+ else {
+ if (ctry[0] == 0) {
+ result = __GetLCID(__ConvertName(lang, __rg_language, sizeof(__rg_language) / sizeof(LOCALECONV)), NULL, lcid);
+ if (result != 0) {
+ /* Check 'C' special case. Check is done after call to __GetLCID because normal programs do not
+ * generate facet from 'C' name, they use the locale::classic() facets. */
+ if (lang[0] == 'C' && lang[1] == 0) {
+ *lcid = INVARIANT_LCID;
+ result = 0;
+ }
+ }
+ }
+ else {
+ result = __GetLCID(__ConvertName(lang, __rg_language, sizeof(__rg_language) / sizeof(LOCALECONV)),
+ __ConvertName(ctry, __rg_country, sizeof(__rg_country) / sizeof(LOCALECONV)),
+ lcid);
+ if (result != 0) {
+ /* Non NLS mapping might introduce problem with some locales when only one entry is mapped,
+ * the lang or the country (example: chinese locales like 'chinese_taiwan' gives 'CHS_taiwan'
+ * that do not exists in system). This is why we are giving this locale an other chance by
+ * calling __GetLCID without the mapping. */
+ result = __GetLCID(lang, ctry, lcid);
+ }
+ }
+ }
+ }
+
+ if (result == 0) {
+ /* Handling code page */
+ if (lstrcmpiA(page, "ACP") == 0 || page[0] == 0)
+ my_ltoa(__intGetACP(*lcid), cp);
+ else if (lstrcmpiA(page, "OCP") == 0)
+ my_ltoa(__intGetOCP(*lcid), cp);
+ else if (lstrcmpiA(page, "UTF7") == 0)
+ my_ltoa(CP_UTF7, cp);
+ else if (lstrcmpiA(page, "UTF8") == 0)
+ my_ltoa(CP_UTF8, cp);
+ else
+ _STLP_STRNCPY(cp, MAX_CP_LEN + 1, page, 5);
+
+ /* Code page must be an integer value,
+ * 0 returned by __intGetACP and 1 returned by __intGetOCP are invalid
+ * values.
+ */
+ if (cp[1] == 0 && (cp[0] == '0' || cp[1] == '1'))
+ return -1;
+ else if (atoi(cp) == 0)
+ return -1;
+ }
+
+ return result;
+}
+
+char const* __GetLocaleName(LCID lcid, const char* cp, char* buf) {
+ if (lcid == INVARIANT_LCID) {
+ return _C_name;
+ }
+ else {
+ char lang[MAX_LANG_LEN + 1], ctry[MAX_CTRY_LEN + 1];
+ GetLocaleInfoA(lcid, LOCALE_SENGLANGUAGE, lang, MAX_LANG_LEN);
+ GetLocaleInfoA(lcid, LOCALE_SENGCOUNTRY, ctry, MAX_CTRY_LEN);
+ _STLP_STRCPY(buf, _Locale_MAX_SIMPLE_NAME, lang);
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, "_");
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, ctry);
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, ".");
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, cp);
+ return buf;
+ }
+}
+
+char const* __Extract_locale_name(const char* loc, const char* category, char* buf) {
+ char *expr;
+ size_t len_name;
+
+ if (loc[0] == 'L' && loc[1] == 'C' && loc[2] == '_') {
+ expr = strstr((char*)loc, category);
+ if (expr == NULL) return NULL; /* Category not found. */
+ expr = strchr(expr, '=');
+ if (expr == NULL) return NULL;
+ ++expr;
+ len_name = strcspn(expr, ";");
+ len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1
+ : len_name;
+ _STLP_STRNCPY(buf, _Locale_MAX_SIMPLE_NAME, expr, len_name); buf[len_name] = 0;
+ return buf;
+ }
+ else {
+ return loc;
+ }
+}
+
+char const* __TranslateToSystem(const char* lname, char* buf, _Locale_lcid_t* hint,
+ int *__err_code) {
+ LCID lcid;
+ char cp[MAX_CP_LEN + 1];
+ if (__GetLCIDFromName(lname, &lcid, cp, hint) != 0)
+ { *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ return __GetLocaleName(lcid, cp, buf);
+}
+
+void __GetLocaleInfoUsingACP(LCID lcid, const char* cp, LCTYPE lctype, char* buf, int buf_size, wchar_t* wbuf, int wbuf_size) {
+ wchar_t *Buffer;
+ int BufferSize;
+ int icp;
+
+ GetLocaleInfoA(lcid, lctype, buf, buf_size);
+
+ icp = atoi(cp);
+ if (icp != CP_ACP && buf[0] != 0) {
+ BufferSize = MultiByteToWideChar(CP_ACP, 0, buf, -1, NULL, 0);
+ if (BufferSize > wbuf_size)
+ {
+ Buffer = (wchar_t*)malloc(sizeof(wchar_t) * BufferSize);
+ }
+ else
+ {
+ Buffer = wbuf;
+ }
+ MultiByteToWideChar(CP_ACP, 0, buf, -1, Buffer, BufferSize);
+ WideCharToMultiByte(icp, 0, Buffer, -1, buf, buf_size, NULL, NULL);
+ if (Buffer != wbuf)
+ {
+ free(Buffer);
+ }
+ }
+}
+
+/* Return 0 if ANSI code page not used */
+int __intGetACP(LCID lcid) {
+ char cp[6];
+ if (!GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE, cp, 6)) {
+#if defined (_STLP_LANG_INVARIANT_DEFINED)
+ if (lcid == INVARIANT_LCID) {
+ /* We are using a limited PSDK, we rely on the most common code page */
+ return 1252;
+ }
+#endif
+ return 0;
+ }
+ return atoi(cp);
+}
+
+/* Return 1 if OEM code page not used */
+int __intGetOCP(LCID lcid) {
+ char cp[6];
+ if (!GetLocaleInfoA(lcid, LOCALE_IDEFAULTCODEPAGE, cp, 6))
+ return 0;
+ return atoi(cp);
+}
+
+int __GetDefaultCP(LCID lcid) {
+ int cp = __intGetACP(lcid);
+ if (cp == 0) return __intGetOCP(lcid);
+ else return cp;
+}
+
+static int trim_size_t_to_int(size_t n) { return n < (size_t)INT_MAX ? (int)n : INT_MAX; }
+
+char* __ConvertToCP(int from_cp, int to_cp, const char *from, size_t size, size_t *ret_buf_size) {
+ size_t wbuffer_size, buffer_size, from_offset, wbuf_offset;
+ int from_size, to_size, wbuf_size;
+ wchar_t *wbuffer;
+ char* buffer;
+
+ size_t orig_size = size;
+
+ wbuffer_size = 0;
+ from_offset = 0;
+ while (size > 0) {
+ from_size = trim_size_t_to_int(size);
+ wbuffer_size += MultiByteToWideChar(from_cp, MB_PRECOMPOSED,
+ from + from_offset, from_size, NULL, 0);
+ from_offset += from_size;
+ size -= from_size;
+ }
+
+ wbuffer = (wchar_t*)malloc(sizeof(wchar_t)*wbuffer_size);
+
+ size = orig_size;
+ wbuf_offset = 0;
+ from_offset = 0;
+ while (size > 0) {
+ from_size = trim_size_t_to_int(size);
+ wbuf_size = trim_size_t_to_int(wbuffer_size - wbuf_offset);
+ wbuf_offset += MultiByteToWideChar(from_cp, MB_PRECOMPOSED,
+ from + from_offset, from_size, wbuffer + wbuf_offset, wbuf_size);
+ from_offset += from_size;
+ size -= from_size;
+ }
+
+ buffer_size = 0;
+ wbuf_offset = 0;
+ size = wbuffer_size;
+ while (size > 0) {
+ wbuf_size = trim_size_t_to_int(size);
+ buffer_size += WideCharToMultiByte(to_cp, WC_COMPOSITECHECK | WC_SEPCHARS,
+ wbuffer + wbuf_offset, wbuf_size,
+ NULL, 0, NULL, FALSE);
+ wbuf_offset += wbuf_size;
+ size -= wbuf_size;
+ }
+
+ buffer = (char*)malloc(buffer_size);
+ *ret_buf_size = buffer_size;
+
+ size = wbuffer_size;
+ wbuf_offset = 0;
+ while (size > 0) {
+ wbuf_size = trim_size_t_to_int(size);
+ to_size = trim_size_t_to_int(buffer_size);
+ buffer_size -= WideCharToMultiByte(to_cp, WC_COMPOSITECHECK | WC_SEPCHARS,
+ wbuffer + wbuf_offset, wbuf_size,
+ buffer, to_size, NULL, FALSE);
+ wbuf_offset += wbuf_size;
+ size -= wbuf_size;
+ }
+
+ free(wbuffer);
+ return buffer;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef _STLP_NO_WCHAR_T
+# include "c_wlocale_win32.c"
+#endif
diff --git a/build/stlport/src/c_locale_win32/c_wlocale_win32.c b/build/stlport/src/c_locale_win32/c_wlocale_win32.c
new file mode 100644
index 000000000..a12659b68
--- /dev/null
+++ b/build/stlport/src/c_locale_win32/c_wlocale_win32.c
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2007 2008
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C)
+#else
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C)
+#endif
+
+static const wchar_t* __wtrue_name = L"true";
+static const wchar_t* __wfalse_name = L"false";
+
+typedef struct _Locale_codecvt {
+ _Locale_lcid_t lc;
+ UINT cp;
+ unsigned char cleads[256 / CHAR_BIT];
+ unsigned char max_char_size;
+ DWORD mbtowc_flags;
+ DWORD wctomb_flags;
+} _Locale_codecvt_t;
+
+/* Ctype */
+_Locale_mask_t _WLocale_ctype(_Locale_ctype_t* ltype, wint_t c,
+ _Locale_mask_t which_bits) {
+ wchar_t buf[2];
+ WORD out[2];
+ buf[0] = c; buf[1] = 0;
+ GetStringTypeW(CT_CTYPE1, buf, -1, out);
+ _STLP_MARK_PARAMETER_AS_UNUSED(ltype)
+ return (_Locale_mask_t)(MapCtypeMask(out[0]) & which_bits);
+}
+
+wint_t _WLocale_tolower(_Locale_ctype_t* ltype, wint_t c) {
+ wchar_t in_c = c;
+ wchar_t res;
+
+ LCMapStringW(ltype->lc.id, LCMAP_LOWERCASE, &in_c, 1, &res, 1);
+ return res;
+}
+
+wint_t _WLocale_toupper(_Locale_ctype_t* ltype, wint_t c) {
+ wchar_t in_c = c;
+ wchar_t res;
+
+ LCMapStringW(ltype->lc.id, LCMAP_UPPERCASE, &in_c, 1, &res, 1);
+ return res;
+}
+
+_Locale_codecvt_t* _Locale_codecvt_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ char cp_name[MAX_CP_LEN + 1];
+ unsigned char *ptr;
+ CPINFO CPInfo;
+ int i;
+
+ _Locale_codecvt_t *lcodecvt = (_Locale_codecvt_t*)malloc(sizeof(_Locale_codecvt_t));
+
+ if (!lcodecvt) { *__err_code = _STLP_LOC_NO_MEMORY; return lcodecvt; }
+ memset(lcodecvt, 0, sizeof(_Locale_codecvt_t));
+
+ if (__GetLCIDFromName(name, &lcodecvt->lc.id, cp_name, lc_hint) == -1)
+ { free(lcodecvt); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ lcodecvt->cp = atoi(cp_name);
+ if (!GetCPInfo(lcodecvt->cp, &CPInfo)) { free(lcodecvt); return NULL; }
+
+ if (lcodecvt->cp != CP_UTF7 && lcodecvt->cp != CP_UTF8) {
+ lcodecvt->mbtowc_flags = MB_PRECOMPOSED;
+ lcodecvt->wctomb_flags = WC_COMPOSITECHECK | WC_SEPCHARS;
+ }
+ lcodecvt->max_char_size = CPInfo.MaxCharSize;
+
+ if (CPInfo.MaxCharSize > 1) {
+ for (ptr = (unsigned char*)CPInfo.LeadByte; *ptr && *(ptr + 1); ptr += 2)
+ for (i = *ptr; i <= *(ptr + 1); ++i) lcodecvt->cleads[i / CHAR_BIT] |= (0x01 << i % CHAR_BIT);
+ }
+
+ return lcodecvt;
+}
+
+char const* _Locale_codecvt_name(const _Locale_codecvt_t* lcodecvt, char* buf) {
+ char cp_buf[MAX_CP_LEN + 1];
+ my_ltoa(lcodecvt->cp, cp_buf);
+ return __GetLocaleName(lcodecvt->lc.id, cp_buf, buf);
+}
+
+void _Locale_codecvt_destroy(_Locale_codecvt_t* lcodecvt) {
+ if (!lcodecvt) return;
+
+ free(lcodecvt);
+}
+
+int _WLocale_mb_cur_max (_Locale_codecvt_t * lcodecvt)
+{ return lcodecvt->max_char_size; }
+
+int _WLocale_mb_cur_min (_Locale_codecvt_t *lcodecvt) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lcodecvt)
+ return 1;
+}
+
+int _WLocale_is_stateless (_Locale_codecvt_t * lcodecvt)
+{ return (lcodecvt->max_char_size == 1) ? 1 : 0; }
+
+static int __isleadbyte(int i, unsigned char *ctable) {
+ unsigned char c = (unsigned char)i;
+ return (ctable[c / CHAR_BIT] & (0x01 << c % CHAR_BIT));
+}
+
+static int __mbtowc(_Locale_codecvt_t *l, wchar_t *dst, const char *from, unsigned int count) {
+ int result;
+
+ if (l->cp == CP_UTF7 || l->cp == CP_UTF8) {
+ result = MultiByteToWideChar(l->cp, l->mbtowc_flags, from, count, dst, 1);
+ if (result == 0) {
+ switch (GetLastError()) {
+ case ERROR_NO_UNICODE_TRANSLATION:
+ return -2;
+ default:
+ return -1;
+ }
+ }
+ }
+ else {
+ if (count == 1 && __isleadbyte(*from, l->cleads)) return (size_t)-2;
+ result = MultiByteToWideChar(l->cp, l->mbtowc_flags, from, count, dst, 1);
+ if (result == 0) return -1;
+ }
+
+ return result;
+}
+
+size_t _WLocale_mbtowc(_Locale_codecvt_t *lcodecvt, wchar_t *to,
+ const char *from, size_t n, mbstate_t *shift_state) {
+ int result;
+ _STLP_MARK_PARAMETER_AS_UNUSED(shift_state)
+ if (lcodecvt->max_char_size == 1) { /* Single byte encoding. */
+ result = MultiByteToWideChar(lcodecvt->cp, lcodecvt->mbtowc_flags, from, 1, to, 1);
+ if (result == 0) return (size_t)-1;
+ return result;
+ }
+ else { /* Multi byte encoding. */
+ int retval;
+ unsigned int count = 1;
+ while (n--) {
+ retval = __mbtowc(lcodecvt, to, from, count);
+ if (retval == -2)
+ { if (++count > ((unsigned int)lcodecvt->max_char_size)) return (size_t)-1; }
+ else if (retval == -1)
+ { return (size_t)-1; }
+ else
+ { return count; }
+ }
+ return (size_t)-2;
+ }
+}
+
+size_t _WLocale_wctomb(_Locale_codecvt_t *lcodecvt, char *to, size_t n,
+ const wchar_t c, mbstate_t *shift_state) {
+ int size = WideCharToMultiByte(lcodecvt->cp, lcodecvt->wctomb_flags, &c, 1, NULL, 0, NULL, NULL);
+
+ if (!size) return (size_t)-1;
+ if ((size_t)size > n) return (size_t)-2;
+
+ if (n > INT_MAX)
+ /* Limiting the output buf size to INT_MAX seems like reasonable to transform a single wchar_t. */
+ n = INT_MAX;
+
+ WideCharToMultiByte(lcodecvt->cp, lcodecvt->wctomb_flags, &c, 1, to, (int)n, NULL, NULL);
+
+ _STLP_MARK_PARAMETER_AS_UNUSED(shift_state)
+ return (size_t)size;
+}
+
+size_t _WLocale_unshift(_Locale_codecvt_t *lcodecvt, mbstate_t *st,
+ char *buf, size_t n, char **next) {
+ /* _WLocale_wctomb do not even touch to st, there is nothing to unshift in this localization implementation. */
+ _STLP_MARK_PARAMETER_AS_UNUSED(lcodecvt)
+ _STLP_MARK_PARAMETER_AS_UNUSED(st)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&n)
+ *next = buf;
+ return 0;
+}
+
+/* Collate */
+/* This function takes care of the potential size_t DWORD different size. */
+static int _WLocale_strcmp_aux(_Locale_collate_t* lcol,
+ const wchar_t* s1, size_t n1,
+ const wchar_t* s2, size_t n2) {
+ int result = CSTR_EQUAL;
+ while (n1 > 0 || n2 > 0) {
+ DWORD size1 = trim_size_t_to_DWORD(n1);
+ DWORD size2 = trim_size_t_to_DWORD(n2);
+ result = CompareStringW(lcol->lc.id, 0, s1, size1, s2, size2);
+ if (result != CSTR_EQUAL)
+ break;
+ n1 -= size1;
+ n2 -= size2;
+ }
+ return result;
+}
+
+int _WLocale_strcmp(_Locale_collate_t* lcol,
+ const wchar_t* s1, size_t n1,
+ const wchar_t* s2, size_t n2) {
+ int result;
+ result = _WLocale_strcmp_aux(lcol, s1, n1, s2, n2);
+ return (result == CSTR_EQUAL) ? 0 : (result == CSTR_LESS_THAN) ? -1 : 1;
+}
+
+size_t _WLocale_strxfrm(_Locale_collate_t* lcol,
+ wchar_t* dst, size_t dst_size,
+ const wchar_t* src, size_t src_size) {
+ int result, i;
+
+ /* see _Locale_strxfrm: */
+ if (src_size > INT_MAX) {
+ if (dst != 0) {
+ _STLP_WCSNCPY(dst, dst_size, src, src_size);
+ }
+ return src_size;
+ }
+ if (dst_size > INT_MAX) {
+ dst_size = INT_MAX;
+ }
+ result = LCMapStringW(lcol->lc.id, LCMAP_SORTKEY, src, (int)src_size, dst, (int)dst_size);
+ if (result != 0 && dst != 0) {
+ for (i = result - 1; i >= 0; --i) {
+ dst[i] = ((unsigned char*)dst)[i];
+ }
+ }
+ return result != 0 ? result - 1 : 0;
+}
+
+/* Numeric */
+wchar_t _WLocale_decimal_point(_Locale_numeric_t* lnum) {
+ wchar_t buf[4];
+ GetLocaleInfoW(lnum->lc.id, LOCALE_SDECIMAL, buf, 4);
+ return buf[0];
+}
+
+wchar_t _WLocale_thousands_sep(_Locale_numeric_t* lnum) {
+ wchar_t buf[4];
+ GetLocaleInfoW(lnum->lc.id, LOCALE_STHOUSAND, buf, 4);
+ return buf[0];
+}
+
+const wchar_t * _WLocale_true(_Locale_numeric_t* lnum, wchar_t* buf, size_t bufSize) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ _STLP_MARK_PARAMETER_AS_UNUSED(buf)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&bufSize)
+ return __wtrue_name;
+}
+
+const wchar_t * _WLocale_false(_Locale_numeric_t* lnum, wchar_t* buf, size_t bufSize) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ _STLP_MARK_PARAMETER_AS_UNUSED(buf)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&bufSize)
+ return __wfalse_name;
+}
+
+/* Monetary */
+const wchar_t* _WLocale_int_curr_symbol(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SINTLSYMBOL, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_currency_symbol(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SCURRENCY, buf, (int)bufSize); return buf; }
+
+wchar_t _WLocale_mon_decimal_point(_Locale_monetary_t * lmon)
+{ return lmon->decimal_point[0]; }
+
+wchar_t _WLocale_mon_thousands_sep(_Locale_monetary_t * lmon)
+{ return lmon->thousands_sep[0]; }
+
+const wchar_t* _WLocale_positive_sign(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SPOSITIVESIGN, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_negative_sign(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SNEGATIVESIGN, buf, (int)bufSize); return buf; }
+
+/* Time */
+const wchar_t * _WLocale_full_monthname(_Locale_time_t * ltime, int month,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SMONTHNAME1 + month, buf, (int)bufSize); return buf; }
+
+const wchar_t * _WLocale_abbrev_monthname(_Locale_time_t * ltime, int month,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SABBREVMONTHNAME1 + month, buf, (int)bufSize); return buf; }
+
+const wchar_t * _WLocale_full_dayofweek(_Locale_time_t * ltime, int day,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SDAYNAME1 + day, buf, (int)bufSize); return buf; }
+
+const wchar_t * _WLocale_abbrev_dayofweek(_Locale_time_t * ltime, int day,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SABBREVDAYNAME1 + day, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_am_str(_Locale_time_t* ltime,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_S1159, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_pm_str(_Locale_time_t* ltime,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_S2359, buf, (int)bufSize); return buf; }
diff --git a/build/stlport/src/codecvt.cpp b/build/stlport/src/codecvt.cpp
new file mode 100644
index 000000000..113a26234
--- /dev/null
+++ b/build/stlport/src/codecvt.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <algorithm>
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// codecvt<char, char, mbstate_t>
+
+codecvt<char, char, mbstate_t>::~codecvt() {}
+
+int codecvt<char, char, mbstate_t>::do_length(state_type&,
+ const char* from,
+ const char* end,
+ size_t mx) const
+{ return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); }
+
+int codecvt<char, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
+{ return 1; }
+
+bool
+codecvt<char, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
+{ return true; }
+
+int
+codecvt<char, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
+{ return 1; }
+
+codecvt_base::result
+codecvt<char, char, mbstate_t>::do_unshift(state_type& /* __state */,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const
+{ __to_next = __to; return noconv; }
+
+codecvt_base::result
+codecvt<char, char, mbstate_t>::do_in (state_type& /* __state */ ,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_end */,
+ char*& __to_next) const
+{ __from_next = __from; __to_next = __to; return noconv; }
+
+codecvt_base::result
+codecvt<char, char, mbstate_t>::do_out(state_type& /* __state */,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const
+{ __from_next = __from; __to_next = __to; return noconv; }
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+//----------------------------------------------------------------------
+// codecvt<wchar_t, char, mbstate_t>
+
+codecvt<wchar_t, char, mbstate_t>::~codecvt() {}
+
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_out(state_type& /* state */,
+ const intern_type* from,
+ const intern_type* from_end,
+ const intern_type*& from_next,
+ extern_type* to,
+ extern_type* to_limit,
+ extern_type*& to_next) const {
+ ptrdiff_t len = (min) (from_end - from, to_limit - to);
+ copy(from, from + len, to);
+ from_next = from + len;
+ to_next = to + len;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_in (state_type& /* state */,
+ const extern_type* from,
+ const extern_type* from_end,
+ const extern_type*& from_next,
+ intern_type* to,
+ intern_type* to_limit,
+ intern_type*& to_next) const {
+ ptrdiff_t len = (min) (from_end - from, to_limit - to);
+ copy(__REINTERPRET_CAST(const unsigned char*, from),
+ __REINTERPRET_CAST(const unsigned char*, from) + len, to);
+ from_next = from + len;
+ to_next = to + len;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& /* state */,
+ extern_type* to,
+ extern_type* ,
+ extern_type*& to_next) const {
+ to_next = to;
+ return noconv;
+}
+
+int codecvt<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
+{ return 1; }
+
+bool codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
+{ return true; }
+
+int codecvt<wchar_t, char, mbstate_t>::do_length(state_type&,
+ const extern_type* from,
+ const extern_type* end,
+ size_t mx) const
+{ return (int)(min) ((size_t) (end - from), mx); }
+
+int codecvt<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
+{ return 1; }
+#endif /* wchar_t */
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/src/collate.cpp b/build/stlport/src/collate.cpp
new file mode 100644
index 000000000..ee5540dfe
--- /dev/null
+++ b/build/stlport/src/collate.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+
+_STLP_BEGIN_NAMESPACE
+
+// collate<char>
+
+collate<char>::~collate() {}
+
+int collate<char>::do_compare(const char* low1, const char* high1,
+ const char* low2, const char* high2) const
+{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
+
+string collate<char>::do_transform(const char* low, const char* high) const
+{ return string(low, high); }
+
+long collate<char>::do_hash(const char* low, const char* high) const {
+ unsigned long result = 0;
+ for ( ; low < high; ++low)
+ result = 5 * result + *low;
+ return result;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// collate<wchar_t>
+
+collate<wchar_t>::~collate() {}
+
+int
+collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
+ const wchar_t* low2, const wchar_t* high2) const
+{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
+
+wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
+{ return wstring(low, high); }
+
+long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const {
+ unsigned long result = 0;
+ for ( ; low < high; ++low)
+ result = 5 * result + *low;
+ return result;
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/src/complex.cpp b/build/stlport/src/complex.cpp
new file mode 100644
index 000000000..6da5bc1a7
--- /dev/null
+++ b/build/stlport/src/complex.cpp
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <numeric>
+#include <cmath>
+#include <complex>
+
+#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB >= 1400)
+// hypot is deprecated.
+# if defined (_STLP_MSVC)
+# pragma warning (disable : 4996)
+# elif defined (__ICL)
+# pragma warning (disable : 1478)
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Complex division and square roots.
+
+// Absolute value
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>& __z)
+{ return ::hypot(__z._M_re, __z._M_im); }
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>& __z)
+{ return ::hypot(__z._M_re, __z._M_im); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>& __z)
+{ return ::hypot(__z._M_re, __z._M_im); }
+#endif
+
+// Phase
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>& __z)
+{ return ::atan2(__z._M_im, __z._M_re); }
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>& __z)
+{ return ::atan2(__z._M_im, __z._M_re); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>& __z)
+{ return ::atan2(__z._M_im, __z._M_re); }
+#endif
+
+// Construct a complex number from polar representation
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi)
+{ return complex<float>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi)
+{ return complex<double>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double& __rho, const long double& __phi)
+{ return complex<long double>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
+#endif
+
+// Division
+template <class _Tp>
+static void _divT(const _Tp& __z1_r, const _Tp& __z1_i,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio + __z1_i) / __denom;
+ __res_i = (__z1_i * __ratio - __z1_r) / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = (__z1_r + __z1_i * __ratio) / __denom;
+ __res_i = (__z1_i - __z1_r * __ratio) / __denom;
+ }
+}
+
+template <class _Tp>
+static void _divT(const _Tp& __z1_r,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio) / __denom;
+ __res_i = - __z1_r / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = __z1_r / __denom;
+ __res_i = - (__z1_r * __ratio) / __denom;
+ }
+}
+
+void _STLP_CALL
+complex<float>::_div(const float& __z1_r, const float& __z1_i,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i)
+{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
+
+void _STLP_CALL
+complex<float>::_div(const float& __z1_r,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i)
+{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
+
+
+void _STLP_CALL
+complex<double>::_div(const double& __z1_r, const double& __z1_i,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i)
+{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
+
+void _STLP_CALL
+complex<double>::_div(const double& __z1_r,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i)
+{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_CALL
+complex<long double>::_div(const long double& __z1_r, const long double& __z1_i,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i)
+{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
+
+void _STLP_CALL
+complex<long double>::_div(const long double& __z1_r,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i)
+{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
+#endif
+
+//----------------------------------------------------------------------
+// Square root
+template <class _Tp>
+static complex<_Tp> sqrtT(const complex<_Tp>& z) {
+ _Tp re = z._M_re;
+ _Tp im = z._M_im;
+ _Tp mag = ::hypot(re, im);
+ complex<_Tp> result;
+
+ if (mag == 0.f) {
+ result._M_re = result._M_im = 0.f;
+ } else if (re > 0.f) {
+ result._M_re = ::sqrt(0.5f * (mag + re));
+ result._M_im = im/result._M_re/2.f;
+ } else {
+ result._M_im = ::sqrt(0.5f * (mag - re));
+ if (im < 0.f)
+ result._M_im = - result._M_im;
+ result._M_re = im/result._M_im/2.f;
+ }
+ return result;
+}
+
+complex<float> _STLP_CALL
+sqrt(const complex<float>& z) { return sqrtT(z); }
+
+complex<double> _STLP_CALL
+sqrt(const complex<double>& z) { return sqrtT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+complex<long double> _STLP_CALL
+sqrt(const complex<long double>& z) { return sqrtT(z); }
+#endif
+
+// exp, log, pow for complex<float>, complex<double>, and complex<long double>
+//----------------------------------------------------------------------
+// exp
+template <class _Tp>
+static complex<_Tp> expT(const complex<_Tp>& z) {
+ _Tp expx = ::exp(z._M_re);
+ return complex<_Tp>(expx * ::cos(z._M_im),
+ expx * ::sin(z._M_im));
+}
+_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>& z)
+{ return expT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>& z)
+{ return expT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>& z)
+{ return expT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// log10
+template <class _Tp>
+static complex<_Tp> log10T(const complex<_Tp>& z, const _Tp& ln10_inv) {
+ complex<_Tp> r;
+
+ r._M_im = ::atan2(z._M_im, z._M_re) * ln10_inv;
+ r._M_re = ::log10(::hypot(z._M_re, z._M_im));
+ return r;
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>& z)
+{
+ const float LN10_INVF = 1.f / ::log(10.f);
+ return log10T(z, LN10_INVF);
+}
+
+_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>& z)
+{
+ const double LN10_INV = 1. / ::log10(10.);
+ return log10T(z, LN10_INV);
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>& z)
+{
+ const long double LN10_INVL = 1.l / ::log(10.l);
+ return log10T(z, LN10_INVL);
+}
+#endif
+
+//----------------------------------------------------------------------
+// log
+template <class _Tp>
+static complex<_Tp> logT(const complex<_Tp>& z) {
+ complex<_Tp> r;
+
+ r._M_im = ::atan2(z._M_im, z._M_re);
+ r._M_re = ::log(::hypot(z._M_re, z._M_im));
+ return r;
+}
+_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>& z)
+{ return logT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>& z)
+{ return logT(z); }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>& z)
+{ return logT(z); }
+# endif
+
+//----------------------------------------------------------------------
+// pow
+template <class _Tp>
+static complex<_Tp> powT(const _Tp& a, const complex<_Tp>& b) {
+ _Tp logr = ::log(a);
+ _Tp x = ::exp(logr * b._M_re);
+ _Tp y = logr * b._M_im;
+
+ return complex<_Tp>(x * ::cos(y), x * ::sin(y));
+}
+
+template <class _Tp>
+static complex<_Tp> powT(const complex<_Tp>& z_in, int n) {
+ complex<_Tp> z = z_in;
+ z = _STLP_PRIV __power(z, (n < 0 ? -n : n), multiplies< complex<_Tp> >());
+ if (n < 0)
+ return _Tp(1.0) / z;
+ else
+ return z;
+}
+
+template <class _Tp>
+static complex<_Tp> powT(const complex<_Tp>& a, const _Tp& b) {
+ _Tp logr = ::log(::hypot(a._M_re,a._M_im));
+ _Tp logi = ::atan2(a._M_im, a._M_re);
+ _Tp x = ::exp(logr * b);
+ _Tp y = logi * b;
+
+ return complex<_Tp>(x * ::cos(y), x * ::sin(y));
+}
+
+template <class _Tp>
+static complex<_Tp> powT(const complex<_Tp>& a, const complex<_Tp>& b) {
+ _Tp logr = ::log(::hypot(a._M_re,a._M_im));
+ _Tp logi = ::atan2(a._M_im, a._M_re);
+ _Tp x = ::exp(logr * b._M_re - logi * b._M_im);
+ _Tp y = logr * b._M_im + logi * b._M_re;
+
+ return complex<_Tp>(x * ::cos(y), x * ::sin(y));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float& a, const complex<float>& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& z_in, int n)
+{ return powT(z_in, n); }
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& a, const float& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& a, const complex<float>& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double& a, const complex<double>& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& z_in, int n)
+{ return powT(z_in, n); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& a, const double& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& a, const complex<double>& b)
+{ return powT(a, b); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double& a,
+ const complex<long double>& b)
+{ return powT(a, b); }
+
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& z_in, int n)
+{ return powT(z_in, n); }
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& a,
+ const long double& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& a,
+ const complex<long double>& b)
+{ return powT(a, b); }
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/complex_io.cpp b/build/stlport/src/complex_io.cpp
new file mode 100644
index 000000000..4cb6636f6
--- /dev/null
+++ b/build/stlport/src/complex_io.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <complex>
+#include <istream>
+
+_STLP_BEGIN_NAMESPACE
+
+// Specializations for narrow characters; lets us avoid the nuisance of
+// widening.
+_STLP_OPERATOR_SPEC
+basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<float>& __z)
+{ return __os << '(' << (double)__z.real() << ',' << (double)__z.imag() << ')'; }
+
+_STLP_OPERATOR_SPEC
+basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<double>& __z)
+{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_OPERATOR_SPEC
+basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<long double>& __z)
+{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
+#endif
+
+// Specialization for narrow characters; lets us avoid widen.
+_STLP_OPERATOR_SPEC
+basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z) {
+ float __re = 0;
+ float __im = 0;
+
+ char __c;
+
+ __is >> __c;
+ if (__c == '(') {
+ __is >> __re >> __c;
+ if (__c == ',')
+ __is >> __im >> __c;
+ if (__c != ')')
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<float>(__re, __im);
+ return __is;
+}
+
+_STLP_OPERATOR_SPEC
+basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z) {
+ double __re = 0;
+ double __im = 0;
+
+ char __c;
+
+ __is >> __c;
+ if (__c == '(') {
+ __is >> __re >> __c;
+ if (__c == ',')
+ __is >> __im >> __c;
+ if (__c != ')')
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<double>(__re, __im);
+ return __is;
+}
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_OPERATOR_SPEC
+basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z) {
+ long double __re = 0;
+ long double __im = 0;
+
+ char __c;
+
+ __is >> __c;
+ if (__c == '(') {
+ __is >> __re >> __c;
+ if (__c == ',')
+ __is >> __im >> __c;
+ if (__c != ')')
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<long double>(__re, __im);
+ return __is;
+}
+#endif
+
+// Force instantiation of complex I/O functions
+#if !(defined (_STLP_NO_FORCE_INSTANTIATE) || defined (_STLP_NO_WCHAR_T))
+
+_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
+
+_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
+
+_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
+#endif
+
+_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
+
+_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
+
+#endif /* _STLP_NO_WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/src/complex_trig.cpp b/build/stlport/src/complex_trig.cpp
new file mode 100644
index 000000000..62d6be70f
--- /dev/null
+++ b/build/stlport/src/complex_trig.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+
+// Trigonometric and hyperbolic functions for complex<float>,
+// complex<double>, and complex<long double>
+#include <complex>
+#include <cfloat>
+#include <cmath>
+
+_STLP_BEGIN_NAMESPACE
+
+
+//----------------------------------------------------------------------
+// helpers
+#if defined (__sgi)
+ static const union { unsigned int i; float f; } float_ulimit = { 0x42b2d4fc };
+ static const float float_limit = float_ulimit.f;
+ static union {
+ struct { unsigned int h; unsigned int l; } w;
+ double d;
+ } double_ulimit = { 0x408633ce, 0x8fb9f87d };
+ static const double double_limit = double_ulimit.d;
+ static union {
+ struct { unsigned int h[2]; unsigned int l[2]; } w;
+ long double ld;
+ } ldouble_ulimit = {0x408633ce, 0x8fb9f87e, 0xbd23b659, 0x4e9bd8b1};
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# define ldouble_limit ldouble_ulimit.ld
+# endif
+#else
+# if defined (M_LN2) && defined (FLT_MAX_EXP)
+ static const float float_limit = float(M_LN2 * FLT_MAX_EXP);
+ static const double double_limit = M_LN2 * DBL_MAX_EXP;
+# else
+ static const float float_limit = ::log(FLT_MAX);
+ static const double double_limit = ::log(DBL_MAX);
+# endif
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if defined (M_LN2l)
+# define ldouble_limit (M_LN2l * LDBL_MAX_EXP)
+# else
+# define ldouble_limit ::log(LDBL_MAX)
+# endif
+# endif
+#endif
+
+
+//----------------------------------------------------------------------
+// sin
+template <class _Tp>
+static complex<_Tp> sinT(const complex<_Tp>& z) {
+ return complex<_Tp>(::sin(z._M_re) * ::cosh(z._M_im),
+ ::cos(z._M_re) * ::sinh(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>& z)
+{ return sinT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>& z)
+{ return sinT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>& z)
+{ return sinT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// cos
+template <class _Tp>
+static complex<_Tp> cosT(const complex<_Tp>& z) {
+ return complex<_Tp>(::cos(z._M_re) * ::cosh(z._M_im),
+ -::sin(z._M_re) * ::sinh(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>& z)
+{ return cosT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>& z)
+{ return cosT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>& z)
+{ return cosT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// tan
+template <class _Tp>
+static complex<_Tp> tanT(const complex<_Tp>& z, const _Tp& Tp_limit) {
+ _Tp re2 = 2.f * z._M_re;
+ _Tp im2 = 2.f * z._M_im;
+
+ if (::abs(im2) > Tp_limit)
+ return complex<_Tp>(0.f, (im2 > 0 ? 1.f : -1.f));
+ else {
+ _Tp den = ::cos(re2) + ::cosh(im2);
+ return complex<_Tp>(::sin(re2) / den, ::sinh(im2) / den);
+ }
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>& z)
+{ return tanT(z, float_limit); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>& z)
+{ return tanT(z, double_limit); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>& z)
+{ return tanT(z, ldouble_limit); }
+#endif
+
+//----------------------------------------------------------------------
+// sinh
+template <class _Tp>
+static complex<_Tp> sinhT(const complex<_Tp>& z) {
+ return complex<_Tp>(::sinh(z._M_re) * ::cos(z._M_im),
+ ::cosh(z._M_re) * ::sin(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>& z)
+{ return sinhT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>& z)
+{ return sinhT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>& z)
+{ return sinhT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// cosh
+template <class _Tp>
+static complex<_Tp> coshT(const complex<_Tp>& z) {
+ return complex<_Tp>(::cosh(z._M_re) * ::cos(z._M_im),
+ ::sinh(z._M_re) * ::sin(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>& z)
+{ return coshT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>& z)
+{ return coshT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>& z)
+{ return coshT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// tanh
+template <class _Tp>
+static complex<_Tp> tanhT(const complex<_Tp>& z, const _Tp& Tp_limit) {
+ _Tp re2 = 2.f * z._M_re;
+ _Tp im2 = 2.f * z._M_im;
+ if (::abs(re2) > Tp_limit)
+ return complex<_Tp>((re2 > 0 ? 1.f : -1.f), 0.f);
+ else {
+ _Tp den = ::cosh(re2) + ::cos(im2);
+ return complex<_Tp>(::sinh(re2) / den, ::sin(im2) / den);
+ }
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>& z)
+{ return tanhT(z, float_limit); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>& z)
+{ return tanhT(z, double_limit); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>& z)
+{ return tanhT(z, ldouble_limit); }
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/ctype.cpp b/build/stlport/src/ctype.cpp
new file mode 100644
index 000000000..b1e84b156
--- /dev/null
+++ b/build/stlport/src/ctype.cpp
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <algorithm>
+#include <locale>
+#include <functional>
+
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// ctype<char>
+
+// The classic table: static data members.
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+//*TY 02/25/2000 - added workaround for MPW compilers; they confuse on in-class static const
+const size_t ctype<char>::table_size;
+#endif
+
+// This macro is specifically for platforms where isprint() relies
+// on separate flag
+
+const ctype_base::mask*
+ctype<char>::classic_table() _STLP_NOTHROW {
+ /* Ctype table for the ASCII character set. */
+ static const ctype_base::mask _S_classic_table[table_size] = {
+ cntrl /* null */,
+ cntrl /* ^A */,
+ cntrl /* ^B */,
+ cntrl /* ^C */,
+ cntrl /* ^D */,
+ cntrl /* ^E */,
+ cntrl /* ^F */,
+ cntrl /* ^G */,
+ cntrl /* ^H */,
+ ctype_base::mask(space | cntrl) /* tab */,
+ ctype_base::mask(space | cntrl) /* LF */,
+ ctype_base::mask(space | cntrl) /* ^K */,
+ ctype_base::mask(space | cntrl) /* FF */,
+ ctype_base::mask(space | cntrl) /* ^M */,
+ cntrl /* ^N */,
+ cntrl /* ^O */,
+ cntrl /* ^P */,
+ cntrl /* ^Q */,
+ cntrl /* ^R */,
+ cntrl /* ^S */,
+ cntrl /* ^T */,
+ cntrl /* ^U */,
+ cntrl /* ^V */,
+ cntrl /* ^W */,
+ cntrl /* ^X */,
+ cntrl /* ^Y */,
+ cntrl /* ^Z */,
+ cntrl /* esc */,
+ cntrl /* ^\ */,
+ cntrl /* ^] */,
+ cntrl /* ^^ */,
+ cntrl /* ^_ */,
+ ctype_base::mask(space | print) /* */,
+ ctype_base::mask(punct | print) /* ! */,
+ ctype_base::mask(punct | print) /* " */,
+ ctype_base::mask(punct | print) /* # */,
+ ctype_base::mask(punct | print) /* $ */,
+ ctype_base::mask(punct | print) /* % */,
+ ctype_base::mask(punct | print) /* & */,
+ ctype_base::mask(punct | print) /* ' */,
+ ctype_base::mask(punct | print) /* ( */,
+ ctype_base::mask(punct | print) /* ) */,
+ ctype_base::mask(punct | print) /* * */,
+ ctype_base::mask(punct | print) /* + */,
+ ctype_base::mask(punct | print) /* , */,
+ ctype_base::mask(punct | print) /* - */,
+ ctype_base::mask(punct | print) /* . */,
+ ctype_base::mask(punct | print) /* / */,
+ ctype_base::mask(digit | print | xdigit) /* 0 */,
+ ctype_base::mask(digit | print | xdigit) /* 1 */,
+ ctype_base::mask(digit | print | xdigit) /* 2 */,
+ ctype_base::mask(digit | print | xdigit) /* 3 */,
+ ctype_base::mask(digit | print | xdigit) /* 4 */,
+ ctype_base::mask(digit | print | xdigit) /* 5 */,
+ ctype_base::mask(digit | print | xdigit) /* 6 */,
+ ctype_base::mask(digit | print | xdigit) /* 7 */,
+ ctype_base::mask(digit | print | xdigit) /* 8 */,
+ ctype_base::mask(digit | print | xdigit) /* 9 */,
+ ctype_base::mask(punct | print) /* : */,
+ ctype_base::mask(punct | print) /* ; */,
+ ctype_base::mask(punct | print) /* < */,
+ ctype_base::mask(punct | print) /* = */,
+ ctype_base::mask(punct | print) /* > */,
+ ctype_base::mask(punct | print) /* ? */,
+ ctype_base::mask(punct | print) /* ! */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* A */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* B */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* C */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* D */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* E */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* F */,
+ ctype_base::mask(alpha | print | upper) /* G */,
+ ctype_base::mask(alpha | print | upper) /* H */,
+ ctype_base::mask(alpha | print | upper) /* I */,
+ ctype_base::mask(alpha | print | upper) /* J */,
+ ctype_base::mask(alpha | print | upper) /* K */,
+ ctype_base::mask(alpha | print | upper) /* L */,
+ ctype_base::mask(alpha | print | upper) /* M */,
+ ctype_base::mask(alpha | print | upper) /* N */,
+ ctype_base::mask(alpha | print | upper) /* O */,
+ ctype_base::mask(alpha | print | upper) /* P */,
+ ctype_base::mask(alpha | print | upper) /* Q */,
+ ctype_base::mask(alpha | print | upper) /* R */,
+ ctype_base::mask(alpha | print | upper) /* S */,
+ ctype_base::mask(alpha | print | upper) /* T */,
+ ctype_base::mask(alpha | print | upper) /* U */,
+ ctype_base::mask(alpha | print | upper) /* V */,
+ ctype_base::mask(alpha | print | upper) /* W */,
+ ctype_base::mask(alpha | print | upper) /* X */,
+ ctype_base::mask(alpha | print | upper) /* Y */,
+ ctype_base::mask(alpha | print | upper) /* Z */,
+ ctype_base::mask(punct | print) /* [ */,
+ ctype_base::mask(punct | print) /* \ */,
+ ctype_base::mask(punct | print) /* ] */,
+ ctype_base::mask(punct | print) /* ^ */,
+ ctype_base::mask(punct | print) /* _ */,
+ ctype_base::mask(punct | print) /* ` */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* a */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* b */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* c */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* d */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* e */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* f */,
+ ctype_base::mask(alpha | print | lower) /* g */,
+ ctype_base::mask(alpha | print | lower) /* h */,
+ ctype_base::mask(alpha | print | lower) /* i */,
+ ctype_base::mask(alpha | print | lower) /* j */,
+ ctype_base::mask(alpha | print | lower) /* k */,
+ ctype_base::mask(alpha | print | lower) /* l */,
+ ctype_base::mask(alpha | print | lower) /* m */,
+ ctype_base::mask(alpha | print | lower) /* n */,
+ ctype_base::mask(alpha | print | lower) /* o */,
+ ctype_base::mask(alpha | print | lower) /* p */,
+ ctype_base::mask(alpha | print | lower) /* q */,
+ ctype_base::mask(alpha | print | lower) /* r */,
+ ctype_base::mask(alpha | print | lower) /* s */,
+ ctype_base::mask(alpha | print | lower) /* t */,
+ ctype_base::mask(alpha | print | lower) /* u */,
+ ctype_base::mask(alpha | print | lower) /* v */,
+ ctype_base::mask(alpha | print | lower) /* w */,
+ ctype_base::mask(alpha | print | lower) /* x */,
+ ctype_base::mask(alpha | print | lower) /* y */,
+ ctype_base::mask(alpha | print | lower) /* z */,
+ ctype_base::mask(punct | print) /* { */,
+ ctype_base::mask(punct | print) /* | */,
+ ctype_base::mask(punct | print) /* } */,
+ ctype_base::mask(punct | print) /* ~ */,
+ cntrl /* del (0x7f)*/,
+ /* ASCII is a 7-bit code, so everything else is non-ASCII */
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0)
+ };
+ return _S_classic_table;
+}
+
+// For every c in the range 0 <= c < 256, _S_upper[c] is the
+// uppercased version of c and _S_lower[c] is the lowercased
+// version. As before, these two tables assume the ASCII character
+// set.
+
+const unsigned char _S_upper[ctype<char>::table_size] =
+{
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+const unsigned char _S_lower[ctype<char>::table_size] =
+{
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+//An helper struct to check wchar_t index without generating warnings
+//under some compilers (gcc) because of a limited range of value
+//(when wchar_t is unsigned)
+template <bool _IsSigned>
+struct _WCharIndexT;
+
+#if !(defined (__BORLANDC__) && !defined(__linux__)) && \
+ !(defined (__GNUC__) && (defined (__MINGW32__) || defined (__CYGWIN__))) && \
+ !defined (__ICL)
+_STLP_TEMPLATE_NULL
+struct _WCharIndexT<true> {
+ static bool in_range(wchar_t c, size_t upperBound) {
+ return c >= 0 && size_t(c) < upperBound;
+ }
+};
+#endif
+
+_STLP_TEMPLATE_NULL
+struct _WCharIndexT<false> {
+ static bool in_range(wchar_t c, size_t upperBound) {
+ return size_t(c) < upperBound;
+ }
+};
+
+typedef _WCharIndexT<wchar_t(-1) < 0> _WCharIndex;
+
+// Some helper functions used in ctype<>::scan_is and scan_is_not.
+
+struct _Ctype_is_mask : public unary_function<char, bool> {
+ ctype_base::mask _Mask;
+ const ctype_base::mask* _M_table;
+
+ _Ctype_is_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {}
+ bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) != 0; }
+};
+
+struct _Ctype_not_mask : public unary_function<char, bool> {
+ ctype_base::mask _Mask;
+ const ctype_base::mask* _M_table;
+
+ _Ctype_not_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {}
+ bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) == 0; }
+};
+
+ctype<char>::ctype(const ctype_base::mask * __tab, bool __del, size_t __refs) :
+ locale::facet(__refs),
+ _M_ctype_table(__tab ? __tab : classic_table()),
+ _M_delete(__tab && __del)
+{}
+
+ctype<char>::~ctype() {
+ if (_M_delete)
+ delete[] __CONST_CAST(ctype_base::mask *, _M_ctype_table);
+}
+
+const char*
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype<char>::scan_is(ctype_base::mask __m, const char* __low, const char* __high) const
+{ return _STLP_STD::find_if(__low, __high, _Ctype_is_mask(__m, _M_ctype_table)); }
+
+const char*
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype<char>::scan_not(ctype_base::mask __m, const char* __low, const char* __high) const
+{ return _STLP_STD::find_if(__low, __high, _Ctype_not_mask(__m, _M_ctype_table)); }
+
+char ctype<char>::do_toupper(char __c) const
+{ return (char) _S_upper[(unsigned char) __c]; }
+char ctype<char>::do_tolower(char __c) const
+{ return (char) _S_lower[(unsigned char) __c]; }
+
+const char* ctype<char>::do_toupper(char* __low, const char* __high) const {
+ for ( ; __low < __high; ++__low)
+ *__low = (char) _S_upper[(unsigned char) *__low];
+ return __high;
+}
+const char* ctype<char>::do_tolower(char* __low, const char* __high) const {
+ for ( ; __low < __high; ++__low)
+ *__low = (char) _S_lower[(unsigned char) *__low];
+ return __high;
+}
+
+char
+ctype<char>::do_widen(char __c) const { return __c; }
+
+const char*
+ctype<char>::do_widen(const char* __low, const char* __high,
+ char* __to) const {
+ _STLP_PRIV __copy_trivial(__low, __high, __to);
+ return __high;
+}
+char
+ctype<char>::do_narrow(char __c, char /* dfault */ ) const { return __c; }
+const char*
+ctype<char>::do_narrow(const char* __low, const char* __high,
+ char /* dfault */, char* __to) const {
+ _STLP_PRIV __copy_trivial(__low, __high, __to);
+ return __high;
+}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+struct _Ctype_w_is_mask : public unary_function<wchar_t, bool> {
+ ctype_base::mask M;
+ const ctype_base::mask* table;
+
+ _Ctype_w_is_mask(ctype_base::mask m, const ctype_base::mask* t)
+ : M(m), table(t) {}
+ bool operator()(wchar_t c) const
+ { return _WCharIndex::in_range(c, ctype<char>::table_size) && (table[c] & M); }
+};
+
+//----------------------------------------------------------------------
+// ctype<wchar_t>
+
+ctype<wchar_t>::~ctype() {}
+
+
+bool ctype<wchar_t>::do_is(ctype_base::mask m, wchar_t c) const {
+ const ctype_base::mask * table = ctype<char>::classic_table();
+ return _WCharIndex::in_range(c, ctype<char>::table_size) && (m & table[c]);
+}
+
+const wchar_t* ctype<wchar_t>::do_is(const wchar_t* low, const wchar_t* high,
+ ctype_base::mask * vec) const {
+ // boris : not clear if this is the right thing to do...
+ const ctype_base::mask * table = ctype<char>::classic_table();
+ wchar_t c;
+ for ( ; low < high; ++low, ++vec) {
+ c = *low;
+ *vec = _WCharIndex::in_range(c, ctype<char>::table_size) ? table[c] : ctype_base::mask(0);
+ }
+ return high;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_scan_is(ctype_base::mask m,
+ const wchar_t* low, const wchar_t* high) const {
+ return find_if(low, high, _Ctype_w_is_mask(m, ctype<char>::classic_table()));
+}
+
+
+const wchar_t*
+ctype<wchar_t>::do_scan_not(ctype_base::mask m,
+ const wchar_t* low, const wchar_t* high) const {
+ return find_if(low, high, not1(_Ctype_w_is_mask(m, ctype<char>::classic_table())));
+}
+
+wchar_t ctype<wchar_t>::do_toupper(wchar_t c) const {
+ return _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_upper[c]
+ : c;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low) {
+ wchar_t c = *low;
+ *low = _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_upper[c]
+ : c;
+ }
+ return high;
+}
+
+wchar_t ctype<wchar_t>::do_tolower(wchar_t c) const {
+ return _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_lower[c]
+ : c;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_tolower(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low) {
+ wchar_t c = *low;
+ *low = _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_lower[c]
+ : c;
+ }
+ return high;
+}
+
+wchar_t ctype<wchar_t>::do_widen(char c) const {
+ return (wchar_t)(unsigned char)c;
+}
+
+const char*
+ctype<wchar_t>::do_widen(const char* low, const char* high,
+ wchar_t* dest) const {
+ while (low != high)
+ *dest++ = (wchar_t)(unsigned char)*low++;
+ return high;
+}
+
+char ctype<wchar_t>::do_narrow(wchar_t c, char dfault) const
+{ return (unsigned char)c == c ? (char)c : dfault; }
+
+const wchar_t* ctype<wchar_t>::do_narrow(const wchar_t* low,
+ const wchar_t* high,
+ char dfault, char* dest) const {
+ while (low != high) {
+ wchar_t c = *low++;
+ *dest++ = (unsigned char)c == c ? (char)c : dfault;
+ }
+
+ return high;
+}
+
+# endif
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/src/cxa.c b/build/stlport/src/cxa.c
new file mode 100644
index 000000000..998170e0f
--- /dev/null
+++ b/build/stlport/src/cxa.c
@@ -0,0 +1,198 @@
+#include "stlport_prefix.h"
+
+#if defined(__unix) && defined(__GNUC__)
+
+#ifdef __FreeBSD__
+# include <osreldate.h>
+#endif
+
+#if (defined(__FreeBSD__) && (__FreeBSD_version < 503001)) || defined(__sun) || defined (__hpux)
+/* Note: __cxa_finalize and __cxa_atexit present in libc in FreeBSD 5.3 */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+
+/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@" "STLPORT_5_0_0"); */
+/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */
+
+/* Not atomic! */
+/* But we can use static mutexes here: I hope that performance issue isn't very
+ significant on unloading (for only few calls, ~10) - ptr */
+
+/*
+#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ ({ __typeof (mem) __gmemp = (mem); \
+ __typeof (*mem) __gnewval = (newval); \
+ \
+ *__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
+*/
+
+enum {
+ ef_free, /* `ef_free' MUST be zero! */
+ ef_us,
+ ef_on,
+ ef_at,
+ ef_cxa
+};
+
+struct exit_function
+{
+ /* `flavour' should be of type of the `enum' above but since we need
+ this element in an atomic operation we have to use `long int'. */
+ long int flavor;
+ union {
+ void (*at)(void);
+ struct {
+ void (*fn)(int status, void *arg);
+ void *arg;
+ } on;
+ struct {
+ void (*fn)(void *arg, int status);
+ void *arg;
+ void *dso_handle;
+ } cxa;
+ } func;
+};
+
+struct exit_function_list
+{
+ struct exit_function_list *next;
+ size_t idx;
+ struct exit_function fns[32];
+};
+
+struct exit_function *__new_exitfn (void);
+
+/* Register a function to be called by exit or when a shared library
+ is unloaded. This function is only called from code generated by
+ the C++ compiler. */
+int __cxa_atexit(void (*func)(void *), void *arg, void *d)
+{
+ struct exit_function *new = __new_exitfn ();
+
+ if ( new == NULL )
+ return -1;
+
+ new->flavor = ef_cxa;
+ new->func.cxa.fn = (void (*) (void *, int)) func;
+ new->func.cxa.arg = arg;
+ new->func.cxa.dso_handle = d;
+ return 0;
+}
+
+
+/* We change global data, so we need locking. */
+#ifdef __linux__
+static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#endif
+/* #ifdef __FreeBSD__ */
+#if 0
+static pthread_mutex_t lock =
+ { PTHREAD_MUTEX_RECURSIVE /* PTHREAD_MUTEX_DEFAULT */, PTHREAD_PRIO_NONE, {NULL,NULL},
+ NULL, { NULL }, /* MUTEX_FLAGS_PRIVATE */ 0x1, 0, 0, 0, {NULL, NULL},
+ { 0, 0, 0, 0 } };
+#endif
+#ifdef __sun
+static pthread_mutex_t lock =
+ {{0, 0, 0, PTHREAD_MUTEX_RECURSIVE, _MUTEX_MAGIC}, {{{0}}}, 0};
+#endif
+#ifdef __hpux
+static pthread_mutex_t lock = PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP;
+# ifdef __ia64
+void *__dso_handle = (void *) &__dso_handle;
+# endif
+#endif
+
+
+static struct exit_function_list initial;
+struct exit_function_list *__exit_funcs = &initial;
+
+struct exit_function *__new_exitfn(void)
+{
+ struct exit_function_list *l;
+ size_t i = 0;
+
+#ifndef __FreeBSD__
+ pthread_mutex_lock( &lock );
+#endif
+
+ for (l = __exit_funcs; l != NULL; l = l->next) {
+ for (i = 0; i < l->idx; ++i)
+ if (l->fns[i].flavor == ef_free)
+ break;
+ if ( i < l->idx )
+ break;
+
+ if (l->idx < sizeof (l->fns) / sizeof (l->fns[0])) {
+ i = l->idx++;
+ break;
+ }
+ }
+
+ if (l == NULL) {
+ l = (struct exit_function_list *)malloc( sizeof(struct exit_function_list) );
+ if (l != NULL) {
+ l->next = __exit_funcs;
+ __exit_funcs = l;
+
+ l->idx = 1;
+ i = 0;
+ }
+ }
+
+ /* Mark entry as used, but we don't know the flavor now. */
+ if ( l != NULL )
+ l->fns[i].flavor = ef_us;
+
+#ifndef __FreeBSD__
+ pthread_mutex_unlock( &lock );
+#endif
+
+ return l == NULL ? NULL : &l->fns[i];
+}
+
+/* If D is non-NULL, call all functions registered with `__cxa_atexit'
+ with the same dso handle. Otherwise, if D is NULL, call all of the
+ registered handlers. */
+
+/*
+ * Note, that original __cxa_finalize don't use lock, but use __exit_funcs
+ * i.e. global data.
+ */
+void __cxa_finalize(void *d)
+{
+ struct exit_function_list *funcs;
+
+#ifndef __FreeBSD__
+ pthread_mutex_lock( &lock );
+#endif
+
+ for (funcs = __exit_funcs; funcs; funcs = funcs->next) {
+ struct exit_function *f;
+
+ for (f = &funcs->fns[funcs->idx - 1]; f >= &funcs->fns[0]; --f) {
+ if ( (d == NULL || d == f->func.cxa.dso_handle) && (f->flavor == ef_cxa) ) {
+ f->flavor = ef_free;
+ (*f->func.cxa.fn) (f->func.cxa.arg, 0);
+ }
+ }
+ }
+
+ /* Remove the registered fork handlers. We do not have to
+ unregister anything if the program is going to terminate anyway. */
+#ifdef UNREGISTER_ATFORK
+ if (d != NULL)
+ UNREGISTER_ATFORK (d);
+#endif
+#ifndef __FreeBSD__
+ pthread_mutex_unlock( &lock );
+#endif
+}
+
+/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */
+/* void __cxa_finalize(void *d) __attribute__ ((weak)); */
+
+#endif /* OS name */
+#endif /* __unix */
+
diff --git a/build/stlport/src/details/fstream_stdio.cpp b/build/stlport/src/details/fstream_stdio.cpp
new file mode 100644
index 000000000..8392ffdeb
--- /dev/null
+++ b/build/stlport/src/details/fstream_stdio.cpp
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if defined (__SUNPPRO_CC) && !defined (_STLP_NO_NEW_C_HEADERS)
+# include <time.h>
+// For sunpro, it chokes if time.h is included through stat.h
+#endif
+
+#include <fstream>
+
+#ifdef __CYGWIN__
+# define __int64 long long
+#endif
+
+#include <cstdio>
+#if !defined(__ISCPP__)
+extern "C" {
+# include <sys/stat.h>
+}
+#endif
+
+#if defined( __MSL__ )
+# include <unix.h>
+#endif
+
+#if defined(__ISCPP__)
+# include <c_locale_is/filestat.h>
+#endif
+
+#if defined(__BEOS__) && defined(__INTEL__)
+# include <fcntl.h>
+# include <sys/stat.h> // For _fstat
+#endif
+
+#if defined (_STLP_MSVC) || defined (__MINGW32__)
+# include <fcntl.h>
+# define S_IREAD _S_IREAD
+# define S_IWRITE _S_IWRITE
+# define S_IFREG _S_IFREG
+ // map permission masks
+# ifndef S_IRUSR
+# define S_IRUSR _S_IREAD
+# define S_IWUSR _S_IWRITE
+# endif
+# ifndef S_IRGRP
+# define S_IRGRP _S_IREAD
+# define S_IWGRP _S_IWRITE
+# endif
+# ifndef S_IROTH
+# define S_IROTH _S_IREAD
+# define S_IWOTH _S_IWRITE
+# endif
+
+# ifndef O_RDONLY
+# define O_RDONLY _O_RDONLY
+# define O_WRONLY _O_WRONLY
+# define O_RDWR _O_RDWR
+# define O_APPEND _O_APPEND
+# define O_CREAT _O_CREAT
+# define O_TRUNC _O_TRUNC
+# define O_TEXT _O_TEXT
+# define O_BINARY _O_BINARY
+# endif
+
+# ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+# endif
+#endif
+
+const _STLP_fd INVALID_STLP_FD = -1;
+
+
+# ifdef __MSL__
+# define _O_TEXT 0x0
+# if !defined( O_TEXT )
+# define O_TEXT _O_TEXT
+# endif
+# define _S_IFREG S_IFREG
+# define S_IREAD S_IRUSR
+# define S_IWRITE S_IWUSR
+# define S_IEXEC S_IXUSR
+# define _S_IWRITE S_IWRITE
+# define _S_IREAD S_IREAD
+# define _open open
+# define _close close
+# define _read read
+# define _write write
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Compare with streamoff definition in stl/char_traits.h!
+
+#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \
+ (!defined(_LARGEFILE_SOURCE) && !defined(_LARGEFILE64_SOURCE))
+# define FOPEN fopen
+# define FSEEK fseek
+# define FSTAT fstat
+# define STAT stat
+# define FTELL ftell
+#else
+# define FOPEN fopen64
+# define FSEEK fseeko64
+# define FSTAT fstat64
+# define STAT stat64
+# define FTELL ftello64
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for _Filebuf_base.
+
+static bool __is_regular_file(_STLP_fd fd) {
+ struct STAT buf;
+ return FSTAT(fd, &buf) == 0 && (buf.st_mode & S_IFREG) != 0 ;
+}
+
+// Number of characters in the file.
+static streamoff __file_size(_STLP_fd fd) {
+ streamoff ret = 0;
+
+ struct STAT buf;
+ if (FSTAT(fd, &buf) == 0 && (buf.st_mode & S_IFREG) != 0)
+ ret = buf.st_size > 0 ? buf.st_size : 0;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// All version of Unix have mmap and lseek system calls. Some also have
+// longer versions of those system calls to accommodate 64-bit offsets.
+// If we're on a Unix system, define some macros to encapsulate those
+// differences.
+
+size_t _Filebuf_base::_M_page_size = 4096;
+
+_Filebuf_base::_Filebuf_base()
+ : _M_file_id(INVALID_STLP_FD),
+ _M_openmode(0),
+ _M_is_open(false),
+ _M_should_close(false)
+{}
+
+void _Filebuf_base::_S_initialize()
+{
+
+}
+
+// Return the size of the file. This is a wrapper for stat.
+// Returns zero if the size cannot be determined or is ill-defined.
+streamoff _Filebuf_base::_M_file_size()
+{
+ return _STLP_PRIV __file_size(_M_file_id);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode,
+ long permission)
+{
+ _STLP_fd file_no;
+
+ if (_M_is_open)
+ return false;
+
+ // use FILE-based i/o
+ const char* flags;
+
+ switch (openmode & (~ios_base::ate)) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ flags = "w";
+ break;
+
+ case ios_base::out | ios_base::binary:
+ case ios_base::out | ios_base::trunc | ios_base::binary:
+ flags = "wb";
+ break;
+
+ case ios_base::out | ios_base::app:
+ flags = "a";
+ break;
+
+ case ios_base::out | ios_base::app | ios_base::binary:
+ flags = "ab";
+ break;
+
+ case ios_base::in:
+ flags = "r";
+ break;
+
+ case ios_base::in | ios_base::binary:
+ flags = "rb";
+ break;
+
+ case ios_base::in | ios_base::out:
+ flags = "r+";
+ break;
+
+ case ios_base::in | ios_base::out | ios_base::binary:
+ flags = "r+b";
+ break;
+
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ flags = "w+";
+ break;
+
+ case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
+ flags = "w+b";
+ break;
+
+ default: // The above are the only combinations of
+ return false; // flags allowed by the C++ standard.
+ }
+
+ // fbp : TODO : set permissions !
+ (void)permission; // currently unused //*TY 02/26/2000 - added to suppress warning message
+ _M_file = FOPEN(name, flags);
+
+ if (_M_file) {
+ file_no = fileno(_M_file);
+ } else {
+ return false;
+ }
+
+ // unset buffering immediately
+ setbuf(_M_file, 0);
+
+ _M_is_open = true;
+
+ if (openmode & ios_base::ate) {
+ if (FSEEK(_M_file, 0, SEEK_END) != 0)
+ _M_is_open = false;
+ }
+
+ _M_file_id = file_no;
+ _M_should_close = _M_is_open;
+ _M_openmode = openmode;
+
+ if (_M_is_open)
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return (_M_is_open != 0);
+}
+
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode)
+{
+ // This doesn't really grant everyone in the world read/write
+ // access. On Unix, file-creation system calls always clear
+ // bits that are set in the umask from the permissions flag.
+ return this->_M_open(name, openmode, S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP | S_IROTH | S_IWOTH);
+}
+
+// Associated the filebuf with a file descriptor pointing to an already-
+// open file. Mode is set to be consistent with the way that the file
+// was opened.
+bool _Filebuf_base::_M_open( int file_no, ios_base::openmode )
+{
+ if (_M_is_open || file_no < 0)
+ return false;
+
+ struct STAT buf;
+ if (FSTAT(file_no, &buf) != 0)
+ return false;
+ int mode = buf.st_mode;
+
+ switch ( mode & (S_IWRITE | S_IREAD) ) {
+ case S_IREAD:
+ _M_openmode = ios_base::in;
+ break;
+ case S_IWRITE:
+ _M_openmode = ios_base::out;
+ break;
+ case (S_IWRITE | S_IREAD):
+ _M_openmode = ios_base::in | ios_base::out;
+ break;
+ default:
+ return false;
+ }
+ _M_file_id = file_no;
+ _M_is_open = true;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+ return true;
+}
+
+bool _Filebuf_base::_M_close()
+{
+ if (!_M_is_open)
+ return false;
+
+ bool ok = _M_should_close ? (fclose(_M_file) == 0) : true;
+
+ _M_is_open = _M_should_close = false;
+ _M_openmode = 0;
+ return ok;
+}
+
+// Read up to n characters into a buffer. Return value is number of
+// characters read.
+ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n) {
+ return fread(buf, 1, n, _M_file);
+}
+
+// Write n characters from a buffer. Return value: true if we managed
+// to write the entire buffer, false if we didn't.
+bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n)
+{
+ for (;;) {
+ ptrdiff_t written = fwrite(buf, 1, n, _M_file);
+
+ if (n == written) {
+ return true;
+ }
+
+ if (written > 0 && written < n) {
+ n -= written;
+ buf += written;
+ } else {
+ return false;
+ }
+ }
+}
+
+// Wrapper for lseek or the like.
+streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir)
+{
+ int whence;
+
+ switch ( dir ) {
+ case ios_base::beg:
+ if (offset < 0 /* || offset > _M_file_size() */ )
+ return streamoff(-1);
+ whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ if (/* offset > 0 || */ -offset > _M_file_size() )
+ return streamoff(-1);
+ whence = SEEK_END;
+ break;
+ default:
+ return streamoff(-1);
+ }
+
+ if ( FSEEK(_M_file, offset, whence) == 0 ) {
+ return FTELL(_M_file);
+ }
+
+ return streamoff(-1);
+}
+
+
+// Attempts to memory-map len bytes of the current file, starting
+// at position offset. Precondition: offset is a multiple of the
+// page size. Postcondition: return value is a null pointer if the
+// memory mapping failed. Otherwise the return value is a pointer to
+// the memory-mapped file and the file position is set to offset.
+void *_Filebuf_base::_M_mmap(streamoff, streamoff )
+{
+ return 0;
+}
+
+void _Filebuf_base::_M_unmap(void*, streamoff)
+{
+ // precondition : there is a valid mapping at the moment
+}
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/details/fstream_unistd.cpp b/build/stlport/src/details/fstream_unistd.cpp
new file mode 100644
index 000000000..744088302
--- /dev/null
+++ b/build/stlport/src/details/fstream_unistd.cpp
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if defined (__SUNPPRO_CC) && !defined (_STLP_NO_NEW_C_HEADERS)
+# include <time.h>
+// For sunpro, it chokes if time.h is included through stat.h
+#endif
+
+#include <fstream>
+
+#ifdef __CYGWIN__
+# define __int64 long long
+#endif
+
+extern "C" {
+// open/close/read/write
+#include <sys/stat.h> // For stat
+#if !defined (_CRAY) && ! defined (__EMX__)
+# include <sys/mman.h> // For mmap
+#endif
+
+// on HP-UX 11, this one contradicts with pthread.h on pthread_atfork, unless we unset this
+#if defined (__hpux) && defined (__GNUC__)
+# undef _INCLUDE_POSIX1C_SOURCE
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+}
+
+#ifdef __APPLE__
+# include <sys/sysctl.h>
+#endif
+
+const _STLP_fd INVALID_STLP_FD = -1;
+
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif
+
+// Compare with streamoff definition in stl/char_traits.h!
+#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \
+ (!defined(_LARGEFILE_SOURCE) && !defined (_LARGEFILE64_SOURCE))
+# define FSTAT fstat
+# define STAT stat
+# define LSEEK lseek
+# define MMAP mmap
+# define OPEN open
+#else
+# define FSTAT fstat64
+# define STAT stat64
+# define LSEEK lseek64
+# define MMAP mmap64
+# define OPEN open64
+#endif
+
+#ifndef MAP_FAILED /* MMAP failure return code */
+# define MAP_FAILED -1
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+static ios_base::openmode flag_to_openmode(int mode)
+{
+ ios_base::openmode ret = ios_base::__default_mode;
+
+ switch ( mode & O_ACCMODE ) {
+ case O_RDONLY:
+ ret = ios_base::in;
+ break;
+ case O_WRONLY:
+ ret = ios_base::out;
+ break;
+ case O_RDWR:
+ ret = ios_base::in | ios_base::out;
+ break;
+ }
+
+ if ( mode & O_APPEND )
+ ret |= ios_base::app;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for _Filebuf_base.
+
+static bool __is_regular_file(_STLP_fd fd) {
+ struct STAT buf;
+ return FSTAT(fd, &buf) == 0 && S_ISREG(buf.st_mode);
+}
+
+// Number of characters in the file.
+static streamoff __file_size(_STLP_fd fd) {
+ streamoff ret = 0;
+
+ struct STAT buf;
+ if (FSTAT(fd, &buf) == 0 && S_ISREG(buf.st_mode))
+ ret = buf.st_size > 0 ? buf.st_size : 0;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+size_t _Filebuf_base::_M_page_size = 4096;
+
+_Filebuf_base::_Filebuf_base()
+ : _M_file_id(INVALID_STLP_FD),
+ _M_openmode(0),
+ _M_is_open(false),
+ _M_should_close(false)
+{}
+
+void _Filebuf_base::_S_initialize()
+{
+#if defined (__APPLE__)
+ int mib[2];
+ size_t pagesize, len;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ len = sizeof(pagesize);
+ sysctl(mib, 2, &pagesize, &len, NULL, 0);
+ _M_page_size = pagesize;
+#elif defined (__DJGPP) && defined (_CRAY)
+ _M_page_size = BUFSIZ;
+#else
+ _M_page_size = sysconf(_SC_PAGESIZE);
+#endif
+}
+
+// Return the size of the file. This is a wrapper for stat.
+// Returns zero if the size cannot be determined or is ill-defined.
+streamoff _Filebuf_base::_M_file_size()
+{
+ return _STLP_PRIV __file_size(_M_file_id);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode,
+ long permission)
+{
+ _STLP_fd file_no;
+
+ if (_M_is_open)
+ return false;
+
+ int flags = 0;
+
+ // Unix makes no distinction between text and binary files.
+ switch ( openmode & (~ios_base::ate & ~ios_base::binary) ) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ flags = O_WRONLY | O_CREAT | O_TRUNC;
+ break;
+ case ios_base::app:
+ case ios_base::out | ios_base::app:
+ flags = O_WRONLY | O_CREAT | O_APPEND;
+ break;
+ case ios_base::in:
+ flags = O_RDONLY;
+ permission = 0; // Irrelevant unless we're writing.
+ break;
+ case ios_base::in | ios_base::out:
+ flags = O_RDWR;
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ flags = O_RDWR | O_CREAT | O_TRUNC;
+ break;
+ case ios_base::in | ios_base::app:
+ case ios_base::in | ios_base::out | ios_base::app:
+ flags = O_RDWR | O_CREAT | O_APPEND;
+ break;
+ default: // The above are the only combinations of
+ return false; // flags allowed by the C++ standard.
+ }
+
+ file_no = OPEN(name, flags, permission);
+
+ if (file_no < 0)
+ return false;
+
+ _M_is_open = true;
+
+ if ((openmode & (ios_base::ate | ios_base::app)) && (LSEEK(file_no, 0, SEEK_END) == -1)) {
+ _M_is_open = false;
+ }
+
+ _M_file_id = file_no;
+ _M_should_close = _M_is_open;
+ _M_openmode = openmode;
+
+ if (_M_is_open)
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return (_M_is_open != 0);
+}
+
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode)
+{
+ // This doesn't really grant everyone in the world read/write
+ // access. On Unix, file-creation system calls always clear
+ // bits that are set in the umask from the permissions flag.
+ return this->_M_open(name, openmode, S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP | S_IROTH | S_IWOTH);
+}
+
+// Associated the filebuf with a file descriptor pointing to an already-
+// open file. Mode is set to be consistent with the way that the file
+// was opened.
+bool _Filebuf_base::_M_open(int file_no, ios_base::openmode)
+{
+ if (_M_is_open || file_no < 0)
+ return false;
+
+ int mode = fcntl(file_no, F_GETFL);
+
+ if (mode == -1)
+ return false;
+
+ _M_openmode = flag_to_openmode(mode);
+ _M_file_id = file_no;
+
+ _M_is_open = true;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+ return true;
+}
+
+bool _Filebuf_base::_M_close()
+{
+ if (!_M_is_open)
+ return false;
+
+ bool ok = _M_should_close ? (close(_M_file_id) == 0) : true;
+
+ _M_is_open = _M_should_close = false;
+ _M_openmode = 0;
+ return ok;
+}
+
+// Read up to n characters into a buffer. Return value is number of
+// characters read.
+ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n)
+{
+ return read(_M_file_id, buf, n);
+}
+
+// Write n characters from a buffer. Return value: true if we managed
+// to write the entire buffer, false if we didn't.
+bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n)
+{
+ for (;;) {
+ ptrdiff_t written = write(_M_file_id, buf, n);
+
+ if (n == written) {
+ return true;
+ }
+
+ if (written > 0 && written < n) {
+ n -= written;
+ buf += written;
+ } else {
+ return false;
+ }
+ }
+}
+
+// Wrapper for lseek or the like.
+streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir)
+{
+ int whence;
+
+ switch ( dir ) {
+ case ios_base::beg:
+ if (offset < 0 /* || offset > _M_file_size() */ )
+ return streamoff(-1);
+ whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ if (/* offset > 0 || */ -offset > _M_file_size() )
+ return streamoff(-1);
+ whence = SEEK_END;
+ break;
+ default:
+ return streamoff(-1);
+ }
+
+ return LSEEK(_M_file_id, offset, whence);
+}
+
+// Attempts to memory-map len bytes of the current file, starting
+// at position offset. Precondition: offset is a multiple of the
+// page size. Postcondition: return value is a null pointer if the
+// memory mapping failed. Otherwise the return value is a pointer to
+// the memory-mapped file and the file position is set to offset.
+void* _Filebuf_base::_M_mmap(streamoff offset, streamoff len)
+{
+ void* base;
+#if !defined (__DJGPP) && !defined (_CRAY)
+ base = MMAP(0, len, PROT_READ, MAP_PRIVATE, _M_file_id, offset);
+ if (base != (void*)MAP_FAILED) {
+ if (LSEEK(_M_file_id, offset + len, SEEK_SET) < 0) {
+ this->_M_unmap(base, len);
+ base = 0;
+ }
+ } else
+ base =0;
+#else
+ _STLP_MARK_PARAMETER_AS_UNUSED(&offset)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&len)
+ base = 0;
+#endif
+ return base;
+}
+
+void _Filebuf_base::_M_unmap(void* base, streamoff len)
+{
+ // precondition : there is a valid mapping at the moment
+#if !defined (__DJGPP) && !defined (_CRAY)
+ munmap((char*)base, len);
+#else
+ _STLP_MARK_PARAMETER_AS_UNUSED(&len)
+ _STLP_MARK_PARAMETER_AS_UNUSED(base)
+#endif
+}
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/details/fstream_win32io.cpp b/build/stlport/src/details/fstream_win32io.cpp
new file mode 100644
index 000000000..673f3670c
--- /dev/null
+++ b/build/stlport/src/details/fstream_win32io.cpp
@@ -0,0 +1,629 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include <fstream>
+
+#if !defined (_STLP_WCE)
+# ifdef __BORLANDC__
+# include <cfcntl.h> // For _O_RDONLY, etc
+# else
+# include <io.h> // For _get_osfhandle
+# include <fcntl.h> // For _O_RDONLY, etc
+# endif
+# include <sys/stat.h> // For _fstat
+#endif
+
+#define _TEXTBUF_SIZE 0x1000
+
+const _STLP_fd INVALID_STLP_FD = INVALID_HANDLE_VALUE;
+
+#if !defined (INVALID_SET_FILE_POINTER)
+# define INVALID_SET_FILE_POINTER 0xffffffff
+#endif
+
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined(__MSL__) && !defined(_STLP_WCE)
+static ios_base::openmode flag_to_openmode(int mode) {
+ ios_base::openmode ret = ios_base::__default_mode;
+
+ switch (mode & O_ACCMODE) {
+ case O_RDONLY:
+ ret = ios_base::in; break;
+ case O_WRONLY:
+ ret = ios_base::out; break;
+ case O_RDWR:
+ ret = ios_base::in | ios_base::out; break;
+ }
+
+ if (mode & O_APPEND)
+ ret |= ios_base::app;
+
+ if (mode & O_BINARY)
+ ret |= ios_base::binary;
+
+ return ret;
+}
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for _Filebuf_base.
+
+static bool __is_regular_file(_STLP_fd fd) {
+ BY_HANDLE_FILE_INFORMATION info;
+
+ // Return true if the file handle isn't a directory.
+ return GetFileInformationByHandle(fd, &info) &&
+ ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0);
+}
+
+// Number of characters in the file.
+static streamoff __file_size(_STLP_fd fd) {
+ streamoff ret = 0;
+
+ LARGE_INTEGER li;
+ li.LowPart = GetFileSize(fd, (unsigned long*) &li.HighPart);
+ if (li.LowPart != INVALID_FILE_SIZE || GetLastError() == NO_ERROR)
+ ret = li.QuadPart;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Visual C++ and Intel use this, but not Metrowerks
+// Also MinGW, msvcrt.dll (but not crtdll.dll) dependent version
+#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
+ (defined (__MINGW32__) && defined (__MSVCRT__))
+
+// fcntl(fileno, F_GETFL) for Microsoft library
+// 'semi-documented' defines:
+# define IOINFO_L2E 5
+# define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
+# define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + \
+ ((i) & (IOINFO_ARRAY_ELTS - 1)) )
+# define FAPPEND 0x20 // O_APPEND flag
+# define FTEXT 0x80 // O_TEXT flag
+// end of 'semi-documented' defines
+
+// 'semi-documented' internal structure
+extern "C" {
+ struct ioinfo {
+ long osfhnd; // the real os HANDLE
+ char osfile; // file handle flags
+ char pipech; // pipe buffer
+# if defined (_MT)
+ // multi-threaded locking
+ int lockinitflag;
+ CRITICAL_SECTION lock;
+# endif
+ };
+# if defined (__MINGW32__)
+ __MINGW_IMPORT ioinfo * __pioinfo[];
+# else
+ extern _CRTIMP ioinfo * __pioinfo[];
+# endif
+} // extern "C"
+// end of 'semi-documented' declarations
+
+static ios_base::openmode _get_osfflags(int fd, HANDLE oshandle) {
+ char dosflags = 0;
+ if (fd >= 0)
+ dosflags = _pioinfo(fd)->osfile;
+ //else
+ //the file will be considered as open in binary mode with no append attribute
+ // end of 'semi-documented' stuff
+
+ int mode = 0;
+ if (dosflags & FAPPEND)
+ mode |= O_APPEND;
+
+ if (dosflags & FTEXT)
+ mode |= O_TEXT;
+ else
+ mode |= O_BINARY;
+
+ // For Read/Write access we have to guess
+ DWORD dummy, dummy2;
+ BOOL writeOk = WriteFile(oshandle, &dummy2, 0, &dummy, 0);
+ BOOL readOk = ReadFile(oshandle, &dummy2, 0, &dummy, NULL);
+ if (writeOk && readOk)
+ mode |= O_RDWR;
+ else if (readOk)
+ mode |= O_RDONLY;
+ else
+ mode |= O_WRONLY;
+
+ return flag_to_openmode(mode);
+}
+
+#elif defined (__DMC__)
+
+# define FHND_APPEND 0x04
+# define FHND_DEVICE 0x08
+# define FHND_TEXT 0x10
+
+extern "C" unsigned char __fhnd_info[_NFILE];
+
+static ios_base::openmode _get_osfflags(int fd, HANDLE oshandle) {
+ int mode = 0;
+
+ if (__fhnd_info[fd] & FHND_APPEND)
+ mode |= O_APPEND;
+
+ if (__fhnd_info[fd] & FHND_TEXT == 0)
+ mode |= O_BINARY;
+
+ for (FILE *fp = &_iob[0]; fp < &_iob[_NFILE]; fp++) {
+ if ((fileno(fp) == fd) && (fp->_flag & (_IOREAD | _IOWRT | _IORW))) {
+ const int osflags = fp->_flag;
+
+ if ((osflags & _IOREAD) && !(osflags & _IOWRT) && !(osflags & _IORW))
+ mode |= O_RDONLY;
+ else if ((osflags & _IOWRT) && !(osflags & _IOREAD) && !(osflags & _IORW))
+ mode |= O_WRONLY;
+ else
+ mode |= O_RDWR;
+ break;
+ }
+ }
+
+ return flag_to_openmode(mode);
+}
+#endif
+
+size_t _Filebuf_base::_M_page_size = 4096;
+
+_Filebuf_base::_Filebuf_base()
+ : _M_file_id(INVALID_STLP_FD),
+ _M_openmode(0),
+ _M_is_open(false),
+ _M_should_close(false),
+ _M_view_id(0)
+{}
+
+void _Filebuf_base::_S_initialize() {
+ SYSTEM_INFO SystemInfo;
+ GetSystemInfo(&SystemInfo);
+ _M_page_size = SystemInfo.dwPageSize;
+ // might be .dwAllocationGranularity
+}
+
+// Return the size of the file. This is a wrapper for stat.
+// Returns zero if the size cannot be determined or is ill-defined.
+streamoff _Filebuf_base::_M_file_size() {
+ return _STLP_PRIV __file_size(_M_file_id);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode,
+ long permission) {
+ _STLP_fd file_no;
+
+ if (_M_is_open)
+ return false;
+
+ DWORD dwDesiredAccess, dwCreationDisposition;
+ bool doTruncate = false;
+
+ switch (openmode & (~ios_base::ate & ~ios_base::binary)) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ dwDesiredAccess = GENERIC_WRITE;
+ dwCreationDisposition = OPEN_ALWAYS;
+ // boris : even though it is very non-intuitive, standard
+ // requires them both to behave same.
+ doTruncate = true;
+ break;
+ case ios_base::out | ios_base::app:
+ dwDesiredAccess = GENERIC_WRITE;
+ dwCreationDisposition = OPEN_ALWAYS;
+ break;
+ case ios_base::in:
+ dwDesiredAccess = GENERIC_READ;
+ dwCreationDisposition = OPEN_EXISTING;
+ permission = 0; // Irrelevant unless we're writing.
+ break;
+ case ios_base::in | ios_base::out:
+ dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ dwCreationDisposition = OPEN_EXISTING;
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ dwCreationDisposition = OPEN_ALWAYS;
+ doTruncate = true;
+ break;
+ default: // The above are the only combinations of
+ return false; // flags allowed by the C++ standard.
+ }
+
+ DWORD dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+ file_no = CreateFile (_STLP_PRIV __ASCIIToWide(name).c_str(),
+#else
+ file_no = CreateFileA(name,
+#endif
+ dwDesiredAccess, dwShareMode, 0,
+ dwCreationDisposition, permission, 0);
+
+ if (file_no == INVALID_STLP_FD)
+ return false;
+
+ if (
+#if !defined (_STLP_WCE)
+ GetFileType(file_no) == FILE_TYPE_DISK &&
+#endif
+ ((doTruncate && SetEndOfFile(file_no) == 0) ||
+ (((openmode & ios_base::ate) != 0) &&
+ (SetFilePointer(file_no, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER)))) {
+ CloseHandle(file_no);
+ return false;
+ }
+
+ _M_is_open = true;
+ _M_file_id = file_no;
+ _M_should_close = _M_is_open;
+ _M_openmode = openmode;
+
+ if (_M_is_open)
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return (_M_is_open != 0);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode) {
+ // This doesn't really grant everyone in the world read/write
+ // access. On Unix, file-creation system calls always clear
+ // bits that are set in the umask from the permissions flag.
+ return this->_M_open(name, openmode, FILE_ATTRIBUTE_NORMAL);
+}
+
+bool _Filebuf_base::_M_open(_STLP_fd __id, ios_base::openmode init_mode) {
+#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
+ (defined (__MINGW32__) && defined (__MSVCRT__)) || defined (__DMC__)
+
+ if (_M_is_open || __id == INVALID_STLP_FD)
+ return false;
+
+ if (init_mode != ios_base::__default_mode)
+ _M_openmode = init_mode;
+ else
+ _M_openmode = _get_osfflags(-1, __id);
+
+ _M_is_open = true;
+ _M_file_id = __id;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return true;
+#else
+ (void)__id;
+ (void)init_mode; // dwa 4/27/00 - suppress unused parameter warning
+
+ // not available for the API
+ return false;
+
+#endif
+}
+
+// Associated the filebuf with a file descriptor pointing to an already-
+// open file. Mode is set to be consistent with the way that the file
+// was opened.
+bool _Filebuf_base::_M_open(int file_no, ios_base::openmode init_mode) {
+ if (_M_is_open || file_no < 0)
+ return false;
+
+#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
+ (defined (__MINGW32__) && defined (__MSVCRT__)) || defined (__DMC__)
+
+ HANDLE oshandle = (HANDLE)_get_osfhandle(file_no);
+ if (oshandle == INVALID_STLP_FD)
+ return false;
+
+ if (init_mode != ios_base::__default_mode)
+ _M_openmode = init_mode;
+ else
+ _M_openmode = _get_osfflags(file_no, oshandle);
+
+ _M_file_id = oshandle;
+ _M_is_open = true;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+ return true;
+#else
+ _STLP_MARK_PARAMETER_AS_UNUSED(&init_mode)
+ // not available for the API
+ return false;
+#endif
+}
+
+bool _Filebuf_base::_M_close() {
+ if (!_M_is_open)
+ return false;
+
+ bool ok;
+
+ if (!_M_should_close)
+ ok = true;
+ else {
+ if (_M_file_id != INVALID_STLP_FD) {
+ ok = (CloseHandle(_M_file_id) != 0);
+ }
+ else {
+ ok = false;
+ }
+ }
+
+ _M_is_open = _M_should_close = false;
+ _M_openmode = 0;
+ return ok;
+}
+
+
+#define _STLP_LF 10
+#define _STLP_CR 13
+#define _STLP_CTRLZ 26
+
+// Read up to n characters into a buffer. Return value is number of
+// characters read.
+ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n) {
+ ptrdiff_t readen = 0;
+ //Here cast to size_t is safe as n cannot be negative.
+ size_t chunkSize = (min)(size_t(0xffffffff), __STATIC_CAST(size_t, n));
+ // The following, while validating that we are still able to extract chunkSize
+ // charaters to the buffer, avoids extraction of too small chunk of datas
+ // which would be counter performant.
+ while (__STATIC_CAST(size_t, (n - readen)) >= chunkSize) {
+ DWORD numberOfBytesRead;
+ ReadFile(_M_file_id, buf + readen, __STATIC_CAST(DWORD, chunkSize), &numberOfBytesRead, 0);
+
+ if (numberOfBytesRead == 0)
+ break;
+
+ if (!(_M_openmode & ios_base::binary)) {
+ // translate CR-LFs to LFs in the buffer
+ char *to = buf + readen;
+ char *from = to;
+ char *last = from + numberOfBytesRead - 1;
+ for (; from <= last && *from != _STLP_CTRLZ; ++from) {
+ if (*from != _STLP_CR)
+ *to++ = *from;
+ else { // found CR
+ if (from < last) { // not at buffer end
+ if (*(from + 1) != _STLP_LF)
+ *to++ = _STLP_CR;
+ }
+ else { // last char is CR, peek for LF
+ char peek = ' ';
+ DWORD NumberOfBytesPeeked;
+ ReadFile(_M_file_id, (LPVOID)&peek, 1, &NumberOfBytesPeeked, 0);
+ if (NumberOfBytesPeeked != 0) {
+ if (peek != _STLP_LF) { //not a <CR><LF> combination
+ *to++ = _STLP_CR;
+ if ((to < buf + n) && (peek != _STLP_CR))
+ //We have enough place to store peek and it is no a special
+ //_STLP_CR character, we can store it.
+ *to++ = peek;
+ else
+ SetFilePointer(_M_file_id, (LONG)-1, 0, FILE_CURRENT);
+ }
+ else {
+ // A <CR><LF> combination, we keep the <LF>:
+ *to++ = _STLP_LF;
+ }
+ }
+ else {
+ /* This case is tedious, we could
+ * - put peek back in the file but this would then generate an infinite loop
+ * - report an error as we don't know if in a future call to ReadFile we won't then
+ * get a <LF>. Doing so would make all files with a <CR> last an invalid file
+ * for STLport, a hard solution for STLport clients.
+ * - store the <CR> in the returned buffer, the chosen solution, even if in this
+ * case we could miss a <CR><LF> combination.
+ */
+ *to++ = _STLP_CR;
+ }
+ }
+ } // found CR
+ } // for
+ readen = to - buf;
+ // seek back to TEXT end of file if hit CTRL-Z
+ if (from <= last) { // terminated due to CTRLZ
+ SetFilePointer(_M_file_id, -(LONG)((last + 1) - from), 0, FILE_CURRENT);
+ break;
+ }
+ }
+ else
+ readen += numberOfBytesRead;
+ }
+ return readen;
+}
+
+// Write n characters from a buffer. Return value: true if we managed
+// to write the entire buffer, false if we didn't.
+bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n) {
+ for (;;) {
+ ptrdiff_t written;
+
+ //In the following implementation we are going to cast most of the ptrdiff_t
+ //values in size_t to work with coherent unsigned values. Doing so make code
+ //more simple especially in the min function call.
+
+ // In append mode, every write does an implicit seek to the end
+ // of the file.
+ if (_M_openmode & ios_base::app)
+ _M_seek(0, ios_base::end);
+
+ if (_M_openmode & ios_base::binary) {
+ // binary mode
+ size_t bytes_to_write = (size_t)n;
+ DWORD NumberOfBytesWritten;
+ written = 0;
+ for (; bytes_to_write != 0;) {
+ WriteFile(_M_file_id, buf + written,
+ __STATIC_CAST(DWORD, (min)(size_t(0xffffffff), bytes_to_write)),
+ &NumberOfBytesWritten, 0);
+ if (NumberOfBytesWritten == 0)
+ return false;
+ bytes_to_write -= NumberOfBytesWritten;
+ written += NumberOfBytesWritten;
+ }
+ }
+ else {
+ char textbuf[_TEXTBUF_SIZE + 1]; // extra 1 in case LF at end
+ char * nextblock = buf, * ptrtextbuf = textbuf;
+ char * endtextbuf = textbuf + _TEXTBUF_SIZE;
+ char * endblock = buf + n;
+ ptrdiff_t nextblocksize = (min) (n, (ptrdiff_t)_TEXTBUF_SIZE);
+ char * nextlf;
+
+ while ( (nextblocksize > 0) &&
+ (nextlf = (char *)memchr(nextblock, _STLP_LF, nextblocksize)) != 0) {
+ ptrdiff_t linelength = nextlf - nextblock;
+ memcpy(ptrtextbuf, nextblock, linelength);
+ ptrtextbuf += linelength;
+ nextblock += (linelength + 1);
+ * ptrtextbuf ++ = _STLP_CR;
+ * ptrtextbuf ++ = _STLP_LF;
+ nextblocksize = (min) (ptrdiff_t(endblock - nextblock),
+ (max) (ptrdiff_t(0), ptrdiff_t(endtextbuf - ptrtextbuf)));
+ }
+ // write out what's left, > condition is here since for LF at the end ,
+ // endtextbuf may get < ptrtextbuf ...
+ if (nextblocksize > 0) {
+ memcpy(ptrtextbuf, nextblock, nextblocksize);
+ ptrtextbuf += nextblocksize;
+ nextblock += nextblocksize;
+ }
+ // now write out the translated buffer
+ char * writetextbuf = textbuf;
+ for (size_t NumberOfBytesToWrite = (size_t)(ptrtextbuf - textbuf);
+ NumberOfBytesToWrite;) {
+ DWORD NumberOfBytesWritten;
+ WriteFile((HANDLE)_M_file_id, writetextbuf,
+ __STATIC_CAST(DWORD, (min)(size_t(0xffffffff), NumberOfBytesToWrite)),
+ &NumberOfBytesWritten, 0);
+ if (!NumberOfBytesWritten) // write shortfall
+ return false;
+ writetextbuf += NumberOfBytesWritten;
+ NumberOfBytesToWrite -= NumberOfBytesWritten;
+ }
+ // count non-translated characters
+ written = (nextblock - buf);
+ }
+
+ if (n == written)
+ return true;
+ else if (written > 0 && written < n) {
+ n -= written;
+ buf += written;
+ }
+ else
+ return false;
+ }
+}
+
+// Wrapper for lseek or the like.
+streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir) {
+ streamoff result = -1;
+ int whence;
+
+ switch(dir) {
+ case ios_base::beg:
+ if (offset < 0 /* || offset > _M_file_size() */ )
+ return streamoff(-1);
+ whence = FILE_BEGIN;
+ break;
+ case ios_base::cur:
+ whence = FILE_CURRENT;
+ break;
+ case ios_base::end:
+ if (/* offset > 0 || */ -offset > _M_file_size() )
+ return streamoff(-1);
+ whence = FILE_END;
+ break;
+ default:
+ return streamoff(-1);
+ }
+
+ LARGE_INTEGER li;
+ li.QuadPart = offset;
+ li.LowPart = SetFilePointer(_M_file_id, li.LowPart, &li.HighPart, whence);
+ if (li.LowPart != INVALID_SET_FILE_POINTER || GetLastError() == NO_ERROR)
+ result = li.QuadPart;
+
+ return result;
+}
+
+
+// Attempts to memory-map len bytes of the current file, starting
+// at position offset. Precondition: offset is a multiple of the
+// page size. Postcondition: return value is a null pointer if the
+// memory mapping failed. Otherwise the return value is a pointer to
+// the memory-mapped file and the file position is set to offset.
+void* _Filebuf_base::_M_mmap(streamoff offset, streamoff len) {
+ void* base;
+ _M_view_id = CreateFileMapping(_M_file_id, (PSECURITY_ATTRIBUTES)0 ,
+ PAGE_READONLY, 0 /* len >> 32 */ ,
+ 0 /* len & 0xFFFFFFFF */ , // low-order DWORD of size
+ 0);
+
+ if (_M_view_id) {
+#if 0
+/*
+ printf("view %x created from file %x, error = %d, size = %d, map_offset = %d map_len = %d\n",
+ _M_view_id, _M_file_id, GetLastError(),
+ (int)cur_filesize, ULL(offset) & 0xffffffff, len);
+*/
+#endif
+ LARGE_INTEGER li;
+ li.QuadPart = offset;
+ base = MapViewOfFile(_M_view_id, FILE_MAP_READ, li.HighPart, li.LowPart,
+#if !defined (__DMC__)
+ __STATIC_CAST(SIZE_T, len));
+#else
+ __STATIC_CAST(DWORD, len));
+#endif
+ // check if mapping succeded and is usable
+ if (base == 0 || _M_seek(offset + len, ios_base::beg) < 0) {
+ this->_M_unmap(base, len);
+ base = 0;
+ }
+ } else
+ base = 0;
+
+ return base;
+}
+
+void _Filebuf_base::_M_unmap(void* base, streamoff len) {
+ // precondition : there is a valid mapping at the moment
+ if (base != NULL)
+ UnmapViewOfFile(base);
+ // destroy view handle as well
+ if (_M_view_id != NULL)
+ CloseHandle(_M_view_id);
+ _M_view_id = NULL;
+ (void)len; //unused variable
+}
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/dll_main.cpp b/build/stlport/src/dll_main.cpp
new file mode 100644
index 000000000..faaa721a7
--- /dev/null
+++ b/build/stlport/src/dll_main.cpp
@@ -0,0 +1,262 @@
+ /*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+
+#include "stlport_prefix.h"
+
+#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
+# if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
+/* dums: Please if the following code was being uncommented please explain why
+ * as for the moment it only looks like a source of inconsistency in the way
+ * STLport different translation units are compiled.
+ */
+//# define _STLP_ASSERTIONS 1
+# endif
+#endif
+
+#include <utility>
+#include <memory>
+#include <vector>
+#include <set>
+#include <list>
+#include <slist>
+#include <deque>
+#include <hash_map>
+#include <limits>
+#include <string>
+#include <stdexcept>
+#include <bitset>
+#include <locale>
+
+#if defined (__DMC__)
+// for rope static members
+# include <rope>
+#endif
+
+#include <stl/_range_errors.c>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
+exception::exception() _STLP_NOTHROW {}
+exception::~exception() _STLP_NOTHROW {}
+bad_exception::bad_exception() _STLP_NOTHROW {}
+bad_exception::~bad_exception() _STLP_NOTHROW {}
+const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
+const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
+#endif
+
+#if defined (_STLP_OWN_STDEXCEPT)
+# include <stl/_stdexcept_base.c>
+
+// boris : those are needed to force typeinfo nodes to be created in here only
+logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
+runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
+domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
+invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
+length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
+out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
+range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
+overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
+underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
+
+#endif
+
+#if !defined(_STLP_WCE_EVC3)
+# if defined (_STLP_NO_BAD_ALLOC)
+const nothrow_t nothrow /* = {} */;
+# endif
+#endif
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+# if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
+template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
+
+//Export of the types used to represent buckets in the hashtable implementation.
+/*
+ * For the vector class we do not use any MSVC6 workaround even if we export it from
+ * the STLport dynamic libraries because we know what methods are called and none is
+ * a template method. Moreover the exported class is an instanciation of vector with
+ * _Slist_node_base struct that is an internal STLport class that no user should ever
+ * use.
+ */
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
+ allocator<_STLP_PRIV _Slist_node_base*> >;
+//End of hashtable bucket types export.
+
+//Export of _Locale_impl facets container:
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
+template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# endif
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
+template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
+//End of export of _Locale_impl facets container.
+
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+template class _STLP_CLASS_DECLSPEC allocator<void*>;
+
+typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
+template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
+
+template class _STLP_CLASS_DECLSPEC _List_node<void*>;
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
+template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
+
+template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
+template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
+
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
+template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
+template class _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# endif /* _STLP_USE_PTR_SPECIALIZATIONS */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
+template class _STLP_CLASS_DECLSPEC _List_global<bool>;
+
+template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
+template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
+
+template class _STLP_CLASS_DECLSPEC _LimG<bool>;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_NO_FORCE_INSTANTIATE */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY)
+extern "C" void _STLP_DECLSPEC _STLP_CALL _STLP_SIGNAL_RUNTIME_COMPATIBILITY() {}
+#endif
+
+#define FORCE_SYMBOL extern
+
+#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB)
+// stlportmt.cpp : Defines the entry point for the DLL application.
+//
+# undef FORCE_SYMBOL
+# define FORCE_SYMBOL APIENTRY
+
+extern "C" {
+
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID) {
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls((HINSTANCE)hModule);
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+} /* extern "C" */
+
+#if !defined (_STLP_MSVC) && !defined (__MINGW32__)
+_STLP_BEGIN_NAMESPACE
+
+static void FORCE_SYMBOL
+force_link() {
+ set<int>::iterator iter;
+ // _M_increment; _M_decrement instantiation
+ ++iter;
+ --iter;
+}
+
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _WIN32 */
+
+#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+# undef std
+
+namespace std
+{
+ void _STLP_CALL unexpected() {
+ unexpected_handler hdl;
+ set_unexpected(hdl = set_unexpected((unexpected_handler)0));
+ hdl();
+ }
+}
+#endif
diff --git a/build/stlport/src/facets_byname.cpp b/build/stlport/src/facets_byname.cpp
new file mode 100644
index 000000000..07d1a3d67
--- /dev/null
+++ b/build/stlport/src/facets_byname.cpp
@@ -0,0 +1,1057 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <hash_map>
+#include <vector>
+
+#include <locale>
+#include <istream>
+
+#include <algorithm>
+#include <functional>
+
+#include "c_locale.h"
+#include "locale_impl.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// ctype_byname<char>
+
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype_byname<char>::ctype_byname(const char* name, size_t refs)
+ : ctype<char>( 0, false, refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_ctype = _STLP_PRIV __acquire_ctype(name, buf, 0, &__err_code);
+ if (!_M_ctype)
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+
+ _M_init();
+}
+
+void ctype_byname<char>::_M_init() {
+ _M_ctype_table = _M_byname_table;
+
+ // We have to do this, instead of just pointer twiddling, because
+ // ctype_base::mask isn't the same type as _Locale_mask_t.
+ const _Locale_mask_t* p = _Locale_ctype_table(_M_ctype);
+ for (size_t i = 0; i != table_size; ++i) {
+ _M_byname_table[i] = ctype_base::mask(p[i]);
+ }
+}
+
+ctype_byname<char>::~ctype_byname()
+{ _STLP_PRIV __release_ctype(_M_ctype); }
+
+char ctype_byname<char>::do_toupper(char c) const
+{ return (char)_Locale_toupper(_M_ctype, c); }
+
+char ctype_byname<char>::do_tolower(char c) const
+{ return (char)_Locale_tolower(_M_ctype, c); }
+
+const char*
+ctype_byname<char>::do_toupper(char* first, const char* last) const {
+ for ( ; first != last ; ++first)
+ *first = (char)_Locale_toupper(_M_ctype, *first);
+ return last;
+}
+
+const char*
+ctype_byname<char>::do_tolower(char* first, const char* last) const {
+ for ( ; first != last ; ++first)
+ *first = (char)_Locale_tolower(_M_ctype, *first);
+ return last;
+}
+
+
+// Some helper functions used in ctype<>::scan_is and scan_is_not.
+#if !defined (_STLP_NO_WCHAR_T)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// ctype_byname<wchar_t>
+
+struct _Ctype_byname_w_is_mask : public unary_function<wchar_t, bool> {
+ _Locale_mask_t M;
+ _Locale_ctype* M_ctp;
+
+ _Ctype_byname_w_is_mask(_Locale_mask_t m, _Locale_ctype* c)
+ : M(m), M_ctp(c) {}
+ bool operator()(wchar_t c) const
+ { return _WLocale_ctype(M_ctp, c, M) != 0; }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
+ : ctype<wchar_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_ctype = _STLP_PRIV __acquire_ctype(name, buf, 0, &__err_code);
+ if (!_M_ctype)
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+}
+
+ctype_byname<wchar_t>::~ctype_byname()
+{ _STLP_PRIV __release_ctype(_M_ctype); }
+
+bool ctype_byname<wchar_t>::do_is(ctype_base::mask m, wchar_t c) const
+{ return _WLocale_ctype(_M_ctype, c, (_Locale_mask_t)m) != 0; }
+
+const wchar_t*
+ctype_byname<wchar_t>::do_is(const wchar_t* low, const wchar_t* high,
+ ctype_base::mask * m) const {
+ _Locale_mask_t all_bits = _Locale_mask_t(ctype_base::space |
+ ctype_base::print |
+ ctype_base::cntrl |
+ ctype_base::upper |
+ ctype_base::lower |
+ ctype_base::alpha |
+ ctype_base::digit |
+ ctype_base::punct |
+ ctype_base::xdigit);
+
+ for ( ; low < high; ++low, ++m)
+ *m = ctype_base::mask (_WLocale_ctype(_M_ctype, *low, all_bits));
+ return high;
+}
+
+const wchar_t*
+ctype_byname<wchar_t>
+ ::do_scan_is(ctype_base::mask m, const wchar_t* low, const wchar_t* high) const
+{ return find_if(low, high, _STLP_PRIV _Ctype_byname_w_is_mask(m, _M_ctype)); }
+
+const wchar_t*
+ctype_byname<wchar_t>
+ ::do_scan_not(ctype_base::mask m, const wchar_t* low, const wchar_t* high) const
+{ return find_if(low, high, not1(_STLP_PRIV _Ctype_byname_w_is_mask(m, _M_ctype))); }
+
+wchar_t ctype_byname<wchar_t>::do_toupper(wchar_t c) const
+{ return _WLocale_toupper(_M_ctype, c); }
+
+const wchar_t*
+ctype_byname<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low)
+ *low = _WLocale_toupper(_M_ctype, *low);
+ return high;
+}
+
+wchar_t ctype_byname<wchar_t>::do_tolower(wchar_t c) const
+{ return _WLocale_tolower(_M_ctype, c); }
+
+const wchar_t*
+ctype_byname<wchar_t>::do_tolower(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low)
+ *low = _WLocale_tolower(_M_ctype, *low);
+ return high;
+}
+
+#endif /* WCHAR_T */
+
+// collate_byname<char>
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+collate_byname<char>::collate_byname(const char* name, size_t refs)
+ : collate<char>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_collate = _STLP_PRIV __acquire_collate(name, buf, 0, &__err_code);
+ if (!_M_collate)
+ locale::_M_throw_on_creation_failure(__err_code, name, "collate");
+}
+
+collate_byname<char>::~collate_byname()
+{ _STLP_PRIV __release_collate(_M_collate); }
+
+int collate_byname<char>::do_compare(const char* __low1,
+ const char* __high1,
+ const char* __low2,
+ const char* __high2) const {
+ return _Locale_strcmp(_M_collate,
+ __low1, __high1 - __low1,
+ __low2, __high2 - __low2);
+}
+
+collate_byname<char>::string_type
+collate_byname<char>::do_transform(const char* low, const char* high) const {
+ if (low == high)
+ return string_type();
+
+ size_t n = _Locale_strxfrm(_M_collate, NULL, 0, low, high - low);
+
+ // NOT PORTABLE. What we're doing relies on internal details of the
+ // string implementation. (Contiguity of string elements and presence
+ // of trailing zero.)
+ string_type buf(n, 0);
+ _Locale_strxfrm(_M_collate, &(*buf.begin()), n + 1, low, high - low);
+ return buf;
+}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+// collate_byname<wchar_t>
+
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+collate_byname<wchar_t>::collate_byname(const char* name, size_t refs)
+ : collate<wchar_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_collate = _STLP_PRIV __acquire_collate(name, buf, 0, &__err_code);
+ if (!_M_collate)
+ locale::_M_throw_on_creation_failure(__err_code, name, "collate");
+}
+
+collate_byname<wchar_t>::~collate_byname()
+{ _STLP_PRIV __release_collate(_M_collate); }
+
+int collate_byname<wchar_t>::do_compare(const wchar_t* low1,
+ const wchar_t* high1,
+ const wchar_t* low2,
+ const wchar_t* high2) const {
+ return _WLocale_strcmp(_M_collate,
+ low1, high1 - low1,
+ low2, high2 - low2);
+}
+
+collate_byname<wchar_t>::string_type
+collate_byname<wchar_t>::do_transform(const wchar_t* low,
+ const wchar_t* high) const {
+ if (low == high)
+ return string_type();
+
+ size_t n = _WLocale_strxfrm(_M_collate, NULL, 0, low, high - low);
+
+ // NOT PORTABLE. What we're doing relies on internal details of the
+ // string implementation. (Contiguity of string elements and presence
+ // of trailing zero.)
+ string_type buf(n, 0);
+ _WLocale_strxfrm(_M_collate, &(*buf.begin()), n + 1, low, high - low);
+ return buf;
+}
+
+#endif /* _STLP_NO_WCHAR_T */
+
+//----------------------------------------------------------------------
+// codecvt_byname<char>
+
+codecvt_byname<char, char, mbstate_t>
+ ::codecvt_byname(const char* name, size_t refs)
+ : codecvt<char, char, mbstate_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+}
+
+codecvt_byname<char, char, mbstate_t>::~codecvt_byname() {}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+//----------------------------------------------------------------------
+// codecvt_byname<wchar_t>
+codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname(const char* name, size_t refs)
+ : codecvt<wchar_t, char, mbstate_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_codecvt = _STLP_PRIV __acquire_codecvt(name, buf, 0, &__err_code);
+ if (!_M_codecvt)
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+}
+
+codecvt_byname<wchar_t, char, mbstate_t>::~codecvt_byname()
+{ _STLP_PRIV __release_codecvt(_M_codecvt); }
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt_byname<wchar_t, char, mbstate_t>::do_out(state_type& state,
+ const intern_type* from,
+ const intern_type* from_end,
+ const intern_type*& from_next,
+ extern_type* to,
+ extern_type* to_limit,
+ extern_type*& to_next) const {
+ while (from != from_end && to != to_limit) {
+ size_t chars_stored = _WLocale_wctomb(_M_codecvt,
+ to, to_limit - to, *from,
+ &state);
+ if (chars_stored == (size_t) -1) {
+ from_next = from;
+ to_next = to;
+ return error;
+ }
+ else if (chars_stored == (size_t) -2) {
+ from_next = from;
+ to_next = to;
+ return partial;
+ }
+
+ ++from;
+ to += chars_stored;
+ }
+
+ from_next = from;
+ to_next = to;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt_byname<wchar_t, char, mbstate_t>::do_in(state_type& state,
+ const extern_type* from,
+ const extern_type* from_end,
+ const extern_type*& from_next,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_next) const {
+ while (from != from_end && to != to_end) {
+ size_t chars_read = _WLocale_mbtowc(_M_codecvt,
+ to, from, from_end - from,
+ &state);
+ if (chars_read == (size_t) -1) {
+ from_next = from;
+ to_next = to;
+ return error;
+ }
+
+ if (chars_read == (size_t) -2) {
+ from_next = from;
+ to_next = to;
+ return partial;
+ }
+
+ from += chars_read;
+ to++;
+ }
+
+ from_next = from;
+ to_next = to;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt_byname<wchar_t, char, mbstate_t>::do_unshift(state_type& state,
+ extern_type* to,
+ extern_type* to_limit,
+ extern_type*& to_next) const {
+ to_next = to;
+ size_t result = _WLocale_unshift(_M_codecvt, &state,
+ to, to_limit - to, &to_next);
+ if (result == (size_t) -1)
+ return error;
+ else if (result == (size_t) -2)
+ return partial;
+ else
+# if defined (__ISCPP__)
+ return /*to_next == to ? noconv :*/ ok;
+# else
+ return to_next == to ? noconv : ok;
+# endif
+}
+
+int
+codecvt_byname<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW {
+ if (_WLocale_is_stateless(_M_codecvt)) {
+ int max_width = _WLocale_mb_cur_max(_M_codecvt);
+ int min_width = _WLocale_mb_cur_min(_M_codecvt);
+ return min_width == max_width ? min_width : 0;
+ }
+ else
+ return -1;
+}
+
+bool
+codecvt_byname<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
+{ return false; }
+
+int
+codecvt_byname<wchar_t, char, mbstate_t>::do_length(state_type& state,
+ const extern_type* from,
+ const extern_type* end,
+ size_t mx) const {
+ size_t __count = 0;
+ while (from != end && mx--) {
+ intern_type __dummy;
+ size_t chars_read = _WLocale_mbtowc(_M_codecvt,
+ &__dummy, from, end - from,
+ &state);
+ if ((chars_read == (size_t) -1) || (chars_read == (size_t) -2)) // error or partial
+ break;
+ __count += chars_read;
+ from += chars_read;
+ }
+ return int(__count);
+}
+
+int
+codecvt_byname<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
+{ return _WLocale_mb_cur_max(_M_codecvt); }
+#endif
+
+// numpunct_byname<char>
+numpunct_byname<char>::numpunct_byname(const char* name, size_t refs)
+: numpunct<char>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_numeric = _STLP_PRIV __acquire_numeric(name, buf, 0, &__err_code);
+ if (!_M_numeric)
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+}
+
+numpunct_byname<char>::~numpunct_byname()
+{ _STLP_PRIV __release_numeric(_M_numeric); }
+
+char numpunct_byname<char>::do_decimal_point() const
+{ return _Locale_decimal_point(_M_numeric); }
+
+char numpunct_byname<char>::do_thousands_sep() const
+{ return _Locale_thousands_sep(_M_numeric); }
+
+string numpunct_byname<char>::do_grouping() const {
+ const char * __grouping = _Locale_grouping(_M_numeric);
+ if (__grouping != NULL && __grouping[0] == CHAR_MAX)
+ __grouping = "";
+ return __grouping;
+}
+
+string numpunct_byname<char>::do_truename() const
+{ return _Locale_true(_M_numeric); }
+
+string numpunct_byname<char>::do_falsename() const
+{ return _Locale_false(_M_numeric); }
+
+//----------------------------------------------------------------------
+// numpunct<wchar_t>
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+// numpunct_byname<wchar_t>
+
+numpunct_byname<wchar_t>::numpunct_byname(const char* name, size_t refs)
+: numpunct<wchar_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_numeric = _STLP_PRIV __acquire_numeric(name, buf, 0, &__err_code);
+ if (!_M_numeric)
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+}
+
+numpunct_byname<wchar_t>::~numpunct_byname()
+{ _STLP_PRIV __release_numeric(_M_numeric); }
+
+wchar_t numpunct_byname<wchar_t>::do_decimal_point() const
+{ return _WLocale_decimal_point(_M_numeric); }
+
+wchar_t numpunct_byname<wchar_t>::do_thousands_sep() const
+{ return _WLocale_thousands_sep(_M_numeric); }
+
+string numpunct_byname<wchar_t>::do_grouping() const {
+ const char * __grouping = _Locale_grouping(_M_numeric);
+ if (__grouping != NULL && __grouping[0] == CHAR_MAX)
+ __grouping = "";
+ return __grouping;
+}
+
+wstring numpunct_byname<wchar_t>::do_truename() const {
+ wchar_t buf[16];
+ return _WLocale_true(_M_numeric, _STLP_ARRAY_AND_SIZE(buf));
+}
+
+wstring numpunct_byname<wchar_t>::do_falsename() const {
+ wchar_t buf[16];
+ return _WLocale_false(_M_numeric, _STLP_ARRAY_AND_SIZE(buf));
+}
+
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+static void _Init_monetary_formats(money_base::pattern& pos_format,
+ money_base::pattern& neg_format,
+ _Locale_monetary * monetary) {
+ switch (_Locale_p_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ pos_format.field[0] = (char) money_base::sign;
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[1] = (char) money_base::symbol;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::space;
+ pos_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[1] = (char) money_base::value;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::space;
+ pos_format.field[3] = (char) money_base::symbol;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[0] = (char) money_base::symbol;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::space;
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::value;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[0] = (char) money_base::value;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::space;
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::symbol;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[0] = (char) money_base::sign;
+ pos_format.field[1] = (char) money_base::symbol;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::space;
+ pos_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[0] = (char) money_base::value;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ break;
+ case 4: // The sign string immediately succeeds the currency symbol.
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[0] = (char) money_base::value;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::space;
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::symbol;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ default: // Default C++ Standard format
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::none;
+ pos_format.field[3] = (char) money_base::value;
+ break;
+ }
+
+ switch (_Locale_n_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ neg_format.field[0] = (char) money_base::sign;
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[1] = (char) money_base::symbol;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::space;
+ neg_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[1] = (char) money_base::value;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::space;
+ neg_format.field[3] = (char) money_base::symbol;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[0] = (char) money_base::symbol;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::space;
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::value;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[0] = (char) money_base::value;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::space;
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::symbol;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[0] = (char) money_base::sign;
+ neg_format.field[1] = (char) money_base::symbol;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::space;
+ neg_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[0] = (char) money_base::value;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ break;
+ case 4: // The sign string immediately succeeds the currency symbol.
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[0] = (char) money_base::value;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::space;
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::symbol;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ default: // Default C++ Standard format
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+ break;
+ }
+}
+
+// international variant of monetary
+
+/*
+ * int_curr_symbol
+ *
+ * The international currency symbol. The operand is a four-character
+ * string, with the first three characters containing the alphabetic
+ * international currency symbol in accordance with those specified
+ * in the ISO 4217 specification. The fourth character is the character used
+ * to separate the international currency symbol from the monetary quantity.
+ *
+ * (http://www.opengroup.org/onlinepubs/7990989775/xbd/locale.html)
+ */
+
+/*
+ * Standards are unclear in the usage of international currency
+ * and monetary formats.
+ * But I am expect that international currency symbol should be the first
+ * (not depends upon where currency symbol situated in the national
+ * format).
+ *
+ * If this isn't so, let's see:
+ * 1 234.56 RUR
+ * GBP 1,234.56
+ * USD 1,234.56
+ * The situation really is worse than you see above:
+ * RUR typed wrong here---it prints '1 234.56 RUR ' (see space after RUR).
+ * This is due to intl_fmp.curr_symbol() == "RUR ". (see reference in comments
+ * above).
+ *
+ */
+
+static void _Init_monetary_formats_int(money_base::pattern& pos_format,
+ money_base::pattern& neg_format,
+ _Locale_monetary * monetary)
+{
+
+ switch (_Locale_p_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::value;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ case 4: // The sign string immediately succeeds the currency symbol.
+ pos_format.field[0] = (char) money_base::symbol;
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::value;
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[1] = (char) money_base::value;
+ pos_format.field[2] = (char) money_base::sign;
+ }
+ pos_format.field[3] = (char) money_base::none;
+ break;
+ default: // Default C++ Standard format
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::none;
+ pos_format.field[3] = (char) money_base::value;
+ break;
+ }
+
+
+ switch (_Locale_n_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::none;
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::value;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ case 4: // The sign string immediately succeeds the currency symbol.
+ neg_format.field[0] = (char) money_base::symbol;
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::value;
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[1] = (char) money_base::value;
+ neg_format.field[2] = (char) money_base::sign;
+ }
+ neg_format.field[3] = (char) money_base::none;
+ break;
+ default: // Default C++ Standard format
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+ break;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// moneypunct_byname<>
+//
+moneypunct_byname<char, true>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<char, true>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, true>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, true>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+char moneypunct_byname<char, true>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+char moneypunct_byname<char, true>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_curr_symbol() const
+{ return _Locale_int_curr_symbol(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_positive_sign() const
+{ return _Locale_positive_sign(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_negative_sign() const
+{ return _Locale_negative_sign(_M_monetary); }
+
+int moneypunct_byname<char, true>::do_frac_digits() const
+{ return _Locale_int_frac_digits(_M_monetary); }
+
+moneypunct_byname<char, false>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<char, false>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, false>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, false>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+char moneypunct_byname<char, false>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+char moneypunct_byname<char, false>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_curr_symbol() const
+{ return _Locale_currency_symbol(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_positive_sign() const
+{ return _Locale_positive_sign(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_negative_sign() const
+{ return _Locale_negative_sign(_M_monetary); }
+
+int moneypunct_byname<char, false>::do_frac_digits() const
+{ return _Locale_frac_digits(_M_monetary); }
+
+//
+// moneypunct_byname<wchar_t>
+//
+#if !defined (_STLP_NO_WCHAR_T)
+
+moneypunct_byname<wchar_t, true>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<wchar_t, true>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, true>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, true>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, true>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, true>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<wchar_t, true>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+inline wstring __do_widen (string const& str) {
+#if defined (_STLP_NO_MEMBER_TEMPLATES) || defined (_STLP_MSVC)
+ wstring::_Reserve_t __Reserve;
+ size_t __size = str.size();
+ wstring result(__Reserve, __size);
+ copy(str.begin(), str.end(), result.begin());
+#else
+ wstring result(str.begin(), str.end());
+#endif
+ return result;
+}
+
+wstring moneypunct_byname<wchar_t, true>::do_curr_symbol() const
+{ wchar_t buf[16]; return _WLocale_int_curr_symbol(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, true>::do_positive_sign() const
+{ wchar_t buf[16]; return _WLocale_positive_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, true>::do_negative_sign() const
+{ wchar_t buf[16]; return _WLocale_negative_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+int moneypunct_byname<wchar_t, true>::do_frac_digits() const
+{ return _Locale_int_frac_digits(_M_monetary); }
+
+moneypunct_byname<wchar_t, false>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<wchar_t, false>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name() ;
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, false>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, false>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, false>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, false>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<wchar_t, false>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+wstring moneypunct_byname<wchar_t, false>::do_curr_symbol() const
+{ wchar_t buf[16]; return _WLocale_currency_symbol(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, false>::do_positive_sign() const
+{ wchar_t buf[16]; return _WLocale_positive_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, false>::do_negative_sign() const
+{ wchar_t buf[16]; return _WLocale_negative_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+int moneypunct_byname<wchar_t, false>::do_frac_digits() const
+{ return _Locale_frac_digits(_M_monetary); }
+
+#endif
+
+_STLP_END_NAMESPACE
+
diff --git a/build/stlport/src/fstream.cpp b/build/stlport/src/fstream.cpp
new file mode 100644
index 000000000..81543bb82
--- /dev/null
+++ b/build/stlport/src/fstream.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#ifdef _STLP_USE_UNIX_IO
+# include "details/fstream_unistd.cpp"
+#elif defined(_STLP_USE_STDIO_IO)
+# include "details/fstream_stdio.cpp"
+#elif defined(_STLP_USE_WIN32_IO)
+# include "details/fstream_win32io.cpp"
+#else
+# error "Can't recognize IO scheme to use"
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// fbp : let us map 1 MB maximum, just be sure not to trash VM
+#define MMAP_CHUNK 0x100000L
+
+_Underflow< char, char_traits<char> >::int_type _STLP_CALL
+_Underflow< char, char_traits<char> >::_M_doit(basic_filebuf<char, char_traits<char> >* __this)
+{
+ typedef char_traits<char> traits_type;
+ typedef traits_type::int_type int_type;
+
+ if (!__this->_M_in_input_mode) {
+ if (!__this->_M_switch_to_input_mode())
+ return traits_type::eof();
+ }
+ else if (__this->_M_in_putback_mode) {
+ __this->_M_exit_putback_mode();
+ if (__this->gptr() != __this->egptr()) {
+ int_type __c = traits_type::to_int_type(*__this->gptr());
+ return __c;
+ }
+ }
+
+ // If it's a disk file, and if the internal and external character
+ // sequences are guaranteed to be identical, then try to use memory
+ // mapped I/O. Otherwise, revert to ordinary read.
+ if (__this->_M_base.__regular_file()
+ && __this->_M_always_noconv
+ && __this->_M_base._M_in_binary_mode()) {
+ // If we've mmapped part of the file already, then unmap it.
+ if (__this->_M_mmap_base)
+ __this->_M_base._M_unmap(__this->_M_mmap_base, __this->_M_mmap_len);
+
+ // Determine the position where we start mapping. It has to be
+ // a multiple of the page size.
+ streamoff __cur = __this->_M_base._M_seek(0, ios_base::cur);
+ streamoff __size = __this->_M_base._M_file_size();
+ if (__size > 0 && __cur >= 0 && __cur < __size) {
+ streamoff __offset = (__cur / __this->_M_base.__page_size()) * __this->_M_base.__page_size();
+ streamoff __remainder = __cur - __offset;
+
+ __this->_M_mmap_len = __size - __offset;
+
+ if (__this->_M_mmap_len > MMAP_CHUNK)
+ __this->_M_mmap_len = MMAP_CHUNK;
+
+ if ((__this->_M_mmap_base = __this->_M_base._M_mmap(__offset, __this->_M_mmap_len)) != 0) {
+ __this->setg(__STATIC_CAST(char*, __this->_M_mmap_base),
+ __STATIC_CAST(char*, __this->_M_mmap_base) + __STATIC_CAST(ptrdiff_t, __remainder),
+ __STATIC_CAST(char*, __this->_M_mmap_base) + __STATIC_CAST(ptrdiff_t, __this->_M_mmap_len));
+ return traits_type::to_int_type(*__this->gptr());
+ }
+ else
+ __this->_M_mmap_len = 0;
+ }
+ else {
+ __this->_M_mmap_base = 0;
+ __this->_M_mmap_len = 0;
+ }
+ }
+
+ return __this->_M_underflow_aux();
+}
+
+//----------------------------------------------------------------------
+// Force instantiation of filebuf and fstream classes.
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+
+template class basic_filebuf<char, char_traits<char> >;
+template class basic_ifstream<char, char_traits<char> >;
+template class basic_ofstream<char, char_traits<char> >;
+template class basic_fstream<char, char_traits<char> >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _Underflow<wchar_t, char_traits<wchar_t> >;
+template class basic_filebuf<wchar_t, char_traits<wchar_t> >;
+template class basic_ifstream<wchar_t, char_traits<wchar_t> >;
+template class basic_ofstream<wchar_t, char_traits<wchar_t> >;
+template class basic_fstream<wchar_t, char_traits<wchar_t> >;
+# endif /* _STLP_NO_WCHAR_T */
+
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/ios.cpp b/build/stlport/src/ios.cpp
new file mode 100644
index 000000000..7bbfecdf6
--- /dev/null
+++ b/build/stlport/src/ios.cpp
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <algorithm>
+#include <ios>
+#include <locale>
+#include <ostream> // for __get_ostreambuf definition
+
+#include "aligned_buffer.h"
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// ios_base members
+
+#ifdef _STLP_USE_EXCEPTIONS
+// class ios_base::failure, a subclass of exception. It's used solely
+// for reporting errors.
+
+ios_base::failure::failure(const string& s)
+ : __Named_exception(s)
+{}
+
+ios_base::failure::~failure() _STLP_NOTHROW_INHERENTLY {}
+#endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+// Definitions of ios_base's formatting flags.
+const ios_base::fmtflags ios_base::left;
+const ios_base::fmtflags ios_base::right;
+const ios_base::fmtflags ios_base::internal;
+const ios_base::fmtflags ios_base::dec;
+const ios_base::fmtflags ios_base::hex;
+const ios_base::fmtflags ios_base::oct;
+const ios_base::fmtflags ios_base::fixed;
+const ios_base::fmtflags ios_base::scientific;
+const ios_base::fmtflags ios_base::boolalpha;
+const ios_base::fmtflags ios_base::showbase;
+const ios_base::fmtflags ios_base::showpoint;
+const ios_base::fmtflags ios_base::showpos;
+const ios_base::fmtflags ios_base::skipws;
+const ios_base::fmtflags ios_base::unitbuf;
+const ios_base::fmtflags ios_base::uppercase;
+const ios_base::fmtflags ios_base::adjustfield;
+const ios_base::fmtflags ios_base::basefield;
+const ios_base::fmtflags ios_base::floatfield;
+
+// Definitions of ios_base's state flags.
+const ios_base::iostate ios_base::goodbit;
+const ios_base::iostate ios_base::badbit;
+const ios_base::iostate ios_base::eofbit;
+const ios_base::iostate ios_base::failbit;
+
+// Definitions of ios_base's openmode flags.
+const ios_base::openmode ios_base::app;
+const ios_base::openmode ios_base::ate;
+const ios_base::openmode ios_base::binary;
+const ios_base::openmode ios_base::in;
+const ios_base::openmode ios_base::out;
+const ios_base::openmode ios_base::trunc;
+
+// Definitions of ios_base's seekdir flags.
+const ios_base::seekdir ios_base::beg;
+const ios_base::seekdir ios_base::cur;
+const ios_base::seekdir ios_base::end;
+
+#endif
+
+// Internal functions used for managing exponentially-growing arrays of
+// POD types.
+
+// array is a pointer to N elements of type PODType. Expands the array,
+// if necessary, so that array[index] is meaningful. All new elements are
+// initialized to zero. Returns a pointer to the new array, and the new
+// size.
+
+template <class PODType>
+static pair<PODType*, size_t>
+_Stl_expand_array(PODType* __array, size_t N, int index) {
+ if ((int)N < index + 1) {
+ size_t new_N = (max)(2 * N, size_t(index + 1));
+ PODType* new_array
+ = __STATIC_CAST(PODType*,realloc(__array, new_N * sizeof(PODType)));
+ if (new_array) {
+ fill(new_array + N, new_array + new_N, PODType());
+ return pair<PODType*, size_t>(new_array, new_N);
+ }
+ else
+ return pair<PODType*, size_t>(__STATIC_CAST(PODType*,0), 0);
+ }
+ else
+ return pair<PODType*, size_t>(__array, N);
+}
+
+// array is a pointer to N elements of type PODType. Allocate a new
+// array of N elements, copying the values from the old array to the new.
+// Return a pointer to the new array. It is assumed that array is non-null
+// and N is nonzero.
+template <class PODType>
+static PODType* _Stl_copy_array(const PODType* __array, size_t N) {
+ PODType* result = __STATIC_CAST(PODType*,malloc(N * sizeof(PODType)));
+ if (result)
+ copy(__array, __array + N, result);
+ return result;
+}
+
+locale ios_base::imbue(const locale& loc) {
+ if (loc != _M_locale) {
+ locale previous = _M_locale;
+ _M_locale = loc;
+ _M_invoke_callbacks(imbue_event);
+ return previous;
+ }
+ else {
+ _M_invoke_callbacks(imbue_event);
+ return _M_locale;
+ }
+}
+
+int _STLP_CALL ios_base::xalloc() {
+#if defined (_STLP_THREADS) && \
+ defined (_STLP_WIN32THREADS) && defined (_STLP_NEW_PLATFORM_SDK)
+ static volatile __stl_atomic_t _S_index = 0;
+ return _STLP_ATOMIC_INCREMENT(&_S_index);
+#else
+ static int _S_index = 0;
+ static _STLP_STATIC_MUTEX __lock _STLP_MUTEX_INITIALIZER;
+ _STLP_auto_lock sentry(__lock);
+ return _S_index++;
+#endif
+}
+
+long& ios_base::iword(int index) {
+ static long dummy = 0;
+
+ pair<long*, size_t> tmp = _Stl_expand_array(_M_iwords, _M_num_iwords, index);
+ if (tmp.first) { // The allocation, if any, succeeded.
+ _M_iwords = tmp.first;
+ _M_num_iwords = tmp.second;
+ return _M_iwords[index];
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ return dummy;
+ }
+}
+
+
+void*& ios_base::pword(int index) {
+ static void* dummy = 0;
+
+ pair<void**, size_t> tmp = _Stl_expand_array(_M_pwords, _M_num_pwords, index);
+ if (tmp.first) { // The allocation, if any, succeeded.
+ _M_pwords = tmp.first;
+ _M_num_pwords = tmp.second;
+ return _M_pwords[index];
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ return dummy;
+ }
+}
+
+void ios_base::register_callback(event_callback __fn, int index) {
+ pair<pair<event_callback, int>*, size_t> tmp
+ = _Stl_expand_array(_M_callbacks, _M_num_callbacks, (int)_M_callback_index /* fbp: index ??? */ );
+ if (tmp.first) {
+ _M_callbacks = tmp.first;
+ _M_num_callbacks = tmp.second;
+ _M_callbacks[_M_callback_index++] = make_pair(__fn, index);
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+}
+
+// Invokes all currently registered callbacks for a particular event.
+// Behaves correctly even if one of the callbacks adds a new callback.
+void ios_base::_M_invoke_callbacks(event E) {
+ for (size_t i = _M_callback_index; i > 0; --i) {
+ event_callback f = _M_callbacks[i-1].first;
+ int n = _M_callbacks[i-1].second;
+ f(E, *this, n);
+ }
+}
+
+// This function is called if the state, rdstate(), has a bit set
+// that is also set in the exception mask exceptions().
+void ios_base::_M_throw_failure() {
+ const char* arg ;
+# if 0
+ char buffer[256];
+ char* ptr;
+ strcpy(buffer, "ios failure: rdstate = 0x");
+ ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_iostate));
+ strcpy(ptr, " mask = 0x");
+ ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_exception_mask));
+ *ptr = 0;
+ arg = buffer;
+# else
+ arg = "ios failure";
+# endif
+
+# ifndef _STLP_USE_EXCEPTIONS
+ fputs(arg, stderr);
+# else
+ throw failure(arg);
+# endif
+}
+
+// Copy x's state to *this. This member function is used in the
+// implementation of basic_ios::copyfmt. Does not copy _M_exception_mask
+// or _M_iostate.
+void ios_base::_M_copy_state(const ios_base& x) {
+ _M_fmtflags = x._M_fmtflags; // Copy the flags, except for _M_iostate
+ _M_openmode = x._M_openmode; // and _M_exception_mask.
+ _M_seekdir = x._M_seekdir;
+ _M_precision = x._M_precision;
+ _M_width = x._M_width;
+ _M_locale = x._M_locale;
+
+ if (x._M_callbacks) {
+ pair<event_callback, int>* tmp = _Stl_copy_array(x._M_callbacks, x._M_callback_index);
+ if (tmp) {
+ free(_M_callbacks);
+ _M_callbacks = tmp;
+ _M_num_callbacks = _M_callback_index = x._M_callback_index;
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+ }
+
+ if (x._M_iwords) {
+ long* tmp = _Stl_copy_array(x._M_iwords, x._M_num_iwords);
+ if (tmp) {
+ free(_M_iwords);
+ _M_iwords = tmp;
+ _M_num_iwords = x._M_num_iwords;
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+ }
+
+ if (x._M_pwords) {
+ void** tmp = _Stl_copy_array(x._M_pwords, x._M_num_pwords);
+ if (tmp) {
+ free(_M_pwords);
+ _M_pwords = tmp;
+ _M_num_pwords = x._M_num_pwords;
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+ }
+}
+
+// ios's (protected) default constructor. The standard says that all
+// fields have indeterminate values; we initialize them to zero for
+// simplicity. The only thing that really matters is that the arrays
+// are all initially null pointers, and the array element counts are all
+// initially zero.
+ios_base::ios_base()
+ : _M_fmtflags(0), _M_iostate(0), _M_openmode(0), _M_seekdir(0),
+ _M_exception_mask(0),
+ _M_precision(0), _M_width(0),
+ _M_locale(),
+ _M_callbacks(0), _M_num_callbacks(0), _M_callback_index(0),
+ _M_iwords(0), _M_num_iwords(0),
+ _M_pwords(0),
+ _M_num_pwords(0)
+{}
+
+// ios's destructor.
+ios_base::~ios_base() {
+ _M_invoke_callbacks(erase_event);
+ free(_M_callbacks);
+ free(_M_iwords);
+ free(_M_pwords);
+}
+
+//----------------------------------------------------------------------
+// Force instantiation of basic_ios
+// For DLL exports, they are already instantiated.
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+template class _STLP_CLASS_DECLSPEC basic_ios<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC basic_ios<wchar_t, char_traits<wchar_t> >;
+# endif /* _STLP_NO_WCHAR_T */
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/iostream.cpp b/build/stlport/src/iostream.cpp
new file mode 100644
index 000000000..0d3329b53
--- /dev/null
+++ b/build/stlport/src/iostream.cpp
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <memory>
+#include <istream>
+#include <fstream>
+#if defined (_STLP_MSVC) || defined (__MWERKS__) || defined (__ICL) || defined (__ISCPP__)
+# define _STLP_USE_NOT_INIT_SEGMENT
+# include <iostream>
+#endif
+
+#include "stdio_streambuf.h"
+#include "aligned_buffer.h"
+#include "_stdio_file.h"
+#include "c_locale.h"
+
+// boris : note this is repeated in <iostream>
+#ifndef _STLP_USE_NAMESPACES
+// in case of SGI iostreams, we have to rename our streams not to clash with those
+// provided in native lib
+# define cin _STLP_cin
+# define cout _STLP_cout
+# define cerr _STLP_cerr
+# define clog _STLP_clog
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// This file handles iostream initialization. It is inherently
+// nonportable, since the C++ language definition provides no mechanism
+// for controlling order of initialization of nonlocal objects.
+// Initialization has three parts, which must be performed in the following
+// order:
+// (1) Initialize the locale system
+// (2) Call the constructors for the eight global stream objects.
+// (3) Create streambufs for the global stream objects, and initialize
+// the stream objects by calling the init() member function.
+
+
+#if defined (_STLP_USE_NOT_INIT_SEGMENT)
+
+// Definitions of the eight global I/O objects that are declared in
+// <iostream>. For some compilers we use pragmas to put the global I/O
+// objects into an initialization segment that will not
+// be executed. We then explicitly invoke the constructors
+// with placement new in ios_base::_S_initialize()
+
+# if defined (__MWERKS__)
+# pragma suppress_init_code on
+# else
+# pragma init_seg("STLPORT_NO_INIT")
+# endif
+
+_STLP_DECLSPEC istream cin(0);
+_STLP_DECLSPEC ostream cout(0);
+_STLP_DECLSPEC ostream cerr(0);
+_STLP_DECLSPEC ostream clog(0);
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC wistream wcin(0);
+_STLP_DECLSPEC wostream wcout(0);
+_STLP_DECLSPEC wostream wcerr(0);
+_STLP_DECLSPEC wostream wclog(0);
+# endif
+
+# if defined (__MWERKS__)
+# pragma suppress_init_code off
+# endif
+
+#else
+
+// Definitions of the eight global I/O objects that are declared in
+// <iostream>. Disgusting hack: we deliberately define them with the
+// wrong types so that the constructors don't get run automatically.
+// We need special tricks to make sure that these objects are struct-
+// aligned rather than byte-aligned.
+
+// This is not portable. Declaring a variable with different types in
+// two translations units is "undefined", according to the C++ standard.
+// Most compilers, however, silently accept this instead of diagnosing
+// it as an error.
+
+# ifndef __DMC__
+_STLP_DECLSPEC _Stl_aligned_buffer<istream> cin;
+_STLP_DECLSPEC _Stl_aligned_buffer<ostream> cout;
+_STLP_DECLSPEC _Stl_aligned_buffer<ostream> cerr;
+_STLP_DECLSPEC _Stl_aligned_buffer<ostream> clog;
+# else
+_Stl_aligned_buffer<istream> cin;
+_Stl_aligned_buffer<ostream> cout;
+_Stl_aligned_buffer<ostream> cerr;
+_Stl_aligned_buffer<ostream> clog;
+
+# pragma alias("?cin@std@@3V?$basic_istream@std@DV?$char_traits@std@D@1@@1@A", "?cin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# pragma alias("?cout@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# pragma alias("?cerr@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# pragma alias("?clog@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?clog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# endif
+
+# ifndef _STLP_NO_WCHAR_T
+
+# ifndef __DMC__
+_STLP_DECLSPEC _Stl_aligned_buffer<wistream> wcin;
+_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wcout;
+_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wcerr;
+_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wclog;
+# else
+_Stl_aligned_buffer<wistream> wcin;
+_Stl_aligned_buffer<wostream> wcout;
+_Stl_aligned_buffer<wostream> wcerr;
+_Stl_aligned_buffer<wostream> wclog;
+
+# pragma alias("?wcin@std@@3V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# pragma alias("?wcout@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# pragma alias("?wcerr@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# pragma alias("?wclog@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wclog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# endif
+# endif
+#endif /* STL_MSVC || __MWERKS__ */
+
+// Member functions from class ios_base and ios_base::Init
+
+long ios_base::Init::_S_count = 0;
+// by default, those are synced
+bool ios_base::_S_is_synced = true;
+
+ios_base::Init::Init() {
+ if (_S_count++ == 0) {
+ _Locale_init();
+ ios_base::_S_initialize();
+ _Filebuf_base::_S_initialize();
+ }
+}
+
+ios_base::Init::~Init() {
+ if (--_S_count == 0) {
+ ios_base::_S_uninitialize();
+ _Locale_final();
+ }
+}
+
+static int _Stl_extract_open_param(FILE* f)
+{ return _FILE_fd(f); }
+
+#ifdef _STLP_REDIRECT_STDSTREAMS
+static const char* _Stl_extract_open_param(const char* name)
+{ return name; }
+#endif
+
+template <class _Tp>
+static filebuf*
+_Stl_create_filebuf(_Tp x, ios_base::openmode mode ) {
+ auto_ptr<filebuf> result(new basic_filebuf<char, char_traits<char> >());
+ result->open(_Stl_extract_open_param(x), mode);
+
+ if (result->is_open())
+ return result.release();
+
+ return 0;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+static wfilebuf*
+_Stl_create_wfilebuf(FILE* f, ios_base::openmode mode) {
+ auto_ptr<wfilebuf> result(new basic_filebuf<wchar_t, char_traits<wchar_t> >());
+ result->_M_open(_FILE_fd(f), mode);
+
+ if (result->is_open())
+ return result.release();
+
+ return 0;
+}
+#endif
+
+void _STLP_CALL ios_base::_S_initialize() {
+#if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+ using _STLP_PRIV stdio_istreambuf;
+ using _STLP_PRIV stdio_ostreambuf;
+#endif
+
+ auto_ptr<streambuf> cin_buf;
+ auto_ptr<streambuf> cout_buf;
+ auto_ptr<streambuf> cerr_buf;
+ auto_ptr<streambuf> clog_buf;
+
+ if (_S_is_synced)
+ cin_buf.reset(new stdio_istreambuf(stdin));
+ else
+ cin_buf.reset(_Stl_create_filebuf(stdin, ios_base::in));
+
+ if (_S_is_synced) {
+#ifdef _STLP_REDIRECT_STDSTREAMS
+ cout_buf.reset(_Stl_create_filebuf("/stdout.txt", ios::out));
+ cerr_buf.reset(_Stl_create_filebuf("/stderr.txt", ios::out));
+ clog_buf.reset(_Stl_create_filebuf("/stdlog.txt", ios::out));
+#else
+ cout_buf.reset(new stdio_ostreambuf(stdout));
+ cerr_buf.reset(new stdio_ostreambuf(stderr));
+ clog_buf.reset(new stdio_ostreambuf(stderr));
+#endif
+ }
+ else {
+ cout_buf.reset(_Stl_create_filebuf(stdout, ios_base::out));
+ cerr_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ clog_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ }
+
+ istream* ptr_cin = new(&cin) istream(cin_buf.get()); cin_buf.release();
+ ostream* ptr_cout = new(&cout) ostream(cout_buf.get()); cout_buf.release();
+ ostream* ptr_cerr = new(&cerr) ostream(cerr_buf.get()); cerr_buf.release();
+ /*ostream* ptr_clog = */ new(&clog) ostream(clog_buf.get()); clog_buf.release();
+ ptr_cin->tie(ptr_cout);
+ ptr_cerr->setf(ios_base::unitbuf);
+
+#ifndef _STLP_NO_WCHAR_T
+ auto_ptr<wfilebuf> win(_Stl_create_wfilebuf(stdin, ios_base::in));
+ auto_ptr<wfilebuf> wout(_Stl_create_wfilebuf(stdout, ios_base::out));
+ auto_ptr<wfilebuf> werr(_Stl_create_wfilebuf(stderr, ios_base::out));
+ auto_ptr<wfilebuf> wlog(_Stl_create_wfilebuf(stderr, ios_base::out));
+
+ // Run constructors for the four wide stream objects.
+ wistream* ptr_wcin = new(&wcin) wistream(win.get()); win.release();
+ wostream* ptr_wcout = new(&wcout) wostream(wout.get()); wout.release();
+ wostream* ptr_wcerr = new(&wcerr) wostream(werr.get()); werr.release();
+ /*wostream* ptr_wclog = */ new(&wclog) wostream(wlog.get()); wlog.release();
+
+ ptr_wcin->tie(ptr_wcout);
+ ptr_wcerr->setf(ios_base::unitbuf);
+#endif
+}
+
+void _STLP_CALL ios_base::_S_uninitialize() {
+ // Note that destroying output streambufs flushes the buffers.
+ istream* ptr_cin = &cin;
+ ostream* ptr_cout = &cout;
+ ostream* ptr_cerr = &cerr;
+ ostream* ptr_clog = &clog;
+
+ // We don't want any exceptions being thrown here
+ ptr_cin->exceptions(0);
+ ptr_cout->exceptions(0);
+ ptr_cerr->exceptions(0);
+ ptr_clog->exceptions(0);
+
+ delete ptr_cin->rdbuf(0);
+ delete ptr_cout->rdbuf(0);
+ delete ptr_cerr->rdbuf(0);
+ delete ptr_clog->rdbuf(0);
+
+ _Destroy(ptr_cin);
+ _Destroy(ptr_cout);
+ _Destroy(ptr_cerr);
+ _Destroy(ptr_clog);
+
+#ifndef _STLP_NO_WCHAR_T
+ wistream* ptr_wcin = &wcin;
+ wostream* ptr_wcout = &wcout;
+ wostream* ptr_wcerr = &wcerr;
+ wostream* ptr_wclog = &wclog;
+
+ // We don't want any exceptions being thrown here
+ ptr_wcin->exceptions(0);
+ ptr_wcout->exceptions(0);
+ ptr_wcerr->exceptions(0);
+ ptr_wclog->exceptions(0);
+
+ delete ptr_wcin->rdbuf(0);
+ delete ptr_wcout->rdbuf(0);
+ delete ptr_wcerr->rdbuf(0);
+ delete ptr_wclog->rdbuf(0);
+
+ _Destroy(ptr_wcin);
+ _Destroy(ptr_wcout);
+ _Destroy(ptr_wcerr);
+ _Destroy(ptr_wclog);
+#endif
+}
+
+
+bool _STLP_CALL ios_base::sync_with_stdio(bool sync) {
+# if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+ using _STLP_PRIV stdio_istreambuf;
+ using _STLP_PRIV stdio_ostreambuf;
+# endif
+
+ if (sync == _S_is_synced) return sync;
+
+ // if by any chance we got there before std streams initialization,
+ // just set the sync flag and exit
+ if (Init::_S_count == 0) {
+ _S_is_synced = sync;
+ return sync;
+ }
+
+ auto_ptr<streambuf> cin_buf;
+ auto_ptr<streambuf> cout_buf;
+ auto_ptr<streambuf> cerr_buf;
+ auto_ptr<streambuf> clog_buf;
+
+ if (sync)
+ cin_buf.reset(new stdio_istreambuf(stdin));
+ else
+ cin_buf.reset(_Stl_create_filebuf(stdin, ios_base::in));
+
+ if (sync) {
+#ifdef _STLP_REDIRECT_STDSTREAMS
+ cout_buf.reset(_Stl_create_filebuf("/stdout.txt", ios::out));
+ cerr_buf.reset(_Stl_create_filebuf("/stderr.txt", ios::out));
+ clog_buf.reset(_Stl_create_filebuf("/stdlog.txt", ios::out));
+#else
+ cout_buf.reset(new stdio_ostreambuf(stdout));
+ cerr_buf.reset(new stdio_ostreambuf(stderr));
+ clog_buf.reset(new stdio_ostreambuf(stderr));
+#endif
+ }
+ else {
+ cout_buf.reset(_Stl_create_filebuf(stdout, ios_base::out));
+ cerr_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ clog_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ }
+
+ if (cin_buf.get() != 0 && cout_buf.get() != 0 && cerr_buf.get() != 0 && clog_buf.get() != 0) {
+ // When streambuf passed to rdbuf is not null, rdbuf is exception safe:
+ delete (&cin)->rdbuf(cin_buf.release());
+ delete (&cout)->rdbuf(cout_buf.release());
+ delete (&cerr)->rdbuf(cerr_buf.release());
+ delete (&clog)->rdbuf(clog_buf.release());
+ _S_is_synced = sync;
+ }
+
+ return _S_is_synced;
+}
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/istream.cpp b/build/stlport/src/istream.cpp
new file mode 100644
index 000000000..715364cd6
--- /dev/null
+++ b/build/stlport/src/istream.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+# include "stlport_prefix.h"
+
+#include <istream>
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+
+// instantiations
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Isentry<char, char_traits<char> >;
+# endif
+
+template class _STLP_CLASS_DECLSPEC basic_iostream<char, char_traits<char> >;
+template class _STLP_CLASS_DECLSPEC basic_istream<char, char_traits<char> >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Isentry<wchar_t, char_traits<wchar_t> >;
+# endif
+template class _STLP_CLASS_DECLSPEC basic_istream<wchar_t, char_traits<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_iostream<wchar_t, char_traits<wchar_t> >;
+# endif /* !_STLP_NO_WCHAR_T */
+
+#endif /* _STLP_NO_FORCE_INSTANTIATE */
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/locale.cpp b/build/stlport/src/locale.cpp
new file mode 100644
index 000000000..5564a6ef7
--- /dev/null
+++ b/build/stlport/src/locale.cpp
@@ -0,0 +1,446 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <stdexcept>
+
+#include "c_locale.h"
+#include "locale_impl.h"
+
+_STLP_BEGIN_NAMESPACE
+
+#define _NAMELESS "*"
+static const char _Nameless[] = _NAMELESS;
+
+static inline bool is_C_locale_name (const char* name)
+{ return ((name[0] == 'C') && (name[1] == 0)); }
+
+locale* _Stl_get_classic_locale();
+locale* _Stl_get_global_locale();
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# define locale _STLP_NO_MEM_T_NAME(loc)
+#endif
+
+locale::facet::~facet() {}
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES)
+// members that fail to be templates
+bool locale::operator()(const string& __x,
+ const string& __y) const
+{ return __locale_do_operator_call(*this, __x, __y); }
+
+# if !defined (_STLP_NO_WCHAR_T)
+bool locale::operator()(const wstring& __x,
+ const wstring& __y) const
+{ return __locale_do_operator_call(*this, __x, __y); }
+# endif
+#endif
+
+void _STLP_CALL locale::_M_throw_on_null_name()
+{ _STLP_THROW(runtime_error("Invalid null locale name")); }
+
+void _STLP_CALL locale::_M_throw_on_combine_error(const string& name) {
+ string what = "Unable to find facet";
+ what += " in ";
+ what += name.empty() ? "system" : name.c_str();
+ what += " locale";
+ _STLP_THROW(runtime_error(what.c_str()));
+}
+
+void _STLP_CALL locale::_M_throw_on_creation_failure(int __err_code,
+ const char* name, const char* facet) {
+ string what;
+ switch (__err_code) {
+ case _STLP_LOC_UNSUPPORTED_FACET_CATEGORY:
+ what = "No platform localization support for ";
+ what += facet;
+ what += " facet category, unable to create facet for ";
+ what += name[0] == 0 ? "system" : name;
+ what += " locale";
+ break;
+ case _STLP_LOC_NO_PLATFORM_SUPPORT:
+ what = "No platform localization support, unable to create ";
+ what += name[0] == 0 ? "system" : name;
+ what += " locale";
+ break;
+ default:
+ case _STLP_LOC_UNKNOWN_NAME:
+ what = "Unable to create facet ";
+ what += facet;
+ what += " from name '";
+ what += name;
+ what += "'";
+ break;
+ case _STLP_LOC_NO_MEMORY:
+ _STLP_THROW_BAD_ALLOC;
+ break;
+ }
+
+ _STLP_THROW(runtime_error(what.c_str()));
+}
+
+// Takes a reference to a locale::id, assign a numeric index if not already
+// affected and returns it. The returned index is always positive.
+static const locale::id& _Stl_loc_get_index(locale::id& id) {
+ if (id._M_index == 0) {
+#if defined (_STLP_ATOMIC_INCREMENT) && !defined (_STLP_WIN95_LIKE)
+ static _STLP_VOLATILE __stl_atomic_t _S_index = __STATIC_CAST(__stl_atomic_t, locale::id::_S_max);
+ id._M_index = _STLP_ATOMIC_INCREMENT(&_S_index);
+#else
+ static _STLP_STATIC_MUTEX _Index_lock _STLP_MUTEX_INITIALIZER;
+ _STLP_auto_lock sentry(_Index_lock);
+ size_t new_index = locale::id::_S_max++;
+ id._M_index = new_index;
+#endif
+ }
+ return id;
+}
+
+// Default constructor: create a copy of the global locale.
+locale::locale() _STLP_NOTHROW
+ : _M_impl(_get_Locale_impl(_Stl_get_global_locale()->_M_impl))
+{}
+
+// Copy constructor
+locale::locale(const locale& L) _STLP_NOTHROW
+ : _M_impl( _get_Locale_impl( L._M_impl ) )
+{}
+
+void locale::_M_insert(facet* f, locale::id& n) {
+ if (f)
+ _M_impl->insert(f, _Stl_loc_get_index(n));
+}
+
+locale::locale( _Locale_impl* impl ) :
+ _M_impl( _get_Locale_impl( impl ) )
+{}
+
+// Create a locale from a name.
+locale::locale(const char* name)
+ : _M_impl(0) {
+ if (!name)
+ _M_throw_on_null_name();
+
+ if (is_C_locale_name(name)) {
+ _M_impl = _get_Locale_impl( locale::classic()._M_impl );
+ return;
+ }
+
+ _Locale_impl* impl = 0;
+ _STLP_TRY {
+ impl = new _Locale_impl(locale::id::_S_max, name);
+
+ // Insert categories one at a time.
+ _Locale_name_hint *hint = 0;
+ const char* ctype_name = name;
+ char ctype_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* numeric_name = name;
+ char numeric_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* time_name = name;
+ char time_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* collate_name = name;
+ char collate_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* monetary_name = name;
+ char monetary_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* messages_name = name;
+ char messages_buf[_Locale_MAX_SIMPLE_NAME];
+ hint = impl->insert_ctype_facets(ctype_name, ctype_buf, hint);
+ hint = impl->insert_numeric_facets(numeric_name, numeric_buf, hint);
+ hint = impl->insert_time_facets(time_name, time_buf, hint);
+ hint = impl->insert_collate_facets(collate_name, collate_buf, hint);
+ hint = impl->insert_monetary_facets(monetary_name, monetary_buf, hint);
+ impl->insert_messages_facets(messages_name, messages_buf, hint);
+
+ // Try to use a normalize locale name in order to have the == operator
+ // to behave correctly:
+ if (strcmp(ctype_name, numeric_name) == 0 &&
+ strcmp(ctype_name, time_name) == 0 &&
+ strcmp(ctype_name, collate_name) == 0 &&
+ strcmp(ctype_name, monetary_name) == 0 &&
+ strcmp(ctype_name, messages_name) == 0) {
+ impl->name = ctype_name;
+ }
+ // else we keep current name.
+
+ // reassign impl
+ _M_impl = _get_Locale_impl( impl );
+ }
+ _STLP_UNWIND(delete impl);
+}
+
+static void _Stl_loc_combine_names_aux(_Locale_impl* L,
+ const char* name,
+ const char* ctype_name, const char* time_name, const char* numeric_name,
+ const char* collate_name, const char* monetary_name, const char* messages_name,
+ locale::category c) {
+ // This function is only called when names has been validated so using _Locale_extract_*_name
+ // can't fail.
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ L->name = string("LC_CTYPE=") + _Locale_extract_ctype_name((c & locale::ctype) ? ctype_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_TIME=") + _Locale_extract_time_name((c & locale::time) ? time_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_NUMERIC=") + _Locale_extract_numeric_name((c & locale::numeric) ? numeric_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_COLLATE=") + _Locale_extract_collate_name((c & locale::collate) ? collate_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_MONETARY=") + _Locale_extract_monetary_name((c & locale::monetary) ? monetary_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_MESSAGES=") + _Locale_extract_messages_name((c & locale::messages) ? messages_name : name, buf, 0, &__err_code);
+}
+
+// Give L a name where all facets except those in category c
+// are taken from name1, and those in category c are taken from name2.
+static void _Stl_loc_combine_names(_Locale_impl* L,
+ const char* name1, const char* name2,
+ locale::category c) {
+ if ((c & locale::all) == 0 || strcmp(name1, name1) == 0)
+ L->name = name1;
+ else if ((c & locale::all) == locale::all)
+ L->name = name2;
+ else {
+ _Stl_loc_combine_names_aux(L, name1, name2, name2, name2, name2, name2, name2, c);
+ }
+}
+
+static void _Stl_loc_combine_names(_Locale_impl* L,
+ const char* name,
+ const char* ctype_name, const char* time_name, const char* numeric_name,
+ const char* collate_name, const char* monetary_name, const char* messages_name,
+ locale::category c) {
+ if ((c & locale::all) == 0 || (strcmp(name, ctype_name) == 0 &&
+ strcmp(name, time_name) == 0 &&
+ strcmp(name, numeric_name) == 0 &&
+ strcmp(name, collate_name) == 0 &&
+ strcmp(name, monetary_name) == 0 &&
+ strcmp(name, messages_name) == 0))
+ L->name = name;
+ else if ((c & locale::all) == locale::all && strcmp(ctype_name, time_name) == 0 &&
+ strcmp(ctype_name, numeric_name) == 0 &&
+ strcmp(ctype_name, collate_name) == 0 &&
+ strcmp(ctype_name, monetary_name) == 0 &&
+ strcmp(ctype_name, messages_name) == 0)
+ L->name = ctype_name;
+ else {
+ _Stl_loc_combine_names_aux(L, name, ctype_name, time_name, numeric_name, collate_name, monetary_name, messages_name, c);
+ }
+}
+
+
+// Create a locale that's a copy of L, except that all of the facets
+// in category c are instead constructed by name.
+locale::locale(const locale& L, const char* name, locale::category c)
+ : _M_impl(0) {
+ if (!name)
+ _M_throw_on_null_name();
+
+ if (!::strcmp(_Nameless, name))
+ _STLP_THROW(runtime_error("Invalid locale name '" _NAMELESS "'"));
+
+ _Locale_impl* impl = 0;
+
+ _STLP_TRY {
+ impl = new _Locale_impl(*L._M_impl);
+
+ _Locale_name_hint *hint = 0;
+ const char* ctype_name = name;
+ char ctype_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* numeric_name = name;
+ char numeric_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* time_name = name;
+ char time_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* collate_name = name;
+ char collate_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* monetary_name = name;
+ char monetary_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* messages_name = name;
+ char messages_buf[_Locale_MAX_SIMPLE_NAME];
+ if (c & locale::ctype)
+ hint = impl->insert_ctype_facets(ctype_name, ctype_buf, hint);
+ if (c & locale::numeric)
+ hint = impl->insert_numeric_facets(numeric_name, numeric_buf, hint);
+ if (c & locale::time)
+ hint = impl->insert_time_facets(time_name, time_buf, hint);
+ if (c & locale::collate)
+ hint = impl->insert_collate_facets(collate_name, collate_buf, hint);
+ if (c & locale::monetary)
+ hint = impl->insert_monetary_facets(monetary_name, monetary_buf,hint);
+ if (c & locale::messages)
+ impl->insert_messages_facets(messages_name, messages_buf, hint);
+
+ _Stl_loc_combine_names(impl, L._M_impl->name.c_str(),
+ ctype_name, time_name, numeric_name,
+ collate_name, monetary_name, messages_name, c);
+ _M_impl = _get_Locale_impl( impl );
+ }
+ _STLP_UNWIND(delete impl)
+}
+
+// Contruct a new locale where all facets that aren't in category c
+// come from L1, and all those that are in category c come from L2.
+locale::locale(const locale& L1, const locale& L2, category c)
+ : _M_impl(0) {
+ _Locale_impl* impl = new _Locale_impl(*L1._M_impl);
+
+ _Locale_impl* i2 = L2._M_impl;
+
+ if (L1.name() != _Nameless && L2.name() != _Nameless)
+ _Stl_loc_combine_names(impl, L1._M_impl->name.c_str(), L2._M_impl->name.c_str(), c);
+ else {
+ impl->name = _Nameless;
+ }
+
+ if (c & collate) {
+ impl->insert( i2, _STLP_STD::collate<char>::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::collate<wchar_t>::id);
+# endif
+ }
+ if (c & ctype) {
+ impl->insert( i2, _STLP_STD::ctype<char>::id);
+ impl->insert( i2, _STLP_STD::codecvt<char, char, mbstate_t>::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::ctype<wchar_t>::id);
+ impl->insert( i2, _STLP_STD::codecvt<wchar_t, char, mbstate_t>::id);
+# endif
+ }
+ if (c & monetary) {
+ impl->insert( i2, _STLP_STD::moneypunct<char, true>::id);
+ impl->insert( i2, _STLP_STD::moneypunct<char, false>::id);
+ impl->insert( i2, _STLP_STD::money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ impl->insert( i2, _STLP_STD::money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::moneypunct<wchar_t, true>::id);
+ impl->insert( i2, _STLP_STD::moneypunct<wchar_t, false>::id);
+ impl->insert( i2, _STLP_STD::money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ impl->insert( i2, _STLP_STD::money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+# endif
+ }
+ if (c & numeric) {
+ impl->insert( i2, _STLP_STD::numpunct<char>::id);
+ impl->insert( i2, _STLP_STD::num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ impl->insert( i2, _STLP_STD::num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::numpunct<wchar_t>::id);
+ impl->insert( i2, _STLP_STD::num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ impl->insert( i2, _STLP_STD::num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+# endif
+ }
+ if (c & time) {
+ impl->insert( i2, _STLP_STD::time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ impl->insert( i2, _STLP_STD::time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ impl->insert( i2, _STLP_STD::time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+# endif
+ }
+ if (c & messages) {
+ impl->insert( i2, _STLP_STD::messages<char>::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::messages<wchar_t>::id);
+# endif
+ }
+ _M_impl = _get_Locale_impl( impl );
+}
+
+// Destructor.
+locale::~locale() _STLP_NOTHROW {
+ if (_M_impl)
+ _release_Locale_impl(_M_impl);
+}
+
+// Assignment operator. Much like the copy constructor: just a bit of
+// pointer twiddling.
+const locale& locale::operator=(const locale& L) _STLP_NOTHROW {
+ if (this->_M_impl != L._M_impl) {
+ if (this->_M_impl)
+ _release_Locale_impl(this->_M_impl);
+ this->_M_impl = _get_Locale_impl(L._M_impl);
+ }
+ return *this;
+}
+
+locale::facet* locale::_M_get_facet(const locale::id& n) const {
+ return n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0;
+}
+
+locale::facet* locale::_M_use_facet(const locale::id& n) const {
+ locale::facet* f = (n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0);
+ if (!f)
+ _M_impl->_M_throw_bad_cast();
+ return f;
+}
+
+string locale::name() const {
+ return _M_impl->name;
+}
+
+// Compare two locales for equality.
+bool locale::operator==(const locale& L) const {
+ return this->_M_impl == L._M_impl ||
+ (this->name() == L.name() && this->name() != _Nameless);
+}
+
+bool locale::operator!=(const locale& L) const {
+ return !(*this == L);
+}
+
+// static data members.
+
+const locale& _STLP_CALL locale::classic() {
+ return *_Stl_get_classic_locale();
+}
+
+#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+locale _STLP_CALL locale::global(const locale& L) {
+#else
+_Locale_impl* _STLP_CALL locale::global(const locale& L) {
+#endif
+ locale old(_Stl_get_global_locale()->_M_impl);
+ if (_Stl_get_global_locale()->_M_impl != L._M_impl) {
+ _release_Locale_impl(_Stl_get_global_locale()->_M_impl);
+ // this assign should be atomic, should be fixed here:
+ _Stl_get_global_locale()->_M_impl = _get_Locale_impl(L._M_impl);
+
+ // Set the global C locale, if appropriate.
+#if !defined(_STLP_NO_LOCALE_SUPPORT)
+ if (L.name() != _Nameless)
+ setlocale(LC_ALL, L.name().c_str());
+#endif
+ }
+
+#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ return old;
+#else
+ return old._M_impl;
+#endif
+}
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+const locale::category locale::none;
+const locale::category locale::collate;
+const locale::category locale::ctype;
+const locale::category locale::monetary;
+const locale::category locale::numeric;
+const locale::category locale::time;
+const locale::category locale::messages;
+const locale::category locale::all;
+#endif
+
+_STLP_END_NAMESPACE
+
diff --git a/build/stlport/src/locale_catalog.cpp b/build/stlport/src/locale_catalog.cpp
new file mode 100644
index 000000000..31e672e83
--- /dev/null
+++ b/build/stlport/src/locale_catalog.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <hash_map>
+#include <string>
+
+#include <locale>
+#include <istream>
+
+#include "c_locale.h"
+#include "locale_impl.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Those wrappers are needed to use locale functions in __acquire_category,
+// all functions have to present the same prototype.
+
+static void* _Loc_ctype_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_ctype_create(s, hint, __err_code); }
+static void* _Loc_codecvt_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_codecvt_create(s, hint, __err_code); }
+static void* _Loc_numeric_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_numeric_create(s, hint, __err_code); }
+static void* _Loc_time_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_time_create(s, hint, __err_code); }
+static void* _Loc_collate_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_collate_create(s, hint, __err_code); }
+static void* _Loc_monetary_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_monetary_create(s, hint, __err_code); }
+static void* _Loc_messages_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_messages_create(s, hint, __err_code); }
+
+static char const* _Loc_ctype_name(void* l, char* s)
+{ return _Locale_ctype_name((_Locale_ctype*)l, s); }
+static char const* _Loc_codecvt_name(void* l, char* s)
+{ return _Locale_codecvt_name((_Locale_codecvt*)l, s); }
+static char const* _Loc_numeric_name(void* l, char* s)
+{ return _Locale_numeric_name((_Locale_numeric*)l, s); }
+static char const* _Loc_time_name(void* l, char* s)
+{ return _Locale_time_name((_Locale_time*)l, s); }
+static char const* _Loc_collate_name(void* l, char* s)
+{ return _Locale_collate_name((_Locale_collate*)l, s); }
+static char const* _Loc_monetary_name(void* l, char* s)
+{ return _Locale_monetary_name((_Locale_monetary*)l, s); }
+static char const* _Loc_messages_name(void* l, char* s)
+{ return _Locale_messages_name((_Locale_messages*)l, s); }
+
+static const char* _Loc_ctype_default(char* p)
+{ return _Locale_ctype_default(p); }
+static const char* _Loc_numeric_default(char * p)
+{ return _Locale_numeric_default(p); }
+static const char* _Loc_time_default(char* p)
+{ return _Locale_time_default(p); }
+static const char* _Loc_collate_default(char* p)
+{ return _Locale_collate_default(p); }
+static const char* _Loc_monetary_default(char* p)
+{ return _Locale_monetary_default(p); }
+static const char* _Loc_messages_default(char* p)
+{ return _Locale_messages_default(p); }
+
+static void _Loc_ctype_destroy(void* p) {_Locale_ctype_destroy((_Locale_ctype*)p); }
+static void _Loc_codecvt_destroy(void* p) {_Locale_codecvt_destroy((_Locale_codecvt*)p); }
+static void _Loc_numeric_destroy(void* p) {_Locale_numeric_destroy((_Locale_numeric*)p); }
+static void _Loc_time_destroy(void* p) {_Locale_time_destroy((_Locale_time*)p);}
+static void _Loc_collate_destroy(void* p) {_Locale_collate_destroy((_Locale_collate*)p);}
+static void _Loc_monetary_destroy(void* p) {_Locale_monetary_destroy((_Locale_monetary*)p);}
+static void _Loc_messages_destroy(void* p) {_Locale_messages_destroy((_Locale_messages*)p);}
+
+typedef void* (*loc_create_func_t)(const char *, _Locale_name_hint*, int *__err_code);
+typedef char const* (*loc_name_func_t)(void* l, char* s);
+typedef void (*loc_destroy_func_t)(void* l);
+typedef const char* (*loc_default_name_func_t)(char* s);
+typedef char const* (*loc_extract_name_func_t)(const char*, char*, _Locale_name_hint*, int *__err_code);
+
+//----------------------------------------------------------------------
+// Acquire and release low-level category objects. The whole point of
+// this is so that we don't allocate (say) four different _Locale_ctype
+// objects for a single locale.
+
+// Global hash tables for category objects.
+typedef hash_map<string, pair<void*, size_t>, hash<string>, equal_to<string> > Category_Map;
+
+// Look up a category by name
+static Category_Map** ctype_hash() {
+ static Category_Map *_S_ctype_hash = 0;
+ return &_S_ctype_hash;
+}
+static Category_Map** codecvt_hash() {
+ static Category_Map *_S_codecvt_hash = 0;
+ return &_S_codecvt_hash;
+}
+static Category_Map** numeric_hash() {
+ static Category_Map *_S_numeric_hash = 0;
+ return &_S_numeric_hash;
+}
+static Category_Map** time_hash() {
+ static Category_Map *_S_time_hash = 0;
+ return &_S_time_hash;
+}
+static Category_Map** collate_hash() {
+ static Category_Map *_S_collate_hash = 0;
+ return &_S_collate_hash;
+}
+static Category_Map** monetary_hash() {
+ static Category_Map *_S_monetary_hash = 0;
+ return &_S_monetary_hash;
+}
+static Category_Map** messages_hash() {
+ static Category_Map *_S_messages_hash;
+ return &_S_messages_hash;
+}
+
+// We have a single lock for all of the hash tables. We may wish to
+// replace it with six different locks.
+/* REFERENCED */
+static _STLP_STATIC_MUTEX& category_hash_mutex() {
+ static _STLP_STATIC_MUTEX lock _STLP_MUTEX_INITIALIZER;
+ return lock;
+}
+
+static void*
+__acquire_category(const char* &name, char *buf, _Locale_name_hint* hint,
+ loc_extract_name_func_t extract_name,
+ loc_create_func_t create_obj, loc_default_name_func_t default_name,
+ Category_Map ** M, int *__err_code) {
+#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
+ typedef Category_Map::iterator Category_iterator;
+ pair<Category_iterator, bool> result;
+#else
+# if !defined(_STLP_DEBUG)
+ pair<_Ht_iterator<_Slist_iterator<pair<const string,pair<void *,unsigned int> >,_Nonconst_traits<pair<const string,pair<void *,unsigned int> > > >,_NonLocalHashMapTraitsT<pair<const string,pair<void *,unsigned int> > > >, bool> result;
+# else
+ pair<_DBG_iter<_NonDbg_hashtable<pair<const string,pair<void *,unsigned int> >,string,hash<string>,_HashMapTraitsT<pair<const string,pair<void *,unsigned int> > >,_Select1st<pair<const string,pair<void *,unsigned int> > >,_DbgEqual<string,equal_to<string> >,allocator<pair<const string,pair<void *,unsigned int> > > >,_DbgTraits<_NonLocalHashMapTraitsT<pair<const string,pair<void *,unsigned int> > > > >, bool> result;
+# endif
+#endif
+
+ *__err_code = _STLP_LOC_UNDEFINED;
+
+ // Find what name to look for. Be careful if user requests the default.
+ if (name[0] == 0) {
+ name = default_name(buf);
+ if (name == 0 || name[0] == 0)
+ name = "C";
+ }
+ else {
+ const char* cname = extract_name(name, buf, hint, __err_code);
+ if (cname == 0) {
+ return 0;
+ }
+ name = cname;
+ }
+
+ Category_Map::value_type __e(name, pair<void*,size_t>((void*)0,size_t(0)));
+
+ _STLP_auto_lock sentry(category_hash_mutex());
+
+ if (!*M)
+ *M = new Category_Map();
+
+ // Look for an existing entry with that name.
+ result = (*M)->insert_noresize(__e);
+
+ if (result.second) {
+ // There was no entry in the map already. Create the category.
+ (*result.first).second.first = create_obj(name, hint, __err_code);
+ if (!(*result.first).second.first) {
+ (*M)->erase(result.first);
+#if defined (_STLP_LEAKS_PEDANTIC)
+ if ((*M)->empty()) {
+ delete *M;
+ *M = 0;
+ }
+#endif
+ return 0;
+ }
+ }
+
+ // Increment the reference count.
+ ++((*result.first).second.second);
+
+ return (*result.first).second.first;
+}
+
+static void
+__release_category(void* cat,
+ loc_destroy_func_t destroy_fun,
+ loc_name_func_t get_name,
+ Category_Map** M) {
+ Category_Map *pM = *M;
+
+ if (cat && pM) {
+ // Find the name of the category object.
+ char buf[_Locale_MAX_SIMPLE_NAME + 1];
+ char const* name = get_name(cat, buf);
+
+ if (name != 0) {
+ _STLP_auto_lock sentry(category_hash_mutex());
+ Category_Map::iterator it = pM->find(name);
+ if (it != pM->end()) {
+ // Decrement the ref count. If it goes to zero, delete this category
+ // from the map.
+ if (--((*it).second.second) == 0) {
+ void* cat1 = (*it).second.first;
+ destroy_fun(cat1);
+ pM->erase(it);
+#if defined (_STLP_LEAKS_PEDANTIC)
+ if (pM->empty()) {
+ delete pM;
+ *M = 0;
+ }
+#endif
+ }
+ }
+ }
+ }
+}
+
+_Locale_ctype* _STLP_CALL __acquire_ctype(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_ctype*, __acquire_category(name, buf, hint,
+ _Locale_extract_ctype_name, _Loc_ctype_create, _Loc_ctype_default,
+ ctype_hash(), __err_code));
+}
+_Locale_codecvt* _STLP_CALL __acquire_codecvt(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_codecvt*, __acquire_category(name, buf, hint,
+ _Locale_extract_ctype_name, _Loc_codecvt_create, _Loc_ctype_default,
+ codecvt_hash(), __err_code));
+}
+_Locale_numeric* _STLP_CALL __acquire_numeric(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_numeric*, __acquire_category(name, buf, hint,
+ _Locale_extract_numeric_name, _Loc_numeric_create, _Loc_numeric_default,
+ numeric_hash(), __err_code));
+}
+_Locale_time* _STLP_CALL __acquire_time(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_time*, __acquire_category(name, buf, hint,
+ _Locale_extract_time_name, _Loc_time_create, _Loc_time_default,
+ time_hash(), __err_code));
+}
+_Locale_collate* _STLP_CALL __acquire_collate(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_collate*, __acquire_category(name, buf, hint,
+ _Locale_extract_collate_name, _Loc_collate_create, _Loc_collate_default,
+ collate_hash(), __err_code));
+}
+_Locale_monetary* _STLP_CALL __acquire_monetary(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_monetary*, __acquire_category(name, buf, hint,
+ _Locale_extract_monetary_name, _Loc_monetary_create, _Loc_monetary_default,
+ monetary_hash(), __err_code));
+}
+_Locale_messages* _STLP_CALL __acquire_messages(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_messages*, __acquire_category(name, buf, hint,
+ _Locale_extract_messages_name, _Loc_messages_create, _Loc_messages_default,
+ messages_hash(), __err_code));
+}
+
+void _STLP_CALL __release_ctype(_Locale_ctype* cat)
+{ __release_category(cat, _Loc_ctype_destroy, _Loc_ctype_name, ctype_hash()); }
+void _STLP_CALL __release_codecvt(_Locale_codecvt* cat)
+{ __release_category(cat, _Loc_codecvt_destroy, _Loc_codecvt_name, codecvt_hash()); }
+void _STLP_CALL __release_numeric(_Locale_numeric* cat)
+{ __release_category(cat, _Loc_numeric_destroy, _Loc_numeric_name, numeric_hash()); }
+void _STLP_CALL __release_time(_Locale_time* cat)
+{ __release_category(cat, _Loc_time_destroy, _Loc_time_name, time_hash()); }
+void _STLP_CALL __release_collate(_Locale_collate* cat)
+{ __release_category(cat, _Loc_collate_destroy, _Loc_collate_name, collate_hash()); }
+void _STLP_CALL __release_monetary(_Locale_monetary* cat)
+{ __release_category(cat, _Loc_monetary_destroy, _Loc_monetary_name, monetary_hash()); }
+void _STLP_CALL __release_messages(_Locale_messages* cat)
+{ __release_category(cat, _Loc_messages_destroy, _Loc_messages_name, messages_hash()); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/locale_impl.cpp b/build/stlport/src/locale_impl.cpp
new file mode 100644
index 000000000..71e08646a
--- /dev/null
+++ b/build/stlport/src/locale_impl.cpp
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <algorithm>
+#include <typeinfo>
+
+#include "c_locale.h"
+#include "aligned_buffer.h"
+#include "acquire_release.h"
+#include "locale_impl.h"
+
+_STLP_BEGIN_NAMESPACE
+
+static const char _Nameless[] = "*";
+
+static inline bool is_C_locale_name (const char* name)
+{ return ((name[0] == 'C') && (name[1] == 0)); }
+
+locale::facet * _STLP_CALL _get_facet(locale::facet *f)
+{
+ if (f != 0)
+ f->_M_incr();
+ return f;
+}
+
+void _STLP_CALL _release_facet(locale::facet *&f)
+{
+ if ((f != 0) && (f->_M_decr() == 0)) {
+ delete f;
+ f = 0;
+ }
+}
+
+size_t locale::id::_S_max = 27;
+
+static void _Stl_loc_assign_ids();
+
+static _Stl_aligned_buffer<_Locale_impl::Init> __Loc_init_buf;
+
+_Locale_impl::Init::Init() {
+ if (_M_count()._M_incr() == 1) {
+ _Locale_impl::_S_initialize();
+ }
+}
+
+_Locale_impl::Init::~Init() {
+ if (_M_count()._M_decr() == 0) {
+ _Locale_impl::_S_uninitialize();
+ }
+}
+
+_Refcount_Base& _Locale_impl::Init::_M_count() const {
+ static _Refcount_Base _S_count(0);
+ return _S_count;
+}
+
+_Locale_impl::_Locale_impl(const char* s)
+ : _Refcount_Base(0), name(s), facets_vec() {
+ facets_vec.reserve( locale::id::_S_max );
+ new (&__Loc_init_buf) Init();
+}
+
+_Locale_impl::_Locale_impl( _Locale_impl const& locimpl )
+ : _Refcount_Base(0), name(locimpl.name), facets_vec() {
+ for_each( locimpl.facets_vec.begin(), locimpl.facets_vec.end(), _get_facet);
+ facets_vec = locimpl.facets_vec;
+ new (&__Loc_init_buf) Init();
+}
+
+_Locale_impl::_Locale_impl( size_t n, const char* s)
+ : _Refcount_Base(0), name(s), facets_vec(n, 0) {
+ new (&__Loc_init_buf) Init();
+}
+
+_Locale_impl::~_Locale_impl() {
+ (&__Loc_init_buf)->~Init();
+ for_each( facets_vec.begin(), facets_vec.end(), _release_facet);
+}
+
+// Initialization of the locale system. This must be called before
+// any locales are constructed. (Meaning that it must be called when
+// the I/O library itself is initialized.)
+void _STLP_CALL _Locale_impl::_S_initialize() {
+ _Stl_loc_assign_ids();
+ make_classic_locale();
+}
+
+// Release of the classic locale ressources. Has to be called after the last
+// locale destruction and not only after the classic locale destruction as
+// the facets can be shared between different facets.
+void _STLP_CALL _Locale_impl::_S_uninitialize() {
+ //Not necessary anymore as classic facets are now 'normal' dynamically allocated
+ //facets with a reference counter telling to _release_facet when the facet can be
+ //deleted.
+ //free_classic_locale();
+}
+
+// _Locale_impl non-inline member functions.
+void _STLP_CALL _Locale_impl::_M_throw_bad_cast() {
+ _STLP_THROW(bad_cast());
+}
+
+void _Locale_impl::insert(_Locale_impl *from, const locale::id& n) {
+ if (n._M_index > 0 && n._M_index < from->size()) {
+ this->insert(from->facets_vec[n._M_index], n);
+ }
+}
+
+locale::facet* _Locale_impl::insert(locale::facet *f, const locale::id& n) {
+ if (f == 0 || n._M_index == 0)
+ return 0;
+
+ if (n._M_index >= facets_vec.size()) {
+ facets_vec.resize(n._M_index + 1);
+ }
+
+ if (f != facets_vec[n._M_index])
+ {
+ _release_facet(facets_vec[n._M_index]);
+ facets_vec[n._M_index] = _get_facet(f);
+ }
+
+ return f;
+}
+
+//
+// <locale> content which is dependent on the name
+//
+
+/* Six functions, one for each category. Each of them takes a
+ * a name, constructs that appropriate category facets by name,
+ * and inserts them into the locale. */
+_Locale_name_hint* _Locale_impl::insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_ctype_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2, ctype<char>::id);
+ this->insert(i2, codecvt<char, char, mbstate_t>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, ctype<wchar_t>::id);
+ this->insert(i2, codecvt<wchar_t, char, mbstate_t>::id);
+#endif
+ } else {
+ locale::facet* ct = 0;
+ locale::facet* cvt = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet* wct = 0;
+ locale::facet* wcvt = 0;
+#endif
+ int __err_code;
+ _Locale_ctype *__lct = _STLP_PRIV __acquire_ctype(name, buf, hint, &__err_code);
+ if (!__lct) {
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_ctype_hint(__lct);
+
+ _STLP_TRY {
+ ct = new ctype_byname<char>(__lct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_ctype(__lct));
+
+ _STLP_TRY {
+ cvt = new codecvt_byname<char, char, mbstate_t>(name);
+ }
+ _STLP_UNWIND(delete ct);
+
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_TRY {
+ _Locale_ctype *__lwct = _STLP_PRIV __acquire_ctype(name, buf, hint, &__err_code);
+ if (!__lwct) {
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+ return hint;
+ }
+
+ _STLP_TRY {
+ wct = new ctype_byname<wchar_t>(__lwct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_ctype(__lwct));
+
+ _Locale_codecvt *__lwcvt = _STLP_PRIV __acquire_codecvt(name, buf, hint, &__err_code);
+ if (__lwcvt) {
+ _STLP_TRY {
+ wcvt = new codecvt_byname<wchar_t, char, mbstate_t>(__lwcvt);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_codecvt(__lwcvt); delete wct);
+ }
+ }
+ _STLP_UNWIND(delete cvt; delete ct);
+#endif
+
+ this->insert(ct, ctype<char>::id);
+ this->insert(cvt, codecvt<char, char, mbstate_t>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(wct, ctype<wchar_t>::id);
+ if (wcvt) this->insert(wcvt, codecvt<wchar_t, char, mbstate_t>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_numeric_default(buf);
+
+ _Locale_impl* i2 = locale::classic()._M_impl;
+
+ // We first insert name independant facets taken from the classic locale instance:
+ this->insert(i2,
+ num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(i2,
+ num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2,
+ num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(i2,
+ num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ this->insert(i2, numpunct<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, numpunct<wchar_t>::id);
+#endif
+ }
+ else {
+ locale::facet* punct = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet* wpunct = 0;
+#endif
+
+ int __err_code;
+ _Locale_numeric *__lpunct = _STLP_PRIV __acquire_numeric(name, buf, hint, &__err_code);
+ if (!__lpunct) {
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_numeric_hint(__lpunct);
+ _STLP_TRY {
+ punct = new numpunct_byname<char>(__lpunct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_numeric(__lpunct));
+
+#ifndef _STLP_NO_WCHAR_T
+ _Locale_numeric *__lwpunct = _STLP_PRIV __acquire_numeric(name, buf, hint, &__err_code);
+ if (!__lwpunct) {
+ delete punct;
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+ return hint;
+ }
+ if (__lwpunct) {
+ _STLP_TRY {
+ wpunct = new numpunct_byname<wchar_t>(__lwpunct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_numeric(__lwpunct); delete punct);
+ }
+#endif
+
+ this->insert(punct, numpunct<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(wpunct, numpunct<wchar_t>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_time_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2,
+ time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(i2,
+ time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2,
+ time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(i2,
+ time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+ } else {
+ locale::facet *get = 0;
+ locale::facet *put = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet *wget = 0;
+ locale::facet *wput = 0;
+#endif
+
+ int __err_code;
+ _Locale_time *__time = _STLP_PRIV __acquire_time(name, buf, hint, &__err_code);
+ if (!__time) {
+ // time facets category is not mandatory for correct stream behavior so if platform
+ // do not support it we do not generate a runtime_error exception.
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ if (!hint) hint = _Locale_get_time_hint(__time);
+ _STLP_TRY {
+ get = new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(__time);
+ put = new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >(__time);
+#ifndef _STLP_NO_WCHAR_T
+ wget = new time_get_byname<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(__time);
+ wput = new time_put_byname<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(__time);
+#endif
+ }
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_UNWIND(delete wget; delete put; delete get; _STLP_PRIV __release_time(__time));
+#else
+ _STLP_UNWIND(delete get; _STLP_PRIV __release_time(__time));
+#endif
+
+ _STLP_PRIV __release_time(__time);
+
+ this->insert(get, time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(put, time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(wget, time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(wput, time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_collate_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2, collate<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, collate<wchar_t>::id);
+#endif
+ }
+ else {
+ locale::facet *col = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet *wcol = 0;
+#endif
+
+ int __err_code;
+ _Locale_collate *__coll = _STLP_PRIV __acquire_collate(name, buf, hint, &__err_code);
+ if (!__coll) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_collate_hint(__coll);
+ _STLP_TRY {
+ col = new collate_byname<char>(__coll);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_collate(__coll));
+
+#ifndef _STLP_NO_WCHAR_T
+ _Locale_collate *__wcoll = _STLP_PRIV __acquire_collate(name, buf, hint, &__err_code);
+ if (!__wcoll) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ delete col;
+ _STLP_THROW_BAD_ALLOC;
+ }
+ }
+ if (__wcoll) {
+ _STLP_TRY {
+ wcol = new collate_byname<wchar_t>(__wcoll);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_collate(__wcoll); delete col);
+ }
+#endif
+
+ this->insert(col, collate<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ if (wcol) this->insert(wcol, collate<wchar_t>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_monetary_default(buf);
+
+ _Locale_impl* i2 = locale::classic()._M_impl;
+
+ // We first insert name independant facets taken from the classic locale instance:
+ this->insert(i2, money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(i2, money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(i2, money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ this->insert(i2, moneypunct<char, false>::id);
+ this->insert(i2, moneypunct<char, true>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, moneypunct<wchar_t, false>::id);
+ this->insert(i2, moneypunct<wchar_t, true>::id);
+#endif
+ }
+ else {
+ locale::facet *punct = 0;
+ locale::facet *ipunct = 0;
+
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet* wpunct = 0;
+ locale::facet* wipunct = 0;
+#endif
+
+ int __err_code;
+ _Locale_monetary *__mon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__mon) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_monetary_hint(__mon);
+
+ _STLP_TRY {
+ punct = new moneypunct_byname<char, false>(__mon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__mon));
+
+ _Locale_monetary *__imon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__imon) {
+ delete punct;
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ _STLP_TRY {
+ ipunct = new moneypunct_byname<char, true>(__imon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__imon); delete punct);
+
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_TRY {
+ _Locale_monetary *__wmon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__wmon) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ }
+
+ if (__wmon) {
+ _STLP_TRY {
+ wpunct = new moneypunct_byname<wchar_t, false>(__wmon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__wmon));
+
+ _Locale_monetary *__wimon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__wimon) {
+ delete wpunct;
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ wpunct = 0;
+ }
+ else {
+ _STLP_TRY {
+ wipunct = new moneypunct_byname<wchar_t, true>(__wimon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__wimon); delete wpunct);
+ }
+ }
+ }
+ _STLP_UNWIND(delete ipunct; delete punct);
+#endif
+
+ this->insert(punct, moneypunct<char, false>::id);
+ this->insert(ipunct, moneypunct<char, true>::id);
+#ifndef _STLP_NO_WCHAR_T
+ if (wpunct) this->insert(wpunct, moneypunct<wchar_t, false>::id);
+ if (wipunct) this->insert(wipunct, moneypunct<wchar_t, true>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_messages_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2, messages<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, messages<wchar_t>::id);
+#endif
+ }
+ else {
+ locale::facet *msg = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet *wmsg = 0;
+#endif
+
+ int __err_code;
+ _Locale_messages *__msg = _STLP_PRIV __acquire_messages(name, buf, hint, &__err_code);
+ if (!__msg) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ _STLP_TRY {
+ msg = new messages_byname<char>(__msg);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_messages(__msg));
+
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_TRY {
+ _Locale_messages *__wmsg = _STLP_PRIV __acquire_messages(name, buf, hint, &__err_code);
+ if (!__wmsg) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ }
+
+ if (__wmsg) {
+ _STLP_TRY {
+ wmsg = new messages_byname<wchar_t>(__wmsg);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_messages(__wmsg));
+ }
+ }
+ _STLP_UNWIND(delete msg);
+#endif
+
+ this->insert(msg, messages<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ if (wmsg) this->insert(wmsg, messages<wchar_t>::id);
+#endif
+ }
+ return hint;
+}
+
+static void _Stl_loc_assign_ids() {
+ // This assigns ids to every facet that is a member of a category,
+ // and also to money_get/put, num_get/put, and time_get/put
+ // instantiated using ordinary pointers as the input/output
+ // iterators. (The default is [io]streambuf_iterator.)
+
+ money_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 8;
+ money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 9;
+ num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 10;
+ num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 11;
+ time_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
+ time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 13;
+
+#ifndef _STLP_NO_WCHAR_T
+ money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 21;
+ money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 22;
+ num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 23;
+ num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 24;
+ time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 25;
+ time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 26;
+#endif
+ // locale::id::_S_max = 27;
+}
+
+// To access those static instance use the getter below, they guaranty
+// a correct initialization.
+static locale *_Stl_classic_locale = 0;
+static locale *_Stl_global_locale = 0;
+
+locale* _Stl_get_classic_locale() {
+ static _Locale_impl::Init init;
+ return _Stl_classic_locale;
+}
+
+locale* _Stl_get_global_locale() {
+ static _Locale_impl::Init init;
+ return _Stl_global_locale;
+}
+
+#if defined (_STLP_MSVC) || defined (__ICL) || defined (__ISCPP__) || defined (__DMC__)
+/*
+ * The following static variable needs to be initialized before STLport
+ * users static variable in order for him to be able to use Standard
+ * streams in its variable initialization.
+ * This variable is here because MSVC do not allow to change the initialization
+ * segment in a given translation unit, iostream.cpp already contains an
+ * initialization segment specification.
+ */
+# pragma warning (disable : 4073)
+# pragma init_seg(lib)
+#endif
+
+static ios_base::Init _IosInit;
+
+void _Locale_impl::make_classic_locale() {
+ // This funcion will be called once: during build classic _Locale_impl
+
+ // The classic locale contains every facet that belongs to a category.
+ static _Stl_aligned_buffer<_Locale_impl> _Locale_classic_impl_buf;
+ _Locale_impl *classic = new(&_Locale_classic_impl_buf) _Locale_impl("C");
+
+ locale::facet* classic_facets[] = {
+ 0,
+ new collate<char>(1),
+ new ctype<char>(0, false, 1),
+ new codecvt<char, char, mbstate_t>(1),
+ new moneypunct<char, true>(1),
+ new moneypunct<char, false>(1),
+ new numpunct<char>(1),
+ new messages<char>(1),
+ new money_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
+ new money_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
+ new num_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
+ new num_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
+ new time_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
+ new time_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
+#ifndef _STLP_NO_WCHAR_T
+ new collate<wchar_t>(1),
+ new ctype<wchar_t>(1),
+ new codecvt<wchar_t, char, mbstate_t>(1),
+ new moneypunct<wchar_t, true>(1),
+ new moneypunct<wchar_t, false>(1),
+ new numpunct<wchar_t>(1),
+ new messages<wchar_t>(1),
+ new money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+#endif
+ 0
+ };
+
+ const size_t nb_classic_facets = sizeof(classic_facets) / sizeof(locale::facet *);
+ classic->facets_vec.reserve(nb_classic_facets);
+ classic->facets_vec.assign(&classic_facets[0], &classic_facets[0] + nb_classic_facets);
+
+ static locale _Locale_classic(classic);
+ _Stl_classic_locale = &_Locale_classic;
+
+ static locale _Locale_global(classic);
+ _Stl_global_locale = &_Locale_global;
+}
+
+// Declarations of (non-template) facets' static data members
+// size_t locale::id::_S_max = 27; // made before
+
+locale::id collate<char>::id = { 1 };
+locale::id ctype<char>::id = { 2 };
+locale::id codecvt<char, char, mbstate_t>::id = { 3 };
+locale::id moneypunct<char, true>::id = { 4 };
+locale::id moneypunct<char, false>::id = { 5 };
+locale::id numpunct<char>::id = { 6 } ;
+locale::id messages<char>::id = { 7 };
+
+#ifndef _STLP_NO_WCHAR_T
+locale::id collate<wchar_t>::id = { 14 };
+locale::id ctype<wchar_t>::id = { 15 };
+locale::id codecvt<wchar_t, char, mbstate_t>::id = { 16 };
+locale::id moneypunct<wchar_t, true>::id = { 17 } ;
+locale::id moneypunct<wchar_t, false>::id = { 18 } ;
+locale::id numpunct<wchar_t>::id = { 19 };
+locale::id messages<wchar_t>::id = { 20 };
+#endif
+
+_STLP_DECLSPEC _Locale_impl* _STLP_CALL _get_Locale_impl(_Locale_impl *loc)
+{
+ _STLP_ASSERT( loc != 0 );
+ loc->_M_incr();
+ return loc;
+}
+
+void _STLP_CALL _release_Locale_impl(_Locale_impl *& loc)
+{
+ _STLP_ASSERT( loc != 0 );
+ if (loc->_M_decr() == 0) {
+ if (*loc != *_Stl_classic_locale)
+ delete loc;
+ else
+ loc->~_Locale_impl();
+ loc = 0;
+ }
+}
+
+_STLP_DECLSPEC _Locale_impl* _STLP_CALL _copy_Nameless_Locale_impl(_Locale_impl *loc)
+{
+ _STLP_ASSERT( loc != 0 );
+ _Locale_impl *loc_new = new _Locale_impl(*loc);
+ loc_new->name = _Nameless;
+ return loc_new;
+}
+
+/* _GetFacetId implementation have to be here in order to be in the same translation unit
+ * as where id are initialize (in _Stl_loc_assign_ids) */
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<char, istreambuf_iterator<char, char_traits<char> > >*)
+{ return money_get<char, istreambuf_iterator<char, char_traits<char> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<char, ostreambuf_iterator<char, char_traits<char> > >*)
+{ return money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<char, istreambuf_iterator<char, char_traits<char> > >*)
+{ return num_get<char, istreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<char, ostreambuf_iterator<char, char_traits<char> > >*)
+{ return num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<char, istreambuf_iterator<char, char_traits<char> > >*)
+{ return time_get<char, istreambuf_iterator<char, char_traits<char> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<char, ostreambuf_iterator<char, char_traits<char> > >*)
+{ return time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
diff --git a/build/stlport/src/locale_impl.h b/build/stlport/src/locale_impl.h
new file mode 100644
index 000000000..2aa694c99
--- /dev/null
+++ b/build/stlport/src/locale_impl.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef LOCALE_IMPL_H
+#define LOCALE_IMPL_H
+
+#include <clocale> // C locale header file.
+#include <vector>
+#include <string>
+#include <locale>
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+//Export of _Locale_impl facets container:
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+//If we are using pointer specialization, vector<locale::facet*> will use
+//the already exported vector<void*> implementation.
+_STLP_EXPORT_TEMPLATE_CLASS allocator<locale::facet*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<locale::facet*, allocator<locale::facet*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+_STLP_EXPORT_TEMPLATE_CLASS vector<locale::facet*, allocator<locale::facet*> >;
+#endif
+
+//----------------------------------------------------------------------
+// Class _Locale_impl
+// This is the base class which implements access only and is supposed to
+// be used for classic locale only
+class _STLP_CLASS_DECLSPEC _Locale_impl : public _Refcount_Base {
+ public:
+ _Locale_impl(const char* s);
+ _Locale_impl(const _Locale_impl&);
+ _Locale_impl(size_t n, const char* s);
+
+ private:
+ ~_Locale_impl();
+
+ public:
+ size_t size() const { return facets_vec.size(); }
+
+ basic_string<char, char_traits<char>, allocator<char> > name;
+
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_bad_cast();
+
+ private:
+ void operator=(const _Locale_impl&);
+
+ public:
+ class _STLP_CLASS_DECLSPEC Init {
+ public:
+ Init();
+ ~Init();
+ private:
+ _Refcount_Base& _M_count() const;
+ };
+
+ static void _STLP_CALL _S_initialize();
+ static void _STLP_CALL _S_uninitialize();
+
+ static void make_classic_locale();
+ static void free_classic_locale();
+
+ friend class Init;
+
+ public:
+ // void remove(size_t index);
+ locale::facet* insert(locale::facet*, const locale::id& n);
+ void insert(_Locale_impl* from, const locale::id& n);
+
+ // Helper functions for byname construction of locales.
+ _Locale_name_hint* insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+
+ bool operator != (const locale& __loc) const { return __loc._M_impl != this; }
+
+ private:
+ vector<locale::facet*> facets_vec;
+
+ private:
+ friend _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl * );
+ friend void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ friend class _STLP_NO_MEM_T_NAME(loc);
+#else
+ friend class locale;
+#endif
+};
+
+void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/lock_free_slist.h b/build/stlport/src/lock_free_slist.h
new file mode 100644
index 000000000..7c753d17c
--- /dev/null
+++ b/build/stlport/src/lock_free_slist.h
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LOCK_FREE_SLIST_H
+#define _STLP_LOCK_FREE_SLIST_H
+
+#if defined(_STLP_PTHREADS)
+# include <pthread.h>
+
+# if defined (__GNUC__) && defined (__i386__)
+
+# define _STLP_HAS_ATOMIC_FREELIST
+/**
+ * Class that implements a non-blocking and thread-safe freelist.
+ * It is used for the lock-free node allocation engine.
+ *
+ * @author felixw@inin.com
+ */
+class _STLP_atomic_freelist {
+public:
+ /**
+ * Type representing items of the freelist
+ */
+ struct item {
+ item* _M_next;
+ };
+
+ _STLP_atomic_freelist() {
+ // Statically assert layout of member is as expected by assembly code
+ _STLP_STATIC_ASSERT(sizeof(_M) == 8)
+ _M._M_data._M_top = 0;
+ _M._M_data._M_sequence = 0;
+ }
+
+ /**
+ * Atomically pushes the specified item onto the freelist.
+ *
+ * @param __item [in] Item to add to the front of the list
+ */
+ void push(item* __item) {
+ // NOTE: GCC uses ebx as the PIC register for globals in shared libraries.
+ // The GCC version I'm using (3.4.1) won't temporarily spill it if it's
+ // used as input, output, or clobber. Instead, it complains with a
+ // "can't find a register in class `BREG' while reloading `asm'" error.
+ // This is probably a compiler bug, but as the cmpxchg8b instruction
+ // requires ebx, I work around this here by using ecx for the '__item'
+ // input and spilling ebx into edi. This also precludes us from using
+ // a "m" operand for the cmpxchg8b argument (GCC might think it can make
+ // it relative to ebx). Instead, we're using esi for the address of _M_data.
+ //
+ int __tmp1; // These dummy variables are used to tell GCC that the eax, ecx,
+ int __tmp2; // and edx registers will not have the same value as their input.
+ int __tmp3; // The optimizer will remove them as their values are not used.
+ __asm__ __volatile__
+ (" movl %%ebx, %%edi\n\t"
+ " movl %%ecx, %%ebx\n\t"
+ "L1_%=: movl %%eax, (%%ebx)\n\t" // __item._M_next = _M._M_data._M_top
+ " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
+ "lock; cmpxchg8b (%%esi)\n\t"
+ " jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ " movl %%edi, %%ebx"
+ :"=a" (__tmp1), "=d" (__tmp2), "=c" (__tmp3)
+ :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "c" (__item), "S" (&_M._M_data)
+ :"edi", "memory", "cc");
+ }
+
+ /**
+ * Atomically removes the topmost item from the freelist and returns a
+ * pointer to it. Returns NULL if the list is empty.
+ *
+ * @return Item that was removed from front of list; NULL if list empty
+ */
+ item* pop() {
+ item* __result;
+ int __tmp;
+ __asm__ __volatile__
+ (" movl %%ebx, %%edi\n\t"
+ "L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL?
+ " je L2_%=\n\t" // If yes, we're done
+ " movl (%%eax), %%ebx\n\t" // new top = _M._M_data._M_top->_M_next
+ " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
+ "lock; cmpxchg8b (%%esi)\n\t"
+ " jne L1_%=\n\t" // We failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ "L2_%=: movl %%edi, %%ebx"
+ :"=a" (__result), "=d" (__tmp)
+ :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data)
+ :"edi", "ecx", "memory", "cc");
+ return __result;
+ }
+
+ /**
+ * Atomically detaches all items from the list and returns a pointer to the
+ * topmost item. The items are still chained and may be traversed safely as
+ * they're now "owned" by the calling thread.
+ *
+ * @return Pointer to topmost item in the list; NULL if list empty
+ */
+ item* clear() {
+ item* __result;
+ int __tmp;
+ __asm__ __volatile__
+ (" movl %%ebx, %%edi\n\t"
+ "L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL?
+ " je L2_%=\n\t" // If yes, we're done
+ " xorl %%ebx, %%ebx\n\t" // We're attempting to set _M_top to NULL
+ " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
+ "lock; cmpxchg8b (%%esi)\n\t"
+ " jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ "L2_%=: movl %%edi, %%ebx"
+ :"=a" (__result), "=d" (__tmp)
+ :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data)
+ :"edi", "ecx", "memory", "cc");
+ return __result;
+ }
+
+private:
+ union {
+ long long _M_align;
+ struct {
+ item* _M_top; // Topmost element in the freelist
+ unsigned int _M_sequence; // Sequence counter to prevent "ABA problem"
+ } _M_data;
+ } _M;
+
+ _STLP_atomic_freelist(const _STLP_atomic_freelist&);
+ _STLP_atomic_freelist& operator=(const _STLP_atomic_freelist&);
+};
+
+# endif /* if defined(__GNUC__) && defined(__i386__) */
+
+#elif defined (_STLP_WIN32THREADS)
+
+# if !defined (_WIN64)
+# define _STLP_USE_ASM_IMPLEMENTATION
+# endif
+
+// Here are the compiler/platform requirements for the thread safe and
+// lock free singly linked list implementation:
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+// For the asm version:
+# if defined (_STLP_MSVC) && defined (_M_IX86) && (_M_IX86 >= 500)
+# define _STLP_HAS_ATOMIC_FREELIST
+# endif
+# else
+// For the API based version:
+# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (WINVER) || (WINVER >= 0x0501)) && \
+ (!defined (_WIN32_WINNT) || (_WIN32_WINNT >= 0x0501))
+# define _STLP_HAS_ATOMIC_FREELIST
+# endif
+# endif
+
+# if defined (_STLP_HAS_ATOMIC_FREELIST)
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL)
+# pragma warning (push)
+# pragma warning (disable : 4035) //function has no return value
+# endif
+# endif
+/**
+ * Class that implements a non-blocking and thread-safe freelist.
+ * It is used for the lock-free node allocation engine.
+ *
+ * @author felixw@inin.com
+ */
+class _STLP_atomic_freelist {
+public:
+ /**
+ * Type representing items of the freelist
+ */
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ struct item {
+ item* _M_next;
+ };
+# else
+ typedef SLIST_ENTRY item;
+# endif
+
+ _STLP_atomic_freelist() {
+ // Statically assert layout of member is as expected by assembly code
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ _STLP_STATIC_ASSERT((sizeof(item) == sizeof(item*)) && (sizeof(_M) == 8))
+ _M._M_data._M_top = 0;
+ _M._M_data._M_sequence = 0;
+# else
+ InitializeSListHead(&_M_head);
+# endif
+ }
+
+ /**
+ * Atomically pushes the specified item onto the freelist.
+ *
+ * @param __item [in] Item to add to the front of the list
+ */
+ void push(item* __item) {
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ __asm
+ {
+ mov esi, this
+ mov ebx, __item
+ mov eax, [esi] // _M._M_data._M_top
+ mov edx, [esi+4] // _M._M_data._M_sequence
+ L1: mov [ebx], eax // __item._M_next = _M._M_data._M_top
+ lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
+ lock cmpxchg8b qword ptr [esi]
+ jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ }
+# else
+ InterlockedPushEntrySList(&_M_head, __item);
+# endif
+ }
+
+ /**
+ * Atomically removes the topmost item from the freelist and returns a
+ * pointer to it. Returns NULL if the list is empty.
+ *
+ * @return Item that was removed from front of list; NULL if list empty
+ */
+ item* pop() {
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ __asm
+ {
+ mov esi, this
+ mov eax, [esi] // _M._M_data._M_top
+ mov edx, [esi+4] // _M._M_data._M_sequence
+ L1: test eax, eax // _M_top == NULL?
+ je L2 // Yes, we're done
+ mov ebx, [eax] // new top = _M._M_data._M_top->_M_next
+ lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
+ lock cmpxchg8b qword ptr [esi]
+ jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ L2:
+ }
+# else
+ return InterlockedPopEntrySList(&_M_head);
+# endif
+ }
+
+ /**
+ * Atomically detaches all items from the list and returns pointer to the
+ * topmost. The items are still chained and may be traversed safely as
+ * they're now "owned" by the calling thread.
+ *
+ * @return Pointer to topmost item in the list; NULL if list empty
+ */
+ item* clear() {
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ __asm
+ {
+ mov esi, this
+ mov eax, [esi] // _M._M_data._M_top
+ mov edx, [esi+4] // _M._M_data._M_sequence
+ L1: test eax, eax // _M_top == NULL?
+ je L2 // Yes, we're done
+ xor ebx,ebx // We're attempting to set _M._M_data._M_top to NULL
+ lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
+ lock cmpxchg8b qword ptr [esi]
+ jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ L2:
+ }
+# else
+ return InterlockedFlushSList(&_M_head);
+# endif
+ }
+
+private:
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ union {
+ __int64 _M_align;
+ struct {
+ item* _M_top; // Topmost element in the freelist
+ unsigned int _M_sequence; // Sequence counter to prevent "ABA problem"
+ } _M_data;
+ } _M;
+# else
+ SLIST_HEADER _M_head;
+# endif
+
+ _STLP_atomic_freelist(const _STLP_atomic_freelist&);
+ _STLP_atomic_freelist& operator = (const _STLP_atomic_freelist&);
+};
+
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL)
+# pragma warning (pop)
+# endif
+# endif
+
+# endif /* _STLP_HAS_ATOMIC_FREELIST */
+
+#endif
+
+#endif /* _STLP_LOCK_FREE_SLIST_H */
diff --git a/build/stlport/src/message_facets.h b/build/stlport/src/message_facets.h
new file mode 100644
index 000000000..946b5291b
--- /dev/null
+++ b/build/stlport/src/message_facets.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef MESSAGE_FACETS_H
+#define MESSAGE_FACETS_H
+
+#include <string>
+#include <locale>
+#include <hash_map>
+
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Class _Catalog_locale_map. The reason for this is that, internally,
+// a message string is always a char*. We need a ctype facet to convert
+// a string to and from wchar_t, and the user is permitted to provide such
+// a facet when calling open().
+
+struct _Catalog_locale_map {
+ _Catalog_locale_map() : M(0) {}
+ ~_Catalog_locale_map() { if (M) delete M; }
+
+ void insert(nl_catd_type key, const locale& L);
+ locale lookup(nl_catd_type key) const;
+ void erase(nl_catd_type key);
+
+ typedef hash_map<nl_catd_type, locale, hash<nl_catd_type>, equal_to<nl_catd_type>,
+ allocator<pair<_STLP_CONST nl_catd_type, locale> > > map_type;
+ map_type *M;
+
+private: // Invalidate copy constructor and assignment
+ _Catalog_locale_map(const _Catalog_locale_map&);
+ void operator=(const _Catalog_locale_map&);
+};
+
+/*
+ * In glibc nl_catd type is void *, but messages_base::catalog is defined as int
+ * by ISO/IEC 14882; The int may be too short to store pointer on 64-bit platforms;
+ * Another problem, is that do_open() may return negative value to indicate that no
+ * catalog open---this case can't be represented with pointers.
+ * The class _Catalog_nl_catd_map intended to make relation between
+ * messages_base::catalog and nl_catd handler.
+ *
+ */
+
+#if defined (_STLP_USE_GLIBC2_LOCALIZATION)
+# define _STLP_USE_NL_CATD_MAPPING
+#else
+/* If no mapping a message_base::catalog entry, int typedef according C++ Standard 22.2.7.1,
+ * has to be large enough to contain a nl_catd_type value.
+ */
+_STLP_STATIC_ASSERT(sizeof(nl_catd_type) <= sizeof(int))
+#endif
+
+class _STLP_CLASS_DECLSPEC _Catalog_nl_catd_map {
+public:
+ _Catalog_nl_catd_map()
+ {}
+ ~_Catalog_nl_catd_map()
+ {}
+
+ typedef hash_map<messages_base::catalog, nl_catd_type, hash<messages_base::catalog>, equal_to<messages_base::catalog>,
+ allocator<pair<_STLP_CONST messages_base::catalog, nl_catd_type> > > map_type;
+ typedef hash_map<nl_catd_type, messages_base::catalog, hash<nl_catd_type>, equal_to<nl_catd_type>,
+ allocator<pair<_STLP_CONST nl_catd_type, messages_base::catalog> > > rmap_type;
+ // typedef map<messages_base::catalog,nl_catd_type> map_type;
+ // typedef map<nl_catd_type,messages_base::catalog> rmap_type;
+
+ messages_base::catalog insert(nl_catd_type cat)
+#if !defined (_STLP_USE_NL_CATD_MAPPING)
+ { return (messages_base::catalog)cat; }
+#else
+ ;
+#endif
+
+ void erase(messages_base::catalog)
+#if !defined (_STLP_USE_NL_CATD_MAPPING)
+ {}
+#else
+ ;
+#endif
+
+ nl_catd_type operator [] ( messages_base::catalog cat )
+#if !defined (_STLP_USE_NL_CATD_MAPPING)
+ { return cat; }
+#else
+ { return cat < 0 ? 0 : M[cat]; }
+#endif
+
+private:
+ _Catalog_nl_catd_map(const _Catalog_nl_catd_map&);
+ _Catalog_nl_catd_map& operator =(const _Catalog_nl_catd_map&);
+
+#if defined (_STLP_USE_NL_CATD_MAPPING)
+ map_type M;
+ rmap_type Mr;
+ static _STLP_VOLATILE __stl_atomic_t _count;
+#endif
+};
+
+class _Messages {
+public:
+ typedef messages_base::catalog catalog;
+
+ _Messages(bool, const char *name);
+ _Messages(bool, _Locale_messages*);
+
+ catalog do_open(const string& __fn, const locale& __loc) const;
+ string do_get(catalog __c, int __set, int __msgid,
+ const string& __dfault) const;
+#if !defined (_STLP_NO_WCHAR_T)
+ wstring do_get(catalog __c, int __set, int __msgid,
+ const wstring& __dfault) const;
+#endif
+ void do_close(catalog __c) const;
+ ~_Messages();
+
+private:
+ _Locale_messages* _M_message_obj;
+ _Catalog_locale_map* _M_map;
+ mutable _Catalog_nl_catd_map _M_cat;
+
+ //private definition to avoid warning (with ICL)
+ _Messages(const _Messages&);
+ _Messages& operator=(const _Messages&);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/messages.cpp b/build/stlport/src/messages.cpp
new file mode 100644
index 000000000..ae4669e5c
--- /dev/null
+++ b/build/stlport/src/messages.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <typeinfo>
+
+#include "message_facets.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+void _Catalog_locale_map::insert(nl_catd_type key, const locale& L) {
+ _STLP_TRY {
+#if !defined (_STLP_NO_TYPEINFO) && !defined (_STLP_NO_RTTI)
+ // Don't bother to do anything unless we're using a non-default ctype facet
+# ifdef _STLP_NO_WCHAR_T
+ typedef char _Char;
+# else
+ typedef wchar_t _Char;
+# endif
+
+ typedef ctype<_Char> wctype;
+ wctype const& wct = use_facet<wctype>(L);
+ if (typeid(wct) != typeid(wctype)) {
+#endif
+ if (!M)
+ M = new map_type;
+
+ M->insert(map_type::value_type(key, L));
+#if !defined (_STLP_NO_TYPEINFO) && !defined (_STLP_NO_RTTI)
+ }
+#endif
+ }
+ _STLP_CATCH_ALL {}
+}
+
+void _Catalog_locale_map::erase(nl_catd_type key) {
+ if (M)
+ M->erase(key);
+}
+
+locale _Catalog_locale_map::lookup(nl_catd_type key) const {
+ if (M) {
+ map_type::const_iterator i = M->find(key);
+ return i != M->end() ? (*i).second : locale::classic();
+ }
+ else
+ return locale::classic();
+}
+
+
+#if defined (_STLP_USE_NL_CATD_MAPPING)
+_STLP_VOLATILE __stl_atomic_t _Catalog_nl_catd_map::_count = 0;
+
+messages_base::catalog _Catalog_nl_catd_map::insert(nl_catd_type cat) {
+ messages_base::catalog &res = Mr[cat];
+ if ( res == 0 ) {
+#if defined (_STLP_ATOMIC_INCREMENT)
+ res = __STATIC_CAST(int, _STLP_ATOMIC_INCREMENT(&_count));
+#else
+ static _STLP_STATIC_MUTEX _Count_lock _STLP_MUTEX_INITIALIZER;
+ {
+ _STLP_auto_lock sentry(_Count_lock);
+ res = __STATIC_CAST(int, ++_count);
+ }
+#endif
+ M[res] = cat;
+ }
+ return res;
+}
+
+void _Catalog_nl_catd_map::erase(messages_base::catalog cat) {
+ map_type::iterator mit(M.find(cat));
+ if (mit != M.end()) {
+ Mr.erase((*mit).second);
+ M.erase(mit);
+ }
+}
+#endif
+
+//----------------------------------------------------------------------
+//
+_Messages::_Messages(bool is_wide, const char *name) :
+ _M_message_obj(0), _M_map(0) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_message_obj = _STLP_PRIV __acquire_messages(name, buf, 0, &__err_code);
+ if (!_M_message_obj)
+ locale::_M_throw_on_creation_failure(__err_code, name, "messages");
+
+ if (is_wide)
+ _M_map = new _Catalog_locale_map;
+}
+
+_Messages::_Messages(bool is_wide, _Locale_messages* msg) :
+ _M_message_obj(msg), _M_map(is_wide ? new _Catalog_locale_map() : 0)
+{}
+
+_Messages::~_Messages() {
+ __release_messages(_M_message_obj);
+ delete _M_map;
+}
+
+_Messages::catalog _Messages::do_open(const string& filename, const locale& L) const {
+ nl_catd_type result = _M_message_obj ? _Locale_catopen(_M_message_obj, filename.c_str())
+ : (nl_catd_type)(-1);
+
+ if ( result != (nl_catd_type)(-1) ) {
+ if ( _M_map != 0 ) {
+ _M_map->insert(result, L);
+ }
+ return _STLP_MUTABLE(_Messages_impl, _M_cat).insert( result );
+ }
+
+ return -1;
+}
+
+string _Messages::do_get(catalog cat,
+ int set, int p_id, const string& dfault) const {
+ return _M_message_obj != 0 && cat >= 0
+ ? string(_Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[cat],
+ set, p_id, dfault.c_str()))
+ : dfault;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+wstring
+_Messages::do_get(catalog thecat,
+ int set, int p_id, const wstring& dfault) const {
+ typedef ctype<wchar_t> wctype;
+ const wctype& ct = use_facet<wctype>(_M_map->lookup(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]));
+
+ const char* str = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "");
+
+ // Verify that the lookup failed; an empty string might represent success.
+ if (!str)
+ return dfault;
+ else if (str[0] == '\0') {
+ const char* str2 = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "*");
+ if (!str2 || ((str2[0] == '*') && (str2[1] == '\0')))
+ return dfault;
+ }
+
+ // str is correct. Now we must widen it to get a wstring.
+ size_t n = strlen(str);
+
+ // NOT PORTABLE. What we're doing relies on internal details of the
+ // string implementation. (Contiguity of string elements.)
+ wstring result(n, wchar_t(0));
+ ct.widen(str, str + n, &*result.begin());
+ return result;
+}
+
+#endif
+
+void _Messages::do_close(catalog thecat) const {
+ if (_M_message_obj)
+ _Locale_catclose(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]);
+ if (_M_map) _M_map->erase(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]);
+ _STLP_MUTABLE(_Messages_impl, _M_cat).erase( thecat );
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// messages<char>
+messages<char>::messages(size_t refs)
+ : locale::facet(refs) {}
+
+messages_byname<char>::messages_byname(const char *name, size_t refs)
+ : messages<char>(refs), _M_impl(new _STLP_PRIV _Messages(false, name)) {}
+
+messages_byname<char>::messages_byname(_Locale_messages* msg)
+ : messages<char>(0), _M_impl(new _STLP_PRIV _Messages(false, msg)) {}
+
+messages_byname<char>::~messages_byname()
+{ delete _M_impl; }
+
+messages_byname<char>::catalog
+messages_byname<char>::do_open(const string& filename, const locale& l) const
+{ return _M_impl->do_open(filename, l); }
+
+string
+messages_byname<char>::do_get(catalog cat, int set, int p_id,
+ const string& dfault) const
+{ return _M_impl->do_get(cat, set, p_id, dfault); }
+
+void messages_byname<char>::do_close(catalog cat) const
+{ _M_impl->do_close(cat); }
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+//----------------------------------------------------------------------
+// messages<wchar_t>
+
+messages<wchar_t>::messages(size_t refs)
+ : locale::facet(refs) {}
+
+messages_byname<wchar_t>::messages_byname(const char *name, size_t refs)
+ : messages<wchar_t>(refs), _M_impl(new _STLP_PRIV _Messages(true, name)) {}
+
+messages_byname<wchar_t>::messages_byname(_Locale_messages* msg)
+ : messages<wchar_t>(0), _M_impl(new _STLP_PRIV _Messages(true, msg)) {}
+
+messages_byname<wchar_t>::~messages_byname()
+{ delete _M_impl; }
+
+messages_byname<wchar_t>::catalog
+messages_byname<wchar_t>::do_open(const string& filename, const locale& L) const
+{ return _M_impl->do_open(filename, L); }
+
+wstring
+messages_byname<wchar_t>::do_get(catalog thecat,
+ int set, int p_id, const wstring& dfault) const
+{ return _M_impl->do_get(thecat, set, p_id, dfault); }
+
+void messages_byname<wchar_t>::do_close(catalog cat) const
+{ _M_impl->do_close(cat); }
+
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/monetary.cpp b/build/stlport/src/monetary.cpp
new file mode 100644
index 000000000..d4a676737
--- /dev/null
+++ b/build/stlport/src/monetary.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <istream>
+
+_STLP_BEGIN_NAMESPACE
+
+static void _Init_monetary_formats(money_base::pattern& pos_format,
+ money_base::pattern& neg_format) {
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::none;
+ pos_format.field[3] = (char) money_base::value;
+
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+}
+
+// This is being used throughout the library
+static const char _S_empty_string[] = "";
+#ifndef _STLP_NO_WCHAR_T
+static const wchar_t _S_empty_wstring[] = L"";
+#endif
+
+//
+// moneypunct<>
+//
+
+moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<char, true>::~moneypunct() {}
+
+char moneypunct<char, true>::do_decimal_point() const {return ' ';}
+char moneypunct<char, true>::do_thousands_sep() const {return ' ';}
+string moneypunct<char, true>::do_grouping() const { return _S_empty_string; }
+string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; }
+string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; }
+string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; }
+money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;}
+money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;}
+int moneypunct<char, true>::do_frac_digits() const {return 0;}
+
+moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<char, false>::~moneypunct() {}
+
+char moneypunct<char, false>::do_decimal_point() const {return ' ';}
+char moneypunct<char, false>::do_thousands_sep() const {return ' ';}
+
+string moneypunct<char, false>::do_grouping() const { return _S_empty_string; }
+string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; }
+string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; }
+string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; }
+money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;}
+money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;}
+int moneypunct<char, false>::do_frac_digits() const {return 0;}
+
+#ifndef _STLP_NO_WCHAR_T
+moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<wchar_t, true>::~moneypunct() {}
+
+wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';}
+wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';}
+string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;}
+
+wstring moneypunct<wchar_t, true>::do_curr_symbol() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, true>::do_positive_sign() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, true>::do_negative_sign() const
+{return _S_empty_wstring;}
+int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;}
+money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const
+{return _M_pos_format;}
+money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const
+{return _M_neg_format;}
+
+moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<wchar_t, false>::~moneypunct() {}
+
+wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';}
+wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';}
+string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;}
+wstring moneypunct<wchar_t, false>::do_curr_symbol() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, false>::do_positive_sign() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, false>::do_negative_sign() const
+{return _S_empty_wstring;}
+int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;}
+
+money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const
+{return _M_pos_format;}
+money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const
+{return _M_neg_format;}
+
+#endif /* WCHAR_T */
+
+//
+// Instantiations
+//
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >;
+template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+// template class money_put<char, char*>;
+
+# ifndef _STLP_NO_WCHAR_T
+template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// template class money_put<wchar_t, wchar_t*>;
+// template class money_get<wchar_t, const wchar_t*>;
+# endif
+
+#endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+const bool moneypunct<char, true>::intl;
+const bool moneypunct<char, false>::intl;
+# ifndef _STLP_NO_WCHAR_T
+const bool moneypunct<wchar_t, true>::intl;
+const bool moneypunct<wchar_t, false>::intl;
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/num_get.cpp b/build/stlport/src/num_get.cpp
new file mode 100644
index 000000000..45901acff
--- /dev/null
+++ b/build/stlport/src/num_get.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <istream>
+#include <algorithm>
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// __valid_grouping compares two strings, one representing the
+// group sizes encountered when reading an integer, and the other
+// representing the valid group sizes as returned by the numpunct
+// grouping() member function. Both are interpreted right-to-left.
+// The grouping string is treated as if it were extended indefinitely
+// with its last value. For a grouping to be valid, each term in
+// the first string must be equal to the corresponding term in the
+// second, except for the last, which must be less than or equal.
+
+// boris : this takes reversed first string !
+bool _STLP_CALL
+__valid_grouping(const char * first1, const char * last1,
+ const char * first2, const char * last2) {
+ if (first1 == last1 || first2 == last2) return true;
+
+ --last1; --last2;
+
+ while (first1 != last1) {
+ if (*last1 != *first2)
+ return false;
+ --last1;
+ if (first2 != last2) ++first2;
+ }
+
+ return *last1 <= *first2;
+}
+
+_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) {
+ static const unsigned char __val_table[128] = {
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
+ };
+
+ return __val_table[__index];
+}
+
+_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms()
+{ return "+-0xX"; }
+
+// index is actually a char
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+// Similar, except return the character itself instead of the numeric
+// value. Used for floating-point input.
+bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) {
+ const wchar_t* p = find(digits, digits + 10, c);
+ if (p != digits + 10) {
+ c = (char)('0' + (p - digits));
+ return true;
+ }
+ else
+ return false;
+}
+
+bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep,
+ const wchar_t * digits) {
+ if (c == sep) {
+ c = (char)',';
+ return true;
+ }
+ else
+ return __get_fdigit(c, digits);
+}
+
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+//----------------------------------------------------------------------
+// Force instantiation of num_get<>
+template class _STLP_CLASS_DECLSPEC istreambuf_iterator<char, char_traits<char> >;
+// template class num_get<char, const char*>;
+template class num_get<char, istreambuf_iterator<char, char_traits<char> > >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+template class num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// template class num_get<wchar_t, const wchar_t*>;
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/num_get_float.cpp b/build/stlport/src/num_get_float.cpp
new file mode 100644
index 000000000..040760404
--- /dev/null
+++ b/build/stlport/src/num_get_float.cpp
@@ -0,0 +1,884 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <limits>
+#include <locale>
+#include <istream>
+
+#if (defined (__GNUC__) && !defined (__sun) && !defined (__hpux)) || \
+ defined (__DMC__)
+# include <stdint.h>
+#endif
+
+#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+ defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
+
+# if defined (__BORLANDC__)
+typedef unsigned int uint32_t;
+typedef unsigned __int64 uint64_t;
+# endif
+
+union _ll {
+ uint64_t i64;
+ struct {
+# if defined (_STLP_BIG_ENDIAN)
+ uint32_t hi;
+ uint32_t lo;
+# elif defined (_STLP_LITTLE_ENDIAN)
+ uint32_t lo;
+ uint32_t hi;
+# else
+# error Unknown endianess
+# endif
+ } i32;
+};
+
+# if defined (__linux__) && !defined (__ANDROID__)
+# include <ieee754.h>
+# else
+union ieee854_long_double {
+ long double d;
+
+ /* This is the IEEE 854 double-extended-precision format. */
+ struct {
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:32;
+ unsigned int exponent:15;
+ unsigned int negative:1;
+ unsigned int empty:16;
+ } ieee;
+};
+
+# define IEEE854_LONG_DOUBLE_BIAS 0x3fff
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_get
+
+// Helper functions for _M_do_get_float.
+
+#if !defined (_STLP_NO_WCHAR_T)
+void _STLP_CALL
+_Initialize_get_float( const ctype<wchar_t>& ct,
+ wchar_t& Plus, wchar_t& Minus,
+ wchar_t& pow_e, wchar_t& pow_E,
+ wchar_t* digits) {
+ char ndigits[11] = "0123456789";
+ Plus = ct.widen('+');
+ Minus = ct.widen('-');
+ pow_e = ct.widen('e');
+ pow_E = ct.widen('E');
+ ct.widen(ndigits + 0, ndigits + 10, digits);
+}
+#endif /* WCHAR_T */
+
+/*
+ * __string_to_double is just lifted from atof, the difference being
+ * that we just use '.' for the decimal point, rather than let it
+ * be taken from the current C locale, which of course is not accessible
+ * to us.
+ */
+#if defined (_STLP_MSVC) || defined (__BORLANDC__) || defined (__ICL)
+typedef unsigned long uint32;
+typedef unsigned __int64 uint64;
+# define ULL(x) x##Ui64
+#elif defined (__unix) || defined (__MINGW32__) || \
+ (defined (__DMC__) && (__LONGLONG)) || defined (__WATCOMC__) || \
+ defined (__ANDROID__)
+typedef uint32_t uint32;
+typedef uint64_t uint64;
+# define ULL(x) x##ULL
+#else
+# error There should be some unsigned 64-bit integer on the system!
+#endif
+
+// Multiplication of two 64-bit integers, giving a 128-bit result.
+// Taken from Algorithm M in Knuth section 4.3.1, with the loop
+// hand-unrolled.
+static void _Stl_mult64(const uint64 u, const uint64 v,
+ uint64& high, uint64& low) {
+ const uint64 low_mask = ULL(0xffffffff);
+ const uint64 u0 = u & low_mask;
+ const uint64 u1 = u >> 32;
+ const uint64 v0 = v & low_mask;
+ const uint64 v1 = v >> 32;
+
+ uint64 t = u0 * v0;
+ low = t & low_mask;
+
+ t = u1 * v0 + (t >> 32);
+ uint64 w1 = t & low_mask;
+ uint64 w2 = t >> 32;
+
+ uint64 x = u0 * v1 + w1;
+ low += (x & low_mask) << 32;
+ high = u1 * v1 + w2 + (x >> 32);
+}
+
+#if !defined (__linux__) || defined (__ANDROID__)
+
+# define bit11 ULL(0x7ff)
+# define exponent_mask (bit11 << 52)
+
+# if !defined (__GNUC__) || (__GNUC__ != 3) || (__GNUC_MINOR__ != 4) || \
+ (!defined (__CYGWIN__) && !defined (__MINGW32__))
+//Generate bad code when compiled with -O2 option.
+inline
+# endif
+void _Stl_set_exponent(uint64 &val, uint64 exp)
+{ val = (val & ~exponent_mask) | ((exp & bit11) << 52); }
+
+#endif // __linux__
+
+/* Power of ten fractions for tenscale*/
+/* The constants are factored so that at most two constants
+ * and two multiplies are needed. Furthermore, one of the constants
+ * is represented exactly - 10**n where 1<= n <= 27.
+ */
+
+static const uint64 _Stl_tenpow[80] = {
+ULL(0xa000000000000000), /* _Stl_tenpow[0]=(10**1)/(2**4) */
+ULL(0xc800000000000000), /* _Stl_tenpow[1]=(10**2)/(2**7) */
+ULL(0xfa00000000000000), /* _Stl_tenpow[2]=(10**3)/(2**10) */
+ULL(0x9c40000000000000), /* _Stl_tenpow[3]=(10**4)/(2**14) */
+ULL(0xc350000000000000), /* _Stl_tenpow[4]=(10**5)/(2**17) */
+ULL(0xf424000000000000), /* _Stl_tenpow[5]=(10**6)/(2**20) */
+ULL(0x9896800000000000), /* _Stl_tenpow[6]=(10**7)/(2**24) */
+ULL(0xbebc200000000000), /* _Stl_tenpow[7]=(10**8)/(2**27) */
+ULL(0xee6b280000000000), /* _Stl_tenpow[8]=(10**9)/(2**30) */
+ULL(0x9502f90000000000), /* _Stl_tenpow[9]=(10**10)/(2**34) */
+ULL(0xba43b74000000000), /* _Stl_tenpow[10]=(10**11)/(2**37) */
+ULL(0xe8d4a51000000000), /* _Stl_tenpow[11]=(10**12)/(2**40) */
+ULL(0x9184e72a00000000), /* _Stl_tenpow[12]=(10**13)/(2**44) */
+ULL(0xb5e620f480000000), /* _Stl_tenpow[13]=(10**14)/(2**47) */
+ULL(0xe35fa931a0000000), /* _Stl_tenpow[14]=(10**15)/(2**50) */
+ULL(0x8e1bc9bf04000000), /* _Stl_tenpow[15]=(10**16)/(2**54) */
+ULL(0xb1a2bc2ec5000000), /* _Stl_tenpow[16]=(10**17)/(2**57) */
+ULL(0xde0b6b3a76400000), /* _Stl_tenpow[17]=(10**18)/(2**60) */
+ULL(0x8ac7230489e80000), /* _Stl_tenpow[18]=(10**19)/(2**64) */
+ULL(0xad78ebc5ac620000), /* _Stl_tenpow[19]=(10**20)/(2**67) */
+ULL(0xd8d726b7177a8000), /* _Stl_tenpow[20]=(10**21)/(2**70) */
+ULL(0x878678326eac9000), /* _Stl_tenpow[21]=(10**22)/(2**74) */
+ULL(0xa968163f0a57b400), /* _Stl_tenpow[22]=(10**23)/(2**77) */
+ULL(0xd3c21bcecceda100), /* _Stl_tenpow[23]=(10**24)/(2**80) */
+ULL(0x84595161401484a0), /* _Stl_tenpow[24]=(10**25)/(2**84) */
+ULL(0xa56fa5b99019a5c8), /* _Stl_tenpow[25]=(10**26)/(2**87) */
+ULL(0xcecb8f27f4200f3a), /* _Stl_tenpow[26]=(10**27)/(2**90) */
+
+ULL(0xd0cf4b50cfe20766), /* _Stl_tenpow[27]=(10**55)/(2**183) */
+ULL(0xd2d80db02aabd62c), /* _Stl_tenpow[28]=(10**83)/(2**276) */
+ULL(0xd4e5e2cdc1d1ea96), /* _Stl_tenpow[29]=(10**111)/(2**369) */
+ULL(0xd6f8d7509292d603), /* _Stl_tenpow[30]=(10**139)/(2**462) */
+ULL(0xd910f7ff28069da4), /* _Stl_tenpow[31]=(10**167)/(2**555) */
+ULL(0xdb2e51bfe9d0696a), /* _Stl_tenpow[32]=(10**195)/(2**648) */
+ULL(0xdd50f1996b947519), /* _Stl_tenpow[33]=(10**223)/(2**741) */
+ULL(0xdf78e4b2bd342cf7), /* _Stl_tenpow[34]=(10**251)/(2**834) */
+ULL(0xe1a63853bbd26451), /* _Stl_tenpow[35]=(10**279)/(2**927) */
+ULL(0xe3d8f9e563a198e5), /* _Stl_tenpow[36]=(10**307)/(2**1020) */
+
+// /* _Stl_tenpow[36]=(10**335)/(2**) */
+// /* _Stl_tenpow[36]=(10**335)/(2**) */
+
+ULL(0xfd87b5f28300ca0e), /* _Stl_tenpow[37]=(10**-28)/(2**-93) */
+ULL(0xfb158592be068d2f), /* _Stl_tenpow[38]=(10**-56)/(2**-186) */
+ULL(0xf8a95fcf88747d94), /* _Stl_tenpow[39]=(10**-84)/(2**-279) */
+ULL(0xf64335bcf065d37d), /* _Stl_tenpow[40]=(10**-112)/(2**-372) */
+ULL(0xf3e2f893dec3f126), /* _Stl_tenpow[41]=(10**-140)/(2**-465) */
+ULL(0xf18899b1bc3f8ca2), /* _Stl_tenpow[42]=(10**-168)/(2**-558) */
+ULL(0xef340a98172aace5), /* _Stl_tenpow[43]=(10**-196)/(2**-651) */
+ULL(0xece53cec4a314ebe), /* _Stl_tenpow[44]=(10**-224)/(2**-744) */
+ULL(0xea9c227723ee8bcb), /* _Stl_tenpow[45]=(10**-252)/(2**-837) */
+ULL(0xe858ad248f5c22ca), /* _Stl_tenpow[46]=(10**-280)/(2**-930) */
+ULL(0xe61acf033d1a45df), /* _Stl_tenpow[47]=(10**-308)/(2**-1023) */
+ULL(0xe3e27a444d8d98b8), /* _Stl_tenpow[48]=(10**-336)/(2**-1116) */
+ULL(0xe1afa13afbd14d6e) /* _Stl_tenpow[49]=(10**-364)/(2**-1209) */
+};
+
+static const short _Stl_twoexp[80] = {
+4,7,10,14,17,20,24,27,30,34,37,40,44,47,50,54,57,60,64,67,70,74,77,80,84,87,90,
+183,276,369,462,555,648,741,834,927,1020,
+-93,-186,-279,-372,-465,-558,-651,-744,-837,-930,-1023,-1116,-1209
+};
+
+#define TEN_1 0 /* offset to 10 ** 1 */
+#define TEN_27 26 /* offset to 10 ** 27 */
+#define TEN_M28 37 /* offset to 10 ** -28 */
+#define NUM_HI_P 11
+#define NUM_HI_N 13
+
+#define _Stl_HIBITULL (ULL(1) << 63)
+
+static void _Stl_norm_and_round(uint64& p, int& norm, uint64 prodhi, uint64 prodlo) {
+ norm = 0;
+ if ((prodhi & _Stl_HIBITULL) == 0) {
+ /* leading bit is a zero
+ * may have to normalize
+ */
+ if ((prodhi == ~_Stl_HIBITULL) &&
+ ((prodlo >> 62) == 0x3)) { /* normalization followed by round
+ * would cause carry to create
+ * extra bit, so don't normalize
+ */
+ p = _Stl_HIBITULL;
+ return;
+ }
+ p = (prodhi << 1) | (prodlo >> 63); /* normalize */
+ norm = 1;
+ prodlo <<= 1;
+ }
+ else {
+ p = prodhi;
+ }
+
+ if ((prodlo & _Stl_HIBITULL) != 0) { /* first guard bit a one */
+ if (((p & 0x1) != 0) ||
+ prodlo != _Stl_HIBITULL ) { /* not borderline for round to even */
+ /* round */
+ ++p;
+ if (p == 0)
+ ++p;
+ }
+ }
+}
+
+// Convert a 64-bitb fraction * 10^exp to a 64-bit fraction * 2^bexp.
+// p: 64-bit fraction
+// exp: base-10 exponent
+// bexp: base-2 exponent (output parameter)
+static void _Stl_tenscale(uint64& p, int exp, int& bexp) {
+ bexp = 0;
+
+ if ( exp == 0 ) { /* no scaling needed */
+ return;
+ }
+
+ int exp_hi = 0, exp_lo = exp; /* exp = exp_hi*32 + exp_lo */
+ int tlo = TEN_1, thi; /* offsets in power of ten table */
+ int num_hi; /* number of high exponent powers */
+
+ if (exp > 0) { /* split exponent */
+ if (exp_lo > 27) {
+ exp_lo++;
+ while (exp_lo > 27) {
+ exp_hi++;
+ exp_lo -= 28;
+ }
+ }
+ thi = TEN_27;
+ num_hi = NUM_HI_P;
+ } else { // exp < 0
+ while (exp_lo < 0) {
+ exp_hi++;
+ exp_lo += 28;
+ }
+ thi = TEN_M28;
+ num_hi = NUM_HI_N;
+ }
+
+ uint64 prodhi, prodlo; /* 128b product */
+ int norm; /* number of bits of normalization */
+
+ int hi, lo; /* offsets in power of ten table */
+ while (exp_hi) { /* scale */
+ hi = (min) (exp_hi, num_hi); /* only a few large powers of 10 */
+ exp_hi -= hi; /* could iterate in extreme case */
+ hi += thi-1;
+ _Stl_mult64(p, _Stl_tenpow[hi], prodhi, prodlo);
+ _Stl_norm_and_round(p, norm, prodhi, prodlo);
+ bexp += _Stl_twoexp[hi] - norm;
+ }
+
+ if (exp_lo) {
+ lo = tlo + exp_lo -1;
+ _Stl_mult64(p, _Stl_tenpow[lo], prodhi, prodlo);
+ _Stl_norm_and_round(p, norm, prodhi, prodlo);
+ bexp += _Stl_twoexp[lo] - norm;
+ }
+
+ return;
+}
+
+// First argument is a buffer of values from 0 to 9, NOT ascii.
+// Second argument is number of digits in buffer, 1 <= digits <= 17.
+// Third argument is base-10 exponent.
+
+/* IEEE representation */
+#if !defined (__linux__) || defined (__ANDROID__)
+
+union _Double_rep {
+ uint64 ival;
+ double val;
+};
+
+static double _Stl_atod(char *buffer, ptrdiff_t ndigit, int dexp) {
+ typedef numeric_limits<double> limits;
+ _Double_rep drep;
+ uint64 &value = drep.ival; /* Value develops as follows:
+ * 1) decimal digits as an integer
+ * 2) left adjusted fraction
+ * 3) right adjusted fraction
+ * 4) exponent and fraction
+ */
+
+ uint32 guard; /* First guard bit */
+ uint64 rest; /* Remaining guard bits */
+
+ int bexp; /* binary exponent */
+ int nzero; /* number of non-zero bits */
+ int sexp; /* scaling exponent */
+
+ char *bufferend; /* pointer to char after last digit */
+
+ /* Convert the decimal digits to a binary integer. */
+ bufferend = buffer + ndigit;
+ value = 0;
+
+ while (buffer < bufferend) {
+ value *= 10;
+ value += *buffer++;
+ }
+
+ /* Check for zero and treat it as a special case */
+ if (value == 0) {
+ return 0.0;
+ }
+
+ /* Normalize value */
+ bexp = 64; /* convert from 64b int to fraction */
+
+ /* Count number of non-zeroes in value */
+ nzero = 0;
+ if ((value >> 32) != 0) { nzero = 32; } //*TY 03/25/2000 - added explicit comparison to zero to avoid uint64 to bool conversion operator
+ if ((value >> (16 + nzero)) != 0) { nzero += 16; }
+ if ((value >> ( 8 + nzero)) != 0) { nzero += 8; }
+ if ((value >> ( 4 + nzero)) != 0) { nzero += 4; }
+ if ((value >> ( 2 + nzero)) != 0) { nzero += 2; }
+ if ((value >> ( 1 + nzero)) != 0) { nzero += 1; }
+ if ((value >> ( nzero)) != 0) { nzero += 1; }
+
+ /* Normalize */
+ value <<= /*(uint64)*/ (64 - nzero); //*TY 03/25/2000 - removed extraneous cast to uint64
+ bexp -= 64 - nzero;
+
+ /* At this point we have a 64b fraction and a binary exponent
+ * but have yet to incorporate the decimal exponent.
+ */
+
+ /* multiply by 10^dexp */
+ _Stl_tenscale(value, dexp, sexp);
+ bexp += sexp;
+
+ if (bexp <= -1022) { /* HI denorm or underflow */
+ bexp += 1022;
+ if (bexp < -53) { /* guaranteed underflow */
+ value = 0;
+ }
+ else { /* denorm or possible underflow */
+ int lead0 = 12 - bexp; /* 12 sign and exponent bits */
+
+ /* we must special case right shifts of more than 63 */
+ if (lead0 > 64) {
+ rest = value;
+ guard = 0;
+ value = 0;
+ }
+ else if (lead0 == 64) {
+ rest = value & ((ULL(1)<< 63)-1);
+ guard = (uint32) ((value>> 63) & 1 );
+ value = 0;
+ }
+ else {
+ rest = value & (((ULL(1) << lead0)-1)-1);
+ guard = (uint32) (((value>> lead0)-1) & 1);
+ value >>= /*(uint64)*/ lead0; /* exponent is zero */
+ }
+
+ /* Round */
+ if (guard && ((value & 1) || rest) ) {
+ ++value;
+ if (value == (ULL(1) << (limits::digits - 1))) { /* carry created normal number */
+ value = 0;
+ _Stl_set_exponent(value, 1);
+ }
+ }
+ }
+ }
+ else { /* not zero or denorm */
+ /* Round to 53 bits */
+ rest = value & ((1 << 10) - 1);
+ value >>= 10;
+ guard = (uint32) value & 1;
+ value >>= 1;
+
+ /* value&1 guard rest Action
+ *
+ * dc 0 dc none
+ * 1 1 dc round
+ * 0 1 0 none
+ * 0 1 !=0 round
+ */
+ if (guard) {
+ if (((value&1)!=0) || (rest!=0)) {
+ ++value; /* round */
+ if ((value >> 53) != 0) { /* carry all the way across */
+ value >>= 1; /* renormalize */
+ ++bexp;
+ }
+ }
+ }
+ /*
+ * Check for overflow
+ * IEEE Double Precision Format
+ * (From Table 7-8 of Kane and Heinrich)
+ *
+ * Fraction bits 52
+ * Emax +1023
+ * Emin -1022
+ * Exponent bias +1023
+ * Exponent bits 11
+ * Integer bit hidden
+ * Total width in bits 64
+ */
+
+ if (bexp > limits::max_exponent) { /* overflow */
+ return limits::infinity();
+ }
+ else { /* value is normal */
+ value &= ~(ULL(1) << (limits::digits - 1)); /* hide hidden bit */
+ _Stl_set_exponent(value, bexp + 1022); /* add bias */
+ }
+ }
+
+ _STLP_STATIC_ASSERT(sizeof(uint64) >= sizeof(double))
+ return drep.val;
+}
+
+#endif
+
+#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+ defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
+
+template <class D, class IEEE, int M, int BIAS>
+D _Stl_atodT(char *buffer, ptrdiff_t ndigit, int dexp)
+{
+ typedef numeric_limits<D> limits;
+
+ /* Convert the decimal digits to a binary integer. */
+ char *bufferend = buffer + ndigit; /* pointer to char after last digit */
+ _ll vv;
+ vv.i64 = 0L;
+
+ while ( buffer < bufferend ) {
+ vv.i64 *= 10;
+ vv.i64 += *buffer++;
+ }
+
+ if ( vv.i64 == ULL(0) ) { /* Check for zero and treat it as a special case */
+ return D(0.0);
+ }
+
+ /* Normalize value */
+
+ int bexp = 64; /* convert from 64b int to fraction */
+
+ /* Count number of non-zeroes in value */
+ int nzero = 0;
+ if ((vv.i64 >> 32) != 0) { nzero = 32; }
+ if ((vv.i64 >> (16 + nzero)) != 0) { nzero += 16; }
+ if ((vv.i64 >> ( 8 + nzero)) != 0) { nzero += 8; }
+ if ((vv.i64 >> ( 4 + nzero)) != 0) { nzero += 4; }
+ if ((vv.i64 >> ( 2 + nzero)) != 0) { nzero += 2; }
+ if ((vv.i64 >> ( 1 + nzero)) != 0) { nzero += 1; }
+ if ((vv.i64 >> ( nzero)) != 0) { nzero += 1; }
+
+ /* Normalize */
+ nzero = 64 - nzero;
+ vv.i64 <<= nzero; // * TY 03/25/2000 - removed extraneous cast to uint64
+ bexp -= nzero;
+
+ /* At this point we have a 64b fraction and a binary exponent
+ * but have yet to incorporate the decimal exponent.
+ */
+
+ /* multiply by 10^dexp */
+ int sexp;
+ _Stl_tenscale(vv.i64, dexp, sexp);
+ bexp += sexp;
+
+ if ( bexp >= limits::min_exponent ) { /* not zero or denorm */
+ if ( limits::digits < 64 ) {
+ /* Round to (64 - M + 1) bits */
+ uint64_t rest = vv.i64 & ((~ULL(0) / ULL(2)) >> (limits::digits - 1));
+ vv.i64 >>= M - 2;
+ uint32_t guard = (uint32) vv.i64 & 1;
+ vv.i64 >>= 1;
+
+ /* value&1 guard rest Action
+ *
+ * dc 0 dc none
+ * 1 1 dc round
+ * 0 1 0 none
+ * 0 1 !=0 round
+ */
+
+ if (guard) {
+ if ( ((vv.i64 & 1) != 0) || (rest != 0) ) {
+ vv.i64++; /* round */
+ if ( (vv.i64 >> (limits::digits < 64 ? limits::digits : 0)) != 0 ) { /* carry all the way across */
+ vv.i64 >>= 1; /* renormalize */
+ ++bexp;
+ }
+ }
+ }
+
+ vv.i64 &= ~(ULL(1) << (limits::digits - 1)); /* hide hidden bit */
+ }
+ /*
+ * Check for overflow
+ * IEEE Double Precision Format
+ * (From Table 7-8 of Kane and Heinrich)
+ *
+ * Fraction bits 52
+ * Emax +1023
+ * Emin -1022
+ * Exponent bias +1023
+ * Exponent bits 11
+ * Integer bit hidden
+ * Total width in bits 64
+ */
+
+ if (bexp > limits::max_exponent) { /* overflow */
+ return limits::infinity();
+ }
+
+ /* value is normal */
+
+ IEEE v;
+
+ v.ieee.mantissa0 = vv.i32.hi;
+ v.ieee.mantissa1 = vv.i32.lo;
+ v.ieee.negative = 0;
+ v.ieee.exponent = bexp + BIAS - 1;
+
+ return v.d;
+ }
+
+ /* HI denorm or underflow */
+ bexp += BIAS - 1;
+ if (bexp < -limits::digits) { /* guaranteed underflow */
+ vv.i64 = 0;
+ } else { /* denorm or possible underflow */
+
+ /*
+ * Problem point for long double: looks like this code reflect shareing of mantissa
+ * and exponent in 64b int; not so for long double
+ */
+
+ int lead0 = M - bexp; /* M = 12 sign and exponent bits */
+ uint64_t rest;
+ uint32_t guard;
+
+ /* we must special case right shifts of more than 63 */
+
+ if (lead0 > 64) {
+ rest = vv.i64;
+ guard = 0;
+ vv.i64 = 0;
+ } else if (lead0 == 64) {
+ rest = vv.i64 & ((ULL(1) << 63)-1);
+ guard = (uint32) ((vv.i64 >> 63) & 1 );
+ vv.i64 = 0;
+ } else {
+ rest = vv.i64 & (((ULL(1) << lead0)-1)-1);
+ guard = (uint32) (((vv.i64 >> lead0)-1) & 1);
+ vv.i64 >>= /*(uint64)*/ lead0; /* exponent is zero */
+ }
+
+ /* Round */
+ if (guard && ( (vv.i64 & 1) || rest)) {
+ vv.i64++;
+ if (vv.i64 == (ULL(1) << (limits::digits - 1))) { /* carry created normal number */
+ IEEE v;
+
+ v.ieee.mantissa0 = 0;
+ v.ieee.mantissa1 = 0;
+ v.ieee.negative = 0;
+ v.ieee.exponent = 1;
+ return v.d;
+ }
+ }
+ }
+
+ IEEE v;
+
+ v.ieee.mantissa0 = vv.i32.hi;
+ v.ieee.mantissa1 = vv.i32.lo;
+ v.ieee.negative = 0;
+ v.ieee.exponent = 0;
+
+ return v.d;
+}
+#endif // __linux__
+
+#if !defined (__linux__) || defined (__ANDROID__)
+static double _Stl_string_to_double(const char *s) {
+ typedef numeric_limits<double> limits;
+ const int max_digits = limits::digits10 + 2;
+ unsigned c;
+ unsigned Negate, decimal_point;
+ char *d;
+ int exp;
+ int dpchar;
+ char digits[max_digits];
+
+ c = *s++;
+
+ /* process sign */
+ Negate = 0;
+ if (c == '+') {
+ c = *s++;
+ } else if (c == '-') {
+ Negate = 1;
+ c = *s++;
+ }
+
+ d = digits;
+ dpchar = '.' - '0';
+ decimal_point = 0;
+ exp = 0;
+
+ for (;;) {
+ c -= '0';
+ if (c < 10) {
+ if (d == digits + max_digits) {
+ /* ignore more than max_digits digits, but adjust exponent */
+ exp += (decimal_point ^ 1);
+ } else {
+ if (c == 0 && d == digits) {
+ /* ignore leading zeros */
+ } else {
+ *d++ = (char) c;
+ }
+ exp -= decimal_point;
+ }
+ } else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */
+ decimal_point = 1;
+ } else {
+ break;
+ }
+ c = *s++;
+ }
+
+ /* strtod cant return until it finds the end of the exponent */
+ if (d == digits) {
+ return 0.0;
+ }
+
+ if (c == 'e' - '0' || c == 'E' - '0') {
+ register unsigned negate_exp = 0;
+ register int e = 0;
+ c = *s++;
+ if (c == '+' || c == ' ') {
+ c = *s++;
+ } else if (c == '-') {
+ negate_exp = 1;
+ c = *s++;
+ }
+ if (c -= '0', c < 10) {
+ do {
+ e = e * 10 + (int)c;
+ c = *s++;
+ } while (c -= '0', c < 10);
+
+ if (negate_exp) {
+ e = -e;
+ }
+ exp += e;
+ }
+ }
+
+ double x;
+ ptrdiff_t n = d - digits;
+ if ((exp + n - 1) < limits::min_exponent10) {
+ x = 0;
+ }
+ else if ((exp + n - 1) > limits::max_exponent10) {
+ x = limits::infinity();
+ }
+ else {
+ /* Let _Stl_atod diagnose under- and over-flows.
+ * If the input was == 0.0, we have already returned,
+ * so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW */
+ x = _Stl_atod(digits, n, exp);
+ }
+
+ if (Negate) {
+ x = -x;
+ }
+
+ return x;
+}
+
+#endif
+
+#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+ defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
+
+template <class D, class IEEE, int M, int BIAS>
+D _Stl_string_to_doubleT(const char *s)
+{
+ typedef numeric_limits<D> limits;
+ const int max_digits = limits::digits10; /* + 2 17 */;
+ unsigned c;
+ unsigned decimal_point;
+ char *d;
+ int exp;
+ D x;
+ int dpchar;
+ char digits[max_digits];
+
+ c = *s++;
+
+ /* process sign */
+ bool Negate = false;
+ if (c == '+') {
+ c = *s++;
+ } else if (c == '-') {
+ Negate = true;
+ c = *s++;
+ }
+
+ d = digits;
+ dpchar = '.' - '0';
+ decimal_point = 0;
+ exp = 0;
+
+ for (;;) {
+ c -= '0';
+ if (c < 10) {
+ if (d == digits + max_digits) {
+ /* ignore more than max_digits digits, but adjust exponent */
+ exp += (decimal_point ^ 1);
+ } else {
+ if (c == 0 && d == digits) {
+ /* ignore leading zeros */
+ } else {
+ *d++ = (char) c;
+ }
+ exp -= decimal_point;
+ }
+ } else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */
+ decimal_point = 1;
+ } else {
+ break;
+ }
+ c = *s++;
+ }
+ /* strtod cant return until it finds the end of the exponent */
+ if (d == digits) {
+ return D(0.0);
+ }
+
+ if (c == 'e'-'0' || c == 'E'-'0') {
+ bool negate_exp = false;
+ register int e = 0;
+ c = *s++;
+ if (c == '+' || c == ' ') {
+ c = *s++;
+ } else if (c == '-') {
+ negate_exp = true;
+ c = *s++;
+ }
+ if (c -= '0', c < 10) {
+ do {
+ e = e * 10 + (int)c;
+ c = *s++;
+ } while (c -= '0', c < 10);
+
+ if (negate_exp) {
+ e = -e;
+ }
+ exp += e;
+ }
+ }
+
+ ptrdiff_t n = d - digits;
+ if ((exp + n - 1) < limits::min_exponent10) {
+ return D(0.0); // +0.0 is the same as -0.0
+ } else if ((exp + n - 1) > limits::max_exponent10 ) {
+ // not good, because of x = -x below; this may lead to portability problems
+ x = limits::infinity();
+ } else {
+ /* let _Stl_atod diagnose under- and over-flows */
+ /* if the input was == 0.0, we have already returned,
+ so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW
+ */
+ x = _Stl_atodT<D,IEEE,M,BIAS>(digits, n, exp);
+ }
+
+ return Negate ? -x : x;
+}
+
+#endif // __linux__
+
+void _STLP_CALL
+__string_to_float(const __iostring& v, float& val)
+{
+#if !defined (__linux__) || defined (__ANDROID__)
+ val = (float)_Stl_string_to_double(v.c_str());
+#else
+ val = (float)_Stl_string_to_doubleT<double,ieee754_double,12,IEEE754_DOUBLE_BIAS>(v.c_str());
+#endif
+}
+
+void _STLP_CALL
+__string_to_float(const __iostring& v, double& val)
+{
+#if !defined (__linux__) || defined (__ANDROID__)
+ val = _Stl_string_to_double(v.c_str());
+#else
+ val = _Stl_string_to_doubleT<double,ieee754_double,12,IEEE754_DOUBLE_BIAS>(v.c_str());
+#endif
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_CALL
+__string_to_float(const __iostring& v, long double& val) {
+#if !defined (__linux__) && !defined (__MINGW32__) && !defined (__CYGWIN__) && \
+ !defined (__BORLANDC__) && !defined (__DMC__) && !defined (__HP_aCC)
+ //The following function is valid only if long double is an alias for double.
+ _STLP_STATIC_ASSERT( sizeof(long double) <= sizeof(double) )
+ val = _Stl_string_to_double(v.c_str());
+#else
+ val = _Stl_string_to_doubleT<long double,ieee854_long_double,16,IEEE854_LONG_DOUBLE_BIAS>(v.c_str());
+#endif
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/num_put.cpp b/build/stlport/src/num_put.cpp
new file mode 100644
index 000000000..e1235617d
--- /dev/null
+++ b/build/stlport/src/num_put.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <ostream>
+
+_STLP_BEGIN_NAMESPACE
+
+// Note that grouping[0] is the number of digits in the *rightmost* group.
+// We assume, without checking, that *last is null and that there is enough
+// space in the buffer to extend the number past [first, last).
+template <class Char>
+static ptrdiff_t
+__insert_grouping_aux(Char* first, Char* last, const string& grouping,
+ Char separator, Char Plus, Char Minus,
+ int basechars) {
+ typedef string::size_type str_size;
+
+ if (first == last)
+ return 0;
+
+ int sign = 0;
+
+ if (*first == Plus || *first == Minus) {
+ sign = 1;
+ ++first;
+ }
+
+ first += basechars;
+ Char* cur_group = last; // Points immediately beyond the rightmost
+ // digit of the current group.
+ int groupsize = 0; // Size of the current group (if grouping.size() == 0, size
+ // of group unlimited: we force condition (groupsize <= 0))
+
+ for ( str_size n = 0; ; ) { // Index of the current group
+ if ( n < grouping.size() ) {
+ groupsize = __STATIC_CAST(int, grouping[n++] );
+ }
+
+ if ((groupsize <= 0) || (groupsize >= cur_group - first) || (groupsize == CHAR_MAX)) {
+ break;
+ }
+
+ // Insert a separator character just before position cur_group - groupsize
+ cur_group -= groupsize;
+ ++last;
+ copy_backward(cur_group, last, last + 1);
+ *cur_group = separator;
+ }
+
+ return (last - first) + sign + basechars;
+}
+
+//Dynamic output buffer version.
+template <class Char, class Str>
+static void
+__insert_grouping_aux( /* __basic_iostring<Char> */ Str& iostr, size_t __group_pos,
+ const string& grouping,
+ Char separator, Char Plus, Char Minus,
+ int basechars) {
+ typedef string::size_type str_size;
+
+ if (iostr.size() < __group_pos)
+ return;
+
+ int __first_pos = 0;
+ Char __first = *iostr.begin();
+
+ if (__first == Plus || __first == Minus) {
+ ++__first_pos;
+ }
+
+ __first_pos += basechars;
+
+ typename Str::iterator cur_group(iostr.begin() + __group_pos); // Points immediately beyond the rightmost
+ // digit of the current group.
+ int groupsize = 0; // Size of the current group (if grouping.size() == 0, size
+ // of group unlimited: we force condition (groupsize <= 0))
+
+ for ( str_size n = 0; ; ) { // Index of the current group
+ if ( n < grouping.size() ) {
+ groupsize = __STATIC_CAST( int, grouping[n++] );
+ }
+
+ if ( (groupsize <= 0) || (groupsize >= ((cur_group - iostr.begin()) - __first_pos)) ||
+ (groupsize == CHAR_MAX)) {
+ break;
+ }
+
+ // Insert a separator character just before position cur_group - groupsize
+ cur_group -= groupsize;
+ cur_group = iostr.insert(cur_group, separator);
+ }
+}
+
+//----------------------------------------------------------------------
+// num_put
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo()
+{ return "0123456789abcdefx"; }
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi()
+{ return "0123456789ABCDEFX"; }
+
+char* _STLP_CALL
+__write_integer(char* buf, ios_base::fmtflags flags, long x) {
+ char tmp[64];
+ char* bufend = tmp+64;
+ char* beg = __write_integer_backward(bufend, flags, x);
+ return copy(beg, bufend, buf);
+}
+
+///-------------------------------------
+
+ptrdiff_t _STLP_CALL
+__insert_grouping(char * first, char * last, const string& grouping,
+ char separator, char Plus, char Minus, int basechars) {
+ return __insert_grouping_aux(first, last, grouping,
+ separator, Plus, Minus, basechars);
+}
+
+void _STLP_CALL
+__insert_grouping(__iostring &str, size_t group_pos, const string& grouping,
+ char separator, char Plus, char Minus, int basechars) {
+ __insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars);
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+ptrdiff_t _STLP_CALL
+__insert_grouping(wchar_t* first, wchar_t* last, const string& grouping,
+ wchar_t separator, wchar_t Plus, wchar_t Minus,
+ int basechars) {
+ return __insert_grouping_aux(first, last, grouping, separator,
+ Plus, Minus, basechars);
+}
+
+void _STLP_CALL
+__insert_grouping(__iowstring &str, size_t group_pos, const string& grouping,
+ wchar_t separator, wchar_t Plus, wchar_t Minus,
+ int basechars) {
+ __insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// Force instantiation of num_put<>
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+template class _STLP_CLASS_DECLSPEC ostreambuf_iterator<char, char_traits<char> >;
+// template class num_put<char, char*>;
+template class num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# ifndef _STLP_NO_WCHAR_T
+template class ostreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+template class num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// template class num_put<wchar_t, wchar_t*>;
+# endif /* INSTANTIATE_WIDE_STREAMS */
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/num_put_float.cpp b/build/stlport/src/num_put_float.cpp
new file mode 100644
index 000000000..e66ae93c0
--- /dev/null
+++ b/build/stlport/src/num_put_float.cpp
@@ -0,0 +1,919 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <cmath>
+#include <ios>
+#include <locale>
+
+#if defined (__DECCXX)
+# define NDIG 400
+#else
+# define NDIG 82
+#endif
+
+#define todigit(x) ((x)+'0')
+
+#if defined (_STLP_UNIX)
+
+# if defined (__sun)
+# include <floatingpoint.h>
+# endif
+
+# if defined (__sun) || defined (__digital__) || defined (__sgi) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
+// DEC, SGI & Solaris need this
+# include <values.h>
+# include <nan.h>
+# endif
+
+# if defined (__QNXNTO__) || ( defined(__GNUC__) && defined(__APPLE__) ) || defined(_STLP_USE_UCLIBC) /* 0.9.26 */ || \
+ defined(__FreeBSD__)
+# define USE_SPRINTF_INSTEAD
+# endif
+
+# if defined (_AIX) // JFA 3-Aug-2000
+# include <math.h>
+# include <float.h>
+# endif
+
+# include <math.h>
+#endif
+
+#include <cstdio>
+#include <cstdlib>
+
+#if defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || \
+ defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
+# include <float.h>
+#endif
+
+#if defined (__MRC__) || defined (__SC__) || defined (_CRAY) //*TY 02/24/2000 - added support for MPW
+# include <fp.h>
+#endif
+
+#if defined (__CYGWIN__)
+# include <ieeefp.h>
+#endif
+
+#if defined (__MSL__)
+# include <cstdlib> // for atoi
+# include <cstdio> // for snprintf
+# include <algorithm>
+# include <cassert>
+#endif
+
+#if defined (__ISCPP__)
+# include <cfloat>
+#endif
+
+#include <algorithm>
+
+#if defined (__DMC__)
+# define snprintf _snprintf
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (__MWERKS__) || defined(__BEOS__)
+# define USE_SPRINTF_INSTEAD
+#endif
+
+template <int N>
+struct _Dig
+{
+ enum { dig = _Dig<N/10>::dig + 1 };
+};
+
+_STLP_TEMPLATE_NULL
+struct _Dig<0>
+{
+ enum { dig = 0 };
+};
+
+#ifdef _STLP_NO_LONG_DOUBLE
+# define MAXEDIGITS int(_Dig<DBL_MAX_10_EXP>::dig)
+# define MAXFSIG DBL_DIG
+# define MAXFCVT (DBL_DIG + 1)
+#else
+# define MAXEDIGITS int(_Dig<LDBL_MAX_10_EXP>::dig)
+# define MAXFSIG LDBL_DIG
+# define MAXFCVT (LDBL_DIG + 1)
+#endif
+
+// Tests for infinity and NaN differ on different OSs. We encapsulate
+// these differences here.
+#if !defined (USE_SPRINTF_INSTEAD)
+# if defined (__hpux) && defined (__GNUC__)
+# define _STLP_USE_SIGN_HELPER
+# elif defined (__DJGPP) || (defined (_STLP_USE_GLIBC) && ! defined (__MSL__)) || \
+ defined (__CYGWIN__) || \
+ defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \
+ defined (__HP_aCC)
+static inline bool _Stl_is_nan_or_inf(double x)
+# if defined (isfinite)
+{ return !isfinite(x); }
+# else
+{ return !finite(x); }
+# endif
+static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
+static inline bool _Stl_is_inf(double x) { return isinf(x); }
+// inline bool _Stl_is_neg_inf(double x) { return isinf(x) < 0; }
+static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && x < 0; }
+# elif (defined (__unix) || defined (__unix__)) && \
+ !defined (__APPLE__) && !defined (__DJGPP) && !defined(__osf__) && \
+ !defined (_CRAY) && !defined (__ANDROID__)
+static inline bool _Stl_is_nan_or_inf(double x) { return IsNANorINF(x); }
+static inline bool _Stl_is_inf(double x) { return IsNANorINF(x) && IsINF(x); }
+static inline bool _Stl_is_neg_inf(double x) { return (IsINF(x)) && (x < 0.0); }
+static inline bool _Stl_is_neg_nan(double x) { return IsNegNAN(x); }
+# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
+static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); }
+# if !defined (__BORLANDC__)
+static inline bool _Stl_is_inf(double x) {
+ int fclass = _fpclass(x);
+ return fclass == _FPCLASS_NINF || fclass == _FPCLASS_PINF;
+}
+static inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; }
+# else
+static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && !_isnan(x);}
+static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
+# endif
+static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; }
+# if defined (__BORLANDC__)
+static inline bool _Stl_is_nan_or_inf(long double x) { return !_finitel(x); }
+static inline bool _Stl_is_inf(long double x) { return _Stl_is_nan_or_inf(x) && !_isnanl(x);}
+static inline bool _Stl_is_neg_inf(long double x) { return _Stl_is_inf(x) && x < 0 ; }
+static inline bool _Stl_is_neg_nan(long double x) { return _isnanl(x) && _copysignl(1.l, x) < 0 ; }
+# elif !defined (_STLP_NO_LONG_DOUBLE)
+// Simply there to avoid warning long double -> double implicit conversion:
+static inline bool _Stl_is_nan_or_inf(long double x) { return _Stl_is_nan_or_inf(__STATIC_CAST(double, x)); }
+static inline bool _Stl_is_inf(long double x) { return _Stl_is_inf(__STATIC_CAST(double, x));}
+static inline bool _Stl_is_neg_inf(long double x) { return _Stl_is_neg_inf(__STATIC_CAST(double, x)); }
+static inline bool _Stl_is_neg_nan(long double x) { return _Stl_is_neg_nan(__STATIC_CAST(double, x)); }
+# endif
+# elif defined (__MRC__) || defined (__SC__) || defined (__DMC__)
+static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); }
+static bool _Stl_is_inf(double x) { return !isfinite(x); }
+static bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); }
+static bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
+# elif /* defined(__FreeBSD__) || defined(__OpenBSD__) || */ (defined(__GNUC__) && defined(__APPLE__))
+static inline bool _Stl_is_nan_or_inf(double x) { return !finite(x); }
+static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! isnan(x); }
+static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
+static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && copysign(1., x) < 0 ; }
+# elif defined( _AIX ) // JFA 11-Aug-2000
+static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !finite(x); }
+static bool _Stl_is_inf(double x) { return !finite(x); }
+// bool _Stl_is_neg_inf(double x) { return _class(x) == FP_MINUS_INF; }
+static bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && ( copysign(1., x) < 0 ); }
+static bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
+# elif defined (__ISCPP__)
+static inline bool _Stl_is_nan_or_inf (double x) { return _fp_isINF(x) || _fp_isNAN(x); }
+static inline bool _Stl_is_inf (double x) { return _fp_isINF(x); }
+static inline bool _Stl_is_neg_inf (double x) { return _fp_isINF(x) && x < 0; }
+static inline bool _Stl_is_neg_nan (double x) { return _fp_isNAN(x) && x < 0; }
+# elif defined (_CRAY)
+# if defined (_CRAYIEEE)
+static inline bool _Stl_is_nan_or_inf(double x) { return isnan(x) || isinf(x); }
+static inline bool _Stl_is_inf(double x) { return isinf(x); }
+static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && signbit(x); }
+static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
+# else
+static inline bool _Stl_is_nan_or_inf(double x) { return false; }
+static inline bool _Stl_is_inf(double x) { return false; }
+static inline bool _Stl_is_neg_inf(double x) { return false; }
+static inline bool _Stl_is_neg_nan(double x) { return false; }
+# endif
+# else // nothing from above
+# define USE_SPRINTF_INSTEAD
+# endif
+#endif // !USE_SPRINTF_INSTEAD
+
+#if !defined (USE_SPRINTF_INSTEAD)
+// Reentrant versions of floating-point conversion functions. The argument
+// lists look slightly different on different operating systems, so we're
+// encapsulating the differences here.
+
+# if defined (__CYGWIN__) || defined(__DJGPP)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return ecvtbuf(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return fcvtbuf(x, n, pt, sign, buf); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if defined (__CYGWIN__)
+# define _STLP_EMULATE_LONG_DOUBLE_CVT
+# else
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return ecvtbuf(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return fcvtbuf(x, n, pt, sign, buf); }
+# endif
+# endif
+# elif defined (_STLP_USE_GLIBC)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return ecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return fcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+# ifndef _STLP_NO_LONG_DOUBLE
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return qecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return qfcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+# endif
+# define _STLP_NEED_CVT_BUFFER_SIZE
+# elif defined (__sun)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return econvert(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return fconvert(x, n, pt, sign, buf); }
+# ifndef _STLP_NO_LONG_DOUBLE
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qeconvert(&x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qfconvert(&x, n, pt, sign, buf); }
+# endif
+# elif defined (__DECCXX)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (ecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (fcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0); }
+# ifndef _STLP_NO_LONG_DOUBLE
+// fbp : no "long double" conversions !
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (ecvt_r((double)x, n, pt, sign, buf, bsize) == 0 ? buf : 0) ; }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (fcvt_r((double)x, n, pt, sign, buf, bsize) == 0 ? buf : 0); }
+# endif
+# define _STLP_NEED_CVT_BUFFER_SIZE
+# elif defined (__hpux)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign)
+{ return ecvt(x, n, pt, sign); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign)
+{ return fcvt(x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign)
+{ return _ldecvt(*(long_double*)&x, n, pt, sign); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign)
+{ return _ldfcvt(*(long_double*)&x, n, pt, sign); }
+# endif
+# define _STLP_CVT_NEED_SYNCHRONIZATION
+# elif defined (__unix) && !defined (__APPLE__) && !defined (_CRAY) && \
+ !defined (__ANDROID__)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return ecvt_r(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return fcvt_r(x, n, pt, sign, buf); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qecvt_r(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qfcvt_r(x, n, pt, sign, buf); }
+# endif
+# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_APPEND(a, b) a##b
+# define _STLP_BUF_PARAMS , char* buf, size_t bsize
+# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) _STLP_APPEND(F, _s)(buf, bsize, X, N, PT, SIGN); return buf
+# else
+# define _STLP_BUF_PARAMS
+# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) return F(X, N, PT, SIGN)
+# define _STLP_CVT_NEED_SYNCHRONIZATION
+# endif
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ _STLP_SECURE_FUN(_ecvt, x, n, pt, sign); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ _STLP_SECURE_FUN(_fcvt, x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_PARAMS , buf, bsize
+# else
+# define _STLP_PARAMS
+# endif
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ return _Stl_ecvtR(__STATIC_CAST(double, x), n, pt, sign _STLP_PARAMS); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ return _Stl_fcvtR(__STATIC_CAST(double, x), n, pt, sign _STLP_PARAMS); }
+# undef _STLP_PARAMS
+# endif
+# undef _STLP_SECURE_FUN
+# undef _STLP_BUF_PARAMS
+# undef _STLP_APPEND
+# if defined (__BORLANDC__) /* || defined (__GNUC__) MinGW do not support 'L' modifier so emulation do not work */
+# define _STLP_EMULATE_LONG_DOUBLE_CVT
+# endif
+# elif defined (__ISCPP__)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_ecvt( x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_fcvt(x, n, pt, sign, buf); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_ecvt( x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_fcvt(x, n, pt, sign, buf); }
+# endif
+# elif defined (_AIX) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \
+ defined (__MRC__) || defined (__SC__) || defined (_CRAY) || \
+ defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) || \
+ defined (__DMC__)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign)
+{ return ecvt(x, n, pt, sign ); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign)
+{ return fcvt(x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign)
+{ return ecvt(x, n, pt, sign ); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign)
+{ return fcvt(x, n, pt, sign); }
+# endif
+# define _STLP_CVT_NEED_SYNCHRONIZATION
+# else
+# error Missing _Stl_ecvtR and _Stl_fcvtR implementations.
+# endif
+
+#if defined (_STLP_CVT_NEED_SYNCHRONIZATION)
+/* STLport synchronize access to *cvt functions but those methods might
+ * be called from outside, in this case we will still have a race condition. */
+# if defined (_STLP_THREADS)
+static _STLP_STATIC_MUTEX& put_float_mutex() {
+ static _STLP_STATIC_MUTEX __put_float_mutex _STLP_MUTEX_INITIALIZER;
+ return __put_float_mutex;
+}
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_ecvtR(x, n, pt, sign)); return buf;
+}
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_fcvtR(x, n, pt, sign)); return buf;
+}
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_ecvtR(x, n, pt, sign)); return buf;
+}
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_fcvtR(x, n, pt, sign)); return buf;
+}
+# endif
+# else
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char*)
+{ return _Stl_ecvtR(x, n, pt, sign); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char*)
+{ return _Stl_fcvtR(x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char*)
+{ return _Stl_ecvtR(x, n, pt, sign); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char*)
+{ return _Stl_fcvtR(x, n, pt, sign); }
+# endif
+# endif
+#endif
+
+# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) && !defined (_STLP_NEED_CVT_BUFFER_SIZE)
+# define _STLP_CVT_BUFFER(B) B
+# else
+# define _STLP_CVT_BUFFER(B) _STLP_ARRAY_AND_SIZE(B)
+# endif
+
+# if defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+static void __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier);
+
+// Emulation of ecvt/fcvt functions using sprintf:
+static char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ // If long double value can be safely converted to double without losing precision
+ // we use the ecvt function for double:
+ double y = __STATIC_CAST(double, x);
+ if (x == y)
+ return _Stl_ecvtR(y, n, pt, sign, buf);
+
+ char fmtbuf[32];
+ __fill_fmtbuf(fmtbuf, 0, 'L');
+ sprintf(buf, fmtbuf, n, x < 0.0l ? -x : x);
+ /* We are waiting for something having the form x.xxxe+yyyy */
+ *pt = 0;
+ *sign = 0;
+ int i = -1;
+ int offset = 0;
+ while (buf[++i] != 0 && n != 0) {
+ if (buf[i] >= '0' && buf[i] <= '9') {
+ --n;
+ if (offset != 0)
+ buf[i - offset] = buf[i];
+ }
+ else {
+ if (offset != 0) break;
+ ++offset;
+ *pt = i;
+ }
+ }
+ if (offset != 0)
+ buf[i - offset] = 0;
+ // Extract exponent part in point position:
+ int e = 0;
+ while (buf[++i] != 0) {
+ if (buf[i] >= '0' && buf[i] <= '9') {
+ e = e * 10 + (buf[i] - '0');
+ }
+ }
+ *pt += e;
+ return buf;
+}
+
+static char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ // If long double value can be safely converted to double without losing precision
+ // we use the fcvt function for double:
+ double y = __STATIC_CAST(double, x);
+ if (x == y)
+ return _Stl_fcvtR(y, n, pt, sign, buf);
+
+ char fmtbuf[32];
+ __fill_fmtbuf(fmtbuf, ios_base::fixed, 'L');
+ sprintf(buf, fmtbuf, n, x < 0.0l ? -x : x);
+ *pt = 0;
+ *sign = 0;
+ int i = -1;
+ int offset = 0;
+ while (buf[++i] != 0 && (offset == 0 || n != 0)) {
+ if (buf[i] >= '0' && buf[i] <= '9') {
+ if (offset != 0) {
+ --n;
+ buf[i - offset] = buf[i];
+ }
+ }
+ else {
+ ++offset;
+ *pt = i;
+ }
+ }
+ if (offset != 0)
+ buf[i - offset] = 0;
+ else
+ *pt = i;
+ return buf;
+}
+#endif
+
+//----------------------------------------------------------------------
+// num_put
+
+// __format_float formats a mantissa and exponent as returned by
+// one of the conversion functions (ecvt_r, fcvt_r, qecvt_r, qfcvt_r)
+// according to the specified precision and format flags. This is
+// based on doprnt but is much simpler since it is concerned only
+// with floating point input and does not consider all formats. It
+// also does not deal with blank padding, which is handled by
+// __copy_float_and_fill.
+
+static size_t __format_float_scientific( __iostring& buf, const char *bp,
+ int decpt, int sign, bool is_zero,
+ ios_base::fmtflags flags,
+ int precision) {
+ // sign if required
+ if (sign)
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+
+ // first digit of mantissa
+ buf += *bp++;
+
+ // start of grouping position, grouping won't occur in scientific notation
+ // as it is impossible to have something like 1234.0e04 but we return a correct
+ // group position for coherency with __format_float_fixed.
+ size_t __group_pos = buf.size();
+
+ // decimal point if required
+ if (precision != 0 || flags & ios_base::showpoint) {
+ buf += '.';
+ }
+
+ // rest of mantissa
+ while (*bp != 0 && precision--)
+ buf += *bp++;
+
+ // trailing 0 if needed
+ if (precision > 0)
+ buf.append(precision, '0');
+
+ // exponent size = number of digits + exponent sign + exponent symbol + trailing zero
+ char expbuf[MAXEDIGITS + 3];
+ //We start filling at the buffer end
+ char *suffix = expbuf + MAXEDIGITS + 2;
+ *suffix = 0;
+ if (!is_zero) {
+ int nn = decpt - 1;
+ if (nn < 0)
+ nn = -nn;
+ for (; nn > 9; nn /= 10)
+ *--suffix = (char) todigit(nn % 10);
+ *--suffix = (char) todigit(nn);
+ }
+
+ // prepend leading zeros to exponent
+ // C89 Standard says that it should be at least 2 digits, C99 Standard says that
+ // we stop prepend zeros if more than 3 digits. To repect both STLport prepend zeros
+ // until it is 2 digits.
+ while (suffix > &expbuf[MAXEDIGITS])
+ *--suffix = '0';
+
+ // put in the exponent sign
+ *--suffix = (char) ((decpt > 0 || is_zero ) ? '+' : '-');
+
+ // put in the e
+ *--suffix = flags & ios_base::uppercase ? 'E' : 'e';
+
+ // copy the suffix
+ buf += suffix;
+ return __group_pos;
+}
+
+static size_t __format_float_fixed( __iostring &buf, const char *bp,
+ int decpt, int sign,
+ ios_base::fmtflags flags,
+ int precision) {
+ if ( sign && (decpt > -precision) && (*bp != 0) )
+ buf += '-';
+ else if ( flags & ios_base::showpos )
+ buf += '+';
+
+ // digits before decimal point
+ int nnn = decpt;
+ do {
+ buf += (nnn <= 0 || *bp == 0) ? '0' : *bp++;
+ } while ( --nnn > 0 );
+
+ // start of grouping position
+ size_t __group_pos = buf.size();
+
+ // decimal point if needed
+ if ( flags & ios_base::showpoint || precision > 0 ) {
+ buf += '.';
+ }
+
+ // digits after decimal point if any
+ while ( *bp != 0 && --precision >= 0 ) {
+ buf += (++decpt <= 0) ? '0' : *bp++;
+ }
+
+ // trailing zeros if needed
+ if (precision > 0)
+ buf.append(precision, '0');
+
+ return __group_pos;
+}
+
+#if defined (_STLP_USE_SIGN_HELPER)
+template<class _FloatT>
+struct float_sign_helper {
+ float_sign_helper(_FloatT __x)
+ { _M_number._num = __x; }
+
+ bool is_negative() const {
+ const unsigned short sign_mask(1 << (sizeof(unsigned short) * CHAR_BIT - 1));
+ return (get_sign_word() & sign_mask) != 0;
+ }
+private:
+ union {
+ unsigned short _Words[8];
+ _FloatT _num;
+ } _M_number;
+
+ unsigned short get_word_higher() const _STLP_NOTHROW
+ { return _M_number._Words[0]; }
+ unsigned short get_word_lower() const _STLP_NOTHROW
+ { return _M_number._Words[(sizeof(_FloatT) >= 12 ? 10 : sizeof(_FloatT)) / sizeof(unsigned short) - 1]; }
+ unsigned short get_sign_word() const _STLP_NOTHROW
+# if defined (_STLP_BIG_ENDIAN)
+ { return get_word_higher(); }
+# else /* _STLP_LITTLE_ENDIAN */
+ { return get_word_lower(); }
+# endif
+};
+#endif
+
+template <class _FloatT>
+static size_t __format_nan_or_inf(__iostring& buf, _FloatT x, ios_base::fmtflags flags) {
+ static const char* inf[2] = { "inf", "Inf" };
+ static const char* nan[2] = { "nan", "NaN" };
+ const char** inf_or_nan;
+#if !defined (_STLP_USE_SIGN_HELPER)
+ if (_Stl_is_inf(x)) { // Infinity
+ inf_or_nan = inf;
+ if (_Stl_is_neg_inf(x))
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+ } else { // NaN
+ inf_or_nan = nan;
+ if (_Stl_is_neg_nan(x))
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+ }
+#else
+ typedef numeric_limits<_FloatT> limits;
+ if (x == limits::infinity() || x == -limits::infinity()) {
+ inf_or_nan = inf;
+ } else { // NaN
+ inf_or_nan = nan;
+ }
+ float_sign_helper<_FloatT> helper(x);
+ if (helper.is_negative())
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+#endif
+ size_t ret = buf.size();
+ buf += inf_or_nan[flags & ios_base::uppercase ? 1 : 0];
+ return ret;
+}
+
+static inline size_t __format_float(__iostring &buf, const char * bp,
+ int decpt, int sign, bool is_zero,
+ ios_base::fmtflags flags,
+ int precision) {
+ size_t __group_pos = 0;
+ switch (flags & ios_base::floatfield) {
+ case ios_base::scientific:
+ __group_pos = __format_float_scientific( buf, bp, decpt, sign, is_zero,
+ flags, precision);
+ break;
+ case ios_base::fixed:
+ __group_pos = __format_float_fixed( buf, bp, decpt, sign,
+ flags, precision);
+ break;
+ default: // g format
+ // establish default precision
+ if (flags & ios_base::showpoint || precision > 0) {
+ if (precision == 0) precision = 1;
+ } else
+ precision = 6;
+
+ // reset exponent if value is zero
+ if (is_zero)
+ decpt = 1;
+
+ int kk = precision;
+ if (!(flags & ios_base::showpoint)) {
+ size_t n = strlen(bp);
+ if (n < (size_t)kk)
+ kk = (int)n;
+ while (kk >= 1 && bp[kk-1] == '0')
+ --kk;
+ }
+
+ if (decpt < -3 || decpt > precision) {
+ precision = kk - 1;
+ __group_pos = __format_float_scientific( buf, bp, decpt, sign, is_zero,
+ flags, precision);
+ } else {
+ precision = kk - decpt;
+ __group_pos = __format_float_fixed( buf, bp, decpt, sign,
+ flags, precision);
+ }
+ break;
+ } /* switch */
+ return __group_pos;
+}
+
+#endif
+
+#if defined (USE_SPRINTF_INSTEAD) || defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+struct GroupPos {
+ bool operator () (char __c) const {
+ return __c == '.' ||
+ __c == 'e' || __c == 'E';
+ }
+};
+
+// Creates a format string for sprintf()
+static void __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier) {
+ fmtbuf[0] = '%';
+ int i = 1;
+
+ if (flags & ios_base::showpos)
+ fmtbuf[i++] = '+';
+
+ if (flags & ios_base::showpoint)
+ fmtbuf[i++] = '#';
+
+ fmtbuf[i++] = '.';
+ fmtbuf[i++] = '*';
+
+ if (long_modifier)
+ fmtbuf[i++] = long_modifier;
+
+ switch (flags & ios_base::floatfield)
+ {
+ case ios_base::scientific:
+ fmtbuf[i++] = (flags & ios_base::uppercase) ? 'E' : 'e';
+ break;
+ case ios_base::fixed:
+# if defined (__FreeBSD__)
+ fmtbuf[i++] = 'f';
+# else
+ fmtbuf[i++] = (flags & ios_base::uppercase) ? 'F' : 'f';
+# endif
+ break;
+ default:
+ fmtbuf[i++] = (flags & ios_base::uppercase) ? 'G' : 'g';
+ break;
+ }
+
+ fmtbuf[i] = 0;
+}
+
+#endif /* USE_SPRINTF_INSTEAD */
+
+template <class _FloatT>
+static size_t __write_floatT(__iostring &buf, ios_base::fmtflags flags, int precision,
+ _FloatT x
+#if defined (USE_SPRINTF_INSTEAD)
+ , char modifier) {
+ /* In theory, if we want 'arbitrary' precision, we should use 'arbitrary'
+ * buffer size below, but really we limited by exponent part in double.
+ * - ptr
+ */
+ typedef numeric_limits<_FloatT> limits;
+ char static_buf[limits::max_exponent10 + 6]; // 6: -xxx.yyyE-zzz (sign, dot, E, exp sign, \0)
+ char fmtbuf[32];
+ __fill_fmtbuf(fmtbuf, flags, modifier);
+ snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x);
+ buf = static_buf;
+ return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin();
+#else
+ ) {
+ typedef numeric_limits<_FloatT> limits;
+ //If numeric_limits support is correct we use the exposed values to detect NaN and infinity:
+ if (limits::has_infinity && limits::has_quiet_NaN) {
+ if (!(x == x) || // NaN check
+ (x == limits::infinity() || x == -limits::infinity())) {
+ return __format_nan_or_inf(buf, x, flags);
+ }
+ }
+ // numeric_limits support is not good enough, we rely on platform dependent function
+ // _Stl_is_nan_or_inf that do not support long double.
+ else if (_Stl_is_nan_or_inf(x)) {
+ return __format_nan_or_inf(buf, x, flags);
+ }
+# if defined (__MINGW32__)
+ //For the moment MinGW is limited to display at most numeric_limits<double>::max()
+ if (x > numeric_limits<double>::max() ||
+ x < -numeric_limits<double>::max()) {
+ return __format_nan_or_inf(buf, x, flags);
+ }
+# endif
+
+ /* Buffer size is max number of digits which is the addition of:
+ * - max_exponent10: max number of digits in fixed mode
+ * - digits10 + 2: max number of significant digits
+ * - trailing '\0'
+ */
+ char cvtbuf[limits::max_exponent10 + limits::digits10 + 2 + 1];
+ char *bp;
+ int decpt, sign;
+
+ switch (flags & ios_base::floatfield) {
+ case ios_base::fixed:
+ {
+ /* Here, number of digits represents digits _after_ decimal point.
+ * In order to limit static buffer size we have to give 2 different values depending on x value.
+ * For small values (abs(x) < 1) we need as many digits as requested by precision limited by the maximum number of digits
+ * which is min_exponent10 + digits10 + 2
+ * For bigger values we won't have more than limits::digits10 + 2 digits after decimal point. */
+ int digits10 = (x > -1.0 && x < 1.0 ? -limits::min_exponent10 + limits::digits10 + 2
+ : limits::digits10 + 2);
+ bp = _Stl_fcvtR(x, (min) (precision, digits10), &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf) );
+ }
+ break;
+ case ios_base::scientific:
+ default:
+ /* Here, number of digits is total number of digits which is limited to digits10 + 2. */
+ {
+ int digits10 = limits::digits10 + 2;
+ bp = _Stl_ecvtR(x, (min) (precision, digits10), &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf) );
+ }
+ break;
+ }
+ return __format_float(buf, bp, decpt, sign, x == 0.0, flags, precision);
+#endif
+}
+
+size_t _STLP_CALL
+__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
+ double x) {
+ return __write_floatT(buf, flags, precision, x
+#if defined (USE_SPRINTF_INSTEAD)
+ , 0
+#endif
+ );
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+size_t _STLP_CALL
+__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
+ long double x) {
+ return __write_floatT(buf, flags, precision, x
+#if defined (USE_SPRINTF_INSTEAD)
+ , 'L'
+#endif
+ );
+}
+#endif
+
+void _STLP_CALL __get_floor_digits(__iostring &out, _STLP_LONGEST_FLOAT_TYPE __x) {
+ typedef numeric_limits<_STLP_LONGEST_FLOAT_TYPE> limits;
+#if defined (USE_SPRINTF_INSTEAD)
+ char cvtbuf[limits::max_exponent10 + 6];
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%Lf", __x); // check for 1234.56!
+# else
+ snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%f", __x); // check for 1234.56!
+# endif
+ char *p = strchr( cvtbuf, '.' );
+ if ( p == 0 ) {
+ out.append( cvtbuf );
+ } else {
+ out.append( cvtbuf, p );
+ }
+#else
+ char cvtbuf[limits::max_exponent10 + 1];
+ char * bp;
+ int decpt, sign;
+ bp = _Stl_fcvtR(__x, 0, &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf));
+
+ if (sign) {
+ out += '-';
+ }
+ out.append(bp, bp + decpt);
+#endif
+}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+void _STLP_CALL __convert_float_buffer( __iostring const& str, __iowstring &out,
+ const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot) {
+ string::const_iterator str_ite(str.begin()), str_end(str.end());
+
+ //First loop, check the dot char
+ if (__check_dot) {
+ while (str_ite != str_end) {
+ if (*str_ite != '.') {
+ out += ct.widen(*str_ite++);
+ } else {
+ out += dot;
+ break;
+ }
+ }
+ } else {
+ if (str_ite != str_end) {
+ out += ct.widen(*str_ite);
+ }
+ }
+
+ if (str_ite != str_end) {
+ //Second loop, dot has been found, no check anymore
+ while (++str_ite != str_end) {
+ out += ct.widen(*str_ite);
+ }
+ }
+}
+
+#endif
+
+void _STLP_CALL
+__adjust_float_buffer(__iostring &str, char dot) {
+ if ('.' != dot) {
+ size_t __dot_pos = str.find('.');
+ if (__dot_pos != string::npos) {
+ str[__dot_pos] = dot;
+ }
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/numpunct.cpp b/build/stlport/src/numpunct.cpp
new file mode 100644
index 000000000..cbadc7ab0
--- /dev/null
+++ b/build/stlport/src/numpunct.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// numpunct<char>
+char numpunct<char>::do_decimal_point() const {return '.';}
+char numpunct<char>::do_thousands_sep() const { return ','; }
+string numpunct<char>::do_grouping() const { return string();}
+string numpunct<char>::do_truename() const { return "true";}
+string numpunct<char>::do_falsename() const { return "false"; }
+numpunct<char>::~numpunct() {}
+
+#if !defined (_STLP_NO_WCHAR_T)
+wchar_t numpunct<wchar_t>::do_decimal_point() const { return L'.'; }
+wchar_t numpunct<wchar_t>::do_thousands_sep() const { return L','; }
+string numpunct<wchar_t>::do_grouping() const { return string(); }
+wstring numpunct<wchar_t>::do_truename() const { return L"true"; }
+wstring numpunct<wchar_t>::do_falsename() const { return L"false"; }
+numpunct<wchar_t>::~numpunct() {}
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/ostream.cpp b/build/stlport/src/ostream.cpp
new file mode 100644
index 000000000..96d473740
--- /dev/null
+++ b/build/stlport/src/ostream.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <ostream>
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+
+// instantiations
+template class _STLP_CLASS_DECLSPEC basic_ostream<char, char_traits<char> >;
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Osentry<char, char_traits<char> >;
+# endif
+
+#ifndef _STLP_NO_WCHAR_T
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Osentry<wchar_t, char_traits<wchar_t> >;
+# endif
+template class _STLP_CLASS_DECLSPEC basic_ostream<wchar_t, char_traits<wchar_t> >;
+#endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/sparc_atomic.s b/build/stlport/src/sparc_atomic.s
new file mode 100644
index 000000000..67e41d628
--- /dev/null
+++ b/build/stlport/src/sparc_atomic.s
@@ -0,0 +1,68 @@
+ .section ".text",#alloc,#execinstr
+ .align 8
+ .skip 16
+
+
+ /*
+ ** int _STLP_atomic_exchange (void *pvalue, int value)
+ */
+
+ .type _STLP_atomic_exchange,#function
+ .global _STLP_atomic_exchange
+ .align 8
+
+_STLP_atomic_exchange:
+0:
+ ld [%o0], %o2 ! Set the current value
+ mov %o1, %o3 ! Set the new value
+! swap [%o0], %o3 ! Do the compare and swap
+ cas [%o0], %o2, %o3
+ cmp %o2, %o3 ! Check whether successful
+ bne 0b ! Retry upon failure
+ stbar
+ mov %o2, %o0 ! Set the new value
+ retl ! return
+ nop
+ .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
+
+ /* int _STLP_atomic_increment (void *pvalue) */
+
+ .type _STLP_atomic_increment,#function
+ .global _STLP_atomic_increment
+ .align 8
+_STLP_atomic_increment:
+1:
+ ld [%o0], %o2 ! set the current
+ add %o2, 0x1, %o3 ! Increment and store current
+! swap [%o0], %o3 ! Do the compare and swap
+ cas [%o0], %o2, %o3
+ cmp %o3, %o2 ! Check whether successful
+ bne 1b ! Retry if we failed.
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ nop
+ retl ! return
+ nop
+
+ .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
+
+
+ /* int _STLP_atomic_decrement (void *pvalue) */
+ .type _STLP_atomic_decrement,#function
+ .global _STLP_atomic_decrement
+ .align 8
+
+_STLP_atomic_decrement:
+2:
+ ld [%o0], %o2 ! set the current
+ sub %o2, 0x1, %o3 ! decrement and store current
+! swap [%o0], %o3 ! Do the compare and swap
+ cas [%o0], %o2, %o3
+ cmp %o3, %o2 ! Check whether successful
+ bne 2b ! Retry if we failed.
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ nop
+ ! returning
+ retl ! return
+ nop
+ .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)
diff --git a/build/stlport/src/sparc_atomic64.s b/build/stlport/src/sparc_atomic64.s
new file mode 100644
index 000000000..ff2c42a82
--- /dev/null
+++ b/build/stlport/src/sparc_atomic64.s
@@ -0,0 +1,65 @@
+ .section ".text",#alloc,#execinstr
+ .align 8
+ .skip 16
+
+! int _STLP_atomic_exchange (void *pvalue, int value)
+!
+
+ .type _STLP_atomic_exchange,#function
+ .global _STLP_atomic_exchange
+ .align 8
+
+_STLP_atomic_exchange:
+1:
+ ldx [%o0], %o2 ! Set the current value
+ mov %o1, %o3 ! Set the new value
+ casx [%o0], %o2, %o3 ! Do the compare and swap
+ cmp %o2, %o3 ! Check whether successful
+ bne 1b ! Retry upon failure
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ retl ! return
+ mov %o2, %o0 ! Set the new value
+ .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
+
+
+! int _STLP_atomic_increment (void *pvalue)
+
+ .type _STLP_atomic_increment,#function
+ .global _STLP_atomic_increment
+ .align 8
+_STLP_atomic_increment:
+0:
+ ldx [%o0], %o2 ! set the current
+ addx %o2, 0x1, %o3 ! Increment and store current
+ casx [%o0], %o2, %o3 ! Do the compare and swap
+ cmp %o3, %o2 ! Check whether successful
+ bne 0b
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ retl ! return
+ mov %o1, %o0 ! Set the return value
+
+ .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
+
+
+! /* int _STLP_atomic_decrement (void *pvalue) */
+ .type _STLP_atomic_decrement,#function
+ .global _STLP_atomic_decrement
+ .align 8
+
+_STLP_atomic_decrement:
+0:
+ ldx [%o0], %o2 ! set the current
+ subx %o2, 0x1, %o3 ! decrement and store current
+ casx [%o0], %o2, %o3 ! Do the compare and swap
+ cmp %o3, %o2 ! Check whether successful
+ bne 0b
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ retl ! return
+ nop
+ .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)
+
+
+
diff --git a/build/stlport/src/sstream.cpp b/build/stlport/src/sstream.cpp
new file mode 100644
index 000000000..2d1d65275
--- /dev/null
+++ b/build/stlport/src/sstream.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <sstream>
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+// Force instantiation of stringstream classes.
+template class _STLP_CLASS_DECLSPEC basic_stringbuf<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC basic_ostringstream<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC basic_istringstream<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC basic_stringstream<char, char_traits<char>, allocator<char> >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/stdio_streambuf.cpp b/build/stlport/src/stdio_streambuf.cpp
new file mode 100644
index 000000000..45aad790a
--- /dev/null
+++ b/build/stlport/src/stdio_streambuf.cpp
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+#include "stdio_streambuf.h"
+
+#ifdef _STLP_UNIX
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+
+#include <fstream>
+#include <limits>
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Compare with streamoff definition in stl/char_traits.h!
+
+#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \
+ (!defined(_LARGEFILE_SOURCE) && !defined(_LARGEFILE64_SOURCE))
+# if !defined (_STLP_MSVC) || (_STLP_MSVC < 1400) || defined(_STLP_WCE)
+# define FSEEK fseek
+# else
+# define FSEEK _fseeki64
+# endif
+# define FSETPOS fsetpos
+# define FGETPOS fgetpos
+# define FPOS_T fpos_t
+#else
+# define FSEEK fseeko64
+# define FSETPOS fsetpos64
+# define FGETPOS fgetpos64
+# define FPOS_T fpos64_t
+#endif
+
+//----------------------------------------------------------------------
+// Class stdio_streambuf_base
+
+stdio_streambuf_base::stdio_streambuf_base(FILE* file)
+ : /* _STLP_STD::FILE_basic_streambuf(file, 0), */
+ _M_file(file)
+{}
+
+stdio_streambuf_base::~stdio_streambuf_base() {
+ _STLP_VENDOR_CSTD::fflush(_M_file);
+}
+
+_STLP_STD::streambuf* stdio_streambuf_base::setbuf(char* s, streamsize n) {
+#ifdef _STLP_WCE
+ // no buffering in windows ce .NET
+#else
+ size_t __n_size_t = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()), n))
+ : __STATIC_CAST(size_t, n);
+ _STLP_VENDOR_CSTD::setvbuf(_M_file, s, (s == 0 && n == 0) ? _IONBF : _IOFBF, __n_size_t);
+#endif
+ return this;
+}
+
+stdio_streambuf_base::pos_type
+stdio_streambuf_base::seekoff(off_type off, ios_base::seekdir dir,
+ ios_base::openmode /* mode */) {
+ int whence;
+ switch (dir) {
+ case ios_base::beg:
+ whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ whence = SEEK_END;
+ break;
+ default:
+ return pos_type(-1);
+ }
+
+ if (off <= numeric_limits<off_type>::max() && FSEEK(_M_file, off, whence) == 0) {
+ FPOS_T pos;
+ FGETPOS(_M_file, &pos);
+ // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
+ // of a primitive type
+#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2))))
+ return pos_type((streamoff)pos.__pos);
+#elif defined (__ISCPP__) || defined (__MVS__) || defined (__OS400__)
+ return pos_type(pos.__fpos_elem[ 0 ]);
+#elif defined (__EMX__)
+ return pos_type((streamoff)pos._pos);
+#else
+ return pos_type(pos);
+#endif
+ }
+ else
+ return pos_type(-1);
+}
+
+
+stdio_streambuf_base::pos_type
+stdio_streambuf_base::seekpos(pos_type pos, ios_base::openmode /* mode */) {
+ // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
+ // of a primitive type
+#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
+ FPOS_T p;
+ p.__pos = pos;
+# ifdef _STLP_USE_UCLIBC
+# ifdef __STDIO_MBSTATE
+ memset( &(p.__mbstate), 0, sizeof(p.__mbstate) );
+# endif
+# ifdef __STDIO_WIDE
+ p.mblen_pending = 0;
+# endif
+# else
+ memset( &(p.__state), 0, sizeof(p.__state) );
+# endif
+#elif defined (__MVS__) || defined (__OS400__)
+ FPOS_T p;
+ p.__fpos_elem[0] = pos;
+#elif defined (__EMX__)
+ FPOS_T p;
+ p._pos = pos;
+ memset( &(p._mbstate), 0, sizeof(p._mbstate) );
+#else
+ FPOS_T p(pos);
+#endif
+
+ return FSETPOS(_M_file, &p) == 0 ? pos : pos_type(-1);
+}
+
+int stdio_streambuf_base::sync() {
+ return _STLP_VENDOR_CSTD::fflush(_M_file) == 0 ? 0 : -1;
+}
+
+//----------------------------------------------------------------------
+// Class stdio_istreambuf
+
+stdio_istreambuf::~stdio_istreambuf() {}
+
+streamsize stdio_istreambuf::showmanyc()
+{ return 0; }
+
+stdio_istreambuf::int_type stdio_istreambuf::underflow()
+{
+#ifdef _STLP_WCE
+ int c = fgetc(_M_file);
+#else
+ int c = getc(_M_file);
+#endif
+ if (c != EOF) {
+ _STLP_VENDOR_CSTD::ungetc(c, _M_file);
+ return c;
+ }
+ else
+ return traits_type::eof();
+}
+
+stdio_istreambuf::int_type stdio_istreambuf::uflow() {
+#ifdef _STLP_WCE
+ int c = fgetc(_M_file);
+#else
+ int c = getc(_M_file);
+#endif
+ return c != EOF ? c : traits_type::eof();
+}
+
+stdio_istreambuf::int_type stdio_istreambuf::pbackfail(int_type c) {
+ if (c != traits_type::eof()) {
+ int result = _STLP_VENDOR_CSTD::ungetc(c, _M_file);
+ return result != EOF ? result : traits_type::eof();
+ }
+ else{
+ if (this->eback() < this->gptr()) {
+ this->gbump(-1);
+ return traits_type::not_eof(c);
+ }
+ else
+ return traits_type::eof();
+ }
+}
+
+//----------------------------------------------------------------------
+// Class stdio_ostreambuf
+
+stdio_ostreambuf::~stdio_ostreambuf() {}
+
+streamsize stdio_ostreambuf::showmanyc()
+{ return -1; }
+
+stdio_ostreambuf::int_type stdio_ostreambuf::overflow(int_type c) {
+ // Write the existing buffer, without writing any additional character.
+ if (c == traits_type::eof()) {
+ // Do we have a buffer to write?
+ ptrdiff_t unwritten = this->pptr() - this->pbase();
+ if (unwritten != 0) {
+ _STLP_VENDOR_CSTD::fflush(_M_file);
+ // Test if the write succeeded.
+ if (this->pptr() - this->pbase() < unwritten)
+ return traits_type::not_eof(c);
+ else
+ return traits_type::eof();
+ }
+
+ // We always succeed if we don't have to do anything.
+ else
+ return traits_type::not_eof(c);
+ }
+
+ // Write the character c, and whatever else might be in the buffer.
+ else {
+#ifdef _STLP_WCE
+ int result = fputc(c, _M_file);
+#else
+ int result = putc(c, _M_file);
+#endif
+ return result != EOF ? result : traits_type::eof();
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/src/stdio_streambuf.h b/build/stlport/src/stdio_streambuf.h
new file mode 100644
index 000000000..33747b513
--- /dev/null
+++ b/build/stlport/src/stdio_streambuf.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// This header defines two streambufs:
+// stdio_istreambuf, a read-only streambuf synchronized with a C stdio
+// FILE object
+// stdio_ostreambuf, a write-only streambuf synchronized with a C stdio
+// FILE object.
+// Note that neither stdio_istreambuf nor stdio_ostreambuf is a template;
+// both classes are derived from basic_streambuf<char, char_traits<char> >.
+
+// Note: the imbue() member function is a no-op. In particular, these
+// classes assume that codecvt<char, char, mbstate_t> is always an identity
+// transformation. This is true of the default locale, and of all locales
+// defined for the C I/O library. If you need to use a locale where
+// the codecvt<char, char, mbstate_t> facet performs a nontrivial
+// conversion, then you should use basic_filebuf<> instead of stdio_istreambuf
+// or stdio_ostreambuf. (If you don't understand what any of this means,
+// then it's not a feature you need to worry about. Locales where
+// codecvt<char, char, mbstate_t> does something nontrivial are a rare
+// corner case.)
+
+
+#ifndef _STLP_STDIO_STREAMBUF
+#define _STLP_STDIO_STREAMBUF
+
+#include <streambuf>
+#include <cstdio> // For FILE.
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Base class for features common to stdio_istreambuf and stdio_ostreambuf
+class stdio_streambuf_base :
+ public basic_streambuf<char, char_traits<char> > /* FILE_basic_streambuf */ {
+public: // Constructor, destructor.
+ // The argument may not be null. It must be an open file pointer.
+ stdio_streambuf_base(FILE*);
+
+ // The destructor flushes the stream, but does not close it.
+ ~stdio_streambuf_base();
+
+protected: // Virtual functions from basic_streambuf.
+ streambuf* setbuf(char*, streamsize);
+
+ pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode
+ = ios_base::in | ios_base::out);
+ pos_type seekpos(pos_type,
+ ios_base::openmode
+ = ios_base::in | ios_base::out);
+ int sync();
+
+protected:
+ FILE* _M_file;
+};
+
+class stdio_istreambuf : public stdio_streambuf_base {
+public: // Constructor, destructor.
+ stdio_istreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
+ ~stdio_istreambuf();
+
+protected: // Virtual functions from basic_streambuf.
+ streamsize showmanyc();
+ int_type underflow();
+ int_type uflow();
+ virtual int_type pbackfail(int_type c = traits_type::eof());
+};
+
+class stdio_ostreambuf : public stdio_streambuf_base {
+public: // Constructor, destructor.
+ stdio_ostreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
+ ~stdio_ostreambuf();
+
+protected: // Virtual functions from basic_streambuf.
+ streamsize showmanyc();
+ int_type overflow(int_type c = traits_type::eof());
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STDIO_STREAMBUF */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/stlport.rc b/build/stlport/src/stlport.rc
new file mode 100644
index 000000000..3fdb4a797
--- /dev/null
+++ b/build/stlport/src/stlport.rc
@@ -0,0 +1,96 @@
+///////////////////////////
+//
+// Version
+//
+#include <windows.h>
+
+#include <stl/_stlport_version.h>
+
+/* On some evc3/evc4 targets the windows.h doesn't include winver.h or doesn't
+ * define needed file version flags, so we redefine them here.
+ */
+#ifndef VS_FF_DEBUG
+# define VS_FF_DEBUG 0x00000001L
+#endif
+
+#ifndef VOS__WINDOWS32
+# define VOS__WINDOWS32 0x00000004L
+#endif
+
+#ifndef VFT_DLL
+# define VFT_DLL 0x00000002L
+#endif
+
+#ifndef VFT2_UNKNOWN
+# define VFT2_UNKNOWN 0x00000000L
+#endif
+
+#define STRINGIZE(X) STRINGIZE_AUX(X)
+#define STRINGIZE_AUX(X) #X
+
+#define VERSION_ID _STLPORT_MAJOR, _STLPORT_MINOR, _STLPORT_PATCHLEVEL, 0
+#if !defined (__BORLANDC__)
+# define VERSION_STR STRINGIZE(_STLPORT_MAJOR._STLPORT_MINOR._STLPORT_PATCHLEVEL)
+#else
+/* Borland precompiler happen weird character when trying to transform a
+ * macro containing 0 in a character string so we use a workaround for this
+ * value. We do not check the major version that will never be 0 again.
+ */
+# if (_STLPORT_MINOR == 0)
+# define _STLP_MINOR "0"
+# else
+# define _STLP_MINOR STRINGIZE(_STLPORT_MINOR)
+# endif
+# if (_STLPORT_PATCHLEVEL == 0)
+# define _STLP_PATCH "0"
+# else
+# define _STLP_PATCH STRINGIZE(_STLPORT_PATCHLEVEL)
+# endif
+# define VERSION_STR STRINGIZE(_STLPORT_MAJOR) "." _STLP_MINOR "." _STLP_PATCH "\0"
+#endif
+
+#if defined (__GNUC__)
+# define LIB_MOTIF "libstlport"
+#else
+# define LIB_MOTIF "stlport"
+#endif
+#define DLLNAME LIB_MOTIF "." STRINGIZE(_STLPORT_MAJOR) "." STRINGIZE(_STLPORT_MINOR) ".dll\0"
+#define DLLNAME2(buildstr) LIB_MOTIF "" STRINGIZE(buildstr) "." STRINGIZE(_STLPORT_MAJOR) "." STRINGIZE(_STLPORT_MINOR) ".dll\0"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VERSION_ID
+PRODUCTVERSION VERSION_ID
+FILEFLAGSMASK 0x3fL
+
+FILEFLAGS VS_FF_DEBUG
+
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "STLport Consulting, Inc.\0"
+ VALUE "FileDescription", "STLport\0"
+ VALUE "FileVersion", VERSION_STR
+ VALUE "InternalName", "STLPORT.DLL\0"
+ VALUE "LegalCopyright", "Copyright (C) Boris Fomitchev\0"
+#if !defined (BUILD)
+ VALUE "OriginalFilename", DLLNAME
+#else
+ VALUE "OriginalFilename", DLLNAME2(BUILD)
+#endif
+ VALUE "ProductName", "STLport Standard ANSI C++ Library\0"
+ VALUE "ProductVersion", VERSION_STR
+#if defined (BUILD_INFOS)
+ VALUE "SpecialBuild", STRINGIZE(COMP) " " STRINGIZE(BUILD_INFOS) "\0"
+#endif
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/build/stlport/src/stlport_prefix.h b/build/stlport/src/stlport_prefix.h
new file mode 100644
index 000000000..4e06b7686
--- /dev/null
+++ b/build/stlport/src/stlport_prefix.h
@@ -0,0 +1,43 @@
+#ifndef STLPORT_PREFIX_H
+#define STLPORT_PREFIX_H
+
+#define __BUILDING_STLPORT 1
+
+#if defined (_WIN32) || defined (WIN32)
+# ifdef __cplusplus
+# define WIN32_LEAN_AND_MEAN
+# define NOSERVICE
+# endif
+#endif
+
+#undef _STLP_NO_FORCE_INSTANTIATE
+
+/* Please add extra compilation switches for particular compilers here */
+
+#if defined (_MSC_VER) && !defined (__COMO__) && !defined (__MWERKS__)
+# include "warning_disable.h"
+#endif
+
+#include <stl/config/features.h>
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+#endif
+
+#ifdef __cplusplus
+
+# include <ctime>
+# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+
+# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+# define _STLP_OPERATOR_SPEC _STLP_DECLSPEC
+# else
+# define _STLP_OPERATOR_SPEC _STLP_TEMPLATE_NULL _STLP_DECLSPEC
+# endif
+
+#endif /* __cplusplus */
+
+#endif /* PREFIX */
+
diff --git a/build/stlport/src/string.cpp b/build/stlport/src/string.cpp
new file mode 100644
index 000000000..77e218730
--- /dev/null
+++ b/build/stlport/src/string.cpp
@@ -0,0 +1,93 @@
+#include "stlport_prefix.h"
+
+#include <string>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+wstring __ASCIIToWide(const char *ascii) {
+ size_t size = strlen(ascii);
+ wchar_t* buff = new wchar_t[size+1];
+ mbstowcs(buff, ascii, size);
+ buff[size] = 0x00;
+ wstring ret(buff);
+ delete[] buff;
+ return ret;
+}
+string __WideToASCII(const wchar_t *wide) {
+ size_t size = wcslen(wide);
+ char* buff = new char[size+1];
+ wcstombs(buff, wide, size);
+ buff[size] = 0;
+ string ret(buff);
+ delete[] buff;
+ return ret;
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+template class _STLP_CLASS_DECLSPEC allocator<char>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<char*, char, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC _String_base<char, allocator<char> >;
+
+# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NON_DBG_NAME(str)
+
+template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<char, char_traits<char>, allocator<char> > >;
+
+# undef basic_string
+# endif
+
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+# else
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
+
+# if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+# endif
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC allocator<wchar_t>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _String_base<wchar_t, allocator<wchar_t> >;
+
+# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NON_DBG_NAME(str)
+
+template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
+
+# undef basic_string
+# endif
+
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+# else
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+
+# if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+# endif
+# endif
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/strstream.cpp b/build/stlport/src/strstream.cpp
new file mode 100644
index 000000000..740e01ea7
--- /dev/null
+++ b/build/stlport/src/strstream.cpp
@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// Implementation of the classes in header <strstream>.
+// WARNING: The classes defined in <strstream> are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+#include "stlport_prefix.h"
+
+#include <strstream>
+#include <algorithm>
+#include <limits>
+
+_STLP_BEGIN_NAMESPACE
+
+// strstreambuf constructor, destructor.
+strstreambuf::strstreambuf(streamsize initial_capacity)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(true), _M_frozen(false), _M_constant(false) {
+ size_t n = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()),
+ (max)(initial_capacity, streamsize(16))))
+ : __STATIC_CAST(size_t, (max)(initial_capacity, streamsize(16)));
+
+ char* buf = _M_alloc(n);
+ if (buf) {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+}
+
+strstreambuf::strstreambuf(__alloc_fn alloc_f, __free_fn free_f)
+ : _M_alloc_fun(alloc_f), _M_free_fun(free_f),
+ _M_dynamic(true), _M_frozen(false), _M_constant(false) {
+ size_t n = 16;
+
+ char* buf = _M_alloc(n);
+ if (buf) {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+}
+
+strstreambuf::strstreambuf(char* get, streamsize n, char* put)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false) {
+ _M_setup(get, put, n);
+}
+
+strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false) {
+ _M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n);
+}
+
+strstreambuf::strstreambuf(unsigned char* get, streamsize n,
+ unsigned char* put)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false) {
+ _M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n);
+}
+
+strstreambuf::strstreambuf(const char* get, streamsize n)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true) {
+ _M_setup(__CONST_CAST(char*,get), 0, n);
+}
+
+strstreambuf::strstreambuf(const signed char* get, streamsize n)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true) {
+ _M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(signed char*,get)), 0, n);
+}
+
+strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true) {
+ _M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(unsigned char*,get)), 0, n);
+}
+
+strstreambuf::~strstreambuf() {
+ if (_M_dynamic && !_M_frozen)
+ _M_free(eback());
+}
+
+void strstreambuf::freeze(bool frozenflag) {
+ if (_M_dynamic)
+ _M_frozen = frozenflag;
+}
+
+char* strstreambuf::str() {
+ freeze(true);
+ return eback();
+}
+
+int strstreambuf::pcount() const {
+ return int(pptr() ? pptr() - pbase() : 0);
+}
+
+strstreambuf::int_type strstreambuf::overflow(int_type c) {
+ if (c == traits_type::eof())
+ return traits_type::not_eof(c);
+
+ // Try to expand the buffer.
+ if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) {
+ ptrdiff_t old_size = epptr() - pbase();
+ ptrdiff_t new_size = (max)(2 * old_size, ptrdiff_t(1));
+
+ char* buf = _M_alloc(new_size);
+ if (buf) {
+ memcpy(buf, pbase(), old_size);
+
+ char* old_buffer = pbase();
+ bool reposition_get = false;
+ ptrdiff_t old_get_offset;
+ if (gptr() != 0) {
+ reposition_get = true;
+ old_get_offset = gptr() - eback();
+ }
+
+ setp(buf, buf + new_size);
+ pbump((int)old_size);
+
+ if (reposition_get)
+ setg(buf, buf + old_get_offset, buf + (max)(old_get_offset, old_size));
+
+ _M_free(old_buffer);
+ }
+ }
+
+ if (pptr() != epptr()) {
+ *pptr() = traits_type::to_char_type(c);
+ pbump(1);
+ return c;
+ }
+ else
+ return traits_type::eof();
+}
+
+strstreambuf::int_type strstreambuf::pbackfail(int_type c) {
+ if (gptr() != eback()) {
+ if (c == traits_type::eof()) {
+ gbump(-1);
+ return traits_type::not_eof(c);
+ }
+ else if (c == gptr()[-1]) {
+ gbump(-1);
+ return c;
+ }
+ else if (!_M_constant) {
+ gbump(-1);
+ *gptr() = traits_type::to_char_type(c);
+ return c;
+ }
+ }
+
+ return traits_type::eof();
+}
+
+strstreambuf::int_type strstreambuf::underflow() {
+ if (gptr() == egptr() && pptr() && pptr() > egptr())
+ setg(eback(), gptr(), pptr());
+
+ if (gptr() != egptr())
+ return (unsigned char) *gptr();
+ else
+ return _Traits::eof();
+}
+
+basic_streambuf<char, char_traits<char> >*
+strstreambuf::setbuf(char*, streamsize) {
+ return this;
+}
+
+strstreambuf::pos_type
+strstreambuf::seekoff(off_type off,
+ ios_base::seekdir dir, ios_base::openmode mode) {
+ bool do_get = false;
+ bool do_put = false;
+
+ if ((mode & (ios_base::in | ios_base::out)) ==
+ (ios_base::in | ios_base::out) &&
+ (dir == ios_base::beg || dir == ios_base::end))
+ do_get = do_put = true;
+ else if (mode & ios_base::in)
+ do_get = true;
+ else if (mode & ios_base::out)
+ do_put = true;
+
+ // !gptr() is here because, according to D.7.1 paragraph 4, the seekable
+ // area is undefined if there is no get area.
+ if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
+ return pos_type(off_type(-1));
+
+ char* seeklow = eback();
+ char* seekhigh = epptr() ? epptr() : egptr();
+
+ off_type newoff;
+ switch(dir) {
+ case ios_base::beg:
+ newoff = 0;
+ break;
+ case ios_base::end:
+ newoff = seekhigh - seeklow;
+ break;
+ case ios_base::cur:
+ newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ off += newoff;
+ if (off < 0 || off > seekhigh - seeklow)
+ return pos_type(off_type(-1));
+
+ if (do_put) {
+ if (seeklow + __STATIC_CAST(ptrdiff_t, off) < pbase()) {
+ setp(seeklow, epptr());
+ pbump((int)off);
+ }
+ else {
+ setp(pbase(), epptr());
+ pbump((int)(off - (pbase() - seeklow)));
+ }
+ }
+ if (do_get) {
+ if (off <= egptr() - seeklow)
+ setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), egptr());
+ else if (off <= pptr() - seeklow)
+ setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), pptr());
+ else
+ setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), epptr());
+ }
+
+ return pos_type(newoff);
+}
+
+strstreambuf::pos_type
+strstreambuf::seekpos(pos_type pos, ios_base::openmode mode) {
+ return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode);
+}
+
+
+char* strstreambuf::_M_alloc(size_t n) {
+ if (_M_alloc_fun)
+ return __STATIC_CAST(char*,_M_alloc_fun(n));
+ else
+ return new char[n];
+}
+
+void strstreambuf::_M_free(char* p) {
+ if (p) {
+ if (_M_free_fun)
+ _M_free_fun(p);
+ else
+ delete[] p;
+ }
+}
+
+void strstreambuf::_M_setup(char* get, char* put, streamsize n) {
+ if (get) {
+ size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
+
+ if (put) {
+ setg(get, get, get + N);
+ setp(put, put + N);
+ }
+ else {
+ setg(get, get, get + N);
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+// Class istrstream
+
+istrstream::istrstream(char* s)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, 0) {
+ this->init(&_M_buf);
+}
+
+istrstream::istrstream(const char* s)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, 0) {
+ this->init(&_M_buf);
+}
+
+istrstream::istrstream(char* s, streamsize n)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, n) {
+ this->init(&_M_buf);
+}
+
+istrstream::istrstream(const char* s, streamsize n)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, n) {
+ this->init(&_M_buf);
+}
+
+istrstream::~istrstream() {}
+
+strstreambuf* istrstream::rdbuf() const {
+ return __CONST_CAST(strstreambuf*,&_M_buf);
+}
+
+char* istrstream::str() { return _M_buf.str(); }
+
+//----------------------------------------------------------------------
+// Class ostrstream
+
+ostrstream::ostrstream()
+ : basic_ostream<char, char_traits<char> >(0), _M_buf() {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
+ : basic_ostream<char, char_traits<char> >(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+ostrstream::~ostrstream() {}
+
+strstreambuf* ostrstream::rdbuf() const {
+ return __CONST_CAST(strstreambuf*,&_M_buf);
+}
+
+void ostrstream::freeze(bool freezeflag) {
+ _M_buf.freeze(freezeflag);
+}
+
+char* ostrstream::str() {
+ return _M_buf.str();
+}
+
+int ostrstream::pcount() const {
+ return _M_buf.pcount();
+}
+
+
+//----------------------------------------------------------------------
+// Class strstream
+
+strstream::strstream()
+ : basic_iostream<char, char_traits<char> >(0), _M_buf() {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+strstream::strstream(char* s, int n, ios_base::openmode mode)
+ : basic_iostream<char, char_traits<char> >(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+strstream::~strstream() {}
+
+strstreambuf* strstream::rdbuf() const {
+ return __CONST_CAST(strstreambuf*,&_M_buf);
+}
+
+void strstream::freeze(bool freezeflag) {
+ _M_buf.freeze(freezeflag);
+}
+
+int strstream::pcount() const {
+ return _M_buf.pcount();
+}
+
+char* strstream::str() {
+ return _M_buf.str();
+}
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/src/time_facets.cpp b/build/stlport/src/time_facets.cpp
new file mode 100644
index 000000000..3e98c70d1
--- /dev/null
+++ b/build/stlport/src/time_facets.cpp
@@ -0,0 +1,565 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <cstdio>
+#include <locale>
+#include <istream>
+
+#include "c_locale.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// default "C" values for month and day names
+
+const char default_dayname[][14] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday"};
+
+const char default_monthname[][24] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"};
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t default_wdayname[][14] = {
+ L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat",
+ L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday",
+ L"Friday", L"Saturday"};
+
+const wchar_t default_wmonthname[][24] = {
+ L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
+ L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec",
+ L"January", L"February", L"March", L"April", L"May", L"June",
+ L"July", L"August", L"September", L"October", L"November", L"December"};
+#endif
+
+#if defined (__BORLANDC__)
+_Time_Info time_init<char>::_M_timeinfo;
+# ifndef _STLP_NO_WCHAR_T
+_WTime_Info time_init<wchar_t>::_M_timeinfo;
+# endif
+#endif
+
+// _Init_time_info: initialize table with
+// "C" values (note these are not defined in the C standard, so this
+// is somewhat arbitrary).
+
+static void _Init_timeinfo_base(_Time_Info_Base& table) {
+ table._M_time_format = "%H:%M:%S";
+ table._M_date_format = "%m/%d/%y";
+ table._M_date_time_format = "%m/%d/%y";
+}
+
+static void _Init_timeinfo(_Time_Info& table) {
+ int i;
+ for (i = 0; i < 14; ++i)
+ table._M_dayname[i] = default_dayname[i];
+ for (i = 0; i < 24; ++i)
+ table._M_monthname[i] = default_monthname[i];
+ table._M_am_pm[0] = "AM";
+ table._M_am_pm[1] = "PM";
+ _Init_timeinfo_base(table);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+static void _Init_timeinfo(_WTime_Info& table) {
+ int i;
+ for (i = 0; i < 14; ++i)
+ table._M_dayname[i] = default_wdayname[i];
+ for (i = 0; i < 24; ++i)
+ table._M_monthname[i] = default_wmonthname[i];
+ table._M_am_pm[0] = L"AM";
+ table._M_am_pm[1] = L"PM";
+ _Init_timeinfo_base(table);
+}
+#endif
+
+static void _Init_timeinfo_base(_Time_Info_Base& table, _Locale_time * time) {
+ table._M_time_format = _Locale_t_fmt(time);
+ if ( table._M_time_format == "%T" ) {
+ table._M_time_format = "%H:%M:%S";
+ } else if ( table._M_time_format == "%r" ) {
+ table._M_time_format = "%I:%M:%S %p";
+ } else if ( table._M_time_format == "%R" ) {
+ table._M_time_format = "%H:%M";
+ }
+ table._M_date_format = _Locale_d_fmt(time);
+ table._M_date_time_format = _Locale_d_t_fmt(time);
+ table._M_long_date_format = _Locale_long_d_fmt(time);
+ table._M_long_date_time_format = _Locale_long_d_t_fmt(time);
+}
+
+static void _Init_timeinfo(_Time_Info& table, _Locale_time * time) {
+ int i;
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i] = _Locale_abbrev_dayofweek(time, i);
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i+7] = _Locale_full_dayofweek(time, i);
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i] = _Locale_abbrev_monthname(time, i);
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i+12] = _Locale_full_monthname(time, i);
+ table._M_am_pm[0] = _Locale_am_str(time);
+ table._M_am_pm[1] = _Locale_pm_str(time);
+ _Init_timeinfo_base(table, time);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+static void _Init_timeinfo(_WTime_Info& table, _Locale_time * time) {
+ wchar_t buf[128];
+ int i;
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i] = _WLocale_abbrev_dayofweek(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i+7] = _WLocale_full_dayofweek(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i] = _WLocale_abbrev_monthname(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i+12] = _WLocale_full_monthname(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ table._M_am_pm[0] = _WLocale_am_str(time, _STLP_ARRAY_AND_SIZE(buf));
+ table._M_am_pm[1] = _WLocale_pm_str(time, _STLP_ARRAY_AND_SIZE(buf));
+ _Init_timeinfo_base(table, time);
+}
+#endif
+
+template <class _Ch, class _TimeInfo>
+void __subformat(_STLP_BASIC_IOSTRING(_Ch) &buf, const ctype<_Ch>& ct,
+ const string& format, const _TimeInfo& table, const tm* t) {
+ const char * cp = format.data();
+ const char * cp_end = cp + format.size();
+ while (cp != cp_end) {
+ if (*cp == '%') {
+ char mod = 0;
+ ++cp;
+ if (*cp == '#') {
+ mod = *cp; ++cp;
+ }
+ __write_formatted_timeT(buf, ct, *cp++, mod, table, t);
+ } else
+ buf.append(1, *cp++);
+ }
+}
+
+static void __append(__iostring &buf, const string& name)
+{ buf.append(name.data(), name.data() + name.size()); }
+
+static void __append(__iowstring &buf, const wstring& name)
+{ buf.append(name.data(), name.data() + name.size()); }
+
+static void __append(__iostring &buf, char *first, char *last, const ctype<char>& /* ct */)
+{ buf.append(first, last); }
+
+static void __append(__iowstring &buf, char *first, char *last, const ctype<wchar_t>& ct) {
+ wchar_t _wbuf[64];
+ ct.widen(first, last, _wbuf);
+ buf.append(_wbuf, _wbuf + (last - first));
+}
+
+#if defined (__GNUC__)
+/* The number of days from the first day of the first ISO week of this
+ year to the year day YDAY with week day WDAY. ISO weeks start on
+ Monday; the first ISO week has the year's first Thursday. YDAY may
+ be as small as YDAY_MINIMUM. */
+# define __ISO_WEEK_START_WDAY 1 /* Monday */
+# define __ISO_WEEK1_WDAY 4 /* Thursday */
+# define __YDAY_MINIMUM (-366)
+# define __TM_YEAR_BASE 1900
+static int
+__iso_week_days(int yday, int wday) {
+ /* Add enough to the first operand of % to make it nonnegative. */
+ int big_enough_multiple_of_7 = (-__YDAY_MINIMUM / 7 + 2) * 7;
+ return (yday
+ - (yday - wday + __ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ + __ISO_WEEK1_WDAY - __ISO_WEEK_START_WDAY);
+}
+
+# define __is_leap(year)\
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+
+#endif
+
+#define __hour12(hour) \
+ (((hour) % 12 == 0) ? (12) : (hour) % 12)
+
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_SPRINTF sprintf
+#else
+# define _STLP_SPRINTF sprintf_s
+#endif
+
+template <class _Ch, class _TimeInfo>
+void _STLP_CALL __write_formatted_timeT(_STLP_BASIC_IOSTRING(_Ch) &buf,
+ const ctype<_Ch>& ct,
+ char format, char modifier,
+ const _TimeInfo& table, const tm* t) {
+ char _buf[64];
+ char *_bend;
+
+ switch (format) {
+ case 'a':
+ __append(buf, table._M_dayname[t->tm_wday]);
+ break;
+
+ case 'A':
+ __append(buf, table._M_dayname[t->tm_wday + 7]);
+ break;
+
+ case 'b':
+ __append(buf, table._M_monthname[t->tm_mon]);
+ break;
+
+ case 'B':
+ __append(buf, table._M_monthname[t->tm_mon + 12]);
+ break;
+
+ case 'c':
+ __subformat(buf, ct, (modifier != '#') ? table._M_date_time_format
+ : table._M_long_date_time_format, table, t);
+ break;
+
+ case 'd':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_mday);
+ __append(buf, _buf, ((long)t->tm_mday < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'e':
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_mday);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'H':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_hour);
+ __append(buf, _buf, ((long)t->tm_hour < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'I':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)__hour12(t->tm_hour));
+ __append(buf, _buf, ((long)__hour12(t->tm_hour) < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'j':
+ _bend = __write_integer(_buf, 0, (long)((long)t->tm_yday + 1));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'm':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_mon + 1);
+ __append(buf, _buf, ((long)(t->tm_mon + 1) < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'M':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_min);
+ __append(buf, _buf, ((long)t->tm_min < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'p':
+ __append(buf, table._M_am_pm[t->tm_hour / 12]);
+ break;
+
+ case 'S': // pad with zeros
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_sec);
+ __append(buf, _buf, ((long)t->tm_sec < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'U':
+ _bend = __write_integer(_buf, 0, long((t->tm_yday - t->tm_wday + 7) / 7));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'w':
+ _bend = __write_integer(_buf, 0, (long)t->tm_wday);
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'W':
+ _bend = __write_integer(_buf, 0,
+ (long)(t->tm_wday == 0 ? (t->tm_yday + 1) / 7 :
+ (t->tm_yday + 8 - t->tm_wday) / 7));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case'x':
+ __subformat(buf, ct, (modifier != '#') ? table._M_date_format
+ : table._M_long_date_format, table, t);
+ break;
+
+ case 'X':
+ __subformat(buf, ct, table._M_time_format, table, t);
+ break;
+
+ case 'y':
+ _bend = __write_integer(_buf, 0, (long)((long)(t->tm_year + 1900) % 100));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'Y':
+ _bend = __write_integer(_buf, 0, (long)((long)t->tm_year + 1900));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case '%':
+ buf.append(1, ct.widen('%'));
+ break;
+
+#if defined (__GNUC__)
+ // fbp : at least on SUN
+# if defined (_STLP_UNIX) && !defined (__linux__)
+# define __USE_BSD 1
+# endif
+
+ /*********************************************
+ * JGS, handle various extensions *
+ *********************************************/
+
+ case 'h': /* POSIX.2 extension */
+ // same as 'b', abbrev month name
+ __append(buf, table._M_monthname[t->tm_mon]);
+ break;
+ case 'C': /* POSIX.2 extension */
+ // same as 'd', the day
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_mday);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'D': /* POSIX.2 extension */
+ // same as 'x'
+ __subformat(buf, ct, table._M_date_format, table, t);
+ break;
+
+ case 'k': /* GNU extension */
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_hour);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'l': /* GNU extension */
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_hour % 12);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'n': /* POSIX.2 extension */
+ buf.append(1, ct.widen('\n'));
+ break;
+
+ case 'R': /* GNU extension */
+ __subformat(buf, ct, "%H:%M", table, t);
+ break;
+
+ case 'r': /* POSIX.2 extension */
+ __subformat(buf, ct, "%I:%M:%S %p", table, t);
+ break;
+
+ case 'T': /* POSIX.2 extension. */
+ __subformat(buf, ct, "%H:%M:%S", table, t);
+ break;
+
+ case 't': /* POSIX.2 extension. */
+ buf.append(1, ct.widen('\t'));
+
+ case 'u': /* POSIX.2 extension. */
+ _bend = __write_integer(_buf, 0, long((t->tm_wday - 1 + 7)) % 7 + 1);
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 's': {
+ time_t __t = mktime(__CONST_CAST(tm*, t));
+ _bend = __write_integer(_buf, 0, (long)__t );
+ __append(buf, _buf, _bend, ct);
+ break;
+ }
+ case 'g': /* GNU extension */
+ case 'G': {
+ int year = t->tm_year + __TM_YEAR_BASE;
+ int days = __iso_week_days (t->tm_yday, t->tm_wday);
+ if (days < 0) {
+ /* This ISO week belongs to the previous year. */
+ year--;
+ days = __iso_week_days (t->tm_yday + (365 + __is_leap (year)), t->tm_wday);
+ }
+ else {
+ int d = __iso_week_days (t->tm_yday - (365 + __is_leap (year)), t->tm_wday);
+ if (0 <= d) {
+ /* This ISO week belongs to the next year. */
+ ++year;
+ days = d;
+ }
+ }
+ long val;
+ switch (format) {
+ case 'g':
+ val = (long)(year % 100 + 100) % 100;
+ break;
+ case 'G':
+ val = (long)year;
+ break;
+ default:
+ val = (long)days / 7 + 1;
+ break;
+ }
+ _bend = __write_integer(_buf, 0, val);
+ __append(buf, _buf, _bend, ct);
+ break;
+ }
+
+# if defined (_STLP_USE_GLIBC)
+ case 'z': /* GNU extension. */
+ if (t->tm_isdst < 0)
+ break;
+ {
+ int diff;
+# if defined (__USE_BSD) || defined (__BEOS__)
+ diff = t->tm_gmtoff;
+# else
+ diff = t->__tm_gmtoff;
+# endif
+ if (diff < 0) {
+ buf.append(1, ct.widen('-'));
+ diff = -diff;
+ } else
+ buf.append(1, ct.widen('+'));
+ diff /= 60;
+ _STLP_SPRINTF(_buf, "%.4d", (diff / 60) * 100 + diff % 60);
+ __append(buf, _buf, _buf + 4, ct);
+ break;
+ }
+# endif /* __GLIBC__ */
+#endif /* __GNUC__ */
+
+ default:
+ break;
+ }
+}
+
+void _STLP_CALL __write_formatted_time(__iostring &buf, const ctype<char>& ct,
+ char format, char modifier,
+ const _Time_Info& table, const tm* t)
+{ __write_formatted_timeT(buf, ct, format, modifier, table, t); }
+
+void _STLP_CALL __write_formatted_time(__iowstring &buf, const ctype<wchar_t>& ct,
+ char format, char modifier,
+ const _WTime_Info& table, const tm* t)
+{ __write_formatted_timeT(buf, ct, format, modifier, table, t); }
+
+static time_base::dateorder __get_date_order(_Locale_time* time) {
+ const char * fmt = _Locale_d_fmt(time);
+ char first, second, third;
+
+ while (*fmt != 0 && *fmt != '%') ++fmt;
+ if (*fmt == 0)
+ return time_base::no_order;
+ first = *++fmt;
+ while (*fmt != 0 && *fmt != '%') ++fmt;
+ if (*fmt == 0)
+ return time_base::no_order;
+ second = *++fmt;
+ while (*fmt != 0 && *fmt != '%') ++fmt;
+ if (*fmt == 0)
+ return time_base::no_order;
+ third = *++fmt;
+
+ switch (first) {
+ case 'd':
+ return (second == 'm' && third == 'y') ? time_base::dmy
+ : time_base::no_order;
+ case 'm':
+ return (second == 'd' && third == 'y') ? time_base::mdy
+ : time_base::no_order;
+ case 'y':
+ switch (second) {
+ case 'd':
+ return third == 'm' ? time_base::ydm : time_base::no_order;
+ case 'm':
+ return third == 'd' ? time_base::ymd : time_base::no_order;
+ default:
+ return time_base::no_order;
+ }
+ default:
+ return time_base::no_order;
+ }
+}
+
+time_init<char>::time_init()
+ : _M_dateorder(time_base::no_order)
+{ _Init_timeinfo(_M_timeinfo); }
+
+time_init<char>::time_init(const char* __name) {
+ if (!__name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _Locale_time *__time = __acquire_time(__name, buf, 0, &__err_code);
+ if (!__time)
+ locale::_M_throw_on_creation_failure(__err_code, __name, "time");
+
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+ __release_time(__time);
+}
+
+time_init<char>::time_init(_Locale_time *__time) {
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+time_init<wchar_t>::time_init()
+ : _M_dateorder(time_base::no_order)
+{ _Init_timeinfo(_M_timeinfo); }
+
+time_init<wchar_t>::time_init(const char* __name) {
+ if (!__name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _Locale_time *__time = __acquire_time(__name, buf, 0, &__err_code);
+ if (!__time)
+ locale::_M_throw_on_creation_failure(__err_code, __name, "time");
+
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+ __release_time(__time);
+}
+
+time_init<wchar_t>::time_init(_Locale_time *__time) {
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+template class time_get<char, istreambuf_iterator<char, char_traits<char> > >;
+template class time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+
+# ifndef _STLP_NO_WCHAR_T
+template class time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+template class time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/src/warning_disable.h b/build/stlport/src/warning_disable.h
new file mode 100644
index 000000000..7f0c1c847
--- /dev/null
+++ b/build/stlport/src/warning_disable.h
@@ -0,0 +1,61 @@
+#if !defined (__ICL)
+/* This header is used to turn off warnings of Microsoft compilers generated.
+ * while building STLport.
+ * For compiling user code, see stlport/config/_msvc_warnings_off.h.
+ */
+
+# if (_MSC_VER < 1300) /* VC6/eVC4 */
+# pragma warning( disable : 4097 ) /* typedef-name used as based class of (...) */
+# pragma warning( disable : 4251 ) /* DLL interface needed */
+# pragma warning( disable : 4284 ) /* for -> operator */
+# pragma warning( disable : 4503 ) /* decorated name length exceeded, name was truncated */
+# pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */
+# pragma warning( disable : 4660 ) /* template-class specialization '...' is already instantiated */
+# pragma warning( disable : 4701 ) /* local variable 'base' may be used without having been initialized */
+# pragma warning( disable : 4710 ) /* function (...) not inlined */
+# pragma warning( disable : 4786 ) /* identifier truncated to 255 characters */
+# endif
+
+# if (_MSC_VER <= 1310)
+# pragma warning( disable : 4511 ) /* copy constructor cannot be generated */
+# endif
+
+# if (_MSC_VER < 1300) && defined (UNDER_CE)
+# pragma warning( disable : 4201 ) /* nonstandard extension used : nameless struct/union */
+# pragma warning( disable : 4214 ) /* nonstandard extension used : bit field types other than int */
+# endif
+
+/* Suppress warnings emitted from Windows CE SDK headers. */
+# if (_MSC_VER >= 1400) && defined (UNDER_CE)
+# pragma warning( disable : 4115 ) /* Named type definition in parentheses. */
+# pragma warning( disable : 4201 ) /* Nameless struct/union. */
+# pragma warning( disable : 4214 ) /* Bit field types other than int. */
+# pragma warning( disable : 4290 ) /* C++ exception specification ignored. */
+# pragma warning( disable : 4430 ) /* Missing type specifier, int assumed. */
+# pragma warning( disable : 4431 ) /* Missing type specifier, int assumed. */
+# endif
+
+# pragma warning( disable : 4075 ) /* initializers put in unrecognized initialization area */
+/* This warning is disable only for the c_locale_win32.c file compilation: */
+# pragma warning( disable : 4100 ) /* unreferenced formal parameter */
+# pragma warning( disable : 4127 ) /* conditional expression is constant */
+# pragma warning( disable : 4146 ) /* unary minus applied to unsigned type */
+# pragma warning( disable : 4245 ) /* conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch */
+# pragma warning( disable : 4244 ) /* implicit conversion: possible loss of data */
+# pragma warning( disable : 4512 ) /* assignment operator could not be generated */
+# pragma warning( disable : 4571 ) /* catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions */
+# pragma warning( disable : 4702 ) /* unreachable code (appears in release with warning level4) */
+#else
+# pragma warning( disable : 69 ) /* integer conversion resulted in truncation */
+# pragma warning( disable : 174 ) /* expression has no effect */
+# pragma warning( disable : 279 ) /* controling expression is constant */
+# pragma warning( disable : 383 ) /* reference to temporary used */
+# pragma warning( disable : 444 ) /* destructor for base class "..." is not virtual*/
+# pragma warning( disable : 810 ) /* conversion from "int" to "char" may lose significant bits */
+# pragma warning( disable : 981 ) /* operands are evaluated in unspecified order */
+# pragma warning( disable : 1418 ) /* external definition with no prior declaration */
+# pragma warning( disable : 1419 ) /* external declaration in primary source file */
+# pragma warning( disable : 1572 ) /* floating-point equality and inequality comparisons are unreliable */
+# pragma warning( disable : 1682 ) /* implicit conversion of a 64-bit integral type to a smaller integral type */
+# pragma warning( disable : 1683 ) /* explicit conversion of a 64-bit integral type to a smaller integral type */
+#endif
diff --git a/build/stlport/stl/config/_android.h.in b/build/stlport/stl/config/_android.h.in
deleted file mode 100644
index 17ca9896f..000000000
--- a/build/stlport/stl/config/_android.h.in
+++ /dev/null
@@ -1,31 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_stl_config__android_h
-#define mozilla_stl_config__android_h
-
-#include "@STLPORT_SOURCES@/stlport/stl/config/_android.h"
-
-// No rtti support
-#undef _STLP_NO_RTTI
-#define _STLP_NO_RTTI 1
-
-// No throwing exceptions
-#undef _STLP_NO_EXCEPTIONS
-#define _STLP_NO_EXCEPTIONS 1
-#undef _STLP_NO_EXCEPTION_HEADER
-#define _STLP_NO_EXCEPTION_HEADER 1
-#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT 1
-
-#undef _STLP_NATIVE_CPP_C_HEADER
-#define _STLP_NATIVE_CPP_C_HEADER(header) <../../system/include/header>
-#undef _STLP_NATIVE_CPP_RUNTIME_HEADER
-#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../../system/include/header>
-
-// Use operator new instead of stlport own node allocator
-#undef _STLP_USE_NEWALLOC
-#define _STLP_USE_NEWALLOC 1
-
-#endif /* mozilla_stl_config__android_h */
diff --git a/build/stlport/stlport/algorithm b/build/stlport/stlport/algorithm
new file mode 100644
index 000000000..c653d8c77
--- /dev/null
+++ b/build/stlport/stlport/algorithm
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ALGORITHM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1
+# include <stl/_prolog.h>
+# define _STLP_ALGORITHM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1)
+# ifndef _STLP_INTERNAL_CSTDIO
+// remove() conflicts, <cstdio> should always go first
+# include <stl/_cstdio.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <algorithm>
+# else
+# include _STLP_NATIVE_HEADER(algorithm)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ALGORITHM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/assert.h b/build/stlport/stlport/assert.h
new file mode 100644
index 000000000..112dd265b
--- /dev/null
+++ b/build/stlport/stlport/assert.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x202
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */
+#ifndef _STLP_WCE_EVC3
+# if !defined (assert)
+# define _STLP_NATIVE_ASSERT_H_INCLUDED
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <assert.h>
+# else
+# include _STLP_NATIVE_C_HEADER(assert.h)
+# endif
+# endif
+# if !defined (_STLP_NATIVE_ASSERT_H_INCLUDED)
+/* See errno.h for additional information about this #error */
+# error assert has been defined before inclusion of assert.h header.
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x202)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/build/stlport/stlport/bitset b/build/stlport/stlport/bitset
new file mode 100644
index 000000000..1d7fcf3eb
--- /dev/null
+++ b/build/stlport/stlport/bitset
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET
+
+// This implementation of bitset<> has a second template parameter,
+// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
+// THIS FEATURE*. It is experimental, and it may be removed in
+// future releases.
+
+// A bitset of size N, using words of type _WordT, will have
+// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
+// order bits in the highest word.) It is a class invariant
+// of class bitset<> that those unused bits are always zero.
+
+// Most of the actual code isn't contained in bitset<> itself, but in the
+// base class _Base_bitset. The base class works with whole words, not with
+// individual bits. This allows us to specialize _Base_bitset for the
+// important special case where the bitset is only a single word.
+
+// The C++ standard does not define the precise semantics of operator[].
+// In this implementation the const version of operator[] is equivalent
+// to test(), except that it does no range checking. The non-const version
+// returns a reference to a bit, again without doing any range checking.
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2
+# include <stl/_prolog.h>
+# define _STLP_BITSET
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2)
+# ifndef _STLP_INTERNAL_BITSET
+# include <stl/_bitset.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x2) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <bitset>
+# else
+# include _STLP_NATIVE_HEADER(bitset)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_BITSET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cassert b/build/stlport/stlport/cassert
new file mode 100644
index 000000000..aabd0b4ee
--- /dev/null
+++ b/build/stlport/stlport/cassert
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x103
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (_STLP_WCE_EVC3)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cassert>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cassert)
+# endif
+# else
+# include <assert.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x103 )
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cctype b/build/stlport/stlport/cctype
new file mode 100644
index 000000000..513512e92
--- /dev/null
+++ b/build/stlport/stlport/cctype
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CCTYPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x104
+# define _STLP_CCTYPE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
+# ifndef _STLP_INTERNAL_CCTYPE
+# include <stl/_cctype.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x104) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CCTYPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cerrno b/build/stlport/stlport/cerrno
new file mode 100644
index 000000000..0d17faf5e
--- /dev/null
+++ b/build/stlport/stlport/cerrno
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CERRNO
+#define _STLP_CERRNO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x105
+# include <stl/_prolog.h>
+#endif
+
+#ifndef _STLP_WCE
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cerrno>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cerrno)
+# endif
+# else
+# include <errno.h>
+# endif
+#endif
+
+#ifndef errno /* errno is not a macro */
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+# if !defined (__IBMCPP__) && !defined (__hpux) && !defined (__MWERKS__) && !defined (_STLP_WCE)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::errno;
+_STLP_END_NAMESPACE
+# endif
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x105 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CERRNO */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cfloat b/build/stlport/stlport/cfloat
new file mode 100644
index 000000000..cb2e0cd00
--- /dev/null
+++ b/build/stlport/stlport/cfloat
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CFLOAT
+#define _STLP_CFLOAT
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x106
+# include <stl/_prolog.h>
+#endif
+
+// Borland defines some implementation constants in std:: namespace,
+// we do not want to import them.
+#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cfloat>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
+# endif
+#else
+# include <float.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x106 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CFLOAT */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ciso646 b/build/stlport/stlport/ciso646
new file mode 100644
index 000000000..443449d6f
--- /dev/null
+++ b/build/stlport/stlport/ciso646
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CISO646
+#define _STLP_CISO646
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x107
+# include <stl/_prolog.h>
+#endif
+
+#if !defined(_STLP_WCE_EVC3) && !defined (__BORLANDC__)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ciso646>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(ciso646)
+# endif
+# else
+# include <iso646.h>
+# endif /* _STLP_USE_NEW_C_HEADERS */
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x107 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CISO646 */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/climits b/build/stlport/stlport/climits
new file mode 100644
index 000000000..86bc413c8
--- /dev/null
+++ b/build/stlport/stlport/climits
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CLIMITS
+# define _STLP_CLIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x108
+# include <stl/_prolog.h>
+#endif
+
+#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4))
+# include </usr/include/limits.h>
+#elif defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <climits>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(climits)
+# endif
+#else
+# if defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits.h>
+# else
+# include _STLP_NATIVE_C_HEADER(limits.h)
+# endif
+# else
+# include <limits.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x108 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CLIMITS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/clocale b/build/stlport/stlport/clocale
new file mode 100644
index 000000000..28996ced4
--- /dev/null
+++ b/build/stlport/stlport/clocale
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CLOCALE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x109
+# define _STLP_CLOCALE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x109)
+# ifndef _STLP_INTERNAL_CLOCALE
+# include <stl/_clocale.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x109) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <clocale>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(clocale)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x109)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CLOCALE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cmath b/build/stlport/stlport/cmath
new file mode 100644
index 000000000..46a8f52ec
--- /dev/null
+++ b/build/stlport/stlport/cmath
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CMATH
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x110
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CMATH
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x110) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cmath>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cmath)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x110)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_CMATH */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/complex b/build/stlport/stlport/complex
new file mode 100644
index 000000000..6cfe6052f
--- /dev/null
+++ b/build/stlport/stlport/complex
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_COMPLEX
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x10
+# define _STLP_COMPLEX
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x10)
+// This header declares the template class complex, as described in
+// in the C++ Standard. Single-precision complex numbers
+// are complex<float>, double-precision are complex<double>, and
+// quad precision are complex<long double>.
+
+// Note that the template class complex is declared within namespace
+// std, as called for by the draft C++ standard
+# ifndef _STLP_INTERNAL_COMPLEX
+# include <stl/_complex.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x10) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <complex>
+# else
+# include _STLP_NATIVE_HEADER(complex)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x10 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_COMPLEX */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/csetjmp b/build/stlport/stlport/csetjmp
new file mode 100644
index 000000000..eef2bd861
--- /dev/null
+++ b/build/stlport/stlport/csetjmp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSETJMP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x111
+# define _STLP_CSETJMP
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x111)
+# ifndef _STLP_INTERNAL_CSETJMP
+# include <stl/_csetjmp.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x111) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csetjmp>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x111 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSETJMP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/csignal b/build/stlport/stlport/csignal
new file mode 100644
index 000000000..7b1a30d50
--- /dev/null
+++ b/build/stlport/stlport/csignal
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSIGNAL
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x112
+# define _STLP_CSIGNAL
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x112)
+# ifndef _STLP_INTERNAL_CSIGNAL
+# include <stl/_csignal.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x112) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csignal>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csignal)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x112 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSIGNAL */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cstdarg b/build/stlport/stlport/cstdarg
new file mode 100644
index 000000000..6882bbdc0
--- /dev/null
+++ b/build/stlport/stlport/cstdarg
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDARG
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x113
+# define _STLP_CSTDARG
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x113)
+# ifndef _STLP_INTERNAL_CSTDARG
+# include <stl/_cstdarg.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x113) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdarg>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x113 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDARG */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cstddef b/build/stlport/stlport/cstddef
new file mode 100644
index 000000000..0a66f0e4d
--- /dev/null
+++ b/build/stlport/stlport/cstddef
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDDEF
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x114
+# define _STLP_CSTDDEF
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x114)
+# ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x114) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x114 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDDEF */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cstdio b/build/stlport/stlport/cstdio
new file mode 100644
index 000000000..e20c8fff7
--- /dev/null
+++ b/build/stlport/stlport/cstdio
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDIO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x15
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CSTDIO
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x15) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdio>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cstdlib b/build/stlport/stlport/cstdlib
new file mode 100644
index 000000000..20afa3563
--- /dev/null
+++ b/build/stlport/stlport/cstdlib
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDLIB
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x116
+# define _STLP_CSTDLIB
+# include <stl/_prolog.h>
+#endif
+
+# if defined (__GNUC__) && defined (__MINGW32__)
+/* Native cstdlib includes stdlib.h using an include_next so STLport stdlib.h
+ * is not used and the workaround in this file must be duplicated here
+ * (see stdlib.h). */
+# include "errno.h"
+# endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x116) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdlib>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDLIB */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cstring b/build/stlport/stlport/cstring
new file mode 100644
index 000000000..d5cf58d01
--- /dev/null
+++ b/build/stlport/stlport/cstring
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x117
+# define _STLP_CSTRING
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x117) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstring>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTRING */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ctime b/build/stlport/stlport/ctime
new file mode 100644
index 000000000..bafb7dd2e
--- /dev/null
+++ b/build/stlport/stlport/ctime
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CTIME
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x118
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x118) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CTIME
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x118) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x118) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ctime>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(ctime)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x118)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_CTIME */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ctype.h b/build/stlport/stlport/ctype.h
new file mode 100644
index 000000000..f9d10003e
--- /dev/null
+++ b/build/stlport/stlport/ctype.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CTYPE_H
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include ctype.h, which results in warnings and errors
+ */
+#if !defined(RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x219
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CTYPE_H
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ctype.h>
+# else
+# include _STLP_NATIVE_C_HEADER(ctype.h)
+# endif
+
+/* on evc4 including ctype.h also defines setjmp macro */
+# if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# ifndef _STLP_CTYPE_H_SEEN
+# define _STLP_CTYPE_H_SEEN
+
+/* Undef convenience interfaces */
+# undef isspace
+# undef isprint
+# undef iscntrl
+# undef isupper
+# undef islower
+# undef isalpha
+# undef isdigit
+# undef ispunct
+# undef isxdigit
+# undef isalnum
+# undef isgraph
+# undef toupper
+# undef tolower
+
+# if defined (UNDER_CE)
+
+# if (_WIN32_WCE < 300) /* Only wide chars for older versions */
+# define _isctype iswctype
+# endif
+
+__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
+__inline int (isupper)(int c) { return _isctype(c, _UPPER); }
+__inline int (islower)(int c) { return _isctype(c, _LOWER); }
+__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
+__inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
+__inline int (isspace)(int c) { return _isctype(c, _SPACE); }
+__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
+__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
+__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
+__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
+__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
+__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
+
+# undef _isctype
+
+__inline int (iswalpha)(int c) { return iswctype((unsigned short)(c), _ALPHA); }
+__inline int (iswupper)(int c) { return iswctype((unsigned short)(c), _UPPER); }
+__inline int (iswlower)(int c) { return iswctype((unsigned short)(c), _LOWER); }
+__inline int (iswdigit)(int c) { return iswctype((unsigned short)(c), _DIGIT); }
+__inline int (iswxdigit)(int c) { return iswctype((unsigned short)(c), _HEX); }
+__inline int (iswspace)(int c) { return iswctype((unsigned short)(c), _SPACE); }
+__inline int (iswpunct)(int c) { return iswctype((unsigned short)(c), _PUNCT); }
+__inline int (iswalnum)(int c) { return iswctype((unsigned short)(c), _ALPHA|_DIGIT); }
+__inline int (iswprint)(int c) { return iswctype((unsigned short)(c), _BLANK|_PUNCT|_ALPHA|_DIGIT); }
+__inline int (iswgraph)(int c) { return iswctype((unsigned short)(c), _PUNCT|_ALPHA|_DIGIT); }
+__inline int (iswcntrl)(int c) { return iswctype((unsigned short)(c), _CONTROL); }
+__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
+
+# endif /* UNDER_CE */
+
+# endif /* _STLP_CTYPE_H_SEEN */
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x219)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+
+#endif /* RC_INVOKED */
+
+#endif /* _STLP_CTYPE_H */
diff --git a/build/stlport/stlport/cwchar b/build/stlport/stlport/cwchar
new file mode 100644
index 000000000..0b3205474
--- /dev/null
+++ b/build/stlport/stlport/cwchar
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CWCHAR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x120
+# define _STLP_CWCHAR
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
+# ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x120) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwchar>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CWCHAR */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/cwctype b/build/stlport/stlport/cwctype
new file mode 100644
index 000000000..0e86218e0
--- /dev/null
+++ b/build/stlport/stlport/cwctype
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CWCTYPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x121
+# define _STLP_CWCTYPE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
+# ifndef _STLP_INTERNAL_CWCTYPE
+# include <stl/_cwctype.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x121) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CWCTYPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/deque b/build/stlport/stlport/deque
new file mode 100644
index 000000000..448f159b7
--- /dev/null
+++ b/build/stlport/stlport/deque
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEQUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x22
+# include <stl/_prolog.h>
+# define _STLP_DEQUE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
+# ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x22) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <deque>
+# else
+# include _STLP_NATIVE_HEADER(deque)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_DEQUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/errno.h b/build/stlport/stlport/errno.h
new file mode 100644
index 000000000..bb7999b9d
--- /dev/null
+++ b/build/stlport/stlport/errno.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x205
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#ifdef _STLP_WCE
+/* only show message when directly including this file in a non-library build */
+# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205)
+# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here")
+# endif
+#else
+# ifndef errno
+/* We define the following macro first to guaranty the header reentrancy: */
+# define _STLP_NATIVE_ERRNO_H_INCLUDED
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <errno.h>
+# else
+# include _STLP_NATIVE_C_HEADER(errno.h)
+# endif
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x590) && defined (__cplusplus)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::__errno;
+_STLP_END_NAMESPACE
+# endif
+# endif /* errno */
+
+# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED)
+/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h
+ * becomes impossible because if:
+ * #define errno foo
+ * then
+ * #include _STLP_NATIVE_C_HEADER(errno.h)
+ * becomes:
+ * #include _STLP_NATIVE_C_HEADER(foo.h)
+ *
+ * To fix this problem you have to find where this definition comes from and include errno.h before it.
+ */
+# error errno has been defined before inclusion of errno.h header.
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x205)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode: C
+ * End:
+ */
diff --git a/build/stlport/stlport/exception b/build/stlport/stlport/exception
new file mode 100644
index 000000000..47822e915
--- /dev/null
+++ b/build/stlport/stlport/exception
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+// This header exists solely for portability. Normally it just includes
+// the native header <exception>.
+
+#ifndef _STLP_EXCEPTION
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x423
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x423)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_EXCEPTION
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x423) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+/* If we are here it means that we are in an include called
+ * from the native lib which means that we can simply forward this
+ * call to the native exception header:
+ */
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception>
+# else
+# if defined (__DMC__) && (_STLP_OUTERMOST_HEADER_ID == 0x874)
+// Workaround to DMC harcoded typeinfo.h inclusion.
+# include <../include/exception>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x423)
+# if !defined(_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_EXCEPTION */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/exception.h b/build/stlport/stlport/exception.h
new file mode 100644
index 000000000..f4be9af3d
--- /dev/null
+++ b/build/stlport/stlport/exception.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OLDSTD_exception
+#define _STLP_OLDSTD_exception
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x824
+# include <stl/_prolog.h>
+#endif
+
+#if defined (__BORLANDC__) || defined (_MSC_VER)
+# include <exception>
+#else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception.h>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x824)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OLDSTD_exception */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/float.h b/build/stlport/stlport/float.h
new file mode 100644
index 000000000..70fe3ade9
--- /dev/null
+++ b/build/stlport/stlport/float.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x203
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x203)
+# error This header is only reentrant once, it should be modified if it has to be included more.
+#endif
+
+#if defined (_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <float.h>
+#else
+# include _STLP_NATIVE_C_HEADER(float.h)
+#endif
+
+#if !defined (__linux__)
+# if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560)
+_STLP_BEGIN_NAMESPACE
+using ::_max_dble;
+using ::_max_flt;
+using ::_max_ldble;
+using ::_tiny_ldble;
+_STLP_END_NAMESPACE
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x203)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
diff --git a/build/stlport/stlport/fstream b/build/stlport/stlport/fstream
new file mode 100644
index 000000000..fc4cd1ead
--- /dev/null
+++ b/build/stlport/stlport/fstream
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+// This header defines classes basic_filebuf, basic_ifstream,
+// basic_ofstream, and basic_fstream. These classes represent
+// streambufs and streams whose sources or destinations are files.
+
+#ifndef _STLP_FSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1025
+# include <stl/_prolog.h>
+# define _STLP_FSTREAM
+# if defined (__DMC__) && defined (_DLL)
+# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1025) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1025) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <fstream>
+# else
+# include _STLP_NATIVE_HEADER(fstream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1025)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# if defined (__DMC__) && defined (_DLL)
+# undef _STLP_CLASS_IMPORT_DECLSPEC
+# define _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+#endif
+
+#endif /* _STLP_FSTREAM */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/fstream.h b/build/stlport/stlport/fstream.h
new file mode 100644
index 000000000..46400334e
--- /dev/null
+++ b/build/stlport/stlport/fstream.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_FSTREAM_H
+#define _STLP_FSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2026
+# include <stl/_prolog.h>
+#endif
+
+#include <fstream>
+
+// get desired pollution
+#include <iostream.h>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# include <using/fstream>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2026)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_FSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/functional b/build/stlport/stlport/functional
new file mode 100644
index 000000000..27e37ab98
--- /dev/null
+++ b/build/stlport/stlport/functional
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_FUNCTIONAL
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x27
+# include <stl/_prolog.h>
+# define _STLP_FUNCTIONAL
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x27)
+# ifndef _STLP_INTERNAL_FUNCTION_H
+# include <stl/_function.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x27) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <functional>
+# else
+# include _STLP_NATIVE_HEADER(functional)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x27)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+#include <boost/ref.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/bind/placeholders.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/bind.hpp>
+
+namespace boost {
+
+template<class T> class reference_wrapper;
+template<class T> reference_wrapper<T> const ref(T &);
+template<class T> inline reference_wrapper<T const> const cref(T const &);
+
+template<typename F> struct result_of;
+
+namespace _mfi {
+template<class R, class T> class dm;
+}
+
+template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f);
+
+} // namespace boost
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::reference_wrapper;
+using ::boost::ref;
+using ::boost::cref;
+
+using ::boost::result_of;
+
+using ::boost::mem_fn;
+
+using ::boost::bind;
+
+namespace placeholders {
+ using ::_1;
+ using ::_2;
+ using ::_3;
+ using ::_4;
+ using ::_5;
+ using ::_6;
+ using ::_7;
+ using ::_8;
+ using ::_9;
+} // placeholders
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif // !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT
+
+#endif /* _STLP_FUNCTIONAL */
+
+#if !defined(_STLP_FUNCTIONAL_FUN) && !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+#ifndef BOOST_FUNCTION_NUM_ARGS // avoid recursive includes
+
+// #ifdef BOOST_FUNCTION_BASE_HEADER
+// #undef BOOST_FUNCTION_BASE_HEADER
+// #endif
+
+// #ifdef BOOST_FUNCTION_PROLOGUE_HPP
+// #undef BOOST_FUNCTION_PROLOGUE_HPP
+// #endif
+
+#define _STLP_FUNCTIONAL_FUN
+
+#ifndef BOOST_FUNCTION_BASE_HEADER // avoid recursive includes
+# include <boost/function.hpp>
+#else
+namespace boost {
+class bad_function_call;
+template<typename Signature, typename Allocator >
+class function;
+template<typename Signature, typename Allocator>
+void swap(function<Signature, Allocator>& f1, function<Signature, Allocator>& f2);
+}
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::bad_function_call;
+using ::boost::function;
+using ::boost::swap;
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif // !BOOST_FUNCTION_NUM_ARGS
+
+#endif // !_STLP_FUNCTIONAL_REF && !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/hash_map b/build/stlport/stlport/hash_map
new file mode 100644
index 000000000..0e2422d88
--- /dev/null
+++ b/build/stlport/stlport/hash_map
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_HASH_MAP
+#define _STLP_HASH_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4028
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use hash constainers even if you ask for
+ * no extension.
+ */
+# error The hash_map and hash_multimap class are STLport extensions.
+#endif
+
+#include <stl/_hash_map.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4028)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_HASH_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/hash_set b/build/stlport/stlport/hash_set
new file mode 100644
index 000000000..0fc89ec56
--- /dev/null
+++ b/build/stlport/stlport/hash_set
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_HASH_SET
+#define _STLP_HASH_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4029
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use hash constainers even if you ask for
+ * no extension.
+ */
+# error The hash_set and hash_multiset class are STLport extensions.
+#endif
+
+#include <stl/_hash_set.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4029)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_HASH_SET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/iomanip b/build/stlport/stlport/iomanip
new file mode 100644
index 000000000..085564f9e
--- /dev/null
+++ b/build/stlport/stlport/iomanip
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOMANIP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1030
+# include <stl/_prolog.h>
+# define _STLP_IOMANIP
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1030) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_IOMANIP
+# include <stl/_iomanip.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1030) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iomanip>
+# else
+# include _STLP_NATIVE_HEADER(iomanip)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1030)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOMANIP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/iomanip.h b/build/stlport/stlport/iomanip.h
new file mode 100644
index 000000000..1bfb0d24a
--- /dev/null
+++ b/build/stlport/stlport/iomanip.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOMANIP_H
+#define _STLP_IOMANIP_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2031
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <iomanip>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::setiosflags;
+using _STLP_STD::resetiosflags;
+using _STLP_STD::setbase;
+using _STLP_STD::setfill;
+using _STLP_STD::setprecision;
+using _STLP_STD::setw;
+# endif
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+// get all the pollution we want
+#include <iostream.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2031)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOMANIP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ios b/build/stlport/stlport/ios
new file mode 100644
index 000000000..12492bb72
--- /dev/null
+++ b/build/stlport/stlport/ios
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1032
+# include <stl/_prolog.h>
+# define _STLP_IOS
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1032) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1032) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ios>
+# else
+# include _STLP_NATIVE_HEADER(ios)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1032)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ios.h b/build/stlport/stlport/ios.h
new file mode 100644
index 000000000..90ccfbbd6
--- /dev/null
+++ b/build/stlport/stlport/ios.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOS_H
+#define _STLP_IOS_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1033
+# include <stl/_prolog.h>
+#endif
+
+#include <ios>
+
+#if defined (_STLP_USE_NAMESPACES)
+# include <using/ios>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1033)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/iosfwd b/build/stlport/stlport/iosfwd
new file mode 100644
index 000000000..14010465b
--- /dev/null
+++ b/build/stlport/stlport/iosfwd
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOSFWD
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1034
+# include <stl/_prolog.h>
+# define _STLP_IOSFWD
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1034) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1034) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iosfwd>
+# else
+# include _STLP_NATIVE_HEADER(iosfwd)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1034)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSFWD */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/iostream b/build/stlport/stlport/iostream
new file mode 100644
index 000000000..1241f10c5
--- /dev/null
+++ b/build/stlport/stlport/iostream
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1037
+# include <stl/_prolog.h>
+# define _STLP_IOSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1037) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifdef _STLP_REDIRECT_STDSTREAMS
+// for ofstream redirection
+# ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+# endif
+# endif
+
+# ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+# ifndef _STLP_USE_NAMESPACES
+// in case of SGI iostreams, we have to rename our streams not to clash with those
+// provided in native lib
+# define cin _STLP_cin
+# define cout _STLP_cout
+# define cerr _STLP_cerr
+# define clog _STLP_clog
+# endif
+
+// Note: cin and wcin are both associated with stdio. The C standard
+// (Amendment 1, section 4.6.2.1) says that it is an error to mix
+// wide- and narrow-oriented I/O on the same stream. This implies
+// that it is an error to use both cin and wcin in the same C++
+// program; the same applies to cout and wcout, and cerr/clog and
+// wcerr/wclog.
+
+extern _STLP_DECLSPEC istream cin;
+
+# ifdef _STLP_REDIRECT_STDSTREAMS
+extern _STLP_DECLSPEC ofstream cout;
+extern _STLP_DECLSPEC ofstream cerr;
+extern _STLP_DECLSPEC ofstream clog;
+# else
+extern _STLP_DECLSPEC ostream cout;
+extern _STLP_DECLSPEC ostream cerr;
+extern _STLP_DECLSPEC ostream clog;
+# endif
+
+# ifndef _STLP_NO_WCHAR_T
+extern _STLP_DECLSPEC wistream wcin;
+extern _STLP_DECLSPEC wostream wcout;
+extern _STLP_DECLSPEC wostream wcerr;
+extern _STLP_DECLSPEC wostream wclog;
+# endif
+
+_STLP_END_NAMESPACE
+
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1037) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iostream>
+# else
+# include _STLP_NATIVE_HEADER(iostream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/iostream.h b/build/stlport/stlport/iostream.h
new file mode 100644
index 000000000..2e7a7a9fe
--- /dev/null
+++ b/build/stlport/stlport/iostream.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOSTREAM_H
+#define _STLP_IOSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2035
+# include <stl/_prolog.h>
+#endif
+
+#include <iostream>
+
+// Those should be included all separately, as they do contain using declarations
+#include <streambuf.h>
+#include <ostream.h>
+#include <istream.h>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::cin;
+using _STLP_STD::cout;
+using _STLP_STD::clog;
+using _STLP_STD::cerr;
+using _STLP_STD::iostream;
+# ifndef _STLP_NO_WCHAR_T
+using _STLP_STD::wcin;
+using _STLP_STD::wcout;
+using _STLP_STD::wclog;
+using _STLP_STD::wcerr;
+# endif
+# endif
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+// Obsolete classes for old-style backwards compatibility
+
+
+class istream_withassign : public istream {
+ public:
+ istream_withassign() : istream((streambuf*)0) {}
+ ~istream_withassign() {}
+
+ istream_withassign& operator=(istream& __s) {
+ ios::init(__s.rdbuf());
+ return *this;
+ }
+ istream_withassign& operator=(streambuf* __s) {
+ ios::init(__s);
+ return *this;
+ }
+};
+
+class ostream_withassign : public ostream {
+ public:
+ ostream_withassign() : ostream((streambuf*)0) {}
+ ~ostream_withassign() {}
+
+ ostream_withassign& operator=(ostream& __s) {
+ ios::init(__s.rdbuf());
+ return *this;
+ }
+ ostream_withassign& operator=(streambuf* __s) {
+ ios::init(__s);
+ return *this;
+ }
+};
+
+class iostream_withassign : public iostream {
+ public:
+ iostream_withassign() : iostream((streambuf*)0) {}
+ ~iostream_withassign() {}
+ iostream_withassign & operator=(ios& __i) {
+ ios::init(__i.rdbuf());
+ return *this;
+ }
+ iostream_withassign & operator=(streambuf* __s) {
+ ios::init(__s);
+ return *this;
+ }
+} ;
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2035)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/iso646.h b/build/stlport/stlport/iso646.h
new file mode 100644
index 000000000..858863aef
--- /dev/null
+++ b/build/stlport/stlport/iso646.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x204
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have iso646.h */
+#if !defined (_STLP_WCE_EVC3) && !defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iso646.h>
+# else
+# include _STLP_NATIVE_C_HEADER(iso646.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x204)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
diff --git a/build/stlport/stlport/istream b/build/stlport/stlport/istream
new file mode 100644
index 000000000..d4ca903ab
--- /dev/null
+++ b/build/stlport/stlport/istream
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ISTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1036
+# include <stl/_prolog.h>
+# define _STLP_ISTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1036) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1036) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <istream>
+# else
+# include _STLP_NATIVE_HEADER(istream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1036)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ISTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/istream.h b/build/stlport/stlport/istream.h
new file mode 100644
index 000000000..d382d96e3
--- /dev/null
+++ b/build/stlport/stlport/istream.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ISTREAM_H
+#define _STLP_ISTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2037
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <istream>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::basic_istream;
+using _STLP_STD::basic_iostream;
+using _STLP_STD::istream;
+using _STLP_STD::iostream;
+using _STLP_STD::ios;
+# ifndef _STLP_NO_WCHAR_T
+using _STLP_STD::wistream;
+using _STLP_STD::wiostream;
+# endif
+using _STLP_STD::ws;
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2037)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ISTREAM_H */
diff --git a/build/stlport/stlport/iterator b/build/stlport/stlport/iterator
new file mode 100644
index 000000000..f8d3deee7
--- /dev/null
+++ b/build/stlport/stlport/iterator
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ITERATOR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x38
+# include <stl/_prolog.h>
+# define _STLP_ITERATOR
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x38)
+# ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+# endif
+
+# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H
+# include <stl/_stream_iterator.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x38) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iterator>
+# else
+# include _STLP_NATIVE_HEADER(iterator)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x38)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ITERATOR */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/limits b/build/stlport/stlport/limits
new file mode 100644
index 000000000..5333b14fd
--- /dev/null
+++ b/build/stlport/stlport/limits
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x39
+# include <stl/_prolog.h>
+# define _STLP_LIMITS
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
+# ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x39) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits>
+# else
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LIMITS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/limits.h b/build/stlport/stlport/limits.h
new file mode 100644
index 000000000..aab553b65
--- /dev/null
+++ b/build/stlport/stlport/limits.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x201
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined(_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits.h>
+#else
+# include _STLP_NATIVE_C_HEADER(limits.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x201)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
diff --git a/build/stlport/stlport/list b/build/stlport/stlport/list
new file mode 100644
index 000000000..647a8be5d
--- /dev/null
+++ b/build/stlport/stlport/list
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIST
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x40
+# include <stl/_prolog.h>
+# define _STLP_LIST
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
+# ifndef _STLP_INTERNAL_LIST_H
+# include <stl/_list.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x40) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <list>
+# else
+# include _STLP_NATIVE_HEADER(list)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LIST */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/locale b/build/stlport/stlport/locale
new file mode 100644
index 000000000..22cd01fb0
--- /dev/null
+++ b/build/stlport/stlport/locale
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_LOCALE
+
+// Basic framework: class locale and class locale::facet
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1041
+# include <stl/_prolog.h>
+# define _STLP_LOCALE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1041) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+// Individual facets
+# ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+# endif
+
+# ifndef _STLP_INTERNAL_CODECVT_H
+# include <stl/_codecvt.h>
+# endif
+
+# ifndef _STLP_INTERNAL_COLLATE_H
+# include <stl/_collate.h>
+# endif
+
+# ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+# endif
+
+# ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+# endif
+
+// those never included separately anyway
+# include <stl/_monetary.h>
+# include <stl/_time_facets.h>
+# include <stl/_messages_facets.h>
+
+// some stuff for streambuf iterators ended up defined there
+// Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
+// programs if we omit it
+# ifndef _STLP_ISTREAM_H
+# include <stl/_istream.h>
+# endif
+
+// Convenience interfaces
+#undef isspace
+#undef isprint
+#undef iscntrl
+#undef isupper
+#undef islower
+#undef isalpha
+#undef isdigit
+#undef ispunct
+#undef isxdigit
+#undef isalnum
+#undef isgraph
+#undef toupper
+#undef tolower
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT>
+inline bool isspace (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
+
+template <class _CharT>
+inline bool isprint (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
+
+template <class _CharT>
+inline bool iscntrl (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
+
+template <class _CharT>
+inline bool isupper (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
+
+template <class _CharT>
+inline bool islower (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
+
+template <class _CharT>
+inline bool isalpha (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c); }
+
+template <class _CharT>
+inline bool isdigit (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
+
+template <class _CharT>
+inline bool ispunct (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c); }
+
+template <class _CharT>
+inline bool isxdigit (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
+
+template <class _CharT>
+inline bool isalnum (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
+
+template <class _CharT>
+inline bool isgraph (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
+
+template <class _CharT>
+inline _CharT toupper(_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
+
+template <class _CharT>
+inline _CharT tolower(_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
+
+_STLP_END_NAMESPACE
+
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1041) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <locale>
+# else
+# include _STLP_NATIVE_HEADER(locale)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LOCALE */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/locale.h b/build/stlport/stlport/locale.h
new file mode 100644
index 000000000..81b56b47b
--- /dev/null
+++ b/build/stlport/stlport/locale.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x242
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x242)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# else
+# error STLport include schema violation
+# endif
+#endif
+
+/* evc3 doesn't have locale.h */
+#ifndef _STLP_WCE_EVC3
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <locale.h>
+# else
+# include _STLP_NATIVE_C_HEADER(locale.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x242)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/build/stlport/stlport/map b/build/stlport/stlport/map
new file mode 100644
index 000000000..f30c400c5
--- /dev/null
+++ b/build/stlport/stlport/map
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x43
+# include <stl/_prolog.h>
+# define _STLP_MAP
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
+# ifndef _STLP_INTERNAL_MAP_H
+# include <stl/_map.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x43) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <map>
+# else
+# include _STLP_NATIVE_HEADER(map)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/math.h b/build/stlport/stlport/math.h
new file mode 100644
index 000000000..32b666f05
--- /dev/null
+++ b/build/stlport/stlport/math.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x244
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \
+ !(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3)
+# define _STLP_EXCEPTION_WAS_REDEFINED 1
+# define exception __math_exception
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <math.h>
+#else
+# include _STLP_NATIVE_C_HEADER(math.h)
+#endif
+
+#if defined (_STLP_EXCEPTION_WAS_REDEFINED)
+# undef exception
+# undef _STLP_EXCEPTION_WAS_REDEFINED
+#endif
+
+#ifdef _STLP_WCE_EVC3
+# undef _exception
+# define _exception exception
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x244)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
diff --git a/build/stlport/stlport/mem.h b/build/stlport/stlport/mem.h
new file mode 100644
index 000000000..2ebeceaaf
--- /dev/null
+++ b/build/stlport/stlport/mem.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_mem_h
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x245
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x245) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x245) || defined (_STLP_DONT_POP_HEADER_ID)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <mem.h>
+# else
+# include _STLP_NATIVE_C_HEADER(mem.h)
+# endif
+#else
+# if defined (__BORLANDC__) && defined (__USING_CNAME__)
+# define _USING_CNAME_WAS_UNDEFINED
+# undef __USING_CNAME__
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <mem.h>
+# else
+# include _STLP_NATIVE_C_HEADER(mem.h)
+# endif
+
+# if defined (__BORLANDC__) && defined (_USING_CNAME_WAS_UNDEFINED)
+# define __USING_CNAME__
+# define _STLP_mem_h 1
+# undef _USING_CNAME_WAS_UNDEFINED
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x245)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+#endif /* _STLP_mem_h */
diff --git a/build/stlport/stlport/memory b/build/stlport/stlport/memory
new file mode 100644
index 000000000..3c0ceb38b
--- /dev/null
+++ b/build/stlport/stlport/memory
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MEMORY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x46
+# include <stl/_prolog.h>
+# define _STLP_MEMORY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
+# ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+# endif
+
+# ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+# endif
+
+# ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H
+# include <stl/_raw_storage_iter.h>
+# endif
+
+# include <stl/_auto_ptr.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x46) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (__MSL__)
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+
+# if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+# define BOOST_TR1_MEMORY_INCLUDED
+# define BOOST_TR1_FULL_MEMORY_INCLUDED
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <memory>
+# else
+# include _STLP_NATIVE_HEADER(memory)
+# endif
+
+# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201)
+/* 980401 vss MSL 2.4 Pro 3 Release */
+# include <new_mem.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+namespace boost {
+
+class bad_weak_ptr;
+template<class T> class shared_ptr;
+template<class T> class weak_ptr;
+template<class T> class enable_shared_from_this;
+template<class D, class T> D * get_deleter(shared_ptr<T> const & p);
+template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r);
+template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r);
+template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r);
+template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b);
+template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b);
+
+namespace detail{
+class shared_count;
+class weak_count;
+}
+
+} // namespace boost
+
+# ifndef BOOST_SHARED_PTR_HPP_INCLUDED
+# include <boost/shared_ptr.hpp>
+# endif
+# ifndef BOOST_WEAK_PTR_HPP_INCLUDED
+# include <boost/weak_ptr.hpp>
+# endif
+# ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+# include <boost/enable_shared_from_this.hpp>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::bad_weak_ptr;
+using ::boost::shared_ptr;
+using ::boost::swap;
+using ::boost::static_pointer_cast;
+using ::boost::dynamic_pointer_cast;
+using ::boost::const_pointer_cast;
+using ::boost::get_deleter;
+using ::boost::weak_ptr;
+using ::boost::enable_shared_from_this;
+
+// shared_ptr IO
+// weak_ptr IO
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
+
+#endif /* _STLP_MEMORY */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/new b/build/stlport/stlport/new
new file mode 100644
index 000000000..974ca4480
--- /dev/null
+++ b/build/stlport/stlport/new
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_NEW_HEADER
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x447
+# define _STLP_NEW_HEADER
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
+# ifndef _STLP_NEW_H_HEADER
+# include <stl/_new.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x447) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <new>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_NEW */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/new.h b/build/stlport/stlport/new.h
new file mode 100644
index 000000000..0a9bf33e8
--- /dev/null
+++ b/build/stlport/stlport/new.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x848
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_NEW_HEADER)
+# if defined (__BORLANDC__)
+# include <new>
+# elif defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <new.h>
+# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER))
+# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
+# else
+# if defined (__GNUC__) && (__GNUC__ >= 3)
+# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
+# endif
+# endif
+#endif /* !defined(_STLP_NO_NEW_HEADER) */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x848)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/numeric b/build/stlport/stlport/numeric
new file mode 100644
index 000000000..79e46471b
--- /dev/null
+++ b/build/stlport/stlport/numeric
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_NUMERIC
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x49
+# include <stl/_prolog.h>
+# define _STLP_NUMERIC
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
+# ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x49) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <numeric>
+# else
+# include _STLP_NATIVE_HEADER(numeric)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_NUMERIC */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ostream b/build/stlport/stlport/ostream
new file mode 100644
index 000000000..5134d9c9e
--- /dev/null
+++ b/build/stlport/stlport/ostream
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_OSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1050
+# include <stl/_prolog.h>
+# define _STLP_OSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1050) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_OSTREAM
+# include <stl/_ostream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1050) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ostream>
+# else
+# include _STLP_NATIVE_HEADER(ostream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1050)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/ostream.h b/build/stlport/stlport/ostream.h
new file mode 100644
index 000000000..b6a76649e
--- /dev/null
+++ b/build/stlport/stlport/ostream.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OSTREAM_H
+#define _STLP_OSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2051
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <ostream>
+
+#ifdef _STLP_USE_NAMESPACES
+# include <using/ostream>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2051)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OSTREAM_H */
diff --git a/build/stlport/stlport/pthread.h b/build/stlport/stlport/pthread.h
new file mode 100644
index 000000000..4f0d90c83
--- /dev/null
+++ b/build/stlport/stlport/pthread.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x280
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x280) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined (__SUNPRO_CC) || defined (__HP_aCC)
+# include "/usr/include/pthread.h"
+#else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <pthread.h>
+# else
+# include _STLP_NATIVE_C_HEADER(pthread.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x280)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
diff --git a/build/stlport/stlport/pthread_alloc b/build/stlport/stlport/pthread_alloc
new file mode 100644
index 000000000..c5ccbcb9a
--- /dev/null
+++ b/build/stlport/stlport/pthread_alloc
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_PTHREAD_ALLOC
+#define _STLP_PTHREAD_ALLOC
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x52
+# include <stl/_prolog.h>
+# endif
+
+# ifdef _STLP_PRAGMA_ONCE
+# pragma once
+# endif
+
+# include <stl/_pthread_alloc.h>
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x52)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+#endif /* _STLP_PTHREAD_ALLOC */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/queue b/build/stlport/stlport/queue
new file mode 100644
index 000000000..6acd63fdd
--- /dev/null
+++ b/build/stlport/stlport/queue
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_QUEUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x53
+# include <stl/_prolog.h>
+# define _STLP_QUEUE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
+# ifndef _STLP_INTERNAL_QUEUE_H
+# include <stl/_queue.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x53) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <queue>
+# else
+# include _STLP_NATIVE_HEADER(queue)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_QUEUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/rlocks.h b/build/stlport/stlport/rlocks.h
new file mode 100644
index 000000000..84db1f404
--- /dev/null
+++ b/build/stlport/stlport/rlocks.h
@@ -0,0 +1,11 @@
+#ifndef _STLP_misc_rlocks_h
+# define _STLP_misc_rlocks_h
+# if (__SUNPRO_CC >= 0x500 )
+# include <../CCios/rlocks.h>
+# elif defined (__SUNPRO_CC)
+# include <../CC/rlocks.h>
+# else
+# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers."
+# endif
+#endif
+
diff --git a/build/stlport/stlport/rope b/build/stlport/stlport/rope
new file mode 100644
index 000000000..4faa36b65
--- /dev/null
+++ b/build/stlport/stlport/rope
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef _STLP_ROPE
+#define _STLP_ROPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x54
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use rope class even if you ask for
+ * no extension.
+ */
+# error The rope class is a STLport extension.
+#endif
+
+#include <stl/_rope.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x54)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ROPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/set b/build/stlport/stlport/set
new file mode 100644
index 000000000..ed79d89fb
--- /dev/null
+++ b/build/stlport/stlport/set
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x55
+# include <stl/_prolog.h>
+# define _STLP_SET
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
+# ifndef _STLP_INTERNAL_SET_H
+# include <stl/_set.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x55) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <set>
+# else
+# include _STLP_NATIVE_HEADER(set)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/setjmp.h b/build/stlport/stlport/setjmp.h
new file mode 100644
index 000000000..3d3f5ef92
--- /dev/null
+++ b/build/stlport/stlport/setjmp.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_SETJMP_H
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x256
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x256) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_SETJMP_H
+#endif
+
+#if defined(_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if !defined (setjmp)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <setjmp.h>
+# else
+# include _STLP_NATIVE_C_HEADER(setjmp.h)
+# endif
+#endif
+
+#if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+/* See errno.h file for a description of this problem. */
+# error setjmp has been defined before inclusion of setjmp.h header.
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x256)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+#endif /* _STLP_SETJMP_H */
diff --git a/build/stlport/stlport/signal.h b/build/stlport/stlport/signal.h
new file mode 100644
index 000000000..27f91be32
--- /dev/null
+++ b/build/stlport/stlport/signal.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x257
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x257) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 and evc4 don't have signal.h */
+#ifndef _STLP_WCE
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <signal.h>
+# else
+# include _STLP_NATIVE_C_HEADER(signal.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x257)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
diff --git a/build/stlport/stlport/slist b/build/stlport/stlport/slist
new file mode 100644
index 000000000..c1930e4f7
--- /dev/null
+++ b/build/stlport/stlport/slist
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _STLP_SLIST
+#define _STLP_SLIST
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x58
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#if defined (_STLP_NO_EXTENSIONS)
+/* Comment following if you want to use the slist constainer even if you ask for
+ * no extension.
+ */
+# error The slist class is an STLport extension.
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_STD)
+//This is not a Standard header, it might failed for most of
+//the compilers so we comment it for the moment. Should be uncommented
+//on a compiler basis.
+//# include _STLP_NATIVE_HEADER(slist)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x58)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SLIST */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/sstream b/build/stlport/stlport/sstream
new file mode 100644
index 000000000..336bdde19
--- /dev/null
+++ b/build/stlport/stlport/sstream
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// This header defines classes basic_stringbuf, basic_istringstream,
+// basic_ostringstream, and basic_stringstream. These classes
+// represent streamsbufs and streams whose sources or destinations are
+// C++ strings.
+
+#ifndef _STLP_SSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1059
+# include <stl/_prolog.h>
+# define _STLP_SSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1059) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1059) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <sstream>
+# else
+# include _STLP_NATIVE_HEADER(sstream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1059)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stack b/build/stlport/stlport/stack
new file mode 100644
index 000000000..253b31d2f
--- /dev/null
+++ b/build/stlport/stlport/stack
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STACK
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x60
+# include <stl/_prolog.h>
+# define _STLP_STACK
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
+# ifndef _STLP_INTERNAL_STACK_H
+# include <stl/_stack.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x60) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stack>
+# else
+# include _STLP_NATIVE_HEADER(stack)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STACK */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stdarg.h b/build/stlport/stlport/stdarg.h
new file mode 100644
index 000000000..368e6724b
--- /dev/null
+++ b/build/stlport/stlport/stdarg.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdarg.h, which results in warnings and errors
+ */
+#if !defined (RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x261
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdarg.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x261)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+#endif /* RC_INVOKED */
diff --git a/build/stlport/stlport/stddef.h b/build/stlport/stlport/stddef.h
new file mode 100644
index 000000000..f959c23af
--- /dev/null
+++ b/build/stlport/stlport/stddef.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x262
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined (_MSC_VER) || defined (__DMC__)
+/* Native stddef.h contains errno macro definition making inclusion of native
+ * errno.h in STLport errno.h impossible. We are then forced to include errno.h
+ * first.
+ */
+# include "errno.h"
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+#else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x262)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/build/stlport/stlport/stdexcept b/build/stlport/stlport/stdexcept
new file mode 100644
index 000000000..dbb96b9a9
--- /dev/null
+++ b/build/stlport/stlport/stdexcept
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STDEXCEPT
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x63
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_STDEXCEPT
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
+# ifndef _STLP_INTERNAL_STDEXCEPT
+# include <stl/_stdexcept.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdexcept>
+# else
+# include _STLP_NATIVE_HEADER(stdexcept)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_STDEXCEPT */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stdio.h b/build/stlport/stlport/stdio.h
new file mode 100644
index 000000000..e2dbdeae3
--- /dev/null
+++ b/build/stlport/stlport/stdio.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdarg.h, which results in warnings and errors
+ */
+#if !defined(RC_INVOKED)
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x264
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdio.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdio.h)
+# endif
+
+# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE)
+# define _STRUCT_FILE
+# endif
+
+# if defined (__BORLANDC__) && defined (__cplusplus) && !defined (__linux__)
+_STLP_BEGIN_NAMESPACE
+using __std_alias::_streams;
+_STLP_END_NAMESPACE
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x264)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+
+#endif /* RC_INVOKED */
diff --git a/build/stlport/stlport/stdiostream.h b/build/stlport/stlport/stdiostream.h
new file mode 100644
index 000000000..80a5c672f
--- /dev/null
+++ b/build/stlport/stlport/stdiostream.h
@@ -0,0 +1,10 @@
+#ifndef _STLP_misc_stdiostream_h
+# define _STLP_misc_stdiostream_h
+# if (__SUNPRO_CC >= 0x500 )
+# include <../CCios/stdiostream.h>
+# else if defined (__SUNPRO_CC)
+# include <../CC/stdiostream.h>
+# else
+# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers."
+# endif
+#endif
diff --git a/build/stlport/stlport/stdlib.h b/build/stlport/stlport/stdlib.h
new file mode 100644
index 000000000..fd55f8a8f
--- /dev/null
+++ b/build/stlport/stlport/stdlib.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdlib.h, which results in warnings and errors
+ */
+#if !defined (RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x265
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined (_STLP_MSVC_LIB) || (defined (__GNUC__) && defined (__MINGW32__)) || \
+ defined (__BORLANDC__) || defined (__DMC__) || \
+ (defined (__HP_aCC) && defined (_REENTRANT))
+/* Native stdlib.h contains errno macro definition making inclusion of native
+ * errno.h in STLport errno.h impossible. We are then forced to include errno.h
+ * first.
+ */
+# include "errno.h"
+# endif
+
+/*
+ forward-declaration for _exception struct; prevents warning message
+ ../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses
+*/
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdlib.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdlib.h)
+# endif
+
+/* on evc3/evc4 including stdlib.h also defines setjmp macro */
+# if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x265)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+
+#endif /* RC_INVOKED */
diff --git a/build/stlport/stlport/stl/_abbrevs.h b/build/stlport/stlport/stl/_abbrevs.h
new file mode 100644
index 000000000..c4acac8b1
--- /dev/null
+++ b/build/stlport/stlport/stl/_abbrevs.h
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ABBREVS_H
+# define _STLP_INTERNAL_ABBREVS_H
+
+// ugliness is intentional - to reduce conflicts
+# define input_iterator_tag _In__ItT
+# define output_iterator_tag _Ou__ItT
+# define bidirectional_iterator_tag _Bd__ItT
+# define random_access_iterator_tag _Ra__ItT
+# define input_iterator _In__It
+# define output_iterator _Ou__It
+# define bidirectional_iterator _Bd__It
+# define random_access_iterator _Ra__It
+# define reverse_bidirectional_iterator _rBd__It
+# define reverse_iterator _r__It
+# define back_insert_iterator _bI__It
+# define front_insert_iterator _fI__It
+# define raw_storage_iterator _rS__It
+# define _Const_traits _C_Tr
+# define _Const_Const_traits _CC_Tr
+# define _Nonconst_traits _N_Tr
+# define _Nonconst_Const_traits _NC_Tr
+
+// ugliness is intentional - to reduce conflicts probability
+# define __malloc_alloc M__A
+# define __node_alloc D__A
+# define __new_alloc N__A
+# define __debug_alloc G__A
+# define _STLP_alloc_proxy P__A
+
+# define _Deque_iterator_base _Dq__ItB
+# define _Deque_iterator _Dq__It
+
+# define _Select1st _S1st
+# define _Select2nd _S2nd
+# define __move_source __m_s
+# define _Vector_nonconst_traits _V_nct
+
+# define _Ht_iterator _Ht_It
+
+# define _List_node_base _L__NB
+# define _List_iterator_base _L__ItB
+# define _List_iterator _L__It
+
+# define _Slist_iterator_base _SL__ItB
+# define _Slist_iterator _SL__It
+
+# define _Rb_tree_node_base _rbT__NB
+# define _Rb_tree_node _rbT__N
+# define _Rb_tree_base_iterator _rbT__It
+# define _Rb_tree_base _rbT__B
+
+# if defined (__DMC__) && defined (_STLP_DEBUG)
+# define _NonDbg_hashtable _Nd_Ht
+# define _DBG_iter _d__It
+# endif
+#endif
+
diff --git a/build/stlport/stlport/stl/_algo.c b/build/stlport/stlport/stl/_algo.c
new file mode 100644
index 000000000..b58b92dc8
--- /dev/null
+++ b/build/stlport/stlport/stl/_algo.c
@@ -0,0 +1,2028 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ALGO_C
+#define _STLP_ALGO_C
+
+#if !defined (_STLP_INTERNAL_ALGO_H)
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Distance, class _Compare>
+void __merge_without_buffer(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp);
+
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BidirectionalIter3, class _Compare>
+_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
+ _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2,
+ _BidirectionalIter2 __last2,
+ _BidirectionalIter3 __result,
+ _Compare __comp);
+
+template <class _Tp>
+#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
+inline
+#endif
+const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) {
+ if (__a < __b)
+ if (__b < __c)
+ return __b;
+ else if (__a < __c)
+ return __c;
+ else
+ return __a;
+ else if (__a < __c)
+ return __a;
+ else if (__b < __c)
+ return __c;
+ else
+ return __b;
+}
+
+template <class _Tp, class _Compare>
+#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
+inline
+#endif
+const _Tp&
+__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) {
+ if (__comp(__a, __b)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__b, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ if (__comp(__b, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __b;
+ }
+ else if (__comp(__a, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __c;
+ }
+ else
+ return __a;
+ }
+ else if (__comp(__a, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __a;
+ }
+ else if (__comp(__b, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __c;
+ }
+ else
+ return __b;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIter2 __p1(__first2);
+
+ if ( ++__p1 == __last2 )
+ return find(__first1, __last1, *__first2);
+
+ // General case.
+
+ for ( ; ; ) { // __first1 != __last1 will be checked in find below
+ __first1 = find(__first1, __last1, *__first2);
+ if (__first1 == __last1)
+ return __last1;
+
+ _ForwardIter2 __p = __p1;
+ _ForwardIter1 __current = __first1;
+ if (++__current == __last1)
+ return __last1;
+
+ while (*__current == *__p) {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+
+ ++__first1;
+ }
+ return __first1;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Integer, class _Tp,
+ class _BinaryPred, class _Distance>
+_RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __pred,
+ _Distance*, const random_access_iterator_tag &)
+{
+ _Distance __tailSize = __last - __first;
+ const _Distance __pattSize = __count;
+ const _Distance __skipOffset = __pattSize - 1;
+ _RandomAccessIter __backTrack;
+ _Distance __remainder, __prevRemainder;
+
+ for ( _RandomAccessIter __lookAhead = __first + __skipOffset; __tailSize >= __pattSize; __lookAhead += __pattSize ) { // the main loop...
+ //__lookAhead here is always pointing to the last element of next possible match.
+ __tailSize -= __pattSize;
+
+ while ( !__pred(*__lookAhead, __val) ) { // the skip loop...
+ if (__tailSize < __pattSize)
+ return __last;
+
+ __lookAhead += __pattSize;
+ __tailSize -= __pattSize;
+ }
+
+ if ( __skipOffset == 0 ) {
+ return (__lookAhead - __skipOffset); //Success
+ }
+
+ __remainder = __skipOffset;
+
+ for (__backTrack = __lookAhead; __pred(*--__backTrack, __val); ) {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); //Success
+ }
+
+ if (__remainder > __tailSize)
+ return __last; //failure
+
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+
+ while ( __pred(*__lookAhead, __val) ) {
+ __prevRemainder = __remainder;
+ __backTrack = __lookAhead;
+
+ do {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); //Success
+ } while (__pred(*--__backTrack, __val));
+
+ //adjust remainder for next comparison
+ __remainder += __pattSize - __prevRemainder;
+
+ if (__remainder > __tailSize)
+ return __last; //failure
+
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+ }
+
+ //__lookAhead here is always pointing to the element of the last mismatch.
+ }
+
+ return __last; //failure
+}
+
+template <class _ForwardIter, class _Integer, class _Tp,
+ class _Distance, class _BinaryPred>
+_ForwardIter __search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __pred,
+ _Distance*, const forward_iterator_tag &) {
+ for (; (__first != __last) && !__pred(*__first, __val); ++__first) {}
+ while (__first != __last) {
+ _Integer __n = __count - 1;
+ _ForwardIter __i = __first;
+ ++__i;
+ while (__i != __last && __n != 0 && __pred(*__i, __val)) {
+ ++__i;
+ --__n;
+ }
+ if (__n == 0)
+ return __first;
+ else if (__i != __last)
+ for (__first = ++__i; (__first != __last) && !__pred(*__first, __val); ++__first) {}
+ else
+ break;
+ }
+ return __last;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// search_n. Search for __count consecutive copies of __val.
+template <class _ForwardIter, class _Integer, class _Tp>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__count <= 0)
+ return __first;
+ if (__count == 1)
+ //We use find when __count == 1 to use potential find overload.
+ return find(__first, __last, __val);
+ return _STLP_PRIV __search_n(__first, __last, __count, __val, equal_to<_Tp>(),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val,
+ _BinaryPred __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__count <= 0)
+ return __first;
+ return _STLP_PRIV __search_n(__first, __last, __count, __val, __binary_pred,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
+ _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
+#else
+ forward_iterator_tag(),
+ forward_iterator_tag(),
+#endif
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _ForwardIter1))
+ );
+}
+
+// unique and unique_copy
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _BinaryPredicate,
+ class _Tp>
+_STLP_INLINE_LOOP _OutputIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ _BinaryPredicate __binary_pred, _Tp*) {
+ _Tp __val = *__first;
+ *__result = __val;
+ while (++__first != __last)
+ if (!__binary_pred(__val, *__first)) {
+ __val = *__first;
+ *++__result = __val;
+ }
+ return ++__result;
+}
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+inline _OutputIter
+__unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred, const output_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_STLP_INLINE_LOOP _ForwardIter
+__unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _BinaryPredicate __binary_pred, const forward_iterator_tag &) {
+ *__result = *__first;
+ while (++__first != __last)
+ if (!__binary_pred(*__result, *__first)) *++__result = *__first;
+ return ++__result;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIterator, class _BidirectionalIterator, class _BinaryPredicate>
+inline _BidirectionalIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _BidirectionalIterator __result, _BinaryPredicate __binary_pred,
+ const bidirectional_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
+}
+
+template <class _InputIterator, class _RandomAccessIterator, class _BinaryPredicate>
+inline _RandomAccessIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __result, _BinaryPredicate __binary_pred,
+ const random_access_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
+}
+#endif /* _STLP_NONTEMPL_BASE_MATCH_BUG */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+_OutputIter
+unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __result;
+ return _STLP_PRIV __unique_copy(__first, __last, __result,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _InputIter)),
+ _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
+}
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+_OutputIter
+unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __result;
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
+ _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
+}
+
+// rotate and rotate_copy, and their auxiliary functions
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Distance>
+_ForwardIter __rotate_aux(_ForwardIter __first,
+ _ForwardIter __middle,
+ _ForwardIter __last,
+ _Distance*,
+ const forward_iterator_tag &) {
+ if (__first == __middle)
+ return __last;
+ if (__last == __middle)
+ return __first;
+
+ _ForwardIter __first2 = __middle;
+ do {
+ _STLP_STD::swap(*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ } while (__first2 != __last);
+
+ _ForwardIter __new_middle = __first;
+
+ __first2 = __middle;
+
+ while (__first2 != __last) {
+ _STLP_STD::swap (*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ else if (__first2 == __last)
+ __first2 = __middle;
+ }
+
+ return __new_middle;
+}
+
+template <class _BidirectionalIter, class _Distance>
+_BidirectionalIter __rotate_aux(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance*,
+ const bidirectional_iterator_tag &) {
+ if (__first == __middle)
+ return __last;
+ if (__last == __middle)
+ return __first;
+
+ _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag());
+ _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag());
+
+ while (__first != __middle && __middle != __last)
+ _STLP_STD::swap(*__first++, *--__last);
+
+ if (__first == __middle) {
+ _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag());
+ return __last;
+ }
+ else {
+ _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag());
+ return __first;
+ }
+}
+
+// rotate and rotate_copy, and their auxiliary functions
+template <class _EuclideanRingElement>
+_STLP_INLINE_LOOP
+_EuclideanRingElement __gcd(_EuclideanRingElement __m,
+ _EuclideanRingElement __n) {
+ while (__n != 0) {
+ _EuclideanRingElement __t = __m % __n;
+ __m = __n;
+ __n = __t;
+ }
+ return __m;
+}
+
+template <class _RandomAccessIter, class _Distance, class _Tp>
+_RandomAccessIter __rotate_aux(_RandomAccessIter __first,
+ _RandomAccessIter __middle,
+ _RandomAccessIter __last,
+ _Distance *, _Tp *) {
+
+ _Distance __n = __last - __first;
+ _Distance __k = __middle - __first;
+ _Distance __l = __n - __k;
+ _RandomAccessIter __result = __first + (__last - __middle);
+
+ if (__k == 0) /* __first == middle */
+ return __last;
+
+ if (__k == __l) {
+ _STLP_STD::swap_ranges(__first, __middle, __middle);
+ return __result;
+ }
+
+ _Distance __d = _STLP_PRIV __gcd(__n, __k);
+
+ for (_Distance __i = 0; __i < __d; __i++) {
+ _Tp __tmp = *__first;
+ _RandomAccessIter __p = __first;
+
+ if (__k < __l) {
+ for (_Distance __j = 0; __j < __l/__d; __j++) {
+ if (__p > __first + __l) {
+ *__p = *(__p - __l);
+ __p -= __l;
+ }
+
+ *__p = *(__p + __k);
+ __p += __k;
+ }
+ }
+
+ else {
+ for (_Distance __j = 0; __j < __k/__d - 1; __j ++) {
+ if (__p < __last - __k) {
+ *__p = *(__p + __k);
+ __p += __k;
+ }
+
+ *__p = * (__p - __l);
+ __p -= __l;
+ }
+ }
+
+ *__p = __tmp;
+ ++__first;
+ }
+
+ return __result;
+}
+
+template <class _RandomAccessIter, class _Distance>
+inline _RandomAccessIter
+__rotate_aux(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last,
+ _Distance * __dis, const random_access_iterator_tag &) {
+ return _STLP_PRIV __rotate_aux(__first, __middle, __last,
+ __dis, _STLP_VALUE_TYPE(__first, _RandomAccessIter));
+}
+
+template <class _ForwardIter>
+_ForwardIter
+__rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(__check_range(__middle, __last))
+ return __rotate_aux(__first, __middle, __last,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter>
+void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
+ _STLP_PRIV __rotate(__first, __middle, __last);
+}
+
+// Return a random number in the range [0, __n). This function encapsulates
+// whether we're using rand (part of the standard C library) or lrand48
+// (not standard, but a much better choice whenever it's available).
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Distance>
+inline _Distance __random_number(_Distance __n) {
+#ifdef _STLP_NO_DRAND48
+ return rand() % __n;
+#else
+ return lrand48() % __n;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void random_shuffle(_RandomAccessIter __first,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ iter_swap(__i, __first + _STLP_PRIV __random_number((__i - __first) + 1));
+}
+
+template <class _RandomAccessIter, class _RandomNumberGenerator>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
+ _RandomNumberGenerator &__rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ iter_swap(__i, __first + __rand((__i - __first) + 1));
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// random_sample and random_sample_n (extensions, not part of the standard).
+template <class _ForwardIter, class _OutputIter, class _Distance>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Distance __remaining = _STLP_STD::distance(__first, __last);
+ _Distance __m = (min) (__n, __remaining);
+
+ while (__m > 0) {
+ if (_STLP_PRIV __random_number(__remaining) < __m) {
+ *__out_ite = *__first;
+ ++__out_ite;
+ --__m;
+ }
+
+ --__remaining;
+ ++__first;
+ }
+ return __out_ite;
+}
+
+
+template <class _ForwardIter, class _OutputIter, class _Distance,
+ class _RandomNumberGenerator>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n,
+ _RandomNumberGenerator& __rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Distance __remaining = _STLP_STD::distance(__first, __last);
+ _Distance __m = (min) (__n, __remaining);
+
+ while (__m > 0) {
+ if (__rand(__remaining) < __m) {
+ *__out_ite = *__first;
+ ++__out_ite;
+ --__m;
+ }
+
+ --__remaining;
+ ++__first;
+ }
+ return __out_ite;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter, class _Distance>
+_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_ite,
+ const _Distance __n) {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out_ite[__m] = *__first;
+
+ while (__first != __last) {
+ ++__t;
+ _Distance __M = __random_number(__t);
+ if (__M < __n)
+ __out_ite[__M] = *__first;
+ ++__first;
+ }
+
+ return __out_ite + __m;
+}
+
+template <class _InputIter, class _RandomAccessIter,
+ class _RandomNumberGenerator, class _Distance>
+_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_ite,
+ _RandomNumberGenerator& __rand,
+ const _Distance __n) {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out_ite[__m] = *__first;
+
+ while (__first != __last) {
+ ++__t;
+ _Distance __M = __rand(__t);
+ if (__M < __n)
+ __out_ite[__M] = *__first;
+ ++__first;
+ }
+
+ return __out_ite + __m;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
+ return _STLP_PRIV __random_sample(__first, __last,
+ __out_first, __out_last - __out_first);
+}
+
+template <class _InputIter, class _RandomAccessIter, class _RandomNumberGenerator>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last,
+ _RandomNumberGenerator& __rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
+ return _STLP_PRIV __random_sample(__first, __last,
+ __out_first, __rand,
+ __out_last - __out_first);
+}
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+// partition, stable_partition, and their auxiliary functions
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_STLP_INLINE_LOOP _ForwardIter __partition(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred,
+ const forward_iterator_tag &) {
+ if (__first == __last) return __first;
+
+ while (__pred(*__first))
+ if (++__first == __last) return __first;
+
+ _ForwardIter __next = __first;
+
+ while (++__next != __last) {
+ if (__pred(*__next)) {
+ _STLP_STD::swap(*__first, *__next);
+ ++__first;
+ }
+ }
+ return __first;
+}
+
+template <class _BidirectionalIter, class _Predicate>
+_STLP_INLINE_LOOP _BidirectionalIter __partition(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _Predicate __pred,
+ const bidirectional_iterator_tag &) {
+ for (;;) {
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ }
+ --__last;
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (!__pred(*__last))
+ --__last;
+ else
+ break;
+ }
+ iter_swap(__first, __last);
+ ++__first;
+ }
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _BidirectionalIter, class _Predicate>
+inline
+_BidirectionalIter __partition(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _Predicate __pred,
+ const random_access_iterator_tag &) {
+ return __partition(__first, __last, __pred, bidirectional_iterator_tag());
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __partition(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+
+/* __pred_of_first: false if we know that __pred(*__first) is false,
+ * true when we don't know the result of __pred(*__first).
+ * __not_pred_of_before_last: true if we know that __pred(*--__last) is true,
+ * false when we don't know the result of __pred(*--__last).
+ */
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Predicate, class _Distance>
+_ForwardIter __inplace_stable_partition(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred, _Distance __len,
+ bool __pred_of_first, bool __pred_of_before_last) {
+ if (__len == 1)
+ return (__pred_of_first && (__pred_of_before_last || __pred(*__first))) ? __last : __first;
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ _STLP_STD::advance(__middle, __half_len);
+ return _STLP_PRIV __rotate(_STLP_PRIV __inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false),
+ __middle,
+ _STLP_PRIV __inplace_stable_partition(__middle, __last, __pred, __len - __half_len, true, __pred_of_before_last));
+}
+
+template <class _ForwardIter, class _Pointer, class _Predicate,
+ class _Distance>
+_ForwardIter __stable_partition_adaptive(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred, _Distance __len,
+ _Pointer __buffer, _Distance __buffer_size,
+ bool __pred_of_first, bool __pred_of_before_last) {
+ if (__len <= __buffer_size) {
+ _ForwardIter __result1 = __first;
+ _Pointer __result2 = __buffer;
+ if ((__first != __last) && (!__pred_of_first || __pred(*__first))) {
+ *__result2 = *__first;
+ ++__result2; ++__first; --__len;
+ }
+ for (; __first != __last ; ++__first, --__len) {
+ if (((__len == 1) && (__pred_of_before_last || __pred(*__first))) ||
+ ((__len != 1) && __pred(*__first))){
+ *__result1 = *__first;
+ ++__result1;
+ }
+ else {
+ *__result2 = *__first;
+ ++__result2;
+ }
+ }
+ _STLP_STD::copy(__buffer, __result2, __result1);
+ return __result1;
+ }
+ else {
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ _STLP_STD::advance(__middle, __half_len);
+ return _STLP_PRIV __rotate(_STLP_PRIV __stable_partition_adaptive(__first, __middle, __pred,
+ __half_len, __buffer, __buffer_size,
+ __pred_of_first, false),
+ __middle,
+ _STLP_PRIV __stable_partition_adaptive(__middle, __last, __pred,
+ __len - __half_len, __buffer, __buffer_size,
+ true, __pred_of_before_last));
+ }
+}
+
+template <class _ForwardIter, class _Predicate, class _Tp, class _Distance>
+inline _ForwardIter
+__stable_partition_aux_aux(_ForwardIter __first, _ForwardIter __last,
+ _Predicate __pred, _Tp*, _Distance*, bool __pred_of_before_last) {
+ _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last);
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
+ return (__buf.size() > 0) ?
+ __stable_partition_adaptive(__first, __last, __pred,
+ _Distance(__buf.requested_size()),
+ __buf.begin(), __buf.size(),
+ false, __pred_of_before_last) :
+ __inplace_stable_partition(__first, __last, __pred,
+ _Distance(__buf.requested_size()),
+ false, __pred_of_before_last);
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
+}
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, _Predicate __pred,
+ const forward_iterator_tag &) {
+ return __stable_partition_aux_aux(__first, __last, __pred,
+ _STLP_VALUE_TYPE(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter), false);
+}
+
+template <class _BidirectIter, class _Predicate>
+_BidirectIter
+__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
+ const bidirectional_iterator_tag &) {
+ for (--__last;;) {
+ if (__first == __last)
+ return __first;
+ else if (!__pred(*__last))
+ --__last;
+ else
+ break;
+ }
+ ++__last;
+ //Here we know that __pred(*--__last) is true
+ return __stable_partition_aux_aux(__first, __last, __pred,
+ _STLP_VALUE_TYPE(__first, _BidirectIter),
+ _STLP_DISTANCE_TYPE(__first, _BidirectIter), true);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _BidirectIter, class _Predicate>
+_BidirectIter
+__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
+ const random_access_iterator_tag &) {
+ return __stable_partition_aux(__first, __last, __pred, bidirectional_iterator_tag());
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ }
+ return _STLP_PRIV __stable_partition_aux(__first, __last, __pred,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+_RandomAccessIter __unguarded_partition(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp __pivot, _Compare __comp) {
+ for (;;) {
+ while (__comp(*__first, __pivot)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__pivot, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__first;
+ }
+ --__last;
+ while (__comp(__pivot, *__last)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__last, __pivot), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ --__last;
+ }
+ if (!(__first < __last))
+ return __first;
+ iter_swap(__first, __last);
+ ++__first;
+ }
+}
+
+// sort() and its auxiliary functions.
+#define __stl_threshold 16
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val,
+ _Compare __comp) {
+ _RandomAccessIter __next = __last;
+ --__next;
+ while (__comp(__val, *__next)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__next, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__last = *__next;
+ __last = __next;
+ --__next;
+ }
+ *__last = __val;
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+inline void __linear_insert(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp __val, _Compare __comp) {
+ //*TY 12/26/1998 - added __val as a paramter
+ // _Tp __val = *__last; //*TY 12/26/1998 - __val supplied by caller
+ if (__comp(__val, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ copy_backward(__first, __last, __last + 1);
+ *__first = __val;
+ }
+ else
+ __unguarded_linear_insert(__last, __val, __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp *, _Compare __comp) {
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ __linear_insert<_RandomAccessIter, _Tp, _Compare>(__first, __i, *__i, __comp); //*TY 12/26/1998 - supply *__i as __val
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __unguarded_insertion_sort_aux(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp*, _Compare __comp) {
+ for (_RandomAccessIter __i = __first; __i != __last; ++__i)
+ __unguarded_linear_insert<_RandomAccessIter, _Tp, _Compare>(__i, *__i, __comp);
+}
+
+template <class _RandomAccessIter, class _Compare>
+inline void __unguarded_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Compare __comp) {
+ __unguarded_insertion_sort_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Compare>
+void __final_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ if (__last - __first > __stl_threshold) {
+ __insertion_sort(__first, __first + __stl_threshold, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp);
+ }
+ else
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Size, class _Compare>
+void __introsort_loop(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp*,
+ _Size __depth_limit, _Compare __comp) {
+ while (__last - __first > __stl_threshold) {
+ if (__depth_limit == 0) {
+ partial_sort(__first, __last, __last, __comp);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIter __cut =
+ __unguarded_partition(__first, __last,
+ _Tp(__median(*__first,
+ *(__first + (__last - __first)/2),
+ *(__last - 1), __comp)),
+ __comp);
+ __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp);
+ __last = __cut;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first != __last) {
+ _STLP_PRIV __introsort_loop(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __lg(__last - __first) * 2,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+ _STLP_PRIV __final_insertion_sort(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+ }
+}
+
+template <class _RandomAccessIter, class _Compare>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first != __last) {
+ _STLP_PRIV __introsort_loop(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __lg(__last - __first) * 2, __comp);
+ _STLP_PRIV __final_insertion_sort(__first, __last, __comp);
+ }
+}
+
+// stable_sort() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Compare>
+void __inplace_stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ if (__last - __first < 15) {
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ return;
+ }
+ _RandomAccessIter __middle = __first + (__last - __first) / 2;
+ __inplace_stable_sort(__first, __middle, __comp);
+ __inplace_stable_sort(__middle, __last, __comp);
+ __merge_without_buffer(__first, __middle, __last,
+ __middle - __first,
+ __last - __middle,
+ __comp);
+}
+
+template <class _RandomAccessIter1, class _RandomAccessIter2,
+ class _Distance, class _Compare>
+void __merge_sort_loop(_RandomAccessIter1 __first,
+ _RandomAccessIter1 __last,
+ _RandomAccessIter2 __result, _Distance __step_size,
+ _Compare __comp) {
+ _Distance __two_step = 2 * __step_size;
+
+ while (__last - __first >= __two_step) {
+ __result = merge(__first, __first + __step_size,
+ __first + __step_size, __first + __two_step,
+ __result,
+ __comp);
+ __first += __two_step;
+ }
+ __step_size = (min) (_Distance(__last - __first), __step_size);
+
+ merge(__first, __first + __step_size,
+ __first + __step_size, __last,
+ __result,
+ __comp);
+}
+
+const int __stl_chunk_size = 7;
+
+template <class _RandomAccessIter, class _Distance, class _Compare>
+void __chunk_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Distance __chunk_size, _Compare __comp) {
+ while (__last - __first >= __chunk_size) {
+ __insertion_sort(__first, __first + __chunk_size,
+ _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ __first += __chunk_size;
+ }
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Pointer, class _Distance,
+ class _Compare>
+void __merge_sort_with_buffer(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Pointer __buffer,
+ _Distance*, _Compare __comp) {
+ _Distance __len = __last - __first;
+ _Pointer __buffer_last = __buffer + __len;
+
+ _Distance __step_size = __stl_chunk_size;
+ __chunk_insertion_sort(__first, __last, __step_size, __comp);
+
+ while (__step_size < __len) {
+ __merge_sort_loop(__first, __last, __buffer, __step_size, __comp);
+ __step_size *= 2;
+ __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp);
+ __step_size *= 2;
+ }
+}
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _Distance>
+_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first,
+ _BidirectionalIter1 __middle,
+ _BidirectionalIter1 __last,
+ _Distance __len1, _Distance __len2,
+ _BidirectionalIter2 __buffer,
+ _Distance __buffer_size) {
+ if (__len1 > __len2 && __len2 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__middle, __last, __buffer);
+ _STLP_STD::copy_backward(__first, __middle, __last);
+ return _STLP_STD::copy(__buffer, __buffer_end, __first);
+ }
+ else if (__len1 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__first, __middle, __buffer);
+ _STLP_STD::copy(__middle, __last, __first);
+ return _STLP_STD::copy_backward(__buffer, __buffer_end, __last);
+ }
+ else
+ return _STLP_PRIV __rotate(__first, __middle, __last);
+}
+
+template <class _BidirectionalIter, class _Distance, class _Pointer,
+ class _Compare>
+void __merge_adaptive(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Pointer __buffer, _Distance __buffer_size,
+ _Compare __comp) {
+ if (__len1 <= __len2 && __len1 <= __buffer_size) {
+ _Pointer __buffer_end = _STLP_STD::copy(__first, __middle, __buffer);
+ _STLP_STD::merge(__buffer, __buffer_end, __middle, __last, __first, __comp);
+ }
+ else if (__len2 <= __buffer_size) {
+ _Pointer __buffer_end = _STLP_STD::copy(__middle, __last, __buffer);
+ _STLP_PRIV __merge_backward(__first, __middle, __buffer, __buffer_end, __last,
+ __comp);
+ }
+ else {
+ _BidirectionalIter __first_cut = __first;
+ _BidirectionalIter __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2) {
+ __len11 = __len1 / 2;
+ _STLP_STD::advance(__first_cut, __len11);
+ __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += _STLP_STD::distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ _STLP_STD::advance(__second_cut, __len22);
+ __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += _STLP_STD::distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle =
+ __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11,
+ __len22, __buffer, __buffer_size);
+ __merge_adaptive(__first, __first_cut, __new_middle, __len11,
+ __len22, __buffer, __buffer_size, __comp);
+ __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11,
+ __len2 - __len22, __buffer, __buffer_size, __comp);
+ }
+}
+
+template <class _RandomAccessIter, class _Pointer, class _Distance,
+ class _Compare>
+void __stable_sort_adaptive(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Pointer __buffer,
+ _Distance __buffer_size, _Compare __comp) {
+ _Distance __len = (__last - __first + 1) / 2;
+ _RandomAccessIter __middle = __first + __len;
+ if (__len > __buffer_size) {
+ __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size,
+ __comp);
+ __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size,
+ __comp);
+ }
+ else {
+ __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0,
+ __comp);
+ __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0,
+ __comp);
+ }
+ __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first),
+ _Distance(__last - __middle), __buffer, __buffer_size,
+ __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare>
+void __stable_sort_aux(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp*, _Distance*,
+ _Compare __comp) {
+ _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last);
+ if (buf.begin() == 0)
+ __inplace_stable_sort(__first, __last, __comp);
+ else
+ __stable_sort_adaptive(__first, __last, buf.begin(),
+ _Distance(buf.size()),
+ __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __stable_sort_aux(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __stable_sort_aux(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
+ __comp);
+}
+
+// partial_sort, partial_sort_copy, and auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
+ _RandomAccessIter __last, _Tp*, _Compare __comp) {
+ make_heap(__first, __middle, __comp);
+ for (_RandomAccessIter __i = __middle; __i < __last; ++__i) {
+ if (__comp(*__i, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __pop_heap(__first, __middle, __i, _Tp(*__i), __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter));
+ }
+ }
+ sort_heap(__first, __middle, __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter, class _Compare,
+ class _Distance, class _Tp>
+_RandomAccessIter __partial_sort_copy(_InputIter __first,
+ _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last,
+ _Compare __comp, _Distance*, _Tp*) {
+ if (__result_first == __result_last) return __result_last;
+ _RandomAccessIter __result_real_last = __result_first;
+ while(__first != __last && __result_real_last != __result_last) {
+ *__result_real_last = *__first;
+ ++__result_real_last;
+ ++__first;
+ }
+ make_heap(__result_first, __result_real_last, __comp);
+ while (__first != __last) {
+ if (__comp(*__first, *__result_first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__result_first, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __adjust_heap(__result_first, _Distance(0),
+ _Distance(__result_real_last - __result_first),
+ _Tp(*__first),
+ __comp);
+ }
+ ++__first;
+ }
+ sort_heap(__result_first, __result_real_last, __comp);
+ return __result_real_last;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first, _RandomAccessIter __result_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
+ return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _InputIter)),
+ _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _RandomAccessIter, class _Compare>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
+ return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
+ __comp,
+ _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+// nth_element() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Tp*, _Compare __comp) {
+ while (__last - __first > 3) {
+ _RandomAccessIter __cut =
+ __unguarded_partition(__first, __last,
+ _Tp(__median(*__first,
+ *(__first + (__last - __first)/2),
+ *(__last - 1),
+ __comp)),
+ __comp);
+ if (__cut <= __nth)
+ __first = __cut;
+ else
+ __last = __cut;
+ }
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
+ _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
+ _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+// Binary search (lower_bound, upper_bound, equal_range, binary_search).
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp,
+ class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp2(__val, *__middle)) {
+ _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __len = __half;
+ }
+ else {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ }
+ return __first;
+}
+
+template <class _ForwardIter, class _Tp,
+ class _Compare1, class _Compare2, class _Distance>
+pair<_ForwardIter, _ForwardIter>
+__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance* __dist) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp1(*__middle, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else if (__comp2(__val, *__middle)) {
+ _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __len = __half;
+ }
+ else {
+ _ForwardIter __left = _STLP_PRIV __lower_bound(__first, __middle, __val, __comp1, __comp2, __dist);
+ //Small optim: If lower_bound haven't found an equivalent value
+ //there is no need to call upper_bound.
+ if (__comp1(*__left, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__left), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return pair<_ForwardIter, _ForwardIter>(__left, __left);
+ }
+ _STLP_STD::advance(__first, __len);
+ _ForwardIter __right = _STLP_PRIV __upper_bound(++__middle, __first, __val, __comp1, __comp2, __dist);
+ return pair<_ForwardIter, _ForwardIter>(__left, __right);
+ }
+ }
+ return pair<_ForwardIter, _ForwardIter>(__first, __first);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (*__first2 < *__first1) {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Distance, class _Compare>
+void __merge_without_buffer(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp) {
+ if (__len1 == 0 || __len2 == 0)
+ return;
+ if (__len1 + __len2 == 2) {
+ if (__comp(*__middle, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ iter_swap(__first, __middle);
+ }
+ return;
+ }
+ _BidirectionalIter __first_cut = __first;
+ _BidirectionalIter __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2) {
+ __len11 = __len1 / 2;
+ _STLP_STD::advance(__first_cut, __len11);
+ __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += _STLP_STD::distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ _STLP_STD::advance(__second_cut, __len22);
+ __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += _STLP_STD::distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle
+ = _STLP_PRIV __rotate(__first_cut, __middle, __second_cut);
+ __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22,
+ __comp);
+ __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11,
+ __len2 - __len22, __comp);
+}
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BidirectionalIter3, class _Compare>
+_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
+ _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2,
+ _BidirectionalIter2 __last2,
+ _BidirectionalIter3 __result,
+ _Compare __comp) {
+ if (__first1 == __last1)
+ return copy_backward(__first2, __last2, __result);
+ if (__first2 == __last2)
+ return copy_backward(__first1, __last1, __result);
+ --__last1;
+ --__last2;
+ for (;;) {
+ if (__comp(*__last2, *__last1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__last1, *__last2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *--__result = *__last1;
+ if (__first1 == __last1)
+ return copy_backward(__first2, ++__last2, __result);
+ --__last1;
+ }
+ else {
+ *--__result = *__last2;
+ if (__first2 == __last2)
+ return copy_backward(__first1, ++__last1, __result);
+ --__last2;
+ }
+ }
+}
+
+template <class _BidirectionalIter, class _Tp,
+ class _Distance, class _Compare>
+inline void __inplace_merge_aux(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Tp*, _Distance*,
+ _Compare __comp) {
+ _Distance __len1 = _STLP_STD::distance(__first, __middle);
+ _Distance __len2 = _STLP_STD::distance(__middle, __last);
+
+ _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last);
+ if (__buf.begin() == 0)
+ __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp);
+ else
+ __merge_adaptive(__first, __middle, __last, __len1, __len2,
+ __buf.begin(), _Distance(__buf.size()),
+ __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ if (__first == __middle || __middle == __last)
+ return;
+ _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
+ _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ if (__first == __middle || __middle == __last)
+ return;
+ _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
+ _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
+ __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool __includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ else if (__comp(*__first1, *__first2))
+ ++__first1;
+ else
+ ++__first1, ++__first2;
+
+ return __first2 == __last2;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
+ return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, __comp);
+}
+
+template <class _InputIter1, class _InputIter2>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ return _STLP_PRIV __includes(__first1, __last1, __first2, __last2,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ }
+ else if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__first1;
+ }
+ else if (__comp(*__first2, *__first1))
+ ++__first2;
+ else {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ ++__result;
+ }
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(*__first2, *__first1))
+ ++__first2;
+ else {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::copy(__first1, __last1, __result);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
+_OutputIter
+__set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__first2;
+ ++__result;
+ }
+ else {
+ ++__first1;
+ ++__first2;
+ }
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result,
+ _Compare __comp) {
+ return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+// min_element and max_element, with and without an explicitly supplied
+// comparison function.
+
+template <class _ForwardIter>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last)
+ if (*__result < *__first) {
+ _STLP_VERBOSE_ASSERT(!(*__first < *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last) {
+ if (__comp(*__result, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ }
+ return __result;
+}
+
+template <class _ForwardIter>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last)
+ if (*__first < *__result) {
+ _STLP_VERBOSE_ASSERT(!(*__result < *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last) {
+ if (__comp(*__first, *__result)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__result, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ }
+ return __result;
+}
+
+// next_permutation and prev_permutation, with and without an explicitly
+// supplied comparison function.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Compare>
+bool __next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return false;
+ _BidirectionalIter __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;) {
+ _BidirectionalIter __ii = __i;
+ --__i;
+ if (__comp(*__i, *__ii)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__ii, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _BidirectionalIter __j = __last;
+ while (!__comp(*__i, *--__j)) {}
+ iter_swap(__i, __j);
+ reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first) {
+ reverse(__first, __last);
+ return false;
+ }
+ }
+#if defined (_STLP_NEED_UNREACHABLE_RETURN)
+ return false;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __next_permutation(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __next_permutation(__first, __last, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Compare>
+bool __prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ if (__first == __last)
+ return false;
+ _BidirectionalIter __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;) {
+ _BidirectionalIter __ii = __i;
+ --__i;
+ if (__comp(*__ii, *__i)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__i, *__ii), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _BidirectionalIter __j = __last;
+ while (!__comp(*--__j, *__i)) {}
+ iter_swap(__i, __j);
+ reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first) {
+ reverse(__first, __last);
+ return false;
+ }
+ }
+#if defined (_STLP_NEED_UNREACHABLE_RETURN)
+ return false;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __prev_permutation(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __prev_permutation(__first, __last, __comp);
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+// is_heap, a predicate testing whether or not a range is
+// a heap. This function is an extension, not part of the C++
+// standard.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Distance, class _StrictWeakOrdering>
+bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp,
+ _Distance __n) {
+ _Distance __parent = 0;
+ for (_Distance __child = 1; __child < __n; ++__child) {
+ if (__comp(__first[__parent], __first[__child])) {
+ _STLP_VERBOSE_ASSERT(!__comp(__first[__child], __first[__parent]), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ if ((__child & 1) == 0)
+ ++__parent;
+ }
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __is_heap(__first, _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)), __last - __first);
+}
+
+template <class _RandomAccessIter, class _StrictWeakOrdering>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
+ _StrictWeakOrdering __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __is_heap(__first, __comp, __last - __first);
+}
+
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return true;
+
+ _ForwardIter __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next) {
+ if (__comp(*__next, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__next), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ }
+
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+#undef __stl_threshold
+
+#endif /* _STLP_ALGO_C */
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_algo.h b/build/stlport/stlport/stl/_algo.h
new file mode 100644
index 000000000..01e5f93f0
--- /dev/null
+++ b/build/stlport/stlport/stl/_algo.h
@@ -0,0 +1,745 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALGO_H
+#define _STLP_INTERNAL_ALGO_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO)
+// remove() conflict
+# include <stl/_cstdio.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// for_each. Apply a function to every element of a range.
+template <class _InputIter, class _Function>
+_STLP_INLINE_LOOP _Function
+for_each(_InputIter __first, _InputIter __last, _Function __f) {
+ for ( ; __first != __last; ++__first)
+ __f(*__first);
+ return __f;
+}
+
+// count_if
+template <class _InputIter, class _Predicate>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
+count_if(_InputIter __first, _InputIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
+ for ( ; __first != __last; ++__first) {
+ if (__pred(*__first))
+ ++__n;
+ }
+ return __n;
+}
+
+// adjacent_find.
+
+template <class _ForwardIter, class _BinaryPredicate>
+_STLP_INLINE_LOOP _ForwardIter
+adjacent_find(_ForwardIter __first, _ForwardIter __last,
+ _BinaryPredicate __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return __last;
+ _ForwardIter __next = __first;
+ while(++__next != __last) {
+ if (__binary_pred(*__first, *__next))
+ return __first;
+ __first = __next;
+ }
+ return __last;
+}
+
+template <class _ForwardIter>
+_STLP_INLINE_LOOP _ForwardIter
+adjacent_find(_ForwardIter __first, _ForwardIter __last) {
+ return adjacent_find(__first, __last,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter)));
+}
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+template <class _InputIter, class _Tp, class _Size>
+_STLP_INLINE_LOOP void
+count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (*__first == __val)
+ ++__n;
+}
+
+template <class _InputIter, class _Predicate, class _Size>
+_STLP_INLINE_LOOP void
+count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ ++__n;
+}
+#endif
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2);
+
+// search_n. Search for __count consecutive copies of __val.
+template <class _ForwardIter, class _Integer, class _Tp>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val);
+template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __binary_pred);
+
+template <class _InputIter, class _ForwardIter>
+inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2);
+}
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+inline _InputIter
+find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp);
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2);
+
+// swap_ranges
+template <class _ForwardIter1, class _ForwardIter2>
+_STLP_INLINE_LOOP _ForwardIter2
+swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ iter_swap(__first1, __first2);
+ return __first2;
+}
+
+// transform
+template <class _InputIter, class _OutputIter, class _UnaryOperation>
+_STLP_INLINE_LOOP _OutputIter
+transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __opr(*__first);
+ return __result;
+}
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _BinaryOperation>
+_STLP_INLINE_LOOP _OutputIter
+transform(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)
+ *__result = __binary_op(*__first1, *__first2);
+ return __result;
+}
+
+// replace_if, replace_copy, replace_copy_if
+
+template <class _ForwardIter, class _Predicate, class _Tp>
+_STLP_INLINE_LOOP void
+replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ *__first = __new_value;
+}
+
+template <class _InputIter, class _OutputIter, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ const _Tp& __old_value, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = *__first == __old_value ? __new_value : *__first;
+ return __result;
+}
+
+template <class _Iterator, class _OutputIter, class _Predicate, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+replace_copy_if(_Iterator __first, _Iterator __last,
+ _OutputIter __result,
+ _Predicate __pred, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __pred(*__first) ? __new_value : *__first;
+ return __result;
+}
+
+// generate and generate_n
+
+template <class _ForwardIter, class _Generator>
+_STLP_INLINE_LOOP void
+generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ *__first = __gen();
+}
+
+template <class _OutputIter, class _Size, class _Generator>
+_STLP_INLINE_LOOP void
+generate_n(_OutputIter __first, _Size __n, _Generator __gen) {
+ for ( ; __n > 0; --__n, ++__first)
+ *__first = __gen();
+}
+
+// remove, remove_if, remove_copy, remove_copy_if
+
+template <class _InputIter, class _OutputIter, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first) {
+ if (!(*__first == __val)) {
+ *__result = *__first;
+ ++__result;
+ }
+ }
+ return __result;
+}
+
+template <class _InputIter, class _OutputIter, class _Predicate>
+_STLP_INLINE_LOOP _OutputIter
+remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first) {
+ if (!__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
+ }
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP _ForwardIter
+remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __first = find(__first, __last, __val);
+ if (__first == __last)
+ return __first;
+ else {
+ _ForwardIter __next = __first;
+ return remove_copy(++__next, __last, __first, __val);
+ }
+}
+
+template <class _ForwardIter, class _Predicate>
+_STLP_INLINE_LOOP _ForwardIter
+remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __first = find_if(__first, __last, __pred);
+ if ( __first == __last )
+ return __first;
+ else {
+ _ForwardIter __next = __first;
+ return remove_copy_if(++__next, __last, __first, __pred);
+ }
+}
+
+// unique and unique_copy
+template <class _InputIter, class _OutputIter>
+_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result);
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred);
+
+template <class _ForwardIter>
+inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
+ __first = adjacent_find(__first, __last);
+ return unique_copy(__first, __last, __first);
+}
+
+template <class _ForwardIter, class _BinaryPredicate>
+inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last,
+ _BinaryPredicate __binary_pred) {
+ __first = adjacent_find(__first, __last, __binary_pred);
+ return unique_copy(__first, __last, __first, __binary_pred);
+}
+
+// reverse and reverse_copy, and their auxiliary functions
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter>
+_STLP_INLINE_LOOP void
+__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) {
+ for (; __first != __last && __first != --__last; ++__first)
+ _STLP_STD::iter_swap(__first,__last);
+}
+
+template <class _RandomAccessIter>
+_STLP_INLINE_LOOP void
+__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) {
+ for (; __first < __last; ++__first)
+ _STLP_STD::iter_swap(__first, --__last);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+inline void
+reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter));
+}
+
+template <class _BidirectionalIter, class _OutputIter>
+_STLP_INLINE_LOOP
+_OutputIter reverse_copy(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ while (__first != __last) {
+ --__last;
+ *__result = *__last;
+ ++__result;
+ }
+ return __result;
+}
+
+template <class _ForwardIter>
+void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last);
+
+template <class _ForwardIter, class _OutputIter>
+inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
+ _ForwardIter __last, _OutputIter __result) {
+ return _STLP_STD::copy(__first, __middle, copy(__middle, __last, __result));
+}
+
+// random_shuffle
+
+template <class _RandomAccessIter>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _RandomNumberGenerator>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
+ _RandomNumberGenerator& __rand);
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// random_sample and random_sample_n (extensions, not part of the standard).
+
+template <class _ForwardIter, class _OutputIter, class _Distance>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n);
+
+template <class _ForwardIter, class _OutputIter, class _Distance,
+ class _RandomNumberGenerator>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n,
+ _RandomNumberGenerator& __rand);
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last);
+
+template <class _InputIter, class _RandomAccessIter,
+ class _RandomNumberGenerator>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last,
+ _RandomNumberGenerator& __rand);
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+// partition, stable_partition, and their auxiliary functions
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
+
+// sort() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Size>
+inline _Size __lg(_Size __n) {
+ _Size __k;
+ for (__k = 0; __n != 1; __n >>= 1) ++__k;
+ return __k;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last);
+template <class _RandomAccessIter, class _Compare>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp);
+
+// stable_sort() and its auxiliary functions.
+template <class _RandomAccessIter>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp);
+
+// partial_sort, partial_sort_copy, and auxiliary functions.
+
+template <class _RandomAccessIter>
+void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last, _Compare __comp);
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first, _RandomAccessIter __result_last);
+
+template <class _InputIter, class _RandomAccessIter, class _Compare>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last, _Compare __comp);
+
+// nth_element() and its auxiliary functions.
+template <class _RandomAccessIter>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Compare __comp);
+
+// auxiliary class for lower_bound, etc.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _T1, class _T2>
+struct __less_2 {
+ bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; }
+};
+
+template <class _T1, class _T2>
+__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); }
+
+#if defined (_STLP_FUNCTION_PARTIAL_ORDER)
+template <class _Tp>
+less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); }
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Binary search (lower_bound, upper_bound, equal_range, binary_search).
+template <class _ForwardIter, class _Tp>
+inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __lower_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __upper_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+pair<_ForwardIter, _ForwardIter>
+__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline pair<_ForwardIter, _ForwardIter>
+equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __equal_range(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline pair<_ForwardIter, _ForwardIter>
+equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp>
+inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+ return __i != __last && !(__val < *__i);
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+ return __i != __last && !__comp(__val, *__i);
+}
+
+// merge, with and without an explicitly supplied comparison function.
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+
+// inplace_merge and its auxiliary functions.
+
+
+template <class _BidirectionalIter>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last) ;
+
+template <class _BidirectionalIter, class _Compare>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Compare __comp);
+
+// Set algorithms: includes, set_union, set_intersection, set_difference,
+// set_symmetric_difference. All of these algorithms have the precondition
+// that their input ranges are sorted and the postcondition that their output
+// ranges are sorted.
+
+template <class _InputIter1, class _InputIter2>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result,
+ _Compare __comp);
+
+
+// min_element and max_element, with and without an explicitly supplied
+// comparison function.
+
+template <class _ForwardIter>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last);
+template <class _ForwardIter, class _Compare>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp);
+
+template <class _ForwardIter>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last);
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp);
+
+// next_permutation and prev_permutation, with and without an explicitly
+// supplied comparison function.
+
+template <class _BidirectionalIter>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
+
+template <class _BidirectionalIter, class _Compare>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp);
+
+
+template <class _BidirectionalIter>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
+
+
+template <class _BidirectionalIter, class _Compare>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp);
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// is_heap, a predicate testing whether or not a range is
+// a heap. This function is an extension, not part of the C++
+// standard.
+
+template <class _RandomAccessIter>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _StrictWeakOrdering>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
+ _StrictWeakOrdering __comp);
+
+// is_sorted, a predicated testing whether a range is sorted in
+// nondescending order. This is an extension, not part of the C++
+// standard.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _ForwardIter>
+inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) {
+ return _STLP_PRIV __is_sorted(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter)));
+}
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+inline bool is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp) {
+ return _STLP_PRIV __is_sorted(__first, __last, __comp);
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_algo.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALGO_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_algobase.c b/build/stlport/stlport/stl/_algobase.c
new file mode 100644
index 000000000..157e25c5c
--- /dev/null
+++ b/build/stlport/stlport/stl/_algobase.c
@@ -0,0 +1,483 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_ALGOBASE_C
+#define _STLP_ALGOBASE_C
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ for ( ; __first1 != __last1 && __first2 != __last2
+ ; ++__first1, ++__first2) {
+ if (*__first1 < *__first2) {
+ _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return true;
+ }
+ if (*__first2 < *__first1)
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+}
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ for ( ; __first1 != __last1 && __first2 != __last2
+ ; ++__first1, ++__first2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return true;
+ }
+ if (__comp(*__first2, *__first1))
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (*__first1 < *__first2) {
+ _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return -1;
+ }
+ if (*__first2 < *__first1)
+ return 1;
+ ++__first1;
+ ++__first2;
+ }
+ if (__first2 == __last2) {
+ return !(__first1 == __last1);
+ }
+ else {
+ return -1;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
+}
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp>
+_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last,
+ const _Tp& __val,
+ const random_access_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
+
+ for ( ; __trip_count > 0 ; --__trip_count) {
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+ }
+
+ switch (__last - __first) {
+ case 3:
+ if (*__first == __val) return __first;
+ ++__first;
+ case 2:
+ if (*__first == __val) return __first;
+ ++__first;
+ case 1:
+ if (*__first == __val) return __first;
+ //++__first;
+ case 0:
+ default:
+ return __last;
+ }
+}
+
+inline char*
+__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) {
+ void *res = memchr(__first, __val, __last - __first);
+ return res != 0 ? __STATIC_CAST(char*, res) : __last;
+}
+inline const char*
+__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) {
+ const void *res = memchr(__first, __val, __last - __first);
+ return res != 0 ? __STATIC_CAST(const char*, res) : __last;
+}
+
+template <class _RandomAccessIter, class _Predicate>
+_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Predicate __pred,
+ const random_access_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
+
+ for ( ; __trip_count > 0 ; --__trip_count) {
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+ }
+
+ switch(__last - __first) {
+ case 3:
+ if (__pred(*__first)) return __first;
+ ++__first;
+ case 2:
+ if (__pred(*__first)) return __first;
+ ++__first;
+ case 1:
+ if (__pred(*__first)) return __first;
+ //++__first;
+ case 0:
+ default:
+ return __last;
+ }
+}
+
+template <class _InputIter, class _Tp>
+_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last,
+ const _Tp& __val,
+ const input_iterator_tag &) {
+ while (__first != __last && !(*__first == __val)) ++__first;
+ return __first;
+}
+
+template <class _InputIter, class _Predicate>
+_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _InputIter __last,
+ _Predicate __pred,
+ const input_iterator_tag &) {
+ while (__first != __last && !__pred(*__first))
+ ++__first;
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Predicate>
+_InputIter find_if(_InputIter __first, _InputIter __last,
+ _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+
+template <class _InputIter, class _Tp>
+_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+
+template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPred __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIter2 __p1(__first2);
+
+ if ( ++__p1 == __last2 ) {
+ while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
+ ++__first1;
+ }
+ return __first1;
+ }
+
+ // General case.
+
+ for ( ; ; ) { // __first1 != __last1 will be checked below
+ while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
+ ++__first1;
+ }
+ if (__first1 == __last1) {
+ return __last1;
+ }
+ _ForwardIter2 __p = __p1;
+ _ForwardIter1 __current = __first1;
+ if (++__current == __last1) return __last1;
+
+ while (__pred(*__current, *__p)) {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+ ++__first1;
+ }
+ return __first1;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Tp>
+struct _IsCharLikeType
+{ typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsCharLikeType<char>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsCharLikeType<unsigned char>
+{ typedef __true_type _Ret; };
+
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_TEMPLATE_NULL struct _IsCharLikeType<signed char>
+{ typedef __true_type _Ret; };
+# endif
+
+template <class _Tp1, class _Tp2>
+inline bool __stlp_eq(_Tp1 __val1, _Tp2 __val2)
+{ return __val1 == __val2; }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Tp>
+inline bool __stlp_eq(_Tp, _Tp)
+{ return true; }
+#endif
+
+template <class _InputIter, class _ForwardIter, class _Tp2, class _Predicate>
+inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _Tp2*, _Predicate __pred,
+ const __true_type& /* _UseStrcspnLikeAlgo */) {
+ unsigned char __hints[(UCHAR_MAX + 1) / CHAR_BIT];
+ memset(__hints, 0, sizeof(__hints) / sizeof(unsigned char));
+ for (; __first2 != __last2; ++__first2) {
+ unsigned char __tmp = (unsigned char)*__first2;
+ __hints[__tmp / CHAR_BIT] |= (1 << (__tmp % CHAR_BIT));
+ }
+
+ for (; __first1 != __last1; ++__first1) {
+ _Tp2 __tmp = (_Tp2)*__first1;
+ if (__stlp_eq(*__first1, __tmp) &&
+ __pred((__hints[(unsigned char)__tmp / CHAR_BIT] & (1 << ((unsigned char)__tmp % CHAR_BIT))) != 0))
+ break;
+ }
+ return __first1;
+}
+
+template <class _InputIter, class _ForwardIter, class _Tp2, class _Predicate>
+inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _Tp2* /* __dummy */, _Predicate /* __pred */,
+ const __false_type& /* _UseStrcspnLikeAlgo */) {
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter)));
+}
+
+template <class _InputIter, class _ForwardIter, class _Tp1, class _Tp2>
+inline _InputIter __find_first_of_aux1(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _Tp1* __pt1, _Tp2* __pt2) {
+ typedef _STLP_TYPENAME _STLP_STD::_IsIntegral<_Tp1>::_Ret _IsIntegral;
+ typedef _STLP_TYPENAME _STLP_PRIV _IsCharLikeType<_Tp2>::_Ret _IsCharLike;
+ typedef _STLP_TYPENAME _STLP_STD::_Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
+ return _STLP_PRIV __find_first_of_aux2(__first1, __last1,
+ __first2, __last2,
+ __pt2, _Identity<bool>(), _UseStrcspnLikeAlgo());
+}
+
+template <class _InputIter, class _ForwardIter>
+inline _InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2) {
+ return _STLP_PRIV __find_first_of_aux1(__first1, __last1, __first2, __last2,
+ _STLP_VALUE_TYPE(__first1, _InputIter),
+ _STLP_VALUE_TYPE(__first2, _ForwardIter));
+}
+
+// find_first_of, with and without an explicitly supplied comparison function.
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _BinaryPredicate __comp) {
+ for ( ; __first1 != __last1; ++__first1) {
+ for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) {
+ if (__comp(*__first1, *__iter)) {
+ return __first1;
+ }
+ }
+ }
+ return __last1;
+}
+
+// find_end, with and without an explicitly supplied comparison function.
+// Search [first2, last2) as a subsequence in [first1, last1), and return
+// the *last* possible match. Note that find_end for bidirectional iterators
+// is much faster than for forward iterators.
+
+// find_end for forward iterators.
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ const forward_iterator_tag &, const forward_iterator_tag &,
+ _BinaryPredicate __comp) {
+ if (__first2 == __last2)
+ return __last1;
+ else {
+ _ForwardIter1 __result = __last1;
+ for (;;) {
+ _ForwardIter1 __new_result = _STLP_STD::search(__first1, __last1, __first2, __last2, __comp);
+ if (__new_result == __last1)
+ return __result;
+ else {
+ __result = __new_result;
+ __first1 = __new_result;
+ ++__first1;
+ }
+ }
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// find_end for bidirectional iterators. Requires partial specialization.
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+# ifndef _STLP_INTERNAL_ITERATOR_H
+_STLP_END_NAMESPACE
+# include <stl/_iterator.h>
+_STLP_BEGIN_NAMESPACE
+# endif /*_STLP_INTERNAL_ITERATOR_H*/
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BinaryPredicate>
+_BidirectionalIter1
+__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
+ const bidirectional_iterator_tag &, const bidirectional_iterator_tag &,
+ _BinaryPredicate __comp) {
+ typedef _STLP_STD::reverse_iterator<_BidirectionalIter1> _RevIter1;
+ typedef _STLP_STD::reverse_iterator<_BidirectionalIter2> _RevIter2;
+
+ _RevIter1 __rlast1(__first1);
+ _RevIter2 __rlast2(__first2);
+ _RevIter1 __rresult = _STLP_STD::search(_RevIter1(__last1), __rlast1,
+ _RevIter2(__last2), __rlast2,
+ __comp);
+
+ if (__rresult == __rlast1)
+ return __last1;
+ else {
+ _BidirectionalIter1 __result = __rresult.base();
+ _STLP_STD::advance(__result, -_STLP_STD::distance(__first2, __last2));
+ return __result;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPredicate __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
+ _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
+#else
+ forward_iterator_tag(),
+ forward_iterator_tag(),
+#endif
+ __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+ _ForwardIter __middle;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp1(*__middle, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_ALGOBASE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_algobase.h b/build/stlport/stlport/stl/_algobase.h
new file mode 100644
index 000000000..597dcbea3
--- /dev/null
+++ b/build/stlport/stlport/stl/_algobase.h
@@ -0,0 +1,728 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+#define _STLP_INTERNAL_ALGOBASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Tp>
+inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) {
+ __a._M_swap_workaround(__b);
+}
+
+template <class _Tp>
+inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) {
+ _Tp __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+// swap and iter_swap
+template <class _Tp>
+inline void swap(_Tp& __a, _Tp& __b) {
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+# if !defined(__BORLANDC__)
+ typedef typename _SwapImplemented<_Tp>::_Ret _Implemented;
+# else
+ enum { _Is = _SwapImplemented<_Tp>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _Implemented;
+# endif
+ _STLP_PRIV __swap_aux(__a, __b, _Implemented());
+#else
+ _Tp __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+#endif
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2, class _Value>
+inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) {
+ _Value tmp = *__i1;
+ *__i1 = *__i2;
+ *__i2 = tmp;
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) {
+ /* namespace specification breaks access to the right swap template overload (at least for gcc) */
+ /*_STLP_STD::*/ swap(*__i1, *__i2);
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) {
+ _STLP_PRIV __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) );
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) {
+ _STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2),
+ _STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1),
+ _STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer());
+}
+
+//--------------------------------------------------
+// min and max
+
+#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE)
+# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__)
+//In not ANSI mode Borland import min/max in global namespace which conflict
+//with STLport min/max when user does a 'using namespace std' in its code
+//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max
+//in STLport namespace.
+using _STLP_VENDOR_STD::min;
+using _STLP_VENDOR_STD::max;
+# else
+template <class _Tp>
+inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; }
+template <class _Tp>
+inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; }
+# endif
+#endif
+
+# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE)
+inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; }
+inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; }
+# endif
+
+# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x590)
+template <class _Tp, class _Compare>
+inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
+}
+
+template <class _Tp, class _Compare>
+inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
+}
+# else
+template <class _Tp, class _Compare>
+inline const _Tp (min)(const _Tp __a, const _Tp __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
+}
+
+template <class _Tp, class _Compare>
+inline const _Tp (max)(const _Tp __a, const _Tp __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
+}
+# endif
+
+//--------------------------------------------------
+// copy
+
+// All of these auxiliary functions serve two purposes. (1) Replace
+// calls to copy with memmove whenever possible. (Memmove, not memcpy,
+// because the input and output ranges are permitted to overlap.)
+// (2) If we're using random access iterators, then write the loop as
+// a for loop with an explicit count.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const input_iterator_tag &, _Distance*) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const forward_iterator_tag &, _Distance* ) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+#endif
+
+template <class _RandomAccessIter, class _OutputIter, class _Distance>
+inline _OutputIter
+__copy(_RandomAccessIter __first, _RandomAccessIter __last,
+ _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
+ for (_Distance __n = __last - __first; __n > 0; --__n) {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return __result;
+}
+
+inline void*
+__copy_trivial(const void* __first, const void* __last, void* __result) {
+ size_t __n = (const char*)__last - (const char*)__first;
+ return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result;
+}
+
+//--------------------------------------------------
+// copy_backward auxiliary functions
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _Distance>
+inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
+ _BidirectionalIter1 __last,
+ _BidirectionalIter2 __result,
+ const bidirectional_iterator_tag &,
+ _Distance*) {
+ while (__first != __last)
+ *--__result = *--__last;
+ return __result;
+}
+
+template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
+inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _BidirectionalIter __result,
+ const random_access_iterator_tag &,
+ _Distance*) {
+ for (_Distance __n = __last - __first; __n > 0; --__n)
+ *--__result = *--__last;
+ return __result;
+}
+
+inline void*
+__copy_trivial_backward(const void* __first, const void* __last, void* __result) {
+ const ptrdiff_t _Num = (const char*)__last - (const char*)__first;
+ return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ;
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*IsOKToMemCpy*/) {
+ return _STLP_PRIV __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0);
+}
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*IsOKToMemCpy*/) {
+ // we know they all pointers, so this cast is OK
+ // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
+ return (_OutputIter)_STLP_PRIV __copy_trivial(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*BothPtrType*/) {
+ return _STLP_PRIV __copy_ptrs(__first, __last, __result,
+ _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*BothPtrType*/) {
+ return _STLP_PRIV __copy(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer());
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const __false_type& /*TrivialAssignment*/) {
+ return _STLP_PRIV __copy_backward(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const __true_type& /*TrivialAssignment*/) {
+ return (_OutputIter)_STLP_PRIV __copy_trivial_backward(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) {
+ return _STLP_PRIV __copy_backward(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first,_InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) {
+ return _STLP_PRIV __copy_backward_ptrs(__first, __last, __result,
+ _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() );
+}
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \
+inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \
+{ return (_Tp*)_STLP_PRIV __copy_trivial(__first, __last, __result); } \
+inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \
+{ return (_Tp*)_STLP_PRIV __copy_trivial_backward(__first, __last, __result); }
+
+# if !defined (_STLP_NO_BOOL)
+_STLP_DECLARE_COPY_TRIVIAL(bool)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(char)
+# if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_DECLARE_COPY_TRIVIAL(signed char)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(unsigned char)
+_STLP_DECLARE_COPY_TRIVIAL(short)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned short)
+_STLP_DECLARE_COPY_TRIVIAL(int)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned int)
+_STLP_DECLARE_COPY_TRIVIAL(long)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned long)
+# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_DECLARE_COPY_TRIVIAL(wchar_t)
+# endif
+# if defined (_STLP_LONG_LONG)
+_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(float)
+_STLP_DECLARE_COPY_TRIVIAL(double)
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLARE_COPY_TRIVIAL(long double)
+# endif
+# undef _STLP_DECLARE_COPY_TRIVIAL
+#endif
+
+//--------------------------------------------------
+// copy_n (not part of the C++ standard)
+
+#if !defined (_STLP_NO_EXTENSIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Size, class _OutputIter>
+_STLP_INLINE_LOOP _STLP_STD::pair<_InputIter, _OutputIter>
+__copy_n(_InputIter __first, _Size __count, _OutputIter __result,
+ const input_iterator_tag &) {
+ for ( ; __count > 0; --__count) {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return _STLP_STD::pair<_InputIter, _OutputIter>(__first, __result);
+}
+
+template <class _RAIter, class _Size, class _OutputIter>
+inline _STLP_STD::pair<_RAIter, _OutputIter>
+__copy_n(_RAIter __first, _Size __count, _OutputIter __result,
+ const random_access_iterator_tag &) {
+ _RAIter __last = __first + __count;
+ return _STLP_STD::pair<_RAIter, _OutputIter>(__last, _STLP_STD::copy(__first, __last, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Size, class _OutputIter>
+inline pair<_InputIter, _OutputIter>
+copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+#endif
+
+//--------------------------------------------------
+// fill and fill_n
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP
+void __fill_fwd(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ for ( ; __first != __last; ++__first)
+ *__first = __val;
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ const input_iterator_tag &, _Distance*) {
+ _STLP_PRIV __fill_fwd(__first, __last, __val);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ const forward_iterator_tag &, _Distance*) {
+ _STLP_PRIV __fill_fwd(__first, __last, __val);
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ const bidirectional_iterator_tag &, _Distance*) {
+ _STLP_PRIV __fill_fwd(__first, __last, __val);
+}
+#endif
+
+template <class _RandomAccessIter, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void __fill(_RandomAccessIter __first, _RandomAccessIter __last, const _Tp& __val,
+ const random_access_iterator_tag &, _Distance*) {
+ for (_Distance __n = __last - __first ; __n > 0; ++__first, --__n)
+ *__first = __val;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __fill(__first, __last, __val,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+// Specialization: for one-byte types we can use memset.
+inline void fill(unsigned char* __first, unsigned char* __last,
+ const unsigned char& __val) {
+ unsigned char __tmp = __val;
+ memset(__first, __tmp, __last - __first);
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+inline void fill(signed char* __first, signed char* __last,
+ const signed char& __val) {
+ signed char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+#endif
+inline void fill(char* __first, char* __last, const char& __val) {
+ char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _OutputIter, class _Size, class _Tp>
+_STLP_INLINE_LOOP
+_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ for ( ; __n > 0; --__n, ++__first)
+ *__first = __val;
+ return __first;
+}
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Size>
+inline unsigned char* __fill_n(unsigned char* __first, _Size __n,
+ const unsigned char& __val) {
+ _STLP_STD::fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+template <class _Size>
+inline signed char* __fill_n(signed char* __first, _Size __n,
+ const signed char& __val) {
+ _STLP_STD::fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+#endif
+template <class _Size>
+inline char* __fill_n(char* __first, _Size __n,
+ const char& __val) {
+ _STLP_STD::fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _OutputIter, class _Size, class _Tp>
+inline void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ _STLP_PRIV __fill_n(__first, __n, __val);
+}
+
+
+//--------------------------------------------------
+// equal and mismatch
+
+template <class _InputIter1, class _InputIter2>
+_STLP_INLINE_LOOP
+_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
+ _InputIter1 __last1,
+ _InputIter2 __first2) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ while (__first1 != __last1 && *__first1 == *__first2) {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
+}
+
+template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
+_STLP_INLINE_LOOP
+_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
+ _InputIter1 __last1,
+ _InputIter2 __first2,
+ _BinaryPredicate __binary_pred) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
+}
+
+template <class _InputIter1, class _InputIter2>
+_STLP_INLINE_LOOP
+bool equal(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2) {
+ _STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ if (!(*__first1 == *__first2))
+ return false;
+ return true;
+}
+
+template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
+_STLP_INLINE_LOOP
+bool equal(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _BinaryPredicate __binary_pred) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ if (!__binary_pred(*__first1, *__first2))
+ return false;
+ return true;
+}
+
+//--------------------------------------------------
+// lexicographical_compare and lexicographical_compare_3way.
+// (the latter is not part of the C++ standard.)
+
+template <class _InputIter1, class _InputIter2>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _Compare __comp);
+
+inline bool
+lexicographical_compare(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2) {
+ const size_t __len1 = __last1 - __first1;
+ const size_t __len2 = __last2 - __first2;
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+
+ const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
+ return __result != 0 ? (__result < 0) : (__len1 < __len2);
+}
+
+
+#if !(CHAR_MAX == SCHAR_MAX)
+inline bool lexicographical_compare(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+
+ return lexicographical_compare((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+}
+#endif /* CHAR_MAX == SCHAR_MAX */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+inline int
+__lexicographical_compare_3way(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2) {
+ const ptrdiff_t __len1 = __last1 - __first1;
+ const ptrdiff_t __len2 = __last2 - __first2;
+ const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
+ return __result != 0 ? __result
+ : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
+}
+
+
+#if !(CHAR_MAX == SCHAR_MAX)
+inline int
+__lexicographical_compare_3way(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2) {
+ return __lexicographical_compare_3way((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_EXTENSIONS)
+template <class _InputIter1, class _InputIter2>
+int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+#endif
+
+// count
+template <class _InputIter, class _Tp>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
+count(_InputIter __first, _InputIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
+ for ( ; __first != __last; ++__first)
+ if (*__first == __val)
+ ++__n;
+ return __n;
+}
+
+// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available.
+template <class _InputIter, class _Tp>
+_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val);
+
+template <class _InputIter, class _Predicate>
+_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred);
+
+// search.
+template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate);
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// find_first_of
+template <class _InputIter, class _ForwardIter>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2);
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _BinaryPredicate __comp);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPredicate __comp);
+
+// replace
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP void
+replace(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __old_value, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (*__first == __old_value)
+ *__first = __new_value;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_algobase.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALGOBASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_alloc.c b/build/stlport/stlport/stl/_alloc.c
new file mode 100644
index 000000000..467405b4b
--- /dev/null
+++ b/build/stlport/stlport/stl/_alloc.c
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_ALLOC_C
+#define _STLP_ALLOC_C
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#if defined (__WATCOMC__)
+# pragma warning 13 9
+# pragma warning 367 9
+# pragma warning 368 9
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Alloc>
+void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) {
+ size_t __total_extra = __extra_before_chunk() + __extra_after_chunk();
+ size_t __real_n = __n + __total_extra;
+ if (__real_n < __n) {
+ //It means that we rolled on size_t, __n must be very large:
+ _STLP_THROW_BAD_ALLOC;
+ }
+ __alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n);
+ memset((char*)__result, __shred_byte, __real_n * sizeof(value_type));
+ __result->__magic = __magic;
+ __result->__type_size = sizeof(value_type);
+ __result->_M_size = (_STLP_UINT32_T)__n;
+ return ((char*)__result) + (long)__extra_before;
+}
+
+template <class _Alloc>
+void _STLP_CALL
+__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) {
+ __alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before);
+ // check integrity
+ _STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE)
+ _STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED)
+ _STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH)
+ _STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH)
+ // check pads on both sides
+ unsigned char* __tmp;
+ for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) {
+ _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN)
+ }
+
+ size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk();
+
+ for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type);
+ __tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) {
+ _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN)
+ }
+
+ // that may be unfortunate, just in case
+ __real_p->__magic = __deleted_magic;
+ memset((char*)__p, __shred_byte, __n * sizeof(value_type));
+ __allocator_type::deallocate(__real_p, __real_n);
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_ALLOC_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_alloc.h b/build/stlport/stlport/stl/_alloc.h
new file mode 100644
index 000000000..09b8af518
--- /dev/null
+++ b/build/stlport/stlport/stl/_alloc.h
@@ -0,0 +1,580 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+#define _STLP_INTERNAL_ALLOC_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW_HEADER
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Malloc-based allocator. Typically slower than default alloc below.
+// Typically thread-safe and more storage efficient.
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+typedef void (* __oom_handler_type)();
+#endif
+
+class _STLP_CLASS_DECLSPEC __malloc_alloc {
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+ static void* _STLP_CALL allocate(size_t __n)
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+ ;
+#else
+ {
+ void *__result = malloc(__n);
+ if (__result == 0) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return __result;
+ }
+#endif
+
+ static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+ static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f);
+#endif
+};
+
+// New-based allocator. Typically slower than default alloc below.
+// Typically thread-safe and more storage efficient.
+class _STLP_CLASS_DECLSPEC __new_alloc {
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+ static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
+ static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
+};
+
+// Allocator adaptor to check size arguments for debugging.
+// Reports errors using assert. Checking can be disabled with
+// NDEBUG, but it's far better to just use the underlying allocator
+// instead when no checking is desired.
+// There is some evidence that this can confuse Purify.
+// This adaptor can only be applied to raw allocators
+
+template <class _Alloc>
+class __debug_alloc : public _Alloc {
+public:
+ typedef _Alloc __allocator_type;
+ typedef typename _Alloc::value_type value_type;
+private:
+ struct __alloc_header {
+ size_t __magic: 16;
+ size_t __type_size:16;
+ _STLP_UINT32_T _M_size;
+ }; // that is 8 bytes for sure
+ // Sunpro CC has bug on enums, so extra_before/after set explicitly
+ enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd,
+ __shred_byte = _STLP_SHRED_BYTE };
+
+ enum { __extra_before = 16, __extra_after = 8 };
+ // Size of space used to store size. Note
+ // that this must be large enough to preserve
+ // alignment.
+ static size_t _STLP_CALL __extra_before_chunk() {
+ return (long)__extra_before / sizeof(value_type) +
+ (size_t)((long)__extra_before % sizeof(value_type) > 0);
+ }
+ static size_t _STLP_CALL __extra_after_chunk() {
+ return (long)__extra_after / sizeof(value_type) +
+ (size_t)((long)__extra_after % sizeof(value_type) > 0);
+ }
+public:
+ __debug_alloc() {}
+ ~__debug_alloc() {}
+ static void* _STLP_CALL allocate(size_t);
+ static void _STLP_CALL deallocate(void *, size_t);
+};
+
+# if defined (__OS400__)
+// dums 02/05/2007: is it really necessary ?
+enum { _MAX_BYTES = 256 };
+# else
+enum { _MAX_BYTES = 32 * sizeof(void*) };
+# endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+// Default node allocator.
+// With a reasonable compiler, this should be roughly as fast as the
+// original STL class-specific allocators, but with less fragmentation.
+class _STLP_CLASS_DECLSPEC __node_alloc {
+ static void * _STLP_CALL _M_allocate(size_t& __n);
+ /* __p may not be 0 */
+ static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
+
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+ /* __n must be > 0 */
+ static void* _STLP_CALL allocate(size_t& __n)
+ { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
+ /* __p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n)
+ { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>;
+# endif
+
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>;
+#endif
+
+/* macro to convert the allocator for initialization
+ * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
+#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
+ * not used implicitly to convert allocator parameter, so let us do it explicitly */
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+# else
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
+# endif
+/* else convert, but only if partial specialization works, since else
+ * Container::allocator_type won't be different */
+#else
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+#endif
+
+// Another allocator adaptor: _Alloc_traits. This serves two
+// purposes. First, make it possible to write containers that can use
+// either SGI-style allocators or standard-conforming allocator.
+
+// The fully general version.
+template <class _Tp, class _Allocator>
+struct _Alloc_traits {
+ typedef _Allocator _Orig;
+#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
+ typedef typename _Rebind_type::other allocator_type;
+ static allocator_type create_allocator(const _Orig& __a)
+ { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
+#else
+ // this is not actually true, used only to pass this type through
+ // to dynamic overload selection in _STLP_alloc_proxy methods
+ typedef _Allocator allocator_type;
+#endif
+};
+
+#if defined (_STLP_USE_PERTHREAD_ALLOC)
+
+_STLP_END_NAMESPACE
+// include additional header here
+# include <stl/_pthread_alloc.h>
+_STLP_BEGIN_NAMESPACE
+
+typedef __pthread_alloc __alloc_type;
+#elif defined (_STLP_USE_NEWALLOC)
+typedef __new_alloc __alloc_type;
+#elif defined (_STLP_USE_MALLOC)
+typedef __malloc_alloc __alloc_type;
+#else
+typedef __node_alloc __alloc_type;
+#endif
+
+#if defined (_STLP_DEBUG_ALLOC)
+typedef __debug_alloc<__alloc_type> __sgi_alloc;
+#else
+typedef __alloc_type __sgi_alloc;
+#endif
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+typedef __sgi_alloc __single_client_alloc;
+typedef __sgi_alloc __multithreaded_alloc;
+#endif
+
+// This implements allocators as specified in the C++ standard.
+//
+// Note that standard-conforming allocators use many language features
+// that are not yet widely implemented. In particular, they rely on
+// member templates, partial specialization, partial ordering of function
+// templates, the typename keyword, and the use of the template keyword
+// to refer to a template member of a dependent type.
+
+/*
+template <class _Tp>
+struct _AllocatorAux {
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+};
+
+template <class _Tp>
+struct _AllocatorAux<const _Tp> {
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+
+ const_pointer address(const_reference __x) const { return &__x; }
+};
+*/
+
+template <class _Tp>
+class allocator //: public _AllocatorAux<_Tp>
+/* A small helper struct to recognize STLport allocator implementation
+ * from any user specialization one.
+ */
+ : public __stlport_class<allocator<_Tp> >
+{
+public:
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+#endif
+ allocator() _STLP_NOTHROW {}
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
+#endif
+ allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ allocator(__move_source<allocator<_Tp> > src) _STLP_NOTHROW {}
+#endif
+ ~allocator() _STLP_NOTHROW {}
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+ // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ return __ret;
+ }
+
+ return 0;
+ }
+ // __p is permitted to be a null pointer, only if n==0.
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
+ }
+ }
+#if !defined (_STLP_NO_ANACHRONISMS)
+ // backwards compatibility
+ void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
+#endif
+ size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
+ void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
+ void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* _M_allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+
+ return 0;
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(allocator<_Tp>& __other) {}
+#endif
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ typedef void value_type;
+#endif
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW
+{ return true; }
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW
+{ return false; }
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<void*>;
+# endif
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __alloc_type_traits {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<allocator<_Tp> >::_Ret _STLportAlloc;
+#else
+ enum { _Is = _IsSTLportClass<allocator<_Tp> >::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportAlloc;
+#endif
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef _STLportAlloc has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef _STLportAlloc is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<allocator<_Tp> > : _STLP_PRIV __alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<char> > : _STLP_PRIV __alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<wchar_t> > : _STLP_PRIV __alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<void*> > : _STLP_PRIV __alloc_type_traits<void*> {};
+# endif
+#endif
+
+
+#if !defined (_STLP_FORCE_ALLOCATORS)
+# define _STLP_FORCE_ALLOCATORS(a,y)
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
+template <class _Tp, class _Tp1>
+struct _Alloc_traits<_Tp, allocator<_Tp1> > {
+ typedef allocator<_Tp1> _Orig;
+ typedef allocator<_Tp> allocator_type;
+ static allocator_type create_allocator(const allocator<_Tp1 >& __a)
+ { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
+};
+#endif
+
+#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES)
+template <class _Tp, class _Alloc>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL
+__stl_alloc_create(const _Alloc& __a, const _Tp*) {
+ typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
+ return _Rebound_type(__a);
+}
+#else
+// If custom allocators are being used without member template classes support :
+// user (on purpose) is forced to define rebind/get operations !!!
+template <class _Tp1, class _Tp2>
+inline allocator<_Tp2>& _STLP_CALL
+__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); }
+template <class _Tp1, class _Tp2>
+inline allocator<_Tp2> _STLP_CALL
+__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// inheritance is being used for EBO optimization
+template <class _Value, class _Tp, class _MaybeReboundAlloc>
+class _STLP_alloc_proxy : public _MaybeReboundAlloc {
+private:
+ typedef _MaybeReboundAlloc _Base;
+ typedef typename _Base::size_type size_type;
+ typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
+public:
+ _Value _M_data;
+
+ _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) :
+ _MaybeReboundAlloc(__a), _M_data(__p) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _STLP_alloc_proxy (__move_source<_Self> src) :
+ _Base(_STLP_PRIV _AsMoveSource(src.get()._M_base())),
+ _M_data(_STLP_PRIV _AsMoveSource(src.get()._M_data)) {}
+
+ _Base& _M_base()
+ { return *this; }
+#endif
+
+private:
+ /* Following are helper methods to detect stateless allocators and avoid
+ * swap in this case. For some compilers (VC6) it is a workaround for a
+ * compiler bug in the Empty Base class Optimization feature, for others
+ * it is a small optimization or nothing if no EBO. */
+ void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/)
+ {}
+
+ void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) {
+ _MaybeReboundAlloc &__base_this = *this;
+ _MaybeReboundAlloc &__base_x = __x;
+ _STLP_STD::swap(__base_this, __base_x);
+ }
+
+public:
+ void _M_swap_alloc(_Self& __x) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc;
+#else
+ typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc;
+#endif
+ _M_swap_alloc(__x, _StatelessAlloc());
+ }
+
+ /* We need to define the following swap implementation for allocator with state
+ * as those allocators might have implement a special swap function to correctly
+ * move datas from an instance to the oher, _STLP_alloc_proxy should not break
+ * this mecanism. */
+ void swap(_Self& __x) {
+ _M_swap_alloc(__x);
+ _STLP_STD::swap(_M_data, __x._M_data);
+ }
+
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc;
+#else
+ typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc;
+#endif
+ return allocate(__n, __allocated_n, _STLportAlloc());
+ }
+
+ // Unified interface to perform allocate()/deallocate() with limited
+ // language support
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ // else it is rebound already, and allocate() member is accessible
+ _Tp* allocate(size_type __n)
+ { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); }
+ void deallocate(_Tp* __p, size_type __n)
+ { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); }
+private:
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
+ { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0))._M_allocate(__n, __allocated_n); }
+#else
+ //Expose Standard allocate overload (using expression do not work for some compilers (Borland))
+ _Tp* allocate(size_type __n)
+ { return _Base::allocate(__n); }
+private:
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
+ { return _Base::_M_allocate(__n, __allocated_n); }
+#endif
+
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/)
+ { __allocated_n = __n; return allocate(__n); }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char*, char, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t*, wchar_t, allocator<wchar_t> >;
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void**, void*, allocator<void*> >;
+# endif
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_alloc.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALLOC_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_auto_ptr.h b/build/stlport/stlport/stl/_auto_ptr.h
new file mode 100644
index 000000000..c750534a0
--- /dev/null
+++ b/build/stlport/stlport/stl/_auto_ptr.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_AUTO_PTR_H
+#define _STLP_AUTO_PTR_H
+
+_STLP_BEGIN_NAMESPACE
+// implementation primitive
+class __ptr_base {
+public:
+ void* _M_p;
+ void __set(const volatile void* p) { _M_p = __CONST_CAST(void*,p); }
+ void __set(void* p) { _M_p = p; }
+};
+
+template <class _Tp>
+class auto_ptr_ref {
+public:
+ __ptr_base& _M_r;
+ _Tp* const _M_p;
+
+ auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { }
+
+ _Tp* release() const { _M_r.__set(__STATIC_CAST(void*, 0)); return _M_p; }
+
+private:
+ //explicitely defined as private to avoid warnings:
+ typedef auto_ptr_ref<_Tp> _Self;
+ _Self& operator = (_Self const&);
+};
+
+template<class _Tp>
+class auto_ptr : public __ptr_base {
+public:
+ typedef _Tp element_type;
+ typedef auto_ptr<_Tp> _Self;
+
+ _Tp* release() _STLP_NOTHROW {
+ _Tp* __px = this->get();
+ this->_M_p = 0;
+ return __px;
+ }
+
+ void reset(_Tp* __px = 0) _STLP_NOTHROW {
+ _Tp* __pt = this->get();
+ if (__px != __pt)
+ delete __pt;
+ this->__set(__px);
+ }
+
+ _Tp* get() const _STLP_NOTHROW
+#if !defined (__GNUC__) || (__GNUC__ > 2)
+ { return __STATIC_CAST(_Tp*, _M_p); }
+#else
+ { return __REINTERPRET_CAST(_Tp*, _M_p); }
+#endif
+
+#if !defined (_STLP_NO_ARROW_OPERATOR)
+ _Tp* operator->() const _STLP_NOTHROW {
+ _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
+ return get();
+ }
+#endif
+ _Tp& operator*() const _STLP_NOTHROW {
+ _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
+ return *get();
+ }
+
+ explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS)
+ template<class _Tp1> auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
+ _Tp* __conversionCheck = __r.release();
+ this->__set(__conversionCheck);
+ }
+# endif
+ template<class _Tp1> auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
+ _Tp* __conversionCheck = __r.release();
+ reset(__conversionCheck);
+ return *this;
+ }
+#endif
+
+ auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); }
+
+ _Self& operator=(_Self& __r) _STLP_NOTHROW {
+ reset(__r.release());
+ return *this;
+ }
+
+ ~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); }
+
+ auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW
+ { this->__set(__r.release()); }
+
+ _Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW {
+ reset(__r.release());
+ return *this;
+ }
+
+#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS)
+ template<class _Tp1> operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW
+ { return auto_ptr_ref<_Tp1>(*this, this->get()); }
+ template<class _Tp1> operator auto_ptr<_Tp1>() _STLP_NOTHROW
+ { return auto_ptr<_Tp1>(release()); }
+#else
+ operator auto_ptr_ref<_Tp>() _STLP_NOTHROW
+ { return auto_ptr_ref<_Tp>(*this, this->get()); }
+#endif
+};
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_AUTO_PTR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_bitset.c b/build/stlport/stlport/stl/_bitset.c
new file mode 100644
index 000000000..82b9312d9
--- /dev/null
+++ b/build/stlport/stlport/stl/_bitset.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET_C
+#define _STLP_BITSET_C
+
+#ifndef _STLP_BITSET_H
+# include <stl/_bitset.h>
+#endif
+
+#define __BITS_PER_WORD (CHAR_BIT * sizeof(unsigned long))
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+//
+// Definitions of non-inline functions from _Base_bitset.
+//
+template<size_t _Nw>
+void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) {
+ if (__shift != 0) {
+ const size_t __wshift = __shift / __BITS_PER_WORD;
+ const size_t __offset = __shift % __BITS_PER_WORD;
+
+ if (__offset == 0)
+ for (size_t __n = _Nw - 1; __n >= __wshift; --__n)
+ _M_w[__n] = _M_w[__n - __wshift];
+
+ else {
+ const size_t __sub_offset = __BITS_PER_WORD - __offset;
+ for (size_t __n = _Nw - 1; __n > __wshift; --__n)
+ _M_w[__n] = (_M_w[__n - __wshift] << __offset) |
+ (_M_w[__n - __wshift - 1] >> __sub_offset);
+ _M_w[__wshift] = _M_w[0] << __offset;
+ }
+
+ fill(_M_w + 0, _M_w + __wshift, __STATIC_CAST(_WordT,0));
+ }
+}
+
+template<size_t _Nw>
+void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) {
+ if (__shift != 0) {
+ const size_t __wshift = __shift / __BITS_PER_WORD;
+ const size_t __offset = __shift % __BITS_PER_WORD;
+ const size_t __limit = _Nw - __wshift - 1;
+
+ if (__offset == 0)
+ for (size_t __n = 0; __n <= __limit; ++__n)
+ _M_w[__n] = _M_w[__n + __wshift];
+
+ else {
+ const size_t __sub_offset = __BITS_PER_WORD - __offset;
+ for (size_t __n = 0; __n < __limit; ++__n)
+ _M_w[__n] = (_M_w[__n + __wshift] >> __offset) |
+ (_M_w[__n + __wshift + 1] << __sub_offset);
+ _M_w[__limit] = _M_w[_Nw-1] >> __offset;
+ }
+
+ fill(_M_w + __limit + 1, _M_w + _Nw, __STATIC_CAST(_WordT,0));
+ }
+}
+
+template<size_t _Nw>
+unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const {
+ for (size_t __i = 1; __i < _Nw; ++__i)
+ if (_M_w[__i])
+ __stl_throw_overflow_error("bitset");
+ return _M_w[0];
+} // End _M_do_to_ulong
+
+template<size_t _Nw>
+size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _WordT __thisword = _M_w[__i];
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __i*__BITS_PER_WORD + __j*CHAR_BIT +
+ _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ }
+ // not found, so return an indication of failure.
+ return __not_found;
+}
+
+template<size_t _Nw>
+size_t
+_Base_bitset<_Nw>::_M_do_find_next(size_t __prev,
+ size_t __not_found) const {
+ // make bound inclusive
+ ++__prev;
+
+ // check out of bounds
+ if ( __prev >= _Nw * __BITS_PER_WORD )
+ return __not_found;
+
+ // search first word
+ size_t __i = _S_whichword(__prev);
+ _WordT __thisword = _M_w[__i];
+
+ // mask off bits below bound
+ __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev);
+
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ // get first byte into place
+ __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
+ for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); ++__j ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __i*__BITS_PER_WORD + __j*CHAR_BIT +
+ _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+
+ // check subsequent words
+ ++__i;
+ for ( ; __i < _Nw; ++__i ) {
+ /* _WordT */ __thisword = _M_w[__i];
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ for ( size_t __j = 0; __j < sizeof(_WordT); ++__j ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __i*__BITS_PER_WORD + __j*CHAR_BIT +
+ _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ }
+
+ // not found, so return an indication of failure.
+ return __not_found;
+} // end _M_do_find_next
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+#ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h> //includes _istream.h and _ostream.h
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) {
+ basic_string<_CharT, _Traits> __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename basic_istream<_CharT, _Traits>::sentry __sentry(__is);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
+ }
+
+ return __is;
+}
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const bitset<_Nb>& __x) {
+ basic_string<_CharT, _Traits> __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+# endif /* !_STLP_USE_NO_IOSTREAMS */
+
+#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+
+_STLP_END_NAMESPACE
+
+#undef __BITS_PER_WORD
+#undef bitset
+
+#endif /* _STLP_BITSET_C */
diff --git a/build/stlport/stlport/stl/_bitset.h b/build/stlport/stlport/stl/_bitset.h
new file mode 100644
index 000000000..f894346a4
--- /dev/null
+++ b/build/stlport/stlport/stl/_bitset.h
@@ -0,0 +1,880 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET_H
+#define _STLP_BITSET_H
+
+// A bitset of size N has N % (sizeof(unsigned long) * CHAR_BIT) unused
+// bits. (They are the high- order bits in the highest word.) It is
+// a class invariant of class bitset<> that those unused bits are
+// always zero.
+
+// Most of the actual code isn't contained in bitset<> itself, but in the
+// base class _Base_bitset. The base class works with whole words, not with
+// individual bits. This allows us to specialize _Base_bitset for the
+// important special case where the bitset is only a single word.
+
+// The C++ standard does not define the precise semantics of operator[].
+// In this implementation the const version of operator[] is equivalent
+// to test(), except that it does no range checking. The non-const version
+// returns a reference to a bit, again without doing any range checking.
+
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+#define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long))
+#define __BITSET_WORDS(__n) ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD)
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// structure to aid in counting bits
+class _STLP_CLASS_DECLSPEC _Bs_G
+{
+ public:
+ //returns the number of bit set within the buffer between __beg and __end.
+ static size_t _S_count(const unsigned char *__beg, const unsigned char *__end)
+#if defined (_STLP_USE_NO_IOSTREAMS)
+ {
+ size_t __result = 0;
+ for (; __beg != __end; ++__beg) {
+ for (size_t i = 0; i < (sizeof(unsigned char) * 8); ++i) {
+ if ((*__beg & (1 << i)) != 0) { ++__result; }
+ }
+ }
+ return __result;
+ }
+#else
+ ;
+#endif
+ // Mapping from 8 bit unsigned integers to the index of the first one bit set:
+ static unsigned char _S_first_one(unsigned char __x)
+#if defined (_STLP_USE_NO_IOSTREAMS)
+ {
+ for (unsigned char i = 0; i < (sizeof(unsigned char) * 8); ++i) {
+ if ((__x & (1 << i)) != 0) { return i; }
+ }
+ return 0;
+ }
+#else
+ ;
+#endif
+};
+
+//
+// Base class: general case.
+//
+
+template<size_t _Nw>
+struct _Base_bitset {
+ typedef unsigned long _WordT;
+
+ _WordT _M_w[_Nw]; // 0 is the least significant word.
+
+ _Base_bitset() { _M_do_reset(); }
+
+ _Base_bitset(unsigned long __val) {
+ _M_do_reset();
+ _M_w[0] = __val;
+ }
+
+ static size_t _STLP_CALL _S_whichword( size_t __pos ) {
+ return __pos / __BITS_PER_WORD;
+ }
+ static size_t _STLP_CALL _S_whichbyte( size_t __pos ) {
+ return (__pos % __BITS_PER_WORD) / CHAR_BIT;
+ }
+ static size_t _STLP_CALL _S_whichbit( size_t __pos ) {
+ return __pos % __BITS_PER_WORD;
+ }
+ static _WordT _STLP_CALL _S_maskbit( size_t __pos ) {
+ return __STATIC_CAST(_WordT,1) << _S_whichbit(__pos);
+ }
+
+ _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; }
+ _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; }
+
+ _WordT& _M_hiword() { return _M_w[_Nw - 1]; }
+ _WordT _M_hiword() const { return _M_w[_Nw - 1]; }
+
+ void _M_do_and(const _Base_bitset<_Nw>& __x) {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] &= __x._M_w[__i];
+ }
+ }
+
+ void _M_do_or(const _Base_bitset<_Nw>& __x) {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] |= __x._M_w[__i];
+ }
+ }
+
+ void _M_do_xor(const _Base_bitset<_Nw>& __x) {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] ^= __x._M_w[__i];
+ }
+ }
+
+ void _M_do_left_shift(size_t __shift);
+
+ void _M_do_right_shift(size_t __shift);
+
+ void _M_do_flip() {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] = ~_M_w[__i];
+ }
+ }
+
+ void _M_do_set() {
+ for ( size_t __i = 0; __i < _Nw; __i++ ) {
+ _M_w[__i] = ~__STATIC_CAST(_WordT,0);
+ }
+ }
+
+ void _M_do_reset() { memset(_M_w, 0, _Nw * sizeof(_WordT)); }
+
+ bool _M_is_equal(const _Base_bitset<_Nw>& __x) const {
+ for (size_t __i = 0; __i < _Nw; ++__i) {
+ if (_M_w[__i] != __x._M_w[__i])
+ return false;
+ }
+ return true;
+ }
+
+ bool _M_is_any() const {
+ for ( size_t __i = 0; __i < _Nw ; __i++ ) {
+ if ( _M_w[__i] != __STATIC_CAST(_WordT,0) )
+ return true;
+ }
+ return false;
+ }
+
+ size_t _M_do_count() const {
+ const unsigned char* __byte_ptr = (const unsigned char*)_M_w;
+ const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw);
+
+ return _Bs_G::_S_count(__byte_ptr, __end_ptr);
+ }
+
+ unsigned long _M_do_to_ulong() const;
+
+ // find first "on" bit
+ size_t _M_do_find_first(size_t __not_found) const;
+
+ // find the next "on" bit that follows "prev"
+ size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
+};
+
+//
+// Base class: specialization for a single word.
+//
+_STLP_TEMPLATE_NULL
+struct _Base_bitset<1UL> {
+ typedef unsigned long _WordT;
+ typedef _Base_bitset<1UL> _Self;
+
+ _WordT _M_w;
+
+ _Base_bitset( void ) : _M_w(0) {}
+ _Base_bitset(unsigned long __val) : _M_w(__val) {}
+
+ static size_t _STLP_CALL _S_whichword( size_t __pos ) {
+ return __pos / __BITS_PER_WORD ;
+ }
+ static size_t _STLP_CALL _S_whichbyte( size_t __pos ) {
+ return (__pos % __BITS_PER_WORD) / CHAR_BIT;
+ }
+ static size_t _STLP_CALL _S_whichbit( size_t __pos ) {
+ return __pos % __BITS_PER_WORD;
+ }
+ static _WordT _STLP_CALL _S_maskbit( size_t __pos ) {
+ return (__STATIC_CAST(_WordT,1)) << _S_whichbit(__pos);
+ }
+
+ _WordT& _M_getword(size_t) { return _M_w; }
+ _WordT _M_getword(size_t) const { return _M_w; }
+
+ _WordT& _M_hiword() { return _M_w; }
+ _WordT _M_hiword() const { return _M_w; }
+
+ void _M_do_and(const _Self& __x) { _M_w &= __x._M_w; }
+ void _M_do_or(const _Self& __x) { _M_w |= __x._M_w; }
+ void _M_do_xor(const _Self& __x) { _M_w ^= __x._M_w; }
+ void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; }
+ void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; }
+ void _M_do_flip() { _M_w = ~_M_w; }
+ void _M_do_set() { _M_w = ~__STATIC_CAST(_WordT,0); }
+ void _M_do_reset() { _M_w = 0; }
+
+ bool _M_is_equal(const _Self& __x) const {
+ return _M_w == __x._M_w;
+ }
+ bool _M_is_any() const {
+ return _M_w != 0;
+ }
+
+ size_t _M_do_count() const {
+ const unsigned char* __byte_ptr = (const unsigned char*)&_M_w;
+ const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w);
+ return _Bs_G::_S_count(__byte_ptr, __end_ptr);
+ }
+
+ unsigned long _M_do_to_ulong() const { return _M_w; }
+
+ inline size_t _M_do_find_first(size_t __not_found) const;
+
+ // find the next "on" bit that follows "prev"
+ inline size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
+};
+
+
+// ------------------------------------------------------------
+//
+// Definitions of should-be-non-inline functions from the single-word version of
+// _Base_bitset.
+//
+inline size_t
+_Base_bitset<1UL>::_M_do_find_first(size_t __not_found) const {
+ // typedef unsigned long _WordT;
+ _WordT __thisword = _M_w;
+
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ // not found, so return a value that indicates failure.
+ return __not_found;
+}
+
+inline size_t
+_Base_bitset<1UL>::_M_do_find_next(size_t __prev,
+ size_t __not_found ) const {
+ // make bound inclusive
+ ++__prev;
+
+ // check out of bounds
+ if ( __prev >= __BITS_PER_WORD )
+ return __not_found;
+
+ // search first (and only) word
+ _WordT __thisword = _M_w;
+
+ // mask off bits below bound
+ __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev);
+
+ if ( __thisword != __STATIC_CAST(_WordT,0) ) {
+ // find byte within word
+ // get first byte into place
+ __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
+ for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
+ if ( __this_byte )
+ return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte);
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+
+ // not found, so return a value that indicates failure.
+ return __not_found;
+} // end _M_do_find_next
+
+
+// ------------------------------------------------------------
+// Helper class to zero out the unused high-order bits in the highest word.
+
+template <size_t _Extrabits> struct _Sanitize {
+ static void _STLP_CALL _M_do_sanitize(unsigned long& __val)
+ { __val &= ~((~__STATIC_CAST(unsigned long,0)) << _Extrabits); }
+};
+
+_STLP_TEMPLATE_NULL struct _Sanitize<0UL> {
+ static void _STLP_CALL _M_do_sanitize(unsigned long) {}
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// ------------------------------------------------------------
+// Class bitset.
+// _Nb may be any nonzero number of type size_t.
+template<size_t _Nb>
+class bitset : public _STLP_PRIV _Base_bitset<__BITSET_WORDS(_Nb) > {
+public:
+ enum { _Words = __BITSET_WORDS(_Nb) } ;
+
+private:
+ typedef _STLP_PRIV _Base_bitset< _Words > _Base;
+
+ void _M_do_sanitize() {
+ _STLP_PRIV _Sanitize<_Nb%__BITS_PER_WORD >::_M_do_sanitize(this->_M_hiword());
+ }
+public:
+ typedef unsigned long _WordT;
+ struct reference;
+ friend struct reference;
+
+ // bit reference:
+ struct reference {
+ typedef _STLP_PRIV _Base_bitset<_Words > _Bitset_base;
+ typedef bitset<_Nb> _Bitset;
+ // friend _Bitset;
+ _WordT *_M_wp;
+ size_t _M_bpos;
+
+ // should be left undefined
+ reference() {}
+
+ reference( _Bitset& __b, size_t __pos ) {
+ _M_wp = &__b._M_getword(__pos);
+ _M_bpos = _Bitset_base::_S_whichbit(__pos);
+ }
+
+ public:
+ ~reference() {}
+
+ // for b[i] = __x;
+ reference& operator=(bool __x) {
+ if ( __x )
+ *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos);
+ else
+ *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos);
+
+ return *this;
+ }
+
+ // for b[i] = b[__j];
+ reference& operator=(const reference& __j) {
+ if ( (*(__j._M_wp) & _Bitset_base::_S_maskbit(__j._M_bpos)) )
+ *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos);
+ else
+ *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos);
+
+ return *this;
+ }
+
+ // flips the bit
+ bool operator~() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) == 0; }
+
+ // for __x = b[i];
+ operator bool() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) != 0; }
+
+ // for b[i].flip();
+ reference& flip() {
+ *_M_wp ^= _Bitset_base::_S_maskbit(_M_bpos);
+ return *this;
+ }
+ };
+
+ // 23.3.5.1 constructors:
+ bitset() {}
+
+ bitset(unsigned long __val) : _STLP_PRIV _Base_bitset<_Words>(__val) { _M_do_sanitize(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _CharT, class _Traits, class _Alloc>
+ explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ size_t __pos = 0)
+ : _STLP_PRIV _Base_bitset<_Words >() {
+ if (__pos > __s.size())
+ __stl_throw_out_of_range("bitset");
+ _M_copy_from_string(__s, __pos,
+ basic_string<_CharT, _Traits, _Alloc>::npos);
+ }
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __pos,
+ size_t __n)
+ : _STLP_PRIV _Base_bitset<_Words >() {
+ if (__pos > __s.size())
+ __stl_throw_out_of_range("bitset");
+ _M_copy_from_string(__s, __pos, __n);
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ explicit bitset(const string& __s,
+ size_t __pos = 0,
+ size_t __n = (size_t)-1)
+ : _STLP_PRIV _Base_bitset<_Words >() {
+ if (__pos > __s.size())
+ __stl_throw_out_of_range("bitset");
+ _M_copy_from_string(__s, __pos, __n);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ // 23.3.5.2 bitset operations:
+ bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) {
+ this->_M_do_and(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) {
+ this->_M_do_or(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) {
+ this->_M_do_xor(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>& operator<<=(size_t __pos) {
+ this->_M_do_left_shift(__pos);
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ bitset<_Nb>& operator>>=(size_t __pos) {
+ this->_M_do_right_shift(__pos);
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ //
+ // Extension:
+ // Versions of single-bit set, reset, flip, test with no range checking.
+ //
+
+ bitset<_Nb>& _Unchecked_set(size_t __pos) {
+ this->_M_getword(__pos) |= _STLP_PRIV _Base_bitset<_Words > ::_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) {
+ if (__val)
+ this->_M_getword(__pos) |= this->_S_maskbit(__pos);
+ else
+ this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
+
+ return *this;
+ }
+
+ bitset<_Nb>& _Unchecked_reset(size_t __pos) {
+ this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>& _Unchecked_flip(size_t __pos) {
+ this->_M_getword(__pos) ^= this->_S_maskbit(__pos);
+ return *this;
+ }
+
+ bool _Unchecked_test(size_t __pos) const {
+ return (this->_M_getword(__pos) & this->_S_maskbit(__pos)) != __STATIC_CAST(_WordT,0);
+ }
+
+ // Set, reset, and flip.
+
+ bitset<_Nb>& set() {
+ this->_M_do_set();
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ bitset<_Nb>& set(size_t __pos) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+ return _Unchecked_set(__pos);
+ }
+
+ bitset<_Nb>& set(size_t __pos, int __val) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+ return _Unchecked_set(__pos, __val);
+ }
+
+ bitset<_Nb>& reset() {
+ this->_M_do_reset();
+ return *this;
+ }
+
+ bitset<_Nb>& reset(size_t __pos) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+
+ return _Unchecked_reset(__pos);
+ }
+
+ bitset<_Nb>& flip() {
+ this->_M_do_flip();
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ bitset<_Nb>& flip(size_t __pos) {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+
+ return _Unchecked_flip(__pos);
+ }
+
+ bitset<_Nb> operator~() const {
+ return bitset<_Nb>(*this).flip();
+ }
+
+ // element access:
+ //for b[i];
+ reference operator[](size_t __pos) { return reference(*this,__pos); }
+ bool operator[](size_t __pos) const { return _Unchecked_test(__pos); }
+
+ unsigned long to_ulong() const { return this->_M_do_to_ulong(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+ template <class _CharT, class _Traits, class _Alloc>
+ basic_string<_CharT, _Traits, _Alloc> to_string() const {
+ basic_string<_CharT, _Traits, _Alloc> __result;
+ _M_copy_to_string(__result);
+ return __result;
+ }
+#else
+ string to_string() const {
+ string __result;
+ _M_copy_to_string(__result);
+ return __result;
+ }
+#endif /* _STLP_EXPLICIT_FUNCTION_TMPL_ARGS */
+
+ size_t count() const { return this->_M_do_count(); }
+
+ size_t size() const { return _Nb; }
+
+ bool operator==(const bitset<_Nb>& __rhs) const {
+ return this->_M_is_equal(__rhs);
+ }
+ bool operator!=(const bitset<_Nb>& __rhs) const {
+ return !this->_M_is_equal(__rhs);
+ }
+
+ bool test(size_t __pos) const {
+ if (__pos >= _Nb)
+ __stl_throw_out_of_range("bitset");
+
+ return _Unchecked_test(__pos);
+ }
+
+ bool any() const { return this->_M_is_any(); }
+ bool none() const { return !this->_M_is_any(); }
+
+ bitset<_Nb> operator<<(size_t __pos) const {
+ bitset<_Nb> __result(*this);
+ __result <<= __pos ; return __result;
+ }
+ bitset<_Nb> operator>>(size_t __pos) const {
+ bitset<_Nb> __result(*this);
+ __result >>= __pos ; return __result;
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ //
+ // EXTENSIONS: bit-find operations. These operations are
+ // experimental, and are subject to change or removal in future
+ // versions.
+ //
+
+ // find the index of the first "on" bit
+ size_t _Find_first() const
+ { return this->_M_do_find_first(_Nb); }
+
+ // find the index of the next "on" bit after prev
+ size_t _Find_next( size_t __prev ) const
+ { return this->_M_do_find_next(__prev, _Nb); }
+#endif
+
+//
+// Definitions of should-be non-inline member functions.
+//
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _CharT, class _Traits, class _Alloc>
+ void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ size_t __pos, size_t __n) {
+#else
+ void _M_copy_from_string(const string& __s,
+ size_t __pos, size_t __n) {
+ typedef typename string::traits_type _Traits;
+#endif
+ reset();
+ size_t __tmp = _Nb;
+ const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos));
+ for ( size_t __i= 0; __i < __Nbits; ++__i) {
+ typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]);
+ // boris : widen() ?
+ if (__k == '1')
+ set(__i);
+ else if (__k != '0')
+ __stl_throw_invalid_argument("bitset");
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _CharT, class _Traits, class _Alloc>
+ void _M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const
+#else
+ void _M_copy_to_string(string& __s) const
+#endif
+ {
+ __s.assign(_Nb, '0');
+
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ if (_Unchecked_test(__i))
+ __s[_Nb - 1 - __i] = '1';
+ }
+ }
+
+#if !defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_WCHAR_T)
+ void _M_copy_to_string(wstring& __s) const {
+ __s.assign(_Nb, '0');
+
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ if (_Unchecked_test(__i))
+ __s[_Nb - 1 - __i] = '1';
+ }
+ }
+#endif
+
+#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+ bitset<_Nb> operator&(const bitset<_Nb>& __y) const {
+ bitset<_Nb> __result(*this);
+ __result &= __y;
+ return __result;
+ }
+ bitset<_Nb> operator|(const bitset<_Nb>& __y) const {
+ bitset<_Nb> __result(*this);
+ __result |= __y;
+ return __result;
+ }
+ bitset<_Nb> operator^(const bitset<_Nb>& __y) const {
+ bitset<_Nb> __result(*this);
+ __result ^= __y;
+ return __result;
+ }
+#endif
+};
+
+// ------------------------------------------------------------
+//
+// 23.3.5.3 bitset operations:
+//
+#if ! defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+template <size_t _Nb>
+inline bitset<_Nb> _STLP_CALL
+operator&(const bitset<_Nb>& __x,
+ const bitset<_Nb>& __y) {
+ bitset<_Nb> __result(__x);
+ __result &= __y;
+ return __result;
+}
+
+
+template <size_t _Nb>
+inline bitset<_Nb> _STLP_CALL
+operator|(const bitset<_Nb>& __x,
+ const bitset<_Nb>& __y) {
+ bitset<_Nb> __result(__x);
+ __result |= __y;
+ return __result;
+}
+
+template <size_t _Nb>
+inline bitset<_Nb> _STLP_CALL
+operator^(const bitset<_Nb>& __x,
+ const bitset<_Nb>& __y) {
+ bitset<_Nb> __result(__x);
+ __result ^= __y;
+ return __result;
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) && \
+ !(defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x500))
+
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x);
+
+template <class _CharT, class _Traits, size_t _Nb>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x);
+
+# else
+
+#ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h> //includes _istream.h and _ostream.h
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <size_t _Nb>
+istream& _STLP_CALL
+operator>>(istream& __is, bitset<_Nb>& __x) {
+ typedef typename string::traits_type _Traits;
+ string __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename istream::sentry __sentry(__is);
+ if (__sentry) {
+ streambuf* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
+ }
+
+ return __is;
+}
+
+template <size_t _Nb>
+ostream& _STLP_CALL
+operator<<(ostream& __os, const bitset<_Nb>& __x) {
+ string __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+# if !defined (_STLP_NO_WCHAR_T)
+
+template <size_t _Nb>
+wistream& _STLP_CALL
+operator>>(wistream& __is, bitset<_Nb>& __x) {
+ typedef typename wstring::traits_type _Traits;
+ wstring __tmp;
+ __tmp.reserve(_Nb);
+
+ // Skip whitespace
+ typename wistream::sentry __sentry(__is);
+ if (__sentry) {
+ wstreambuf* __buf = __is.rdbuf();
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof)) {
+ __is.setstate(ios_base::eofbit);
+ break;
+ }
+ else {
+ typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
+ char __c = __is.narrow(__c2, '*');
+
+ if (__c == '0' || __c == '1')
+ __tmp.push_back(__c);
+ else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
+ __is.setstate(ios_base::failbit);
+ break;
+ }
+ }
+ }
+
+ if (__tmp.empty())
+ __is.setstate(ios_base::failbit);
+ else
+ __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
+ }
+
+ return __is;
+}
+
+template <size_t _Nb>
+wostream& _STLP_CALL
+operator<<(wostream& __os, const bitset<_Nb>& __x) {
+ wstring __tmp;
+ __x._M_copy_to_string(__tmp);
+ return __os << __tmp;
+}
+
+# endif /* _STLP_NO_WCHAR_T */
+# endif
+#endif
+
+#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+
+#undef bitset
+
+_STLP_END_NAMESPACE
+
+#undef __BITS_PER_WORD
+#undef __BITSET_WORDS
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_bitset.c>
+#endif
+
+#endif /* _STLP_BITSET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_bvector.h b/build/stlport/stlport/stl/_bvector.h
new file mode 100644
index 000000000..bf417f179
--- /dev/null
+++ b/build/stlport/stlport/stl/_bvector.h
@@ -0,0 +1,841 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_BVECTOR_H
+#define _STLP_INTERNAL_BVECTOR_H
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#define _STLP_WORD_BIT (int(CHAR_BIT * sizeof(unsigned int)))
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Bit_reference {
+ unsigned int* _M_p;
+ unsigned int _M_mask;
+ _Bit_reference(unsigned int* __x, unsigned int __y)
+ : _M_p(__x), _M_mask(__y) {}
+
+public:
+ _Bit_reference() : _M_p(0), _M_mask(0) {}
+
+ operator bool() const {
+ return !(!(*_M_p & _M_mask));
+ }
+ _Bit_reference& operator = (bool __x) {
+ if (__x) *_M_p |= _M_mask;
+ else *_M_p &= ~_M_mask;
+ return *this;
+ }
+ _Bit_reference& operator = (const _Bit_reference& __x) {
+ return *this = bool(__x);
+ }
+ bool operator == (const _Bit_reference& __x) const {
+ return bool(*this) == bool(__x);
+ }
+ bool operator < (const _Bit_reference& __x) const {
+ return !bool(*this) && bool(__x);
+ }
+
+ _Bit_reference& operator |= (bool __x) {
+ if (__x)
+ *_M_p |= _M_mask;
+ return *this;
+ }
+ _Bit_reference& operator &= (bool __x) {
+ if (!__x)
+ *_M_p &= ~_M_mask;
+ return *this;
+ }
+ void flip() { *_M_p ^= _M_mask; }
+};
+
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) {
+ bool __tmp = (bool)__x;
+ __x = __y;
+ __y = __tmp;
+}
+
+// Might not be very useful but costs nothing!
+_STLP_TEMPLATE_NULL
+struct __type_traits<_STLP_PRIV _Bit_reference> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Bit_iterator_base {
+ typedef ptrdiff_t difference_type;
+
+ unsigned int* _M_p;
+ unsigned int _M_offset;
+
+ void _M_bump_up() {
+ if (_M_offset++ == _STLP_WORD_BIT - 1) {
+ _M_offset = 0;
+ ++_M_p;
+ }
+ }
+
+ void _M_bump_down() {
+ if (_M_offset-- == 0) {
+ _M_offset = _STLP_WORD_BIT - 1;
+ --_M_p;
+ }
+ }
+
+ _Bit_iterator_base() : _M_p(0), _M_offset(0) {}
+ _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {}
+// see comment in doc/README.evc4 and doc/README.evc8
+#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
+ _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
+#endif
+ // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; }
+
+ void _M_advance (difference_type __i) {
+ difference_type __n = __i + _M_offset;
+ _M_p += __n / _STLP_WORD_BIT;
+ __n = __n % _STLP_WORD_BIT;
+ if (__n < 0) {
+ _M_offset = (unsigned int) __n + _STLP_WORD_BIT;
+ --_M_p;
+ } else
+ _M_offset = (unsigned int) __n;
+ }
+
+ difference_type _M_subtract(const _Bit_iterator_base& __x) const {
+ return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
+ }
+};
+
+inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset;
+}
+inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset;
+}
+
+inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
+}
+
+inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return operator <(__y , __x);
+}
+inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return !(__y < __x);
+}
+inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return !(__x < __y);
+}
+
+template <class _Ref, class _Ptr>
+struct _Bit_iter : public _Bit_iterator_base {
+ typedef _Ref reference;
+ typedef _Ptr pointer;
+ typedef _Bit_iter<_Ref, _Ptr> _Self;
+ typedef random_access_iterator_tag iterator_category;
+ typedef bool value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {}
+ _Bit_iter() {}
+
+ _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
+ _Bit_iterator_base((const _Bit_iterator_base&)__x) {}
+
+ // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x)
+ // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; }
+
+ reference operator*() const {
+ return _Bit_reference(_M_p, 1UL << _M_offset);
+ }
+ _Self& operator++() {
+ _M_bump_up();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_bump_up();
+ return __tmp;
+ }
+ _Self& operator--() {
+ _M_bump_down();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ _M_bump_down();
+ return __tmp;
+ }
+ _Self& operator+=(difference_type __i) {
+ _M_advance(__i);
+ return *this;
+ }
+ _Self& operator-=(difference_type __i) {
+ *this += -__i;
+ return *this;
+ }
+ _Self operator+(difference_type __i) const {
+ _Self __tmp = *this;
+ return __tmp += __i;
+ }
+ _Self operator-(difference_type __i) const {
+ _Self __tmp = *this;
+ return __tmp -= __i;
+ }
+ difference_type operator-(const _Self& __x) const {
+ return _M_subtract(__x);
+ }
+ reference operator[](difference_type __i) { return *(*this + __i); }
+};
+
+template <class _Ref, class _Ptr>
+inline _Bit_iter<_Ref,_Ptr> _STLP_CALL
+operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) {
+ return __x + __n;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Ref, class _Ptr>
+struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&)
+{ return random_access_iterator_tag(); }
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&)
+{ return (ptrdiff_t*)0; }
+inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&)
+{ return (bool*)0; }
+inline bool* value_type(const _STLP_PRIV _Bit_iter<bool, const bool*>&)
+{ return (bool*)0; }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef _Bit_iter<bool, const bool*> _Bit_const_iterator;
+typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator;
+
+// Bit-vector base class, which encapsulates the difference between
+// old SGI-style allocators and standard-conforming allocators.
+template <class _Alloc>
+class _Bvector_base {
+ typedef _Bvector_base<_Alloc> _Self;
+public:
+ _STLP_FORCE_ALLOCATORS(bool, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef unsigned int __chunk_type;
+ typedef typename _Alloc_traits<__chunk_type, _Alloc>::allocator_type __chunk_allocator_type;
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(__STATIC_CAST(const __chunk_allocator_type&, _M_end_of_storage), bool); }
+
+ _Bvector_base(const allocator_type& __a)
+ : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type),
+ (__chunk_type*)0)
+ {}
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Bvector_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(src.get()._M_end_of_storage) {
+ //Make the source destroyable
+ src.get()._M_start._M_p = 0;
+ }
+#endif
+
+ ~_Bvector_base() {
+ _M_deallocate();
+ }
+
+protected:
+
+ static size_t _M_bits_to_chunks(size_t __n_bits)
+ { return (__n_bits + _STLP_WORD_BIT - 1) / _STLP_WORD_BIT; }
+
+ __chunk_type* _M_bit_alloc(size_t __n)
+ { return _M_end_of_storage.allocate(_M_bits_to_chunks(__n)); }
+
+ void _M_deallocate() {
+ if (_M_start._M_p)
+ _M_end_of_storage.deallocate(_M_start._M_p,
+ _M_end_of_storage._M_data - _M_start._M_p);
+ }
+
+ _Bit_iterator _M_start;
+ _Bit_iterator _M_finish;
+ _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
+};
+
+
+// The next few lines are confusing. What we're doing is declaring a
+// partial specialization of vector<T, Alloc> if we have the necessary
+// compiler support. Otherwise, we define a class bit_vector which uses
+// the default allocator.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
+# define _STLP_VECBOOL_TEMPLATE
+# define __BVEC_TMPL_HEADER template <class _Alloc>
+#else
+# undef _STLP_VECBOOL_TEMPLATE
+# ifdef _STLP_NO_BOOL
+# define __BVEC_TMPL_HEADER
+# else
+# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
+# endif
+# define _Alloc allocator<bool>
+#endif
+
+#if defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#endif
+
+#ifdef _STLP_NO_BOOL
+# define __BVECTOR_QUALIFIED bit_vector
+# define __BVECTOR bit_vector
+#else
+# ifdef _STLP_VECBOOL_TEMPLATE
+# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
+# else
+# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
+# endif
+# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
+# define __BVECTOR __BVECTOR_QUALIFIED
+# else
+# define __BVECTOR vector
+# endif
+#endif
+
+#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+__BVEC_TMPL_HEADER
+class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
+ , public __stlport_class< __BVECTOR_QUALIFIED >
+#endif
+{
+ typedef _STLP_PRIV _Bvector_base<_Alloc > _Base;
+ typedef __BVECTOR_QUALIFIED _Self;
+public:
+ typedef bool value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _STLP_PRIV _Bit_reference reference;
+ typedef bool const_reference;
+ typedef _STLP_PRIV _Bit_reference* pointer;
+ typedef const bool* const_pointer;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Bit_iterator iterator;
+ typedef _STLP_PRIV _Bit_const_iterator const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+#ifdef _STLP_VECBOOL_TEMPLATE
+ typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
+ typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
+#else
+ typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
+ typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
+#endif
+
+protected:
+
+ void _M_initialize(size_type __n) {
+ __chunk_type* __q = this->_M_bit_alloc(__n);
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n);
+ this->_M_start = iterator(__q, 0);
+ this->_M_finish = this->_M_start + difference_type(__n);
+ }
+ void _M_insert_aux(iterator __position, bool __x) {
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
+ _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1,
+ random_access_iterator_tag(), (difference_type*)0 );
+ *__position = __x;
+ ++this->_M_finish;
+ }
+ else {
+ size_type __len = size() ? 2 * size() : _STLP_WORD_BIT;
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ *__i++ = __x;
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_initialize_range(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ this->_M_start = iterator();
+ this->_M_finish = iterator();
+ this->_M_end_of_storage._M_data = 0;
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ template <class _ForwardIterator>
+ void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ _M_initialize(__n);
+ _STLP_STD::copy(__first, __last, this->_M_start);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_range(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range(iterator __position,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
+ random_access_iterator_tag(), (difference_type*)0 );
+ _STLP_STD::copy(__first, __last, __position);
+ this->_M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ __i = _STLP_STD::copy(__first, __last, __i);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+public:
+ iterator begin() { return this->_M_start; }
+ const_iterator begin() const { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator end() const { return this->_M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ size_type size() const { return size_type(end() - begin()); }
+ size_type max_size() const { return size_type(-1); }
+ size_type capacity() const {
+ return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin());
+ }
+ bool empty() const { return begin() == end(); }
+ reference operator[](size_type __n)
+ { return *(begin() + difference_type(__n)); }
+ const_reference operator[](size_type __n) const
+ { return *(begin() + difference_type(__n)); }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_range_error("vector<bool>");
+ }
+
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ explicit __BVECTOR(const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {}
+
+ __BVECTOR(size_type __n, bool __val,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0);
+ }
+
+ explicit __BVECTOR(size_type __n)
+ : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0);
+ }
+
+ __BVECTOR(const _Self& __x)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) {
+ _M_initialize(__x.size());
+ _STLP_STD::copy(__x.begin(), __x.end(), this->_M_start);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ __BVECTOR(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+# endif
+ template <class _InputIterator>
+ __BVECTOR(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ __BVECTOR(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ _M_initialize(__n);
+ _STLP_STD::copy(__first, __last, this->_M_start);
+ }
+ __BVECTOR(const bool* __first, const bool* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ _M_initialize(__n);
+ _STLP_STD::copy(__first, __last, this->_M_start);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ __BVECTOR(__move_source<_Self> src)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {}
+#endif
+
+ ~__BVECTOR() {}
+
+ __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) {
+ if (&__x == this) return *this;
+ if (__x.size() > capacity()) {
+ this->_M_deallocate();
+ _M_initialize(__x.size());
+ }
+ _STLP_STD::copy(__x.begin(), __x.end(), begin());
+ this->_M_finish = begin() + difference_type(__x.size());
+ return *this;
+ }
+
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void _M_fill_assign(size_t __n, bool __x) {
+ if (__n > size()) {
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
+ insert(end(), __n - size(), __x);
+ }
+ else {
+ erase(begin() + __n, end());
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
+ }
+ }
+ void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
+ { _M_fill_assign((size_t) __n, (bool) __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&)
+ { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+ template <class _InputIterator>
+ void _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _ForwardIterator>
+ void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len < size())
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void reserve(size_type __n) {
+ if (capacity() < __n) {
+ if (max_size() < __n)
+ __stl_throw_length_error("vector<bool>");
+ __chunk_type* __q = this->_M_bit_alloc(__n);
+ _STLP_PRIV _Bit_iterator __z(__q, 0);
+ this->_M_finish = _STLP_STD::copy(begin(), end(), __z);
+ this->_M_deallocate();
+ this->_M_start = iterator(__q, 0);
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n);
+ }
+ }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+ void push_back(bool __x) {
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
+ *(this->_M_finish) = __x;
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_aux(end(), __x);
+ }
+ void swap(__BVECTOR_QUALIFIED& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_end_of_storage.swap(__x._M_end_of_storage);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(__BVECTOR_QUALIFIED& __x) { swap(__x); }
+#endif
+
+ iterator insert(iterator __position, bool __x = bool()) {
+ difference_type __n = __position - begin();
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) {
+ *(this->_M_finish) = __x;
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_aux(__position, __x);
+ return begin() + __n;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_fill_insert(__pos, (size_type) __n, (bool) __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __position,
+ _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __position,
+ const_iterator __first, const_iterator __last) {
+ if (__first == __last) return;
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
+ random_access_iterator_tag(), (difference_type*)0 );
+ _STLP_STD::copy(__first, __last, __position);
+ this->_M_finish += __n;
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ __i = _STLP_STD::copy(__first, __last, __i);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+ void insert(iterator __position, const bool* __first, const bool* __last) {
+ if (__first == __last) return;
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
+ random_access_iterator_tag(), (difference_type*)0 );
+ _STLP_STD::copy(__first, __last, __position);
+ this->_M_finish += __n;
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ __i = _STLP_STD::copy(__first, __last, __i);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void _M_fill_insert(iterator __position, size_type __n, bool __x) {
+ if (__n == 0) return;
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
+ random_access_iterator_tag(), (difference_type*)0 );
+ fill(__position, __position + difference_type(__n), __x);
+ this->_M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ fill_n(__i, __n, __x);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i + difference_type(__n));
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+ void insert(iterator __position, size_type __n, bool __x) {
+ _M_fill_insert(__position, __n, __x);
+ }
+
+ void pop_back() {
+ --this->_M_finish;
+ }
+ iterator erase(iterator __position) {
+ if (__position + 1 != end())
+ _STLP_STD::copy(__position + 1, end(), __position);
+ --this->_M_finish;
+ return __position;
+ }
+ iterator erase(iterator __first, iterator __last) {
+ this->_M_finish = _STLP_STD::copy(__last, end(), __first);
+ return __first;
+ }
+ void resize(size_type __new_size, bool __x = bool()) {
+ if (__new_size < size())
+ erase(begin() + difference_type(__new_size), end());
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+ void flip() {
+ for (__chunk_type* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p)
+ *__p = ~*__p;
+ }
+
+ void clear() { erase(begin(), end()); }
+};
+
+#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000)
+# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
+# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
+# include <stl/_relops_cont.h>
+# undef _STLP_TEMPLATE_CONTAINER
+# undef _STLP_TEMPLATE_HEADER
+#endif /* NO_BOOL */
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef vector
+#undef _Alloc
+#undef _STLP_VECBOOL_TEMPLATE
+#undef __BVECTOR
+#undef __BVECTOR_QUALIFIED
+#undef __BVEC_TMPL_HEADER
+
+#undef _STLP_WORD_BIT
+
+#endif /* _STLP_INTERNAL_BVECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_carray.h b/build/stlport/stlport/stl/_carray.h
new file mode 100644
index 000000000..560bab295
--- /dev/null
+++ b/build/stlport/stlport/stl/_carray.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_CARRAY_H
+#define _STLP_CARRAY_H
+
+/* Purpose: Mimic a pur C array with the additionnal feature of
+ * being able to be used with type not default constructible.
+ */
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, size_t _Nb>
+struct _CArray {
+ _CArray (const _Tp& __val) {
+ for (size_t __i = 0; __i < _Nb; ++__i) {
+ _Copy_Construct(__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)), __val);
+ }
+ }
+
+ ~_CArray() {
+ _Destroy_Range(__REINTERPRET_CAST(_Tp*, _M_data + 0),
+ __REINTERPRET_CAST(_Tp*, _M_data + _Nb * sizeof(_Tp)));
+ }
+
+ _Tp& operator [] (size_t __i) {
+ _STLP_ASSERT(__i < _Nb)
+ return *__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp));
+ }
+
+private:
+ char _M_data[sizeof(_Tp) * _Nb];
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif //_STLP_CARRAY_H
diff --git a/build/stlport/stlport/stl/_cctype.h b/build/stlport/stlport/stl/_cctype.h
new file mode 100644
index 000000000..cf82524ae
--- /dev/null
+++ b/build/stlport/stlport/stl/_cctype.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CCTYPE
+#define _STLP_INTERNAL_CCTYPE
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+# endif
+#else
+# include <ctype.h>
+#endif /* _STLP_USE_NEW_C_HEADERS */
+
+#if ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if defined ( _STLP_IMPORT_VENDOR_CSTD )
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::isalnum;
+using _STLP_VENDOR_CSTD::isalpha;
+using _STLP_VENDOR_CSTD::iscntrl;
+using _STLP_VENDOR_CSTD::isdigit;
+using _STLP_VENDOR_CSTD::isgraph;
+using _STLP_VENDOR_CSTD::islower;
+using _STLP_VENDOR_CSTD::isprint;
+using _STLP_VENDOR_CSTD::ispunct;
+using _STLP_VENDOR_CSTD::isspace;
+using _STLP_VENDOR_CSTD::isupper;
+using _STLP_VENDOR_CSTD::isxdigit;
+using _STLP_VENDOR_CSTD::tolower;
+using _STLP_VENDOR_CSTD::toupper;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD*/
+#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+
+#endif
diff --git a/build/stlport/stlport/stl/_clocale.h b/build/stlport/stlport/stl/_clocale.h
new file mode 100644
index 000000000..2dcf39a75
--- /dev/null
+++ b/build/stlport/stlport/stl/_clocale.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CLOCALE
+#define _STLP_INTERNAL_CLOCALE
+
+#if !defined (_STLP_WCE_EVC3)
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <clocale>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(clocale)
+# endif
+# else
+# include <locale.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::lconv;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(__ANDROID__)
+using _STLP_VENDOR_CSTD::localeconv;
+using _STLP_VENDOR_CSTD::setlocale;
+# endif
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* !_STLP_WCE_EVC3 */
+
+#endif
diff --git a/build/stlport/stlport/stl/_cmath.h b/build/stlport/stlport/stl/_cmath.h
new file mode 100644
index 000000000..771c27d48
--- /dev/null
+++ b/build/stlport/stlport/stl/_cmath.h
@@ -0,0 +1,605 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CMATH
+#define _STLP_INTERNAL_CMATH
+
+/* gcc do not like when a using directive appear after a function
+ * declaration. cmath have abs overloads and cstdlib a using directive
+ * so cstdlib has to be included first.
+ */
+#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdlib>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+# endif
+#endif
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
+# define exception __math_exception
+# endif
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cmath>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cmath)
+# endif
+# if defined (_STLP_HAS_NO_NAMESPACES)
+# undef exception
+# endif
+#else
+# include <math.h>
+#endif
+
+#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
+ !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
+# if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC)
+// All the other hypot stuff is going to be at file scope, so follow along here.
+namespace std {
+# endif
+extern "C" double hypot(double x, double y);
+# if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC)
+}
+# endif
+
+#endif
+
+#if defined (__sun) && defined (__GNUC__)
+extern "C" {
+ float __cosf(float v);
+ float __sinf(float v);
+ float __atan2f(float, float);
+ float __coshf(float v);
+ float __sinhf(float v);
+ float __sqrtf(float v);
+ float __expf(float v);
+ float __logf(float v);
+ float __log10f(float v);
+
+ long double __cosl(long double v);
+ long double __sinl(long double v);
+ long double __atan2l(long double, long double);
+ long double __coshl(long double v);
+ long double __sinhl(long double v);
+ long double __sqrtl(long double v);
+ long double __expl(long double v);
+ long double __logl(long double v);
+ long double __log10l(long double v);
+}
+
+extern "C" {
+ inline float cosf(float v) { return __cosf(v); }
+ inline float sinf(float v) { return __sinf(v); }
+ inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
+ inline float coshf(float v) { return __coshf(v); }
+ inline float sinhf(float v) { return __sinhf(v); }
+ inline float sqrtf(float v) { return __sqrtf(v); }
+ inline float expf(float v) { return __expf(v); }
+ inline float logf(float v) { return __logf(v); }
+ inline float log10f(float v) { return __log10f(v); }
+
+ inline long double cosl(long double v) { return __cosl(v); }
+ inline long double sinl(long double v) { return __sinl(v); }
+ inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
+ inline long double coshl(long double v) { return __coshl(v); }
+ inline long double sinhl(long double v) { return __sinhl(v); }
+ inline long double sqrtl(long double v) { return __sqrtl(v); }
+ inline long double expl(long double v) { return __expl(v); }
+ inline long double logl(long double v) { return __logl(v); }
+ inline long double log10l(long double v) { return __log10l(v); }
+}
+#endif // __sun && __GNUC__
+
+#if defined (__sun)
+extern "C" {
+extern float __acosf(float);
+extern float __asinf(float);
+extern float __atanf(float);
+extern float __atan2f(float, float);
+extern float __ceilf(float);
+extern float __cosf(float);
+extern float __coshf(float);
+extern float __expf(float);
+extern float __fabsf(float);
+extern float __floorf(float);
+extern float __fmodf(float, float);
+extern float __frexpf(float, int *);
+extern float __ldexpf(float, int);
+extern float __logf(float);
+extern float __log10f(float);
+extern float __modff(float, float *);
+extern float __powf(float, float);
+extern float __sinf(float);
+extern float __sinhf(float);
+extern float __sqrtf(float);
+extern float __tanf(float);
+extern float __tanhf(float);
+
+extern long double __acosl(long double);
+extern long double __asinl(long double);
+extern long double __atanl(long double);
+extern long double __atan2l(long double, long double);
+extern long double __ceill(long double);
+extern long double __cosl(long double);
+extern long double __coshl(long double);
+extern long double __expl(long double);
+extern long double __fabsl(long double);
+extern long double __floorl(long double);
+extern long double __fmodl(long double, long double);
+extern long double __frexpl(long double, int *);
+extern long double __ldexpl(long double, int);
+extern long double __logl(long double);
+extern long double __log10l(long double);
+extern long double __modfl(long double, long double *);
+extern long double __powl(long double, long double);
+extern long double __sinl(long double);
+extern long double __sinhl(long double);
+extern long double __sqrtl(long double);
+extern long double __tanl(long double);
+extern long double __tanhl(long double);
+}
+#endif
+
+#if defined (__BORLANDC__)
+# define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
+#else
+# define _STLP_CMATH_FUNC_NAMESPACE
+#endif
+
+#if !defined (__sun) || defined (__GNUC__)
+# define _STLP_MATH_INLINE(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
+# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
+# define _STLP_MATH_INLINE_D(float_type, func, cfunc)
+# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
+#else
+# ifdef __SUNPRO_CC
+# define _STLP_MATH_INLINE(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
+# define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
+# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
+# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
+# else
+# error Unknown compiler for the Sun platform
+# endif
+#endif
+
+/** macros to define math functions
+These macros (having an X somewhere in the name) forward to the C library's
+double functions but cast the arguments and return values to the given type. */
+
+#define _STLP_MATH_INLINEX(__type,func,cfunc) \
+ inline __type func (__type x) \
+ { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
+#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
+ inline __type1 func (__type1 x, __type2 y) \
+ { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
+#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
+ inline __type func (__type x, __type *y) { \
+ double tmp1, tmp2; \
+ tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
+ *y = __STATIC_CAST(__type, tmp2); \
+ return __STATIC_CAST(__type, tmp1); \
+ }
+#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
+ inline __type func (__type x, __type y) \
+ { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
+
+
+/** rough characterization of compiler and native C library
+For the compiler, it can either support long double or not. If it doesn't, the
+macro _STLP_NO_LONG_DOUBLE is defined and we don't define any long double
+overloads.
+For the native C library the question is whether it has variants with an 'f'
+suffix (for float as opposed to double) or an 'l' suffix (for long double). If
+the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
+long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
+the latter doesn't make sense anyway when the compiler already has no long
+double support.
+
+Those two traits determine a) which overloads get defined and b) how they are
+defined.
+
+Meaning of suffixes:
+"" : function returning and taking a float_type
+"2" : function returning a float_type and taking to float_types
+"2P" : function returning a float_type and taking a float_type and a float_type*
+"2PI": function returning a float_type and taking a float_type and an int*
+"2I" : function returning a float_type and taking a float_Type and an int
+*/
+
+#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
+ // long double support and both e.g. sinl(long double) and sinf(float)
+ // This is the default for a correct and complete native library.
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f) \
+ _STLP_MATH_INLINE_D(double,func,cf) \
+ _STLP_MATH_INLINE(long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,double,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,double *,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,int *,func,cf) \
+ _STLP_MATH_INLINE2(long double,int *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,int,func,cf) \
+ _STLP_MATH_INLINE2(long double,int,func,cf##l)
+#else
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if !defined (_STLP_NO_VENDOR_MATH_F)
+ // long double support and e.g. sinf(float) but not e.g. sinl(long double)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f) \
+ _STLP_MATH_INLINEX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f) \
+ _STLP_MATH_INLINE2XX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f) \
+ _STLP_MATH_INLINE2PX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f) \
+ _STLP_MATH_INLINE2X(long double,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f) \
+ _STLP_MATH_INLINE2X(long double,int,func,cf)
+# elif !defined (_STLP_NO_VENDOR_MATH_L)
+ // long double support and e.g. sinl(long double) but not e.g. sinf(float)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf) \
+ _STLP_MATH_INLINE(long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf) \
+ _STLP_MATH_INLINE2(long double,int *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf) \
+ _STLP_MATH_INLINE2(long double,int,func,cf##l)
+# else
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf) \
+ _STLP_MATH_INLINEX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf) \
+ _STLP_MATH_INLINE2XX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf) \
+ _STLP_MATH_INLINE2PX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf) \
+ _STLP_MATH_INLINE2X(long double,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf) \
+ _STLP_MATH_INLINE2X(long double,int,func,cf)
+# endif
+# else
+# if !defined (_STLP_NO_VENDOR_MATH_F)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f)
+# else // _STLP_NO_VENDOR_MATH_F
+ // neither long double support nor e.g. sinf(float) functions
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf)
+# endif // _STLP_NO_VENDOR_MATH_F
+# endif
+#endif
+
+#if defined (_STLP_WCE) || \
+ (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
+/*
+ * dums: VC6 has all the required C++ functions but only define them if
+ * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
+ * thing also when _MSC_EXTENSIONS is defined.
+ * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
+ */
+//We have to tell the compilers that abs, acos ... math functions are not intrinsic
+//otherwise we have Internal Compiler Error in release mode...
+# pragma warning(push)
+# pragma warning(disable: 4162) // no function with C linkage found
+# pragma warning(disable: 4163) // not available as an intrinsic function
+# pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
+# if defined (_STLP_WCE)
+# pragma function (ceil, floor)
+# endif
+# define _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
+
+#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS)
+/* In this config Borland native lib only define functions in std namespace.
+ * In order to have all overloads in STLport namespace we need to add the
+ * double overload in global namespace. We do not use a using statement to avoid
+ * import of invalid overload.
+ */
+# define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
+# define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
+
+_STLP_DMATH_INLINE(acos)
+_STLP_DMATH_INLINE(asin)
+_STLP_DMATH_INLINE(atan)
+_STLP_DMATH_INLINE2(atan2)
+_STLP_DMATH_INLINE(ceil)
+_STLP_DMATH_INLINE(cos)
+_STLP_DMATH_INLINE(cosh)
+_STLP_DMATH_INLINE(exp)
+_STLP_DMATH_INLINE(fabs)
+_STLP_DMATH_INLINE(floor)
+_STLP_DMATH_INLINE2(fmod)
+_STLP_MATH_INLINE2X(double, int*, frexp, frexp)
+_STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
+_STLP_DMATH_INLINE(log)
+_STLP_DMATH_INLINE(log10)
+_STLP_MATH_INLINE2PX(double, modf, modf)
+_STLP_DMATH_INLINE(sin)
+_STLP_DMATH_INLINE(sinh)
+_STLP_DMATH_INLINE(sqrt)
+_STLP_DMATH_INLINE(tan)
+_STLP_DMATH_INLINE(tanh)
+_STLP_DMATH_INLINE2(pow)
+_STLP_DMATH_INLINE2(hypot)
+
+# undef _STLP_DMATH_INLINE
+# undef _STLP_DMATH_INLINE2
+#endif
+
+#if defined (__DMC__)
+# if defined (fabs)
+inline double __stlp_fabs(double __x) { return fabs(__x); }
+# undef fabs
+inline double fabs(double __x) { return __stlp_fabs(__x); }
+# endif
+# if defined (cos)
+inline double __stlp_cos(double __x) { return cos(__x); }
+# undef cos
+inline double cos(double __x) { return __stlp_cos(__x); }
+# endif
+# if defined (sin)
+inline double __stlp_sin(double __x) { return sin(__x); }
+# undef sin
+inline double sin(double __x) { return __stlp_sin(__x); }
+# endif
+# if defined (sqrt)
+inline double __stlp_sqrt(double __x) { return sqrt(__x); }
+# undef sqrt
+inline double sqrt(double __x) { return __stlp_sqrt(__x); }
+# endif
+# if defined (ldexp)
+inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
+# undef ldexp
+inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
+# endif
+#endif
+
+/* MSVC native lib starting with .Net 2003 has already all math functions
+ * in global namespace.
+ * HP-UX native lib has math functions in the global namespace.
+ */
+#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
+ (!defined (__HP_aCC) || (__HP_aCC < 30000)) && \
+ !defined (__WATCOMC__)
+inline double abs(double __x)
+{ return ::fabs(__x); }
+# if !defined (__MVS__)
+_STLP_DEF_MATH_INLINE(abs, fabs)
+# else // __MVS__ has native long double abs?
+inline float abs(float __x) { return ::fabsf(__x); }
+# endif
+
+_STLP_DEF_MATH_INLINE(acos, acos)
+_STLP_DEF_MATH_INLINE(asin, asin)
+_STLP_DEF_MATH_INLINE(atan, atan)
+_STLP_DEF_MATH_INLINE2(atan2, atan2)
+_STLP_DEF_MATH_INLINE(ceil, ceil)
+_STLP_DEF_MATH_INLINE(cos, cos)
+_STLP_DEF_MATH_INLINE(cosh, cosh)
+_STLP_DEF_MATH_INLINE(exp, exp)
+_STLP_DEF_MATH_INLINE(fabs, fabs)
+_STLP_DEF_MATH_INLINE(floor, floor)
+_STLP_DEF_MATH_INLINE2(fmod, fmod)
+_STLP_DEF_MATH_INLINE2PI(frexp, frexp)
+_STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
+_STLP_DEF_MATH_INLINE(log, log)
+_STLP_DEF_MATH_INLINE(log10, log10)
+_STLP_DEF_MATH_INLINE2P(modf, modf)
+_STLP_DEF_MATH_INLINE(sin, sin)
+_STLP_DEF_MATH_INLINE(sinh, sinh)
+_STLP_DEF_MATH_INLINE(sqrt, sqrt)
+_STLP_DEF_MATH_INLINE(tan, tan)
+_STLP_DEF_MATH_INLINE(tanh, tanh)
+_STLP_DEF_MATH_INLINE2(pow, pow)
+
+# if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
+# ifndef _STLP_NO_VENDOR_MATH_F
+# ifndef __sun
+inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
+# else
+inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
+# endif
+# else
+inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
+# endif
+inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if !defined(_STLP_NO_VENDOR_MATH_L)
+# ifndef __sun
+inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
+# else
+# ifndef __SUNPRO_CC
+inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
+# else
+inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
+# endif
+# endif
+# else
+inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); }
+# endif
+# endif
+# else
+//The MS native pow version has a bugged overload so it is not imported
+//in the STLport namespace.
+//Here is the bugged version:
+//inline double pow(int __x, int __y) { return (_Pow_int(__x, __y)); }
+inline double pow(double __x, int __y) { return (_Pow_int(__x, __y)); }
+inline float pow(float __x, int __y) { return (_Pow_int(__x, __y)); }
+inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
+# endif
+#endif
+
+#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
+# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
+# pragma warning (push)
+# pragma warning (disable : 4996) // hypot is deprecated.
+# endif
+_STLP_MATH_INLINE2XX(float, hypot, hypot)
+inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
+# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
+# pragma warning (pop)
+# endif
+#else
+# if defined (_STLP_USE_UCLIBC)
+inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
+_STLP_DEF_MATH_INLINE2(hypot, hypot)
+# elif defined (_STLP_WCE)
+ /* CE has a double _hypot(double,double) which we use */
+inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
+_STLP_DEF_MATH_INLINE2(hypot, _hypot)
+# endif
+#endif
+
+#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
+//restoration of the default intrinsic status of those functions:
+# pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
+# if defined (_STLP_WCE)
+# pragma intrinsic (ceil, floor)
+# endif
+# pragma warning(pop)
+# undef _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
+
+/* C++ Standard is unclear about several call to 'using ::func' if new overloads
+ * of ::func appears between 2 successive 'using' calls. To avoid this potential
+ * problem we provide all abs overload before the 'using' call.
+ * Beware: This header inclusion has to be after all abs overload of this file.
+ * The first 'using ::abs' call is going to be in the other header.
+ */
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+#if defined (__ANDROID__)
+namespace __captured {
+template<typename _Tp> inline int __capture_isfinite(_Tp __f) { return isfinite(__f); }
+template<typename _Tp> inline int __capture_isinf(_Tp __f) { return isinf(__f); }
+template<typename _Tp> inline int __capture_isnan(_Tp __f) { return isnan(__f); }
+template<typename _Tp> inline int __capture_signbit(_Tp __f) { return signbit(__f); }
+}
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef signbit
+namespace __captured {
+template<typename _Tp> inline int isfinite(_Tp __f) { return __capture_isfinite(__f); }
+template<typename _Tp> inline int isinf(_Tp __f) { return __capture_isinf(__f); }
+template<typename _Tp> inline int isnan(_Tp __f) { return __capture_isnan(__f); }
+template<typename _Tp> inline int signbit(_Tp __f) { return __capture_signbit(__f); }
+}
+#endif
+_STLP_BEGIN_NAMESPACE
+using ::abs;
+using ::acos;
+using ::asin;
+using ::atan;
+using ::atan2;
+using ::ceil;
+using ::cos;
+using ::cosh;
+using ::exp;
+using ::fabs;
+using ::floor;
+using ::fmod;
+using ::frexp;
+/*
+ Because of some weird interaction between STLport headers
+ and native HP-UX headers, when compiled with _STLP_DEBUG
+ macro defined with aC++, hypot() is not declared.
+ At some point we'll need to get to the bottom line of
+ this problem.
+*/
+#if !(defined(__HP_aCC) && defined(_STLP_DEBUG))
+using ::hypot;
+#endif
+#if defined (__ANDROID__)
+using __captured::isfinite;
+using __captured::isinf;
+using __captured::isnan;
+#endif
+using ::ldexp;
+using ::log;
+using ::log10;
+using ::modf;
+using ::pow;
+#if defined (__ANDROID__)
+using __captured::signbit;
+#endif
+using ::sin;
+using ::sinh;
+using ::sqrt;
+using ::tan;
+using ::tanh;
+_STLP_END_NAMESPACE
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560) && !defined (__linux__)
+using _STLP_VENDOR_CSTD::_ecvt;
+using _STLP_VENDOR_CSTD::_fcvt;
+# endif
+#endif
+
+#endif /* _STLP_INTERNAL_CMATH */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_codecvt.h b/build/stlport/stlport/stl/_codecvt.h
new file mode 100644
index 000000000..29b408b2e
--- /dev/null
+++ b/build/stlport/stlport/stl/_codecvt.h
@@ -0,0 +1,442 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_CODECVT_H
+#define _STLP_INTERNAL_CODECVT_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC codecvt_base {
+public:
+ enum result {ok, partial, error, noconv};
+};
+
+template <class _InternT, class _ExternT, class _StateT>
+class codecvt : public locale::facet, public codecvt_base {
+public:
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
+ /* For the moment VC6 do not support this facet default implementation
+ * because of the static locale::id instance. When VC6 see this definition
+ * it goes crasy with locale::id static instances and all the has_facet tests
+ * unit tests are failing.
+ */
+};
+#else
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const intern_type* __from,
+ const intern_type* __from_end,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type* __to_limit,
+ extern_type*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ extern_type* __to,
+ extern_type* __to_limit,
+ extern_type*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const extern_type* __from,
+ const extern_type* __from_end,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type* __to_limit,
+ intern_type*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(state_type& __state,
+ const extern_type* __from,
+ const extern_type* __from_end,
+ size_t __max) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ return do_length(__state, __from, __from_end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static locale::id id;
+
+protected:
+ ~codecvt() {}
+
+ virtual result do_out(state_type&,
+ const intern_type* __from,
+ const intern_type*,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ virtual result do_in (state_type&,
+ const extern_type* __from,
+ const extern_type*,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type*,
+ intern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ virtual result do_unshift(state_type&,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __to_next = __to; return noconv; }
+
+ virtual int do_encoding() const _STLP_NOTHROW
+ { return 1; }
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW
+ { return true; }
+
+ virtual int do_length(state_type&,
+ const extern_type* __from,
+ const extern_type* __end,
+ size_t __max) const
+ { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); }
+
+ virtual int do_max_length() const _STLP_NOTHROW
+ { return 1; }
+
+private:
+ codecvt(const codecvt<intern_type, extern_type, state_type>&);
+ codecvt<intern_type, extern_type, state_type>& operator = (const codecvt<intern_type, extern_type, state_type>&);
+};
+
+# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)
+template <class _InternT, class _ExternT, class _StateT>
+locale::id codecvt<_InternT, _ExternT, _StateT>::id;
+# endif
+# endif
+#endif
+
+template <class _InternT, class _ExternT, class _StateT>
+class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt<char, char, mbstate_t>
+ : public locale::facet, public codecvt_base {
+public:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ char* __to, char* __to_limit, char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(state_type& __state,
+ const char* __from, const char* __from_end,
+ size_t __max) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ return do_length(__state, __from, __from_end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt();
+
+ virtual result do_out(state_type& /* __state */,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const;
+
+ virtual result do_in (state_type& /* __state */ ,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_end */,
+ char*& __to_next) const;
+
+ virtual result do_unshift(state_type& /* __state */,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+ virtual int do_length(state_type& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+ virtual int do_max_length() const _STLP_NOTHROW;
+private:
+ codecvt(const codecvt<char, char, mbstate_t>&);
+ codecvt<char, char, mbstate_t>& operator =(const codecvt<char, char, mbstate_t>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt<wchar_t, char, mbstate_t>
+ : public locale::facet, public codecvt_base {
+public:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ char* __to, char* __to_limit, char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(state_type& __state,
+ const char* __from, const char* __from_end,
+ size_t __max) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ return do_length(__state, __from, __from_end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt();
+
+ virtual result do_out(state_type& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual result do_in (state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const;
+
+ virtual result do_unshift(state_type& __state,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+
+ virtual int do_length(state_type& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+
+ virtual int do_max_length() const _STLP_NOTHROW;
+
+private:
+ codecvt(const codecvt<wchar_t, char, mbstate_t>&);
+ codecvt<wchar_t, char, mbstate_t>& operator = (const codecvt<wchar_t, char, mbstate_t>&);
+};
+
+# endif
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt_byname<char, char, mbstate_t>
+ : public codecvt<char, char, mbstate_t> {
+public:
+ explicit codecvt_byname(const char* __name, size_t __refs = 0);
+ ~codecvt_byname();
+private:
+ codecvt_byname(const codecvt_byname<char, char, mbstate_t>&);
+ codecvt_byname<char, char, mbstate_t>& operator =(const codecvt_byname<char, char, mbstate_t>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt_byname<wchar_t, char, mbstate_t>
+ : public codecvt<wchar_t, char, mbstate_t> {
+ friend class _Locale_impl;
+public:
+ explicit codecvt_byname(const char * __name, size_t __refs = 0);
+
+protected:
+ ~codecvt_byname();
+
+ virtual result do_out(state_type& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual result do_in (state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const;
+
+ virtual result do_unshift(state_type& __state,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+
+ virtual int do_length(state_type& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+
+ virtual int do_max_length() const _STLP_NOTHROW;
+
+private:
+ codecvt_byname(_Locale_codecvt* __cvt)
+ : _M_codecvt(__cvt) {}
+
+ codecvt_byname(const codecvt_byname<wchar_t, char, mbstate_t>&);
+ codecvt_byname<wchar_t, char, mbstate_t>& operator =(const codecvt_byname<wchar_t, char, mbstate_t>&);
+ _Locale_codecvt* _M_codecvt;
+};
+
+# endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CODECVT_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_collate.h b/build/stlport/stlport/stl/_collate.h
new file mode 100644
index 000000000..4384f2e92
--- /dev/null
+++ b/build/stlport/stlport/stl/_collate.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+#ifndef _STLP_INTERNAL_COLLATE_H
+#define _STLP_INTERNAL_COLLATE_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT> class collate {};
+template <class _CharT> class collate_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate<char> : public locale::facet {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
+
+ int compare(const char* __low1, const char* __high1,
+ const char* __low2, const char* __high2) const {
+ return do_compare( __low1, __high1, __low2, __high2);
+ }
+
+ string_type transform(const char* __low, const char* __high) const {
+ return do_transform(__low, __high);
+ }
+
+ long hash(const char* __low, const char* __high) const
+ { return do_hash(__low, __high); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~collate();
+
+ virtual int do_compare(const char*, const char*,
+ const char*, const char*) const;
+ virtual string_type do_transform(const char*, const char*) const;
+ virtual long do_hash(const char*, const char*) const;
+private:
+ collate(const collate<char>&);
+ collate<char>& operator =(const collate<char>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate<wchar_t> : public locale::facet {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
+
+ int compare(const wchar_t* __low1, const wchar_t* __high1,
+ const wchar_t* __low2, const wchar_t* __high2) const {
+ return do_compare( __low1, __high1, __low2, __high2);
+ }
+
+ string_type transform(const wchar_t* __low, const wchar_t* __high) const {
+ return do_transform(__low, __high);
+ }
+
+ long hash(const wchar_t* __low, const wchar_t* __high) const
+ { return do_hash(__low, __high); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~collate();
+
+ virtual int do_compare(const wchar_t*, const wchar_t*,
+ const wchar_t*, const wchar_t*) const;
+ virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
+ virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const;
+private:
+ collate(const collate<wchar_t>&);
+ collate<wchar_t>& operator = (const collate<wchar_t>&);
+};
+
+# endif /* NO_WCHAR_T */
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate_byname<char>: public collate<char> {
+ friend class _Locale_impl;
+public:
+ explicit collate_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~collate_byname();
+
+ virtual int do_compare(const char*, const char*,
+ const char*, const char*) const;
+ virtual string_type do_transform(const char*, const char*) const;
+
+private:
+ collate_byname(_Locale_collate *__coll)
+ : _M_collate(__coll) {}
+ _Locale_collate* _M_collate;
+ collate_byname(const collate_byname<char>&);
+ collate_byname<char>& operator =(const collate_byname<char>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate_byname<wchar_t>: public collate<wchar_t> {
+ friend class _Locale_impl;
+public:
+ explicit collate_byname(const char * __name, size_t __refs = 0);
+
+protected:
+ ~collate_byname();
+
+ virtual int do_compare(const wchar_t*, const wchar_t*,
+ const wchar_t*, const wchar_t*) const;
+ virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
+
+private:
+ collate_byname(_Locale_collate *__coll)
+ : _M_collate(__coll) {}
+ _Locale_collate* _M_collate;
+ collate_byname(const collate_byname<wchar_t>&);
+ collate_byname<wchar_t>& operator =(const collate_byname<wchar_t>&);
+};
+
+# endif /* NO_WCHAR_T */
+
+template <class _CharT, class _Traits, class _Alloc>
+bool
+__locale_do_operator_call (const locale& __loc,
+ const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) {
+ collate<_CharT> const& __coll = use_facet<collate<_CharT> >(__loc);
+ return __coll.compare(__x.data(), __x.data() + __x.size(),
+ __y.data(), __y.data() + __y.size()) < 0;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_COLLATE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_complex.c b/build/stlport/stlport/stl/_complex.c
new file mode 100644
index 000000000..204fa1ecf
--- /dev/null
+++ b/build/stlport/stlport/stl/_complex.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_COMPLEX_C
+#define _STLP_COMPLEX_C
+
+#ifndef _STLP_INTERNAL_COMPLEX
+# include <stl/_complex.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+
+# ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+# endif
+
+# ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Non-inline member functions.
+
+template <class _Tp>
+void complex<_Tp>::_div(const _Tp& __z1_r, const _Tp& __z1_i,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio + __z1_i) / __denom;
+ __res_i = (__z1_i * __ratio - __z1_r) / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = (__z1_r + __z1_i * __ratio) / __denom;
+ __res_i = (__z1_i - __z1_r * __ratio) / __denom;
+ }
+}
+
+template <class _Tp>
+void complex<_Tp>::_div(const _Tp& __z1_r,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio) / __denom;
+ __res_i = - __z1_r / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = __z1_r / __denom;
+ __res_i = - (__z1_r * __ratio) / __denom;
+ }
+}
+
+// I/O.
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+// Complex output, in the form (re,im). We use a two-step process
+// involving stringstream so that we get the padding right.
+template <class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) {
+ basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp;
+ __tmp.flags(__os.flags());
+ __tmp.imbue(__os.getloc());
+ __tmp.precision(__os.precision());
+ __tmp << '(' << __z.real() << ',' << __z.imag() << ')';
+ return __os << __tmp.str();
+}
+
+// Complex input from arbitrary streams. Note that results in some
+// locales may be confusing, since the decimal character varies with
+// locale and the separator between real and imaginary parts does not.
+
+template <class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) {
+ _Tp __re = 0;
+ _Tp __im = 0;
+
+ const ctype<_CharT>& __c_type = *__is._M_ctype_facet();
+
+ const char __punct[4] = "(,)";
+ _CharT __wpunct[3];
+ __c_type.widen(__punct, __punct + 3, __wpunct);
+
+ _CharT __c;
+
+ __is >> __c;
+ if (_Traits::eq(__c, __wpunct[0])) { // Left paren
+ __is >> __re >> __c;
+ if (_Traits::eq(__c, __wpunct[1])) // Comma
+ __is >> __im >> __c;
+ if (!_Traits::eq(__c, __wpunct[2])) // Right paren
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<_Tp>(__re, __im);
+ return __is;
+}
+
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_COMPLEX_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_complex.h b/build/stlport/stlport/stl/_complex.h
new file mode 100644
index 000000000..5dba0ad40
--- /dev/null
+++ b/build/stlport/stlport/stl/_complex.h
@@ -0,0 +1,935 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_COMPLEX
+#define _STLP_INTERNAL_COMPLEX
+
+// This header declares the template class complex, as described in
+// in the draft C++ standard. Single-precision complex numbers
+// are complex<float>, double-precision are complex<double>, and
+// quad precision are complex<long double>.
+
+// Note that the template class complex is declared within namespace
+// std, as called for by the draft C++ standard.
+
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+struct complex {
+ typedef _Tp value_type;
+ typedef complex<_Tp> _Self;
+
+ // Constructors, destructor, assignment operator.
+ complex() : _M_re(0), _M_im(0) {}
+ complex(const value_type& __x)
+ : _M_re(__x), _M_im(0) {}
+ complex(const value_type& __x, const value_type& __y)
+ : _M_re(__x), _M_im(__y) {}
+ complex(const _Self& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp2>
+ explicit complex(const complex<_Tp2>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ template <class _Tp2>
+ _Self& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (const value_type& __x) {
+ _M_re = __x;
+ _M_im = 0;
+ return *this;
+ }
+ _Self& operator+= (const value_type& __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (const value_type& __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (const value_type& __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (const value_type& __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
+ const value_type& __z2_r, const value_type& __z2_i,
+ value_type& __res_r, value_type& __res_i);
+
+ static void _STLP_CALL _div(const value_type& __z1_r,
+ const value_type& __z2_r, const value_type& __z2_i,
+ value_type& __res_r, value_type& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+ template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+// Explicit specializations for float, double, long double. The only
+// reason for these specializations is to enable automatic conversions
+// from complex<float> to complex<double>, and complex<double> to
+// complex<long double>.
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<float> {
+ typedef float value_type;
+ typedef complex<float> _Self;
+ // Constructors, destructor, assignment operator.
+
+ complex(value_type __x = 0.0f, value_type __y = 0.0f)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ inline explicit complex(const complex<double>& __z);
+#ifndef _STLP_NO_LONG_DOUBLE
+ inline explicit complex(const complex<long double>& __z);
+#endif
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0f;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i);
+
+ static void _STLP_CALL _div(const float& __z1_r,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp2>
+ complex<float>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator*= (const complex<_Tp2>& __z) {
+ float __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ float __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator/= (const complex<_Tp2>& __z) {
+ float __r;
+ float __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<double> {
+ typedef double value_type;
+ typedef complex<double> _Self;
+
+ // Constructors, destructor, assignment operator.
+
+ complex(value_type __x = 0.0, value_type __y = 0.0)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+ inline complex(const complex<float>& __z);
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ explicit inline complex(const complex<long double>& __z);
+#endif
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i);
+ static void _STLP_CALL _div(const double& __z1_r,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp2>
+ complex<double>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator*= (const complex<_Tp2>& __z) {
+ double __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ double __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator/= (const complex<_Tp2>& __z) {
+ double __r;
+ double __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<long double> {
+ typedef long double value_type;
+ typedef complex<long double> _Self;
+
+ // Constructors, destructor, assignment operator.
+ complex(value_type __x = 0.0l, value_type __y = 0.0l)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<long double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+ inline complex(const complex<float>& __z);
+ inline complex(const complex<double>& __z);
+
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0l;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i);
+
+ static void _STLP_CALL _div(const long double& __z1_r,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i);
+
+# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+ template <class _Tp2>
+ complex<long double>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator*= (const complex<_Tp2>& __z) {
+ long double __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ long double __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator/= (const complex<_Tp2>& __z) {
+ long double __r;
+ long double __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+#endif /* _STLP_NO_LONG_DOUBLE */
+
+// Converting constructors from one of these three specialized types
+// to another.
+
+inline complex<float>::complex(const complex<double>& __z)
+ : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
+inline complex<double>::complex(const complex<float>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+#ifndef _STLP_NO_LONG_DOUBLE
+inline complex<float>::complex(const complex<long double>& __z)
+ : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
+inline complex<double>::complex(const complex<long double>& __z)
+ : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {}
+inline complex<long double>::complex(const complex<float>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+inline complex<long double>::complex(const complex<double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+#endif
+
+// Unary non-member arithmetic operators.
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
+{ return __z; }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
+{ return complex<_Tp>(-__z._M_re, -__z._M_im); }
+
+// Non-member arithmetic operations involving one real argument.
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x + __z._M_re, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re + __x, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re - __x, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
+ complex<_Tp> __result;
+ complex<_Tp>::_div(__x,
+ __z._M_re, __z._M_im,
+ __result._M_re, __result._M_im);
+ return __result;
+}
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
+
+// Non-member arithmetic operations involving two complex arguments
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
+ return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
+ __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
+}
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
+ complex<_Tp> __result;
+ complex<_Tp>::_div(__z1._M_re, __z1._M_im,
+ __z2._M_re, __z2._M_im,
+ __result._M_re, __result._M_im);
+ return __result;
+}
+
+// Comparison operators.
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
+{ return __z._M_re == __x && __z._M_im == 0; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
+{ return __x == __z._M_re && 0 == __z._M_im; }
+
+//04/27/04 dums: removal of this check, if it is restablish
+//please explain why the other operators are not macro guarded
+//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; }
+
+//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
+{ return __z._M_re != __x || __z._M_im != 0; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
+{ return __x != __z._M_re || 0 != __z._M_im; }
+
+// Other basic arithmetic operations
+template <class _Tp>
+inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
+{ return __z._M_re; }
+
+template <class _Tp>
+inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
+{ return __z._M_im; }
+
+template <class _Tp>
+_Tp _STLP_CALL abs(const complex<_Tp>& __z);
+
+template <class _Tp>
+_Tp _STLP_CALL arg(const complex<_Tp>& __z);
+
+template <class _Tp>
+inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
+{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
+{ return complex<_Tp>(__z._M_re, -__z._M_im); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
+{ return complex<_Tp>(__rho, 0); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
+
+template <class _Tp>
+_Tp _STLP_CALL abs(const complex<_Tp>& __z)
+{ return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
+
+template <class _Tp>
+_Tp _STLP_CALL arg(const complex<_Tp>& __z)
+{ return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
+ complex<double> __tmp = polar(double(__rho), double(__phi));
+ return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
+#endif
+
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+# ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Complex output, in the form (re,im). We use a two-step process
+// involving stringstream so that we get the padding right.
+template <class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
+
+template <class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
+
+// Specializations for narrow characters; lets us avoid widen.
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
+
+# endif
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
+
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
+# endif
+# endif
+#endif
+
+
+// Transcendental functions. These are defined only for float,
+// double, and long double. (Sqrt isn't transcendental, of course,
+// but it's included in this section anyway.)
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
+ const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
+#endif
+
+_STLP_END_NAMESPACE
+
+#ifndef _STLP_LINK_TIME_INSTANTIATION
+# include <stl/_complex.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_config_compat_post.h b/build/stlport/stlport/stl/_config_compat_post.h
new file mode 100644
index 000000000..e3b411172
--- /dev/null
+++ b/build/stlport/stlport/stl/_config_compat_post.h
@@ -0,0 +1,51 @@
+/*========================================== */
+#if 1 /* def _STLP_3_COMPATIBILITY */
+
+# define __SGI_STL_PORT _STLPORT_VERSION
+
+# if defined (_STLP_DEBUG) && ! defined ( __STL_DEBUG )
+# define __STL_DEBUG _STLP_DEBUG
+# endif
+
+# if defined (_STLP_USE_NAMESPACES)
+# undef __STL_USE_NAMESPACES
+# define __STL_USE_NAMESPACES _STLP_USE_NAMESPACES
+# endif
+
+# if defined (_STLP_USE_EXCEPTIONS)
+# undef __STL_USE_EXCEPTIONS
+# define __STL_USE_EXCEPTIONS _STLP_USE_EXCEPTIONS
+# endif
+
+# if defined (_STLP_BEGIN_NAMESPACE) && ! defined ( __STL_BEGIN_NAMESPACE )
+# define __STL_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
+# define __STL_END_NAMESPACE _STLP_END_NAMESPACE
+# define __STL_VENDOR_STD _STLP_VENDOR_STD
+# define __STL_VENDOR_CSTD _STLP_VENDOR_CSTD
+# endif
+# endif
+
+/*
+# if defined (_STLP_XXX) && ! defined ( __STL_XXX )
+# define __STL_XXX _STLP_XXX
+# endif
+*/
+
+/* 5.0 -> 4.6 compatibility section */
+#if 1 /* def _STLP_46_COMPATIBILITY */
+
+/* provide a uniform way to access full functionality */
+# define __slist__ slist
+# define __map__ map
+# define __multimap__ multimap
+# define __set__ set
+# define __multiset__ multiset
+# define __list__ list
+# define __hash_map__ hash_map
+# define __hash_multimap__ hash_multimap
+# define __hash_set__ hash_set
+# define __hash_multiset__ hash_multiset
+# define __vector__ vector
+
+#endif
+
diff --git a/build/stlport/stlport/stl/_construct.h b/build/stlport/stlport/stl/_construct.h
new file mode 100644
index 000000000..93618780b
--- /dev/null
+++ b/build/stlport/stlport/stl/_construct.h
@@ -0,0 +1,289 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+#define _STLP_INTERNAL_CONSTRUCT_H
+
+#if !defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_INTERNAL_CSTRING)
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+#if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# include <stl/_move_construct_fwk.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+inline void __destroy_aux(_Tp* __pointer, const __false_type& /*_Trivial_destructor*/)
+{ __pointer->~_Tp(); }
+
+template <class _Tp>
+inline void __destroy_aux(_Tp*, const __true_type& /*_Trivial_destructor*/) {}
+
+template <class _Tp>
+inline void _Destroy(_Tp* __pointer) {
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
+ __destroy_aux(__pointer, _Trivial_destructor());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+}
+
+template <class _Tp>
+inline void _Destroy_Moved(_Tp* __pointer) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::complete _Trivial_destructor;
+ __destroy_aux(__pointer, _Trivial_destructor());
+# if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp));
+# endif
+#else
+ _Destroy(__pointer);
+#endif
+}
+
+#if defined (new)
+# define _STLP_NEW_REDEFINE new
+# undef new
+#endif
+
+template <class _T1>
+inline void _Construct_aux (_T1* __p, const __false_type&) {
+ new(__p) _T1();
+}
+
+template <class _T1>
+inline void _Construct_aux (_T1* __p, const __true_type&) {
+#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ *__p = _T1(0);
+#else
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = _T1();
+#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
+}
+
+template <class _T1>
+inline void _Construct(_T1* __p) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer());
+#else
+ _Construct_aux (__p, _Is_POD(__p)._Answer());
+#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
+}
+
+template <class _Tp>
+inline void _Copy_Construct_aux(_Tp* __p, const _Tp& __val, const __false_type&) {
+ new(__p) _Tp(__val);
+}
+
+template <class _Tp>
+inline void _Copy_Construct_aux(_Tp* __p, const _Tp& __val, const __true_type&) {
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = __val;
+}
+
+template <class _Tp>
+inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+ _Copy_Construct_aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct_aux(_T1* __p, const _T2& __val, const __false_type&) {
+ new(__p) _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct_aux(_T1* __p, const _T2& __val, const __true_type&) {
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct(_T1* __p, const _T2& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+ _Param_Construct_aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __false_type& /*_IsPOD*/) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ new(__p) _T1(_STLP_PRIV _AsMoveSource(__val));
+#else
+ _Param_Construct(__p, __val);
+#endif
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __true_type& /*_IsPOD*/) {
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct(_T1* __p, _T2& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+ _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+#if defined(_STLP_NEW_REDEFINE)
+# if defined (DEBUG_NEW)
+# define new DEBUG_NEW
+# endif
+# undef _STLP_NEW_REDEFINE
+#endif
+
+template <class _ForwardIterator, class _Tp>
+_STLP_INLINE_LOOP void
+__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __false_type& /*_Trivial_destructor*/) {
+ for ( ; __first != __last; ++__first) {
+ __destroy_aux(&(*__first), __false_type());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+ }
+}
+
+template <class _ForwardIterator, class _Tp>
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+_STLP_INLINE_LOOP void
+__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __true_type& /*_Trivial_destructor*/) {
+ for ( ; __first != __last; ++__first)
+ memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
+}
+#else
+inline void
+__destroy_range_aux(_ForwardIterator, _ForwardIterator, _Tp*, const __true_type& /*_Trivial_destructor*/) {}
+#endif
+
+template <class _ForwardIterator, class _Tp>
+inline void
+__destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
+ __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor());
+}
+
+template <class _ForwardIterator>
+inline void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last) {
+ __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
+}
+
+inline void _Destroy_Range(char*, char*) {}
+#if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
+inline void _Destroy_Range(wchar_t*, wchar_t*) {}
+inline void _Destroy_Range(const wchar_t*, const wchar_t*) {}
+#endif
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _ForwardIterator, class _Tp>
+inline void
+__destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
+ typedef typename __move_traits<_Tp>::complete _CompleteMove;
+ __destroy_range_aux(__first, __last, __ptr, _CompleteMove());
+}
+#endif
+
+template <class _ForwardIterator>
+inline void _Destroy_Moved_Range(_ForwardIterator __first, _ForwardIterator __last)
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+{ __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); }
+#else
+{ _Destroy_Range(__first, __last); }
+#endif
+
+#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
+// Those adaptors are here to fix common compiler bug regarding builtins:
+// expressions like int k = int() should initialize k to 0
+template <class _Tp>
+inline _Tp __default_constructed_aux(_Tp*, const __false_type&) {
+ return _Tp();
+}
+template <class _Tp>
+inline _Tp __default_constructed_aux(_Tp*, const __true_type&) {
+ return _Tp(0);
+}
+
+template <class _Tp>
+inline _Tp __default_constructed(_Tp* __p) {
+ return __default_constructed_aux(__p, _HasDefaultZeroValue(__p)._Answer());
+}
+
+# define _STLP_DEFAULT_CONSTRUCTED(_TTp) __default_constructed((_TTp*)0)
+#else
+# define _STLP_DEFAULT_CONSTRUCTED(_TTp) _TTp()
+#endif /* _STLP_DEF_CONST_DEF_PARAM_BUG */
+
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+// --------------------------------------------------
+// Old names from the HP STL.
+
+template <class _T1, class _T2>
+inline void construct(_T1* __p, const _T2& __val) {_Param_Construct(__p, __val); }
+template <class _T1>
+inline void construct(_T1* __p) { _STLP_STD::_Construct(__p); }
+template <class _Tp>
+inline void destroy(_Tp* __pointer) { _STLP_STD::_Destroy(__pointer); }
+template <class _ForwardIterator>
+inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy_Range(__first, __last); }
+#endif /* _STLP_NO_ANACHRONISMS */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CONSTRUCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_cprolog.h b/build/stlport/stlport/stl/_cprolog.h
new file mode 100644
index 000000000..1d276562c
--- /dev/null
+++ b/build/stlport/stlport/stl/_cprolog.h
@@ -0,0 +1,25 @@
+/* NOTE : this header has no guards and is MEANT for multiple inclusion!
+ * If you are using "header protection" option with your compiler,
+ * please also find #pragma which disables it and put it here, to
+ * allow reentrancy of this header.
+ */
+
+#ifdef std
+# undef std /* We undef "std" on entry , as STLport headers may include native ones. */
+#endif
+
+#ifdef _STLP_PROLOG_HEADER_INCLUDED
+# error STlport prolog header can not be reincluded as long as epilog has not be included.
+#endif
+
+#define _STLP_PROLOG_HEADER_INCLUDED
+
+#ifndef _STLP_FEATURES_H
+# include <stl/config/features.h>
+#endif
+
+/* If the platform provides any specific prolog actions,
+ * like #pragmas, do include platform-specific prolog file */
+#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG)
+# include <stl/config/_prolog.h>
+#endif
diff --git a/build/stlport/stlport/stl/_csetjmp.h b/build/stlport/stlport/stl/_csetjmp.h
new file mode 100644
index 000000000..ca132c110
--- /dev/null
+++ b/build/stlport/stlport/stl/_csetjmp.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSETJMP
+#define _STLP_INTERNAL_CSETJMP
+
+// if the macro is on, the header is already there
+#if !defined (setjmp)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csetjmp>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
+# endif
+# else
+# include <setjmp.h>
+# endif
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
+/* For Borland, even if stdjmp.h is included symbols won't be in global namespace
+ * so we need to reach them in vendor namespace:
+ */
+# undef _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+using _STLP_VENDOR_CSTD::jmp_buf;
+# else
+// if setjmp.h was included first, this is in global namespace, not in
+// vendor's std. - 2005-08-04, ptr
+using ::jmp_buf;
+# endif
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if !defined (setjmp)
+# if !defined (__MSL__) || ((__MSL__ > 0x7001) && (__MSL__ < 0x8000))
+# ifndef _STLP_NATIVE_SETJMP_H_INCLUDED
+using _STLP_VENDOR_CSTD::setjmp;
+# else
+using ::setjmp;
+# endif
+# endif
+# endif
+# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+using _STLP_VENDOR_CSTD::longjmp;
+# else
+using ::longjmp;
+# endif
+# endif
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
diff --git a/build/stlport/stlport/stl/_csignal.h b/build/stlport/stlport/stl/_csignal.h
new file mode 100644
index 000000000..551846b38
--- /dev/null
+++ b/build/stlport/stlport/stl/_csignal.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSIGNAL
+#define _STLP_INTERNAL_CSIGNAL
+
+#if !defined (_STLP_WCE)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csignal>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csignal)
+# endif
+# else
+# include <signal.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::signal;
+using _STLP_VENDOR_CSTD::raise;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+using _STLP_VENDOR_CSTD::sig_atomic_t;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+#endif
+
+#endif /* _STLP_INTERNAL_CSIGNAL */
diff --git a/build/stlport/stlport/stl/_cstdarg.h b/build/stlport/stlport/stl/_cstdarg.h
new file mode 100644
index 000000000..e98f31cd5
--- /dev/null
+++ b/build/stlport/stlport/stl/_cstdarg.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_INTERNAL_CSTDARG
+#define _STLP_INTERNAL_CSTDARG
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdarg>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
+# endif
+#else
+# include <stdarg.h>
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::va_list;
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
diff --git a/build/stlport/stlport/stl/_cstddef.h b/build/stlport/stlport/stl/_cstddef.h
new file mode 100644
index 000000000..35a585c4e
--- /dev/null
+++ b/build/stlport/stlport/stl/_cstddef.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+#define _STLP_INTERNAL_CSTDDEF
+
+# if (__GNUC__ >= 3) && defined (__CYGWIN__) // this total HACK is the only expedient way I could cygwin to work with GCC 3.0
+# define __need_wint_t // mostly because wint_t didn't seem to get defined otherwise :(
+# define __need_wchar_t
+# define __need_size_t
+# define __need_ptrdiff_t
+# define __need_NULL
+# endif
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+# else
+# include <stddef.h>
+# endif
+
+# ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::ptrdiff_t;
+using _STLP_VENDOR_CSTD::size_t;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTDDEF */
diff --git a/build/stlport/stlport/stl/_cstdio.h b/build/stlport/stlport/stl/_cstdio.h
new file mode 100644
index 000000000..67236f259
--- /dev/null
+++ b/build/stlport/stlport/stl/_cstdio.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTDIO
+#define _STLP_INTERNAL_CSTDIO
+
+#if defined (__Lynx__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdarg.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+# endif
+#endif
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdio>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+# endif
+#else
+# include <stdio.h>
+#endif
+
+#if defined (__MWERKS__)
+# undef stdin
+# undef stdout
+# undef stderr
+# define stdin (&_STLP_VENDOR_CSTD::__files[0])
+# define stdout (&_STLP_VENDOR_CSTD::__files[1])
+# define stderr (&_STLP_VENDOR_CSTD::__files[2])
+#endif
+
+#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v)
+{ return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); }
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD )
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::FILE;
+using _STLP_VENDOR_CSTD::fpos_t;
+using _STLP_VENDOR_CSTD::size_t;
+
+// undef obsolete macros
+# undef putc
+# undef getc
+# undef getchar
+# undef putchar
+# undef feof
+# undef ferror
+
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::clearerr;
+using _STLP_VENDOR_CSTD::fclose;
+using _STLP_VENDOR_CSTD::feof;
+using _STLP_VENDOR_CSTD::ferror;
+using _STLP_VENDOR_CSTD::fflush;
+using _STLP_VENDOR_CSTD::fgetc;
+using _STLP_VENDOR_CSTD::fgetpos;
+using _STLP_VENDOR_CSTD::fgets;
+using _STLP_VENDOR_CSTD::fopen;
+using _STLP_VENDOR_CSTD::fprintf;
+using _STLP_VENDOR_CSTD::fputc;
+using _STLP_VENDOR_CSTD::fputs;
+using _STLP_VENDOR_CSTD::fread;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
+using _STLP_VENDOR_CSTD::freopen;
+# endif
+using _STLP_VENDOR_CSTD::fscanf;
+using _STLP_VENDOR_CSTD::fseek;
+using _STLP_VENDOR_CSTD::fsetpos;
+using _STLP_VENDOR_CSTD::ftell;
+using _STLP_VENDOR_CSTD::fwrite;
+
+# if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500))
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) // Supplied as macros, TODO: use inline function to redirect to the macros?
+ using _STLP_VENDOR_CSTD::getc;
+ using _STLP_VENDOR_CSTD::putc;
+# endif
+ using _STLP_VENDOR_CSTD::getchar;
+ using _STLP_VENDOR_CSTD::putchar;
+# endif
+
+using _STLP_VENDOR_CSTD::gets;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
+using _STLP_VENDOR_CSTD::perror;
+# endif
+using _STLP_VENDOR_CSTD::printf;
+using _STLP_VENDOR_CSTD::puts;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
+using _STLP_VENDOR_CSTD::remove;
+using _STLP_VENDOR_CSTD::rename;
+using _STLP_VENDOR_CSTD::rewind;
+using _STLP_VENDOR_CSTD::setbuf;
+using _STLP_VENDOR_CSTD::tmpfile;
+using _STLP_VENDOR_CSTD::tmpnam;
+# endif
+using _STLP_VENDOR_CSTD::scanf;
+using _STLP_VENDOR_CSTD::setvbuf;
+using _STLP_VENDOR_CSTD::sprintf;
+using _STLP_VENDOR_CSTD::sscanf;
+using _STLP_VENDOR_CSTD::ungetc;
+using _STLP_VENDOR_CSTD::vfprintf;
+using _STLP_VENDOR_CSTD::vprintf;
+using _STLP_VENDOR_CSTD::vsprintf;
+# if (defined (__MWERKS__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \
+ (defined (__BORLANDC__)))
+using _STLP_VENDOR_CSTD::vsnprintf;
+# endif
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTDIO */
diff --git a/build/stlport/stlport/stl/_cstdlib.h b/build/stlport/stlport/stl/_cstdlib.h
new file mode 100644
index 000000000..4d1dd35ee
--- /dev/null
+++ b/build/stlport/stlport/stl/_cstdlib.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+#define _STLP_INTERNAL_CSTDLIB
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdlib>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+# endif
+#else
+# include <stdlib.h>
+#endif
+
+#if defined (__BORLANDC__) && !defined (__linux__)
+/* Borland process.h header do not bring anything here and is just included
+ * in order to avoid inclusion later. This header cannot be included later
+ * because Borland compiler consider that for instance the abort function
+ * defined as extern "C" cannot be overloaded and it finds 2 "overloads",
+ * once in native std namespace and the other in STLport namespace...
+ */
+# include <process.h>
+#endif
+
+/* on evc3/evc4 including stdlib.h also defines setjmp macro */
+#if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+#endif
+
+#if defined (__MSL__) && (__MSL__ <= 0x5003)
+namespace std {
+ typedef ::div_t div_t;
+ typedef ::ldiv_t ldiv_t;
+# ifdef __MSL_LONGLONG_SUPPORT__
+ typedef ::lldiv_t lldiv_t;
+# endif
+}
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::div_t;
+using _STLP_VENDOR_CSTD::ldiv_t;
+using _STLP_VENDOR_CSTD::size_t;
+
+# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
+# ifndef _STLP_WCE
+// these functions just don't exist on Windows CE
+using _STLP_VENDOR_CSTD::abort;
+using _STLP_VENDOR_CSTD::getenv;
+using _STLP_VENDOR_CSTD::mblen;
+using _STLP_VENDOR_CSTD::mbtowc;
+using _STLP_VENDOR_CSTD::system;
+using _STLP_VENDOR_CSTD::bsearch;
+# endif
+using _STLP_VENDOR_CSTD::atexit;
+using _STLP_VENDOR_CSTD::exit;
+using _STLP_VENDOR_CSTD::calloc;
+using _STLP_VENDOR_CSTD::free;
+using _STLP_VENDOR_CSTD::malloc;
+using _STLP_VENDOR_CSTD::realloc;
+using _STLP_VENDOR_CSTD::atof;
+using _STLP_VENDOR_CSTD::atoi;
+using _STLP_VENDOR_CSTD::atol;
+using _STLP_VENDOR_CSTD::mbstowcs;
+using _STLP_VENDOR_CSTD::strtod;
+using _STLP_VENDOR_CSTD::strtol;
+using _STLP_VENDOR_CSTD::strtoul;
+
+# if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_NATIVE_MBSTATE_T))
+using _STLP_VENDOR_CSTD::wcstombs;
+# ifndef _STLP_WCE
+using _STLP_VENDOR_CSTD::wctomb;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::qsort;
+using _STLP_VENDOR_CSTD::labs;
+using _STLP_VENDOR_CSTD::ldiv;
+# if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L)
+# if !defined(__sun)
+using _STLP_VENDOR_CSTD::llabs;
+using _STLP_VENDOR_CSTD::lldiv_t;
+using _STLP_VENDOR_CSTD::lldiv;
+# else
+using ::llabs;
+using ::lldiv_t;
+using ::lldiv;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::rand;
+using _STLP_VENDOR_CSTD::srand;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS)
+//In this config bcc define everything in std namespace and not in
+//the global one.
+inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); }
+inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); }
+#endif
+
+#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300)
+# define _STLP_RESTORE_FUNCTION_INTRINSIC
+# pragma warning (push)
+# pragma warning (disable: 4162)
+# pragma function (abs)
+#endif
+
+//HP-UX native lib has abs() and div() functions in global namespace
+#if !defined (__SUNPRO_CC) && \
+ (!defined (__HP_aCC) || (__HP_aCC < 30000))
+
+//MSVC starting with .Net 2003 already define all math functions in global namespace:
+# if !defined (__WATCOMC__) && \
+ (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined (UNDER_CE))
+inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
+# endif
+
+/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind. */
+# if !defined (__WATCOMC__) && \
+ (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined (UNDER_CE))
+inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); }
+# endif
+
+#endif
+
+#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
+# pragma intrinsic (abs)
+# pragma warning (pop)
+# undef _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif
+
+#if defined (_STLP_LONG_LONG)
+# if !defined (_STLP_NO_VENDOR_STDLIB_L)
+# if !defined (__sun)
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); }
+inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); }
+# else
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
+inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
+# endif
+# else
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
+# endif
+#endif
+
+/* C++ Standard is unclear about several call to 'using ::func' if new overloads
+ * of ::func appears between 2 successive 'using' calls. To avoid this potential
+ * problem we provide all abs overload before the 'using' call.
+ * Beware: This header inclusion has to be after all abs overload of this file.
+ * The first 'using ::abs' call is going to be in the other header.
+ */
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05
+_STLP_BEGIN_NAMESPACE
+using ::abs;
+using ::div;
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_CSTDLIB */
diff --git a/build/stlport/stlport/stl/_cstring.h b/build/stlport/stlport/stl/_cstring.h
new file mode 100644
index 000000000..fe0fd5fe4
--- /dev/null
+++ b/build/stlport/stlport/stl/_cstring.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTRING
+#define _STLP_INTERNAL_CSTRING
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstring>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+# endif
+#else
+# include <string.h>
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+# include <using/cstring>
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTRING */
diff --git a/build/stlport/stlport/stl/_ctime.h b/build/stlport/stlport/stl/_ctime.h
new file mode 100644
index 000000000..56e433bb8
--- /dev/null
+++ b/build/stlport/stlport/stl/_ctime.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CTIME
+#define _STLP_INTERNAL_CTIME
+
+#if !defined (_STLP_WCE_EVC3)
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ctime>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(ctime)
+# endif
+# else
+# include <time.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::size_t;
+using _STLP_VENDOR_CSTD::clock_t;
+using _STLP_VENDOR_CSTD::time_t;
+using _STLP_VENDOR_CSTD::tm;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::clock;
+using _STLP_VENDOR_CSTD::asctime;
+using _STLP_VENDOR_CSTD::ctime;
+using _STLP_VENDOR_CSTD::gmtime;
+
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
+using _STLP_VENDOR_CSTD::difftime;
+# endif
+using _STLP_VENDOR_CSTD::mktime;
+using _STLP_VENDOR_CSTD::localtime;
+using _STLP_VENDOR_CSTD::strftime;
+using _STLP_VENDOR_CSTD::time;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
+
+#endif /* _STLP_INTERNAL_CTIME */
diff --git a/build/stlport/stlport/stl/_ctraits_fns.h b/build/stlport/stlport/stl/_ctraits_fns.h
new file mode 100644
index 000000000..e4a4af109
--- /dev/null
+++ b/build/stlport/stlport/stl/_ctraits_fns.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+// This file contains a few small adapters that allow a character
+// traits class to be used as a function object.
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Traits>
+struct _Eq_traits
+ : public binary_function<typename _Traits::char_type,
+ typename _Traits::char_type,
+ bool> {
+ bool operator()(const typename _Traits::char_type& __x,
+ const typename _Traits::char_type& __y) const
+ { return _Traits::eq(__x, __y); }
+};
+
+template <class _Traits>
+struct _Eq_char_bound
+ : public unary_function<typename _Traits::char_type, bool> {
+ typename _Traits::char_type __val;
+ _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
+ bool operator()(const typename _Traits::char_type& __x) const
+ { return _Traits::eq(__x, __val); }
+};
+
+template <class _Traits>
+struct _Neq_char_bound
+ : public unary_function<typename _Traits::char_type, bool>
+{
+ typename _Traits::char_type __val;
+ _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
+ bool operator()(const typename _Traits::char_type& __x) const
+ { return !_Traits::eq(__x, __val); }
+};
+
+template <class _Traits>
+struct _Eq_int_bound
+ : public unary_function<typename _Traits::char_type, bool> {
+ typename _Traits::int_type __val;
+
+ _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {}
+ bool operator()(const typename _Traits::char_type& __x) const
+ { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); }
+};
+
+#if 0
+template <class _Traits>
+struct _Lt_traits
+ : public binary_function<typename _Traits::char_type,
+ typename _Traits::char_type,
+ bool> {
+ bool operator()(const typename _Traits::char_type& __x,
+ const typename _Traits::char_type& __y) const
+ { return _Traits::lt(__x, __y); }
+};
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_ctype.h b/build/stlport/stlport/stl/_ctype.h
new file mode 100644
index 000000000..33a5d3cbe
--- /dev/null
+++ b/build/stlport/stlport/stl/_ctype.h
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+#define _STLP_INTERNAL_CTYPE_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC ctype_base {
+public:
+ enum mask {
+ space = _Locale_SPACE,
+ print = _Locale_PRINT,
+ cntrl = _Locale_CNTRL,
+ upper = _Locale_UPPER,
+ lower = _Locale_LOWER,
+ alpha = _Locale_ALPHA,
+ digit = _Locale_DIGIT,
+ punct = _Locale_PUNCT,
+ xdigit = _Locale_XDIGIT,
+ alnum = alpha | digit,
+ graph = alnum | punct
+ };
+};
+
+// ctype<> template
+
+template <class charT> class ctype {};
+template <class charT> class ctype_byname {};
+
+//ctype specializations
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype<char> : public locale::facet, public ctype_base {
+#ifndef _STLP_NO_WCHAR_T
+# ifdef _STLP_MSVC
+ typedef ctype<wchar_t> _Wctype;
+ friend _Wctype;
+# else
+ friend class ctype<wchar_t>;
+# endif
+#endif
+public:
+
+ typedef char char_type;
+
+ explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
+ bool is(mask __m, char __c) const
+ { return ((*(_M_ctype_table+(unsigned char)__c)) & __m) != 0; }
+
+ const char* is(const char* __low, const char* __high, mask* __vec) const {
+ for (const char* __p = __low;__p != __high; ++__p, ++__vec) {
+ *__vec = _M_ctype_table[(unsigned char)*__p];
+ }
+ return __high;
+ }
+
+ const char* scan_is(mask __m, const char* __low, const char* __high) const;
+ const char* scan_not(mask __m, const char* __low, const char* __high) const;
+
+ char (toupper)(char __c) const { return do_toupper(__c); }
+ const char* (toupper)(char* __low, const char* __high) const {
+ return do_toupper(__low, __high);
+ }
+
+ char (tolower)(char __c) const { return do_tolower(__c); }
+ const char* (tolower)(char* __low, const char* __high) const {
+ return do_tolower(__low, __high);
+ }
+
+ char widen(char __c) const { return do_widen(__c); }
+ const char* widen(const char* __low, const char* __high, char* __to) const {
+ return do_widen(__low, __high, __to);
+ }
+
+ char narrow(char __c, char __dfault) const {
+ return do_narrow(__c, __dfault);
+ }
+ const char* narrow(const char* __low, const char* __high,
+ char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(size_t, table_size = 256);
+
+protected:
+ const mask* table() const _STLP_NOTHROW { return _M_ctype_table; }
+ static const mask* _STLP_CALL classic_table() _STLP_NOTHROW;
+
+ ~ctype();
+
+ virtual char do_toupper(char __c) const;
+ virtual char do_tolower(char __c) const;
+ virtual const char* do_toupper(char* __low, const char* __high) const;
+ virtual const char* do_tolower(char* __low, const char* __high) const;
+ virtual char do_widen(char __c) const;
+ virtual const char* do_widen(const char* __low, const char* __high,
+ char* __to) const;
+ virtual char do_narrow(char __c, char /* dfault */ ) const;
+ virtual const char* do_narrow(const char* __low, const char* __high,
+ char /* dfault */, char* __to) const;
+private:
+ struct _Is_mask {
+ mask __m;
+ _Is_mask(mask __x): __m(__x) {}
+ bool operator()(char __c) {return (__m & (unsigned char) __c) != 0;}
+ };
+
+protected:
+ const mask* _M_ctype_table;
+private:
+ bool _M_delete;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype_byname<char>: public ctype<char> {
+ friend class _Locale_impl;
+public:
+ explicit ctype_byname(const char*, size_t = 0);
+ ~ctype_byname();
+
+ virtual char do_toupper(char __c) const;
+ virtual char do_tolower(char __c) const;
+
+ virtual const char* do_toupper(char*, const char*) const;
+ virtual const char* do_tolower(char*, const char*) const;
+
+private:
+ ctype_byname(_Locale_ctype* __ctype)
+ : _M_ctype(__ctype)
+ { _M_init(); }
+
+ void _M_init();
+
+ //explicitely defined as private to avoid warnings:
+ typedef ctype_byname<char> _Self;
+ ctype_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ mask _M_byname_table[table_size];
+ _Locale_ctype* _M_ctype;
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype<wchar_t> : public locale::facet, public ctype_base {
+public:
+ typedef wchar_t char_type;
+
+ explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
+
+ bool is(mask __m, wchar_t __c) const
+ { return do_is(__m, __c); }
+
+ const wchar_t* is(const wchar_t* __low, const wchar_t* __high,
+ mask* __vec) const
+ { return do_is(__low, __high, __vec); }
+
+ const wchar_t* scan_is(mask __m,
+ const wchar_t* __low, const wchar_t* __high) const
+ { return do_scan_is(__m, __low, __high); }
+
+ const wchar_t* scan_not (mask __m,
+ const wchar_t* __low, const wchar_t* __high) const
+ { return do_scan_not(__m, __low, __high); }
+
+ wchar_t (toupper)(wchar_t __c) const { return do_toupper(__c); }
+ const wchar_t* (toupper)(wchar_t* __low, const wchar_t* __high) const
+ { return do_toupper(__low, __high); }
+
+ wchar_t (tolower)(wchar_t __c) const { return do_tolower(__c); }
+ const wchar_t* (tolower)(wchar_t* __low, const wchar_t* __high) const
+ { return do_tolower(__low, __high); }
+
+ wchar_t widen(char __c) const { return do_widen(__c); }
+ const char* widen(const char* __low, const char* __high,
+ wchar_t* __to) const
+ { return do_widen(__low, __high, __to); }
+
+ char narrow(wchar_t __c, char __dfault) const
+ { return do_narrow(__c, __dfault); }
+ const wchar_t* narrow(const wchar_t* __low, const wchar_t* __high,
+ char __dfault, char* __to) const
+ { return do_narrow(__low, __high, __dfault, __to); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~ctype();
+
+ virtual bool do_is(mask __m, wchar_t __c) const;
+ virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
+ virtual const wchar_t* do_scan_is(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual const wchar_t* do_scan_not(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_toupper(wchar_t __c) const;
+ virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_tolower(wchar_t c) const;
+ virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_widen(char c) const;
+ virtual const char* do_widen(const char*, const char*, wchar_t*) const;
+ virtual char do_narrow(wchar_t __c, char __dfault) const;
+ virtual const wchar_t* do_narrow(const wchar_t*, const wchar_t*,
+ char, char*) const;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype_byname<wchar_t>: public ctype<wchar_t> {
+ friend class _Locale_impl;
+public:
+ explicit ctype_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~ctype_byname();
+
+ virtual bool do_is(mask __m, wchar_t __c) const;
+ virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
+ virtual const wchar_t* do_scan_is(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual const wchar_t* do_scan_not(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_toupper(wchar_t __c) const;
+ virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_tolower(wchar_t c) const;
+ virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
+
+private:
+ ctype_byname(_Locale_ctype* __ctype)
+ : _M_ctype(__ctype) {}
+
+ //explicitely defined as private to avoid warnings:
+ typedef ctype_byname<wchar_t> _Self;
+ ctype_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_ctype* _M_ctype;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CTYPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_cwchar.h b/build/stlport/stlport/stl/_cwchar.h
new file mode 100644
index 000000000..87cb82b7e
--- /dev/null
+++ b/build/stlport/stlport/stl/_cwchar.h
@@ -0,0 +1,342 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CWCHAR
+#define _STLP_INTERNAL_CWCHAR
+
+#if defined (_STLP_WCE_EVC3)
+# ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+# endif
+#else
+# if defined (__GNUC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+# endif
+
+# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwchar>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+# endif
+# if defined (__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+
+# if defined (__DMC__)
+# define __STDC_LIMIT_MACROS
+# include <stdint.h> // WCHAR_MIN, WCHAR_MAX
+# endif
+# elif defined (_STLP_NO_WCHAR_T) || \
+ (defined (__BORLANDC__) && (__BORLANDC__ < 0x570)) || \
+ defined (__OpenBSD__) || defined (__FreeBSD__) || \
+ (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# endif
+# if defined (__Lynx__)
+# ifndef _WINT_T
+typedef long int wint_t;
+# define _WINT_T
+# endif /* _WINT_T */
+# endif
+# if defined(__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <wchar.h>
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+
+# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4))
+extern wint_t btowc();
+extern int fwprintf();
+extern int fwscanf();
+extern int fwide();
+extern int mbsinit();
+extern size_t mbrlen();
+extern size_t mbrtowc();
+extern size_t mbsrtowcs();
+extern int swprintf();
+extern int swscanf();
+extern int vfwprintf();
+extern int vwprintf();
+extern int vswprintf();
+extern size_t wcrtomb();
+extern size_t wcsrtombs();
+extern wchar_t *wcsstr();
+extern int wctob();
+extern wchar_t *wmemchr();
+extern int wmemcmp();
+extern wchar_t *wmemcpy();
+extern wchar_t *wmemmove();
+extern wchar_t *wmemset();
+extern int wprintf();
+extern int wscanf();
+# endif
+# endif
+
+# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */
+# define _STLP_WCHAR_MSL_EXCLUDE 1
+namespace std {
+ extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr);
+}
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# elif defined (__BORLANDC__)
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+# define _STLP_NO_NATIVE_MBSTATE_T
+# endif
+# define _STLP_WCHAR_BORLAND_EXCLUDE 1
+# endif
+
+# ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+# endif
+
+# if !defined (_STLP_NO_WCHAR_T)
+# ifndef WCHAR_MIN
+# define WCHAR_MIN 0
+/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */
+# if defined (__SUNPRO_CC) || defined (__DJGPP)
+# define WCHAR_MAX (~0)
+# else
+# define WCHAR_MAX ((wchar_t)~0)
+# endif
+# endif
+# if defined (__DMC__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || defined(_WIN32_WCE)
+/* Compilers that do not define WCHAR_MIN and WCHAR_MAX to be testable at
+ * preprocessing time. */
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX 0xffff
+# endif
+# if defined (__GNUC__) && defined (__alpha__)
+/* Definition of WCHAR_MIN and MAX are wrong for alpha platform
+ * as gcc consider wchar_t as an unsigned type but WCHAR_MIN is defined as
+ * a negative value. Static assertion is here to check that a future alpha
+ * SDK or a future gcc won't change the situation making this workaround
+ * useless.
+ */
+/* Check that gcc still consider wchar_t as unsigned */
+_STLP_STATIC_ASSERT(((wchar_t)-1 > 0))
+/* Check that WCHAR_MIN value hasn't been fixed */
+_STLP_STATIC_ASSERT((WCHAR_MIN < 0))
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX 0xffffffff
+# endif
+# if defined(__HP_aCC) && (__HP_aCC >= 60000)
+/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions
+ * of WCHAR_MIN/MAX macros without having to define
+ * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not
+ * predefine). Let STLport provide B.11.31 definitions on any version of
+ * HP-UX/ia64.
+ */
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX UINT_MAX
+# endif
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
+using _STLP_VENDOR_CSTD::wint_t;
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if defined (_STLP_NO_WCHAR_T)
+typedef int wint_t;
+# else
+// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined
+// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition
+// in stdio.h; I prefer settings from last file.
+# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T))
+using ::wint_t;
+# else
+using _STLP_VENDOR_CSTD::wint_t;
+# endif
+# endif
+
+using _STLP_VENDOR_CSTD::size_t;
+
+# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T)
+using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
+
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \
+ (!defined(__MSL__) || __MSL__ > 0x6001)
+# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
+ !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET)
+using _STLP_VENDOR_MB_NAMESPACE::btowc;
+# if (!defined(__MSL__) || __MSL__ > 0x7001)
+using _STLP_VENDOR_MB_NAMESPACE::mbsinit;
+# endif
+# endif
+# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
+ !defined (__GNUC__) && !defined(_STLP_WCE_NET)
+using _STLP_VENDOR_MB_NAMESPACE::mbrlen;
+using _STLP_VENDOR_MB_NAMESPACE::mbrtowc;
+using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs;
+using _STLP_VENDOR_MB_NAMESPACE::wcrtomb;
+using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs;
+# endif
+# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */
+
+# endif /* _STLP_NO_NATIVE_MBSTATE_T */
+
+# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::fgetwc;
+using _STLP_VENDOR_CSTD::fgetws;
+using _STLP_VENDOR_CSTD::fputwc;
+using _STLP_VENDOR_CSTD::fputws;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
+ defined(_STLP_WCHAR_HPACC_EXCLUDE) )
+# if !defined (__DECCXX)
+using _STLP_VENDOR_CSTD::fwide;
+# endif
+using _STLP_VENDOR_CSTD::fwprintf;
+using _STLP_VENDOR_CSTD::fwscanf;
+using _STLP_VENDOR_CSTD::getwchar;
+# endif
+
+# if !defined(_STLP_WCHAR_BORLAND_EXCLUDE)
+# ifndef _STLP_WCE_NET
+using _STLP_VENDOR_CSTD::getwc;
+# endif
+using _STLP_VENDOR_CSTD::ungetwc;
+# ifndef _STLP_WCE_NET
+using _STLP_VENDOR_CSTD::putwc;
+# endif
+using _STLP_VENDOR_CSTD::putwchar;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
+ defined (_STLP_WCHAR_HPACC_EXCLUDE) )
+# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \
+ defined (__MINGW32__)
+# undef swprintf
+# define swprintf _snwprintf
+# undef vswprintf
+# define vswprintf _vsnwprintf
+using ::swprintf;
+using ::vswprintf;
+# else
+using _STLP_VENDOR_CSTD::swprintf;
+using _STLP_VENDOR_CSTD::vswprintf;
+# endif
+using _STLP_VENDOR_CSTD::swscanf;
+using _STLP_VENDOR_CSTD::vfwprintf;
+using _STLP_VENDOR_CSTD::vwprintf;
+
+# if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \
+ !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */
+
+using _STLP_VENDOR_CSTD::wcsftime;
+# endif
+using _STLP_VENDOR_CSTD::wcstok;
+
+# endif
+
+# if !defined (_STLP_WCE_NET)
+using _STLP_VENDOR_CSTD::wcscoll;
+using _STLP_VENDOR_CSTD::wcsxfrm;
+# endif
+using _STLP_VENDOR_CSTD::wcscat;
+using _STLP_VENDOR_CSTD::wcsrchr;
+using _STLP_VENDOR_CSTD::wcscmp;
+
+using _STLP_VENDOR_CSTD::wcscpy;
+using _STLP_VENDOR_CSTD::wcscspn;
+
+using _STLP_VENDOR_CSTD::wcslen;
+using _STLP_VENDOR_CSTD::wcsncat;
+using _STLP_VENDOR_CSTD::wcsncmp;
+using _STLP_VENDOR_CSTD::wcsncpy;
+using _STLP_VENDOR_CSTD::wcspbrk;
+using _STLP_VENDOR_CSTD::wcschr;
+
+using _STLP_VENDOR_CSTD::wcsspn;
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
+using _STLP_VENDOR_CSTD::wcstod;
+using _STLP_VENDOR_CSTD::wcstol;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) )
+using _STLP_VENDOR_CSTD::wcsstr;
+using _STLP_VENDOR_CSTD::wmemchr;
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
+# if !defined (_STLP_WCE_NET)
+using _STLP_VENDOR_CSTD::wctob;
+# endif
+# if !defined (__DMC__)
+using _STLP_VENDOR_CSTD::wmemcmp;
+using _STLP_VENDOR_CSTD::wmemmove;
+# endif
+using _STLP_VENDOR_CSTD::wprintf;
+using _STLP_VENDOR_CSTD::wscanf;
+# endif
+
+# if defined (__BORLANDC__) && !defined (__linux__)
+inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); }
+inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); }
+# undef wmemcpy
+# undef wmemset
+inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
+{ return _STLP_wmemcpy(__wdst, __wsrc, __n); }
+inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ return _STLP_wmemset(__wdst, __wc, __n); }
+# elif defined (__DMC__)
+inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); }
+inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); }
+inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; }
+# else
+using _STLP_VENDOR_CSTD::wmemcpy;
+using _STLP_VENDOR_CSTD::wmemset;
+# endif
+# endif
+
+# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+# undef _STLP_WCHAR_SUNPRO_EXCLUDE
+# undef _STLP_WCHAR_MSL_EXCLUDE
+
+# endif /* !defined(_STLP_WCE_EVC3) */
+
+#endif /* _STLP_INTERNAL_CWCHAR */
diff --git a/build/stlport/stlport/stl/_cwctype.h b/build/stlport/stlport/stl/_cwctype.h
new file mode 100644
index 000000000..83b551f7b
--- /dev/null
+++ b/build/stlport/stlport/stl/_cwctype.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CWCTYPE
+#define _STLP_INTERNAL_CWCTYPE
+
+#if defined (__BORLANDC__) && !defined (_STLP_INTERNAL_CCTYPE)
+# include <stl/_cctype.h>
+#endif
+
+#if !defined (_STLP_WCE_EVC3)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
+# endif
+# if defined (__MSL__)
+namespace std {
+ typedef wchar_t wctrans_t;
+ wint_t towctrans(wint_t c, wctrans_t value);
+ wctrans_t wctrans(const char *name);
+}
+using std::wctrans_t;
+using std::towctrans;
+using std::wctrans;
+# endif
+# else
+# include <wctype.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (__hpux)
+
+# if defined (_STLP_USE_GLIBC) && !(defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCXX_USE_WCHAR_T)) || \
+ defined (__sun) || defined (__FreeBSD__) || \
+ defined (__CYGWIN__) || \
+ defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION < 3) || (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION <= 0))
+//We take wide functions from global namespace:
+# define _STLP_VENDOR_CSTD_WFUNC
+# else
+# define _STLP_VENDOR_CSTD_WFUNC _STLP_VENDOR_CSTD
+# endif
+
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD_WFUNC::wctype_t;
+using _STLP_VENDOR_CSTD_WFUNC::wint_t;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if !defined (__BORLANDC__) && !defined (__MSL__)
+using _STLP_VENDOR_CSTD_WFUNC::wctrans_t;
+# if !defined (__DMC__) && (!defined(_WIN32_WCE) || (_WIN32_WCE < 400))
+using _STLP_VENDOR_CSTD_WFUNC::towctrans;
+using _STLP_VENDOR_CSTD_WFUNC::wctrans;
+using _STLP_VENDOR_CSTD_WFUNC::wctype;
+# endif
+using _STLP_VENDOR_CSTD_WFUNC::iswctype;
+# endif
+using _STLP_VENDOR_CSTD_WFUNC::iswalnum;
+using _STLP_VENDOR_CSTD_WFUNC::iswalpha;
+using _STLP_VENDOR_CSTD_WFUNC::iswcntrl;
+
+using _STLP_VENDOR_CSTD_WFUNC::iswdigit;
+using _STLP_VENDOR_CSTD_WFUNC::iswgraph;
+using _STLP_VENDOR_CSTD_WFUNC::iswlower;
+using _STLP_VENDOR_CSTD_WFUNC::iswprint;
+using _STLP_VENDOR_CSTD_WFUNC::iswpunct;
+using _STLP_VENDOR_CSTD_WFUNC::iswspace;
+using _STLP_VENDOR_CSTD_WFUNC::iswupper;
+using _STLP_VENDOR_CSTD_WFUNC::iswxdigit;
+
+using _STLP_VENDOR_CSTD_WFUNC::towlower;
+using _STLP_VENDOR_CSTD_WFUNC::towupper;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+#endif /* _STLP_WCE_EVC3 */
+
+#endif /* _STLP_INTERNAL_CWCTYPE */
diff --git a/build/stlport/stlport/stl/_deque.c b/build/stlport/stlport/stl/_deque.c
new file mode 100644
index 000000000..74e9ef61d
--- /dev/null
+++ b/build/stlport/stlport/stl/_deque.c
@@ -0,0 +1,823 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_DEQUE_C
+#define _STLP_DEQUE_C
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Non-inline member functions from _Deque_base.
+
+template <class _Tp, class _Alloc >
+_Deque_base<_Tp,_Alloc >::~_Deque_base() {
+ if (_M_map._M_data) {
+ _M_destroy_nodes(_M_start._M_node, this->_M_finish._M_node + 1);
+ _M_map.deallocate(_M_map._M_data, _M_map_size._M_data);
+ }
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) {
+ size_t __num_nodes = __num_elements / this->buffer_size() + 1 ;
+
+ _M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2);
+ _M_map._M_data = _M_map.allocate(_M_map_size._M_data);
+
+ _Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2;
+ _Tp** __nfinish = __nstart + __num_nodes;
+
+ _STLP_TRY {
+ _M_create_nodes(__nstart, __nfinish);
+ }
+ _STLP_UNWIND((_M_map.deallocate(_M_map._M_data, _M_map_size._M_data),
+ _M_map._M_data = 0, _M_map_size._M_data = 0))
+ _M_start._M_set_node(__nstart);
+ this->_M_finish._M_set_node(__nfinish - 1);
+ _M_start._M_cur = _M_start._M_first;
+ this->_M_finish._M_cur = this->_M_finish._M_first + __num_elements % this->buffer_size();
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart,
+ _Tp** __nfinish) {
+ _Tp** __cur = __nstart;
+ _STLP_TRY {
+ for (; __cur < __nfinish; ++__cur)
+ *__cur = _M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur))
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart,
+ _Tp** __nfinish) {
+ for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
+ _M_map_size.deallocate(*__n, this->buffer_size());
+}
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define deque _STLP_PTR_IMPL_NAME(deque)
+#elif defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+// qualified references
+# define __iterator__ _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >
+# define const_iterator _Deque_iterator<_Tp, _Const_traits<_Tp> >
+# define iterator __iterator__
+# define size_type size_t
+# define value_type _Tp
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE deque<_Tp, _Alloc>::iterator
+#endif
+
+template <class _Tp, class _Alloc >
+deque<_Tp, _Alloc >&
+deque<_Tp, _Alloc >::operator= (const deque<_Tp, _Alloc >& __x) {
+ const size_type __len = size();
+ if (&__x != this) {
+ if (__len >= __x.size())
+ erase(_STLP_STD::copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish);
+ else {
+ const_iterator __mid = __x.begin() + difference_type(__len);
+ _STLP_STD::copy(__x.begin(), __mid, this->_M_start);
+ insert(this->_M_finish, __mid, __x.end());
+ }
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp, _Alloc >::_M_fill_insert(iterator __pos,
+ size_type __n, const value_type& __x) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ uninitialized_fill(__new_start, this->_M_start, __x);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ uninitialized_fill(this->_M_finish, __new_finish, __x);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node+1, __new_finish._M_node+1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_fill_insert_aux(__pos, __n, __x, _Movable());
+}
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+
+template <class _Tp, class _Alloc >
+void deque<_Tp, _Alloc>::insert(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = __last - __first;
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, __new_start);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
+ __new_finish._M_node + 1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = __last - __first;
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, __new_start);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
+ __new_finish._M_node + 1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+}
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
+ const __true_type& /*_Movable*/) {
+ difference_type __index = __pos - this->_M_start;
+ if (size_type(__index) < this->size() >> 1) {
+ //We move the start of the deque one position to the right
+ //starting from the rightmost element to move.
+ iterator __src = __pos, __dst = __pos;
+ _STLP_STD::_Destroy(&(*__dst));
+ if (__src != this->_M_start) {
+ for (--__src; __dst != this->_M_start; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ }
+ _M_pop_front_aux();
+ }
+ else {
+ iterator __src = __pos, __dst = __pos;
+ _STLP_STD::_Destroy(&(*__dst));
+ for (++__src; __src != this->_M_finish; ++__src, ++__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ //Duplication of the pop_back code without the destroy which has already been done:
+ if (this->_M_finish._M_cur != this->_M_finish._M_first) {
+ --this->_M_finish._M_cur;
+ }
+ else {
+ _M_pop_back_aux();
+ }
+ }
+ return this->_M_start + __index;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
+ const __false_type& /*_Movable*/) {
+ iterator __next = __pos;
+ ++__next;
+ difference_type __index = __pos - this->_M_start;
+ if (size_type(__index) < this->size() >> 1) {
+ copy_backward(this->_M_start, __pos, __next);
+ pop_front();
+ }
+ else {
+ _STLP_STD::copy(__next, this->_M_finish, __pos);
+ pop_back();
+ }
+ return this->_M_start + __index;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
+ const __true_type& /*_Movable*/) {
+ difference_type __n = __last - __first;
+ difference_type __elems_before = __first - this->_M_start;
+ if (__elems_before <= difference_type(this->size() - __n) / 2) {
+ iterator __src = __first, __dst = __last;
+ if (__src != this->_M_start) {
+ for (--__src, --__dst; (__src >= this->_M_start) && (__dst >= __first); --__src, --__dst) {
+ _STLP_STD::_Destroy(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ if (__dst >= __first) {
+ //There are more elements to erase than elements to move
+ _STLP_STD::_Destroy_Range(__first, ++__dst);
+ _STLP_STD::_Destroy_Moved_Range(this->_M_start, __first);
+ }
+ else {
+ //There are more elements to move than elements to erase
+ for (; __src >= this->_M_start; --__src, --__dst) {
+ _STLP_STD::_Destroy_Moved(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(this->_M_start, ++__dst);
+ }
+ }
+ else {
+ _STLP_STD::_Destroy_Range(this->_M_start, __last);
+ }
+ iterator __new_start = this->_M_start + __n;
+ this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
+ this->_M_start = __new_start;
+ }
+ else {
+ if (__last != this->_M_finish) {
+ iterator __src = __last, __dst = __first;
+ for (; (__src != this->_M_finish) && (__dst != __last); ++__src, ++__dst) {
+ _STLP_STD::_Destroy(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ if (__dst != __last) {
+ //There are more elements to erase than elements to move
+ _STLP_STD::_Destroy_Range(__dst, __last);
+ _STLP_STD::_Destroy_Moved_Range(__last, this->_M_finish);
+ }
+ else {
+ //There are more elements to move than elements to erase
+ for (; __src != this->_M_finish; ++__src, ++__dst) {
+ _STLP_STD::_Destroy_Moved(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(__dst, this->_M_finish);
+ }
+ }
+ else {
+ _STLP_STD::_Destroy_Range(__first, this->_M_finish);
+ }
+ iterator __new_finish = this->_M_finish - __n;
+ this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
+ this->_M_finish = __new_finish;
+ }
+ return this->_M_start + __elems_before;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
+ const __false_type& /*_Movable*/) {
+ difference_type __n = __last - __first;
+ difference_type __elems_before = __first - this->_M_start;
+ if (__elems_before <= difference_type(this->size() - __n) / 2) {
+ copy_backward(this->_M_start, __first, __last);
+ iterator __new_start = this->_M_start + __n;
+ _STLP_STD::_Destroy_Range(this->_M_start, __new_start);
+ this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
+ this->_M_start = __new_start;
+ }
+ else {
+ _STLP_STD::copy(__last, this->_M_finish, __first);
+ iterator __new_finish = this->_M_finish - __n;
+ _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
+ this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
+ this->_M_finish = __new_finish;
+ }
+ return this->_M_start + __elems_before;
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::clear() {
+ for (_Map_pointer __node = this->_M_start._M_node + 1;
+ __node < this->_M_finish._M_node;
+ ++__node) {
+ _STLP_STD::_Destroy_Range(*__node, *__node + this->buffer_size());
+ this->_M_map_size.deallocate(*__node, this->buffer_size());
+ }
+
+ if (this->_M_start._M_node != this->_M_finish._M_node) {
+ _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_start._M_last);
+ _STLP_STD::_Destroy_Range(this->_M_finish._M_first, this->_M_finish._M_cur);
+ this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
+ }
+ else
+ _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_finish._M_cur);
+
+ this->_M_finish = this->_M_start;
+}
+
+// Precondition: this->_M_start and this->_M_finish have already been initialized,
+// but none of the deque's elements have yet been constructed.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __val,
+ const __false_type& /*_TrivialInit*/) {
+ _Map_pointer __cur = this->_M_start._M_node;
+ _STLP_TRY {
+ for (; __cur < this->_M_finish._M_node; ++__cur)
+ uninitialized_fill(*__cur, *__cur + this->buffer_size(), __val);
+ uninitialized_fill(this->_M_finish._M_first, this->_M_finish._M_cur, __val);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur, __cur)))
+}
+
+
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_back_aux_v(const value_type& __t) {
+ _M_reserve_map_at_back();
+ *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ _Copy_Construct(this->_M_finish._M_cur, __t);
+ this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
+ this->_M_finish._M_cur = this->_M_finish._M_first;
+ }
+ _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
+ this->buffer_size()))
+}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_back_aux() {
+ _M_reserve_map_at_back();
+ *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ _STLP_STD::_Construct(this->_M_finish._M_cur);
+ this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
+ this->_M_finish._M_cur = this->_M_finish._M_first;
+ }
+ _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
+ this->buffer_size()))
+}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+// Called only if this->_M_start._M_cur == this->_M_start._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_front_aux_v(const value_type& __t) {
+ _M_reserve_map_at_front();
+ *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ this->_M_start._M_set_node(this->_M_start._M_node - 1);
+ this->_M_start._M_cur = this->_M_start._M_last - 1;
+ _Copy_Construct(this->_M_start._M_cur, __t);
+ }
+ _STLP_UNWIND((++this->_M_start,
+ this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), this->buffer_size())))
+}
+
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+// Called only if this->_M_start._M_cur == this->_M_start._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_front_aux() {
+ _M_reserve_map_at_front();
+ *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ this->_M_start._M_set_node(this->_M_start._M_node - 1);
+ this->_M_start._M_cur = this->_M_start._M_last - 1;
+ _STLP_STD::_Construct(this->_M_start._M_cur);
+ }
+ _STLP_UNWIND((++this->_M_start, this->_M_map_size.deallocate(*(this->_M_start._M_node - 1),
+ this->buffer_size())))
+}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_pop_back_aux() {
+ this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
+ this->_M_finish._M_set_node(this->_M_finish._M_node - 1);
+ this->_M_finish._M_cur = this->_M_finish._M_last - 1;
+}
+
+// Note that if the deque has at least one element (a precondition for this member
+// function), and if this->_M_start._M_cur == this->_M_start._M_last, then the deque
+// must have at least two nodes.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_pop_front_aux() {
+ if (this->_M_start._M_cur != this->_M_start._M_last - 1)
+ ++this->_M_start._M_cur;
+ else {
+ this->_M_map_size.deallocate(this->_M_start._M_first, this->buffer_size());
+ this->_M_start._M_set_node(this->_M_start._M_node + 1);
+ this->_M_start._M_cur = this->_M_start._M_first;
+ }
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const value_type& __x,
+ const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ uninitialized_fill(__dst, __src, __x_copy);
+ __pos = __dst;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ uninitialized_fill(__pos, __pos + __n, __x_copy);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ return __pos;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const value_type& __x,
+ const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::fill(__pos - difference_type(__n), __pos, __x_copy);
+ __pos -= difference_type(__n);
+ }
+ else {
+ _STLP_PRIV __uninitialized_copy_fill(this->_M_start, __pos, __new_start,
+ this->_M_start, __x_copy);
+ this->_M_start = __new_start;
+ fill(__old_start, __pos, __x_copy);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ copy_backward(__pos, __finish_n, __old_finish);
+ fill(__pos, __pos + difference_type(__n), __x_copy);
+ }
+ else {
+ _STLP_PRIV __uninitialized_fill_copy(this->_M_finish, __pos + difference_type(__n),
+ __x_copy, __pos, this->_M_finish);
+ this->_M_finish = __new_finish;
+ fill(__pos, __old_finish, __x_copy);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ return __pos;
+}
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ _STLP_PRIV __ucopy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ _STLP_PRIV __ucopy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const value_type* __mid = __first + (difference_type(__n) - __elems_before);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ const value_type* __mid = __first + __elems_after;
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ _STLP_PRIV __ucopy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ _STLP_PRIV __ucopy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before < difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + __n;
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const_iterator __mid = __first + (__n - __elems_before);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after = __length - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ const_iterator __mid = __first + __elems_after;
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) {
+ size_type __new_nodes
+ = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
+ _M_reserve_map_at_front(__new_nodes);
+ size_type __i = 1;
+ _STLP_TRY {
+ for (; __i <= __new_nodes; ++__i)
+ *(this->_M_start._M_node - __i) = this->_M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
+ this->_M_map_size.deallocate(*(this->_M_start._M_node - __j), this->buffer_size()))
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) {
+ size_type __new_nodes
+ = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
+ _M_reserve_map_at_back(__new_nodes);
+ size_type __i = 1;
+ _STLP_TRY {
+ for (; __i <= __new_nodes; ++__i)
+ *(this->_M_finish._M_node + __i) = this->_M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
+ this->_M_map_size.deallocate(*(this->_M_finish._M_node + __j), this->buffer_size()))
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add,
+ bool __add_at_front) {
+ size_type __old_num_nodes = this->_M_finish._M_node - this->_M_start._M_node + 1;
+ size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
+
+ _Map_pointer __new_nstart;
+ if (this->_M_map_size._M_data > 2 * __new_num_nodes) {
+ __new_nstart = this->_M_map._M_data + (this->_M_map_size._M_data - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ if (__new_nstart < this->_M_start._M_node)
+ _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ else
+ _STLP_STD::copy_backward(this->_M_start._M_node, this->_M_finish._M_node + 1,
+ __new_nstart + __old_num_nodes);
+ }
+ else {
+ size_type __new_map_size =
+ this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2;
+
+ _Map_pointer __new_map = this->_M_map.allocate(__new_map_size);
+ __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ this->_M_map.deallocate(this->_M_map._M_data, this->_M_map_size._M_data);
+
+ this->_M_map._M_data = __new_map;
+ this->_M_map_size._M_data = __new_map_size;
+ }
+
+ this->_M_start._M_set_node(__new_nstart);
+ this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
+}
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __iterator__
+#undef iterator
+#undef const_iterator
+#undef size_type
+#undef value_type
+
+#endif /* _STLP_DEQUE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_deque.h b/build/stlport/stlport/stl/_deque.h
new file mode 100644
index 000000000..a8faeef28
--- /dev/null
+++ b/build/stlport/stlport/stl/_deque.h
@@ -0,0 +1,1115 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+#define _STLP_INTERNAL_DEQUE_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+/* Class invariants:
+ * For any nonsingular iterator i:
+ * i.node is the address of an element in the map array. The
+ * contents of i.node is a pointer to the beginning of a node.
+ * i.first == *(i.node)
+ * i.last == i.first + node_size
+ * i.cur is a pointer in the range [i.first, i.last). NOTE:
+ * the implication of this is that i.cur is always a dereferenceable
+ * pointer, even if i is a past-the-end iterator.
+ * Start and Finish are always nonsingular iterators. NOTE: this means
+ * that an empty deque must have one node, and that a deque
+ * with N elements, where N is the buffer size, must have two nodes.
+ * For every node other than start.node and finish.node, every element
+ * in the node is an initialized object. If start.node == finish.node,
+ * then [start.cur, finish.cur) are initialized objects, and
+ * the elements outside that range are uninitialized storage. Otherwise,
+ * [start.cur, start.last) and [finish.first, finish.cur) are initialized
+ * objects, and [start.first, start.cur) and [finish.cur, finish.last)
+ * are uninitialized storage.
+ * [map, map + map_size) is a valid, non-empty range.
+ * [start.node, finish.node] is a valid range contained within
+ * [map, map + map_size).
+ * A pointer in the range [map, map + map_size) points to an allocated node
+ * if and only if the pointer is in the range [start.node, finish.node].
+ */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct _Deque_iterator_base {
+
+ static size_t _S_buffer_size() {
+ const size_t blocksize = _MAX_BYTES;
+ return (sizeof(_Tp) < blocksize ? (blocksize / sizeof(_Tp)) : 1);
+ }
+
+ typedef random_access_iterator_tag iterator_category;
+
+ typedef _Tp value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef value_type** _Map_pointer;
+
+ typedef _Deque_iterator_base< _Tp > _Self;
+
+ value_type* _M_cur;
+ value_type* _M_first;
+ value_type* _M_last;
+ _Map_pointer _M_node;
+
+ _Deque_iterator_base(value_type* __x, _Map_pointer __y)
+ : _M_cur(__x), _M_first(*__y),
+ _M_last(*__y + _S_buffer_size()), _M_node(__y) {}
+
+ _Deque_iterator_base() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {}
+
+// see comment in doc/README.evc4 and doc/README.evc8
+#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1401) && defined (MIPS) && defined (NDEBUG)
+ _Deque_iterator_base(_Deque_iterator_base const& __other)
+ : _M_cur(__other._M_cur), _M_first(__other._M_first),
+ _M_last(__other._M_last), _M_node(__other._M_node) {}
+#endif
+
+ difference_type _M_subtract(const _Self& __x) const {
+ return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) +
+ (_M_cur - _M_first) + (__x._M_last - __x._M_cur);
+ }
+
+ void _M_increment() {
+ if (++_M_cur == _M_last) {
+ _M_set_node(_M_node + 1);
+ _M_cur = _M_first;
+ }
+ }
+
+ void _M_decrement() {
+ if (_M_cur == _M_first) {
+ _M_set_node(_M_node - 1);
+ _M_cur = _M_last;
+ }
+ --_M_cur;
+ }
+
+ void _M_advance(difference_type __n) {
+ const size_t buffersize = _S_buffer_size();
+ difference_type __offset = __n + (_M_cur - _M_first);
+ if (__offset >= 0 && __offset < difference_type(buffersize))
+ _M_cur += __n;
+ else {
+ difference_type __node_offset =
+ __offset > 0 ? __offset / buffersize
+ : -difference_type((-__offset - 1) / buffersize) - 1;
+ _M_set_node(_M_node + __node_offset);
+ _M_cur = _M_first +
+
+ (__offset - __node_offset * difference_type(buffersize));
+ }
+ }
+
+ void _M_set_node(_Map_pointer __new_node) {
+ _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(_S_buffer_size());
+ }
+};
+
+
+template <class _Tp, class _Traits>
+struct _Deque_iterator : public _Deque_iterator_base< _Tp> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type** _Map_pointer;
+
+ typedef _Deque_iterator_base< _Tp > _Base;
+ typedef _Deque_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Deque_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Deque_iterator<_Tp, _ConstTraits> const_iterator;
+
+ _Deque_iterator(value_type* __x, _Map_pointer __y) :
+ _Deque_iterator_base<value_type>(__x,__y) {}
+
+ _Deque_iterator() {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Deque_iterator(const iterator& __x) :
+ _Deque_iterator_base<value_type>(__x) {}
+
+ reference operator*() const {
+ return *this->_M_cur;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ difference_type operator-(const const_iterator& __x) const { return this->_M_subtract(__x); }
+
+ _Self& operator++() { this->_M_increment(); return *this; }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _Self& operator--() { this->_M_decrement(); return *this; }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _Self& operator+=(difference_type __n) { this->_M_advance(__n); return *this; }
+ _Self operator+(difference_type __n) const {
+ _Self __tmp = *this;
+ return __tmp += __n;
+ }
+
+ _Self& operator-=(difference_type __n) { return *this += -__n; }
+ _Self operator-(difference_type __n) const {
+ _Self __tmp = *this;
+ return __tmp -= __n;
+ }
+
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+
+template <class _Tp, class _Traits>
+inline _Deque_iterator<_Tp, _Traits> _STLP_CALL
+operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Traits>& __x)
+{ return __x + __n; }
+
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _Tp>
+inline bool _STLP_CALL
+operator==(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __x._M_cur == __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator < (const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y) {
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator!=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __x._M_cur != __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return !(__x < __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator<=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return !(__y < __x); }
+
+#else /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _Tp, class _Traits1, class _Traits2>
+inline bool _STLP_CALL
+operator==(const _Deque_iterator<_Tp, _Traits1 >& __x,
+ const _Deque_iterator<_Tp, _Traits2 >& __y)
+{ return __x._M_cur == __y._M_cur; }
+
+template <class _Tp, class _Traits1, class _Traits2>
+inline bool _STLP_CALL
+operator < (const _Deque_iterator<_Tp, _Traits1 >& __x,
+ const _Deque_iterator<_Tp, _Traits2 >& __y) {
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator!=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return __x._M_cur != __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return !(__x < __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator<=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return !(__y < __x); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _Deque_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits> inline _Tp* _STLP_CALL
+value_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return (_Tp*)0; }
+template <class _Tp, class _Traits> inline random_access_iterator_tag _STLP_CALL
+iterator_category(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return random_access_iterator_tag(); }
+template <class _Tp, class _Traits> inline ptrdiff_t* _STLP_CALL
+distance_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+/* Deque base class. It has two purposes. First, its constructor
+ * and destructor allocate (but don't initialize) storage. This makes
+ * exception safety easier. Second, the base class encapsulates all of
+ * the differences between SGI-style allocators and standard-conforming
+ * allocators.
+ */
+
+template <class _Tp, class _Alloc>
+class _Deque_base {
+ typedef _Deque_base<_Tp, _Alloc> _Self;
+public:
+ typedef _Tp value_type;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef _STLP_alloc_proxy<size_t, value_type, allocator_type> _Alloc_proxy;
+
+ typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type _Map_alloc_type;
+ typedef _STLP_alloc_proxy<value_type**, value_type*, _Map_alloc_type> _Map_alloc_proxy;
+
+ typedef _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _Deque_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+
+ static size_t _STLP_CALL buffer_size() { return _Deque_iterator_base<_Tp>::_S_buffer_size(); }
+
+ _Deque_base(const allocator_type& __a, size_t __num_elements)
+ : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
+ _M_map_size(__a, (size_t)0)
+ { _M_initialize_map(__num_elements); }
+
+ _Deque_base(const allocator_type& __a)
+ : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
+ _M_map_size(__a, (size_t)0) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Deque_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_map(__move_source<_Map_alloc_proxy>(src.get()._M_map)),
+ _M_map_size(__move_source<_Alloc_proxy>(src.get()._M_map_size)) {
+ src.get()._M_map._M_data = 0;
+ src.get()._M_map_size._M_data = 0;
+ src.get()._M_finish = src.get()._M_start;
+ }
+#endif
+
+ ~_Deque_base();
+
+protected:
+ void _M_initialize_map(size_t);
+ void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
+ void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
+ enum { _S_initial_map_size = 8 };
+
+protected:
+ iterator _M_start;
+ iterator _M_finish;
+ _Map_alloc_proxy _M_map;
+ _Alloc_proxy _M_map_size;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define deque _STLP_PTR_IMPL_NAME(deque)
+#elif defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque : protected _STLP_PRIV _Deque_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
+ , public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _Deque_base<_Tp, _Alloc> _Base;
+ typedef deque<_Tp, _Alloc> _Self;
+public: // Basic types
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+public: // Iterators
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected: // Internal typedefs
+ typedef pointer* _Map_pointer;
+#if defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef __false_type _Movable;
+#endif
+
+public: // Basic accessors
+ iterator begin() { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator begin() const { return const_iterator(this->_M_start); }
+ const_iterator end() const { return const_iterator(this->_M_finish); }
+
+ reverse_iterator rbegin() { return reverse_iterator(this->_M_finish); }
+ reverse_iterator rend() { return reverse_iterator(this->_M_start); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(this->_M_finish); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(this->_M_start); }
+
+ reference operator[](size_type __n)
+ { return this->_M_start[difference_type(__n)]; }
+ const_reference operator[](size_type __n) const
+ { return this->_M_start[difference_type(__n)]; }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_out_of_range("deque");
+ }
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ reference front() { return *this->_M_start; }
+ reference back() {
+ iterator __tmp = this->_M_finish;
+ --__tmp;
+ return *__tmp;
+ }
+ const_reference front() const { return *this->_M_start; }
+ const_reference back() const {
+ const_iterator __tmp = this->_M_finish;
+ --__tmp;
+ return *__tmp;
+ }
+
+ size_type size() const { return this->_M_finish - this->_M_start; }
+ size_type max_size() const { return size_type(-1); }
+ bool empty() const { return this->_M_finish == this->_M_start; }
+ allocator_type get_allocator() const { return this->_M_map_size; }
+
+public: // Constructor, destructor.
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(const allocator_type& __a = allocator_type())
+#else
+ deque()
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), 0) {}
+ deque(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, 0) {}
+
+ deque(const _Self& __x)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__x.get_allocator(), __x.size())
+ { _STLP_PRIV __ucopy(__x.begin(), __x.end(), this->_M_start); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+private:
+ void _M_initialize(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+ _M_fill_initialize(__val, _TrivialInit());
+ }
+public:
+ explicit deque(size_type __n)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
+ { _M_initialize(__n); }
+ deque(size_type __n, const value_type& __val, const allocator_type& __a = allocator_type())
+#else
+ explicit deque(size_type __n)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) {
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+ _M_fill_initialize(_STLP_DEFAULT_CONSTRUCTED(_Tp), _TrivialInit());
+ }
+ deque(size_type __n, const value_type& __val)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
+ { _M_fill_initialize(__val, __false_type()); }
+ deque(size_type __n, const value_type& __val, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __n)
+ { _M_fill_initialize(__val, __false_type()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+protected:
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
+ this->_M_initialize_map(__n);
+ _M_fill_initialize(__x, __false_type());
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type&) {
+ _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+# endif
+
+#else
+ deque(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
+ { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
+ { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+#endif
+
+ ~deque()
+ { _STLP_STD::_Destroy_Range(this->_M_start, this->_M_finish); }
+
+ _Self& operator= (const _Self& __x);
+
+ void swap(_Self& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_map.swap(__x._M_map);
+ this->_M_map_size.swap(__x._M_map_size);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void _M_fill_assign(size_type __n, const _Tp& __val) {
+ if (__n > size()) {
+ _STLP_STD::fill(begin(), end(), __val);
+ insert(end(), __n - size(), __val);
+ }
+ else {
+ erase(begin() + __n, end());
+ _STLP_STD::fill(begin(), end(), __val);
+ }
+ }
+
+ void assign(size_type __n, const _Tp& __val) {
+ _M_fill_assign(__n, __val);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+private: // helper functions for assign()
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/)
+ { _M_fill_assign((size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/) {
+ _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+ template <class _InputIter>
+ void _M_assign_aux(_InputIter __first, _InputIter __last, const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _ForwardIterator>
+ void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ size_type __size = size();
+ size_type __len = __last - __first;
+ if (__len > __size) {
+ const value_type *__mid = __first + __size;
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ }
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIterator;
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len > size()) {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ }
+ }
+
+
+public: // push_* and pop_*
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_back(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
+ _Copy_Construct(this->_M_finish._M_cur, __t);
+ ++this->_M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux_v(__t);
+ }
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_front(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_start._M_cur != this->_M_start._M_first) {
+ _Copy_Construct(this->_M_start._M_cur - 1, __t);
+ --this->_M_start._M_cur;
+ }
+ else
+ _M_push_front_aux_v(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() {
+ if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
+ _STLP_STD::_Construct(this->_M_finish._M_cur);
+ ++this->_M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux();
+ }
+ void push_front() {
+ if (this->_M_start._M_cur != this->_M_start._M_first) {
+ _STLP_STD::_Construct(this->_M_start._M_cur - 1);
+ --this->_M_start._M_cur;
+ }
+ else
+ _M_push_front_aux();
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() {
+ if (this->_M_finish._M_cur != this->_M_finish._M_first) {
+ --this->_M_finish._M_cur;
+ _STLP_STD::_Destroy(this->_M_finish._M_cur);
+ }
+ else {
+ _M_pop_back_aux();
+ _STLP_STD::_Destroy(this->_M_finish._M_cur);
+ }
+ }
+
+ void pop_front() {
+ _STLP_STD::_Destroy(this->_M_start._M_cur);
+ _M_pop_front_aux();
+ }
+
+public: // Insert
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ push_front(__x);
+ return this->_M_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ push_back(__x);
+ iterator __tmp = this->_M_finish;
+ --__tmp;
+ return __tmp;
+ }
+ else {
+ return _M_fill_insert_aux(__pos, 1, __x, _Movable());
+ }
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+protected:
+ iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __true_type& /*_Movable*/);
+ iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __false_type& /*_Movable*/);
+
+ void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, (size_type) __n, (value_type) __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/) {
+ _M_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __true_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __false_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __true_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __false_type& /*_Movable*/);
+public:
+ void insert(iterator __pos,
+ const value_type* __first, const value_type* __last);
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last);
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+public:
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size,
+ const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const size_type __len = size();
+ if (__new_size < __len)
+ erase(this->_M_start + __new_size, this->_M_finish);
+ else
+ insert(this->_M_finish, __new_size - __len, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size)
+ { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+protected:
+ iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/);
+ iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/);
+
+ iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/);
+ iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/);
+public: // Erase
+ iterator erase(iterator __pos) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__first == this->_M_start && __last == this->_M_finish) {
+ clear();
+ return this->_M_finish;
+ }
+ else {
+ if (__first == __last)
+ return __first;
+ return _M_erase(__first, __last, _Movable());
+ }
+ }
+ void clear();
+
+protected: // Internal construction/destruction
+
+ void _M_fill_initialize(const value_type& __val, const __true_type& /*_TrivialInit*/)
+ {}
+ void _M_fill_initialize(const value_type& __val, const __false_type& /*_TrivialInit*/);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ this->_M_initialize_map(0);
+ _STLP_TRY {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ _STLP_UNWIND(clear())
+ }
+ template <class _ForwardIterator>
+ void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ this->_M_initialize_map(__n);
+ _Map_pointer __cur_node = this->_M_start._M_node;
+ _STLP_TRY {
+ for (; __cur_node < this->_M_finish._M_node; ++__cur_node) {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, this->buffer_size());
+ _STLP_STD::uninitialized_copy(__first, __mid, *__cur_node);
+ __first = __mid;
+ }
+ _STLP_STD::uninitialized_copy(__first, __last, this->_M_finish._M_first);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur_node, __cur_node)))
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+protected: // Internal push_* and pop_*
+
+ void _M_push_back_aux_v(const value_type&);
+ void _M_push_front_aux_v(const value_type&);
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void _M_push_back_aux();
+ void _M_push_front_aux();
+#endif /*_STLP_DONT_SUP_DFLT_PARAM !_STLP_NO_ANACHRONISMS*/
+ void _M_pop_back_aux();
+ void _M_pop_front_aux();
+
+protected: // Internal insert functions
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+
+ template <class _InputIterator>
+ void _M_insert(iterator __pos,
+ _InputIterator __first,
+ _InputIterator __last,
+ const input_iterator_tag &) {
+ _STLP_STD::copy(__first, __last, inserter(*this, __pos));
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, __new_start);
+ this->_M_start = __new_start;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, this->_M_finish);
+ this->_M_finish = __new_finish;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elemsbefore = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elemsbefore <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elemsbefore;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ uninitialized_copy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
+ __pos = this->_M_finish - __elemsafter;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ uninitialized_copy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elemsbefore = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elemsbefore <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elemsbefore;
+ _STLP_TRY {
+ if (__elemsbefore >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_STD::uninitialized_copy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, difference_type(__n) - __elemsbefore);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
+ __pos = this->_M_finish - __elemsafter;
+ _STLP_TRY {
+ if (__elemsafter > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_STD::uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, __elemsafter);
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator _M_reserve_elements_at_front(size_type __n) {
+ size_type __vacancies = this->_M_start._M_cur - this->_M_start._M_first;
+ if (__n > __vacancies)
+ _M_new_elements_at_front(__n - __vacancies);
+ return this->_M_start - difference_type(__n);
+ }
+
+ iterator _M_reserve_elements_at_back(size_type __n) {
+ size_type __vacancies = (this->_M_finish._M_last - this->_M_finish._M_cur) - 1;
+ if (__n > __vacancies)
+ _M_new_elements_at_back(__n - __vacancies);
+ return this->_M_finish + difference_type(__n);
+ }
+
+ void _M_new_elements_at_front(size_type __new_elements);
+ void _M_new_elements_at_back(size_type __new_elements);
+
+protected: // Allocation of _M_map and nodes
+
+ // Makes sure the _M_map has space for new nodes. Does not actually
+ // add the nodes. Can invalidate _M_map pointers. (And consequently,
+ // deque iterators.)
+
+ void _M_reserve_map_at_back (size_type __nodes_to_add = 1) {
+ if (__nodes_to_add + 1 > this->_M_map_size._M_data - (this->_M_finish._M_node - this->_M_map._M_data))
+ _M_reallocate_map(__nodes_to_add, false);
+ }
+
+ void _M_reserve_map_at_front (size_type __nodes_to_add = 1) {
+ if (__nodes_to_add > size_type(this->_M_start._M_node - this->_M_map._M_data))
+ _M_reallocate_map(__nodes_to_add, true);
+ }
+
+ void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
+};
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_deque.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_deque.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_CONTAINER deque<_Tp, _Alloc>
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<deque<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_epilog.h b/build/stlport/stlport/stl/_epilog.h
new file mode 100644
index 000000000..0747ae320
--- /dev/null
+++ b/build/stlport/stlport/stl/_epilog.h
@@ -0,0 +1,42 @@
+/* NOTE : this header has no guards and is MEANT for multiple inclusion!
+ * If you are using "header protection" option with your compiler,
+ * please also find #pragma which disables it and put it here, to
+ * allow reentrancy of this header.
+ */
+
+#ifndef _STLP_PROLOG_HEADER_INCLUDED
+# error STLport epilog header can not be included as long as prolog has not be included.
+#endif
+
+/* If the platform provides any specific epilog actions,
+ * like #pragmas, do include platform-specific prolog file
+ */
+#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG)
+# include <stl/config/_epilog.h>
+#endif
+
+#if !defined (_STLP_NO_POST_COMPATIBLE_SECTION)
+# include <stl/_config_compat_post.h>
+#endif
+
+#if defined (_STLP_USE_OWN_NAMESPACE)
+
+# if !defined (_STLP_DONT_REDEFINE_STD)
+/* We redefine "std" to STLPORT, so that user code may use std:: transparently
+ * The STLPORT macro contains the STLport namespace name containing all the std
+ * stuff.
+ */
+# if defined (std)
+/*
+ * Looks like the compiler native library on which STLport rely defined the std macro.
+ * This might introduce major incompatibility so report the problem to the STLport
+ * forum or comment the following #error at your own risk.
+ */
+# error Incompatible native Std library.
+# endif /* std */
+# define std STLPORT
+# endif /* _STLP_DONT_REDEFINE_STD */
+
+#endif
+
+#undef _STLP_PROLOG_HEADER_INCLUDED /* defined in _prolog.h */
diff --git a/build/stlport/stlport/stl/_exception.h b/build/stlport/stlport/stl/_exception.h
new file mode 100644
index 000000000..1dd712784
--- /dev/null
+++ b/build/stlport/stlport/stl/_exception.h
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+// The header <exception> contains low-level functions that interact
+// with a compiler's exception-handling mechanism. It is assumed to
+// be supplied with the compiler, rather than with the library, because
+// it is inherently tied very closely to the compiler itself.
+
+// On platforms where <exception> does not exist, this header defines
+// an exception base class. This is *not* a substitute for everything
+// in <exception>, but it suffices to support a bare minimum of STL
+// functionality.
+
+#ifndef _STLP_INTERNAL_EXCEPTION
+#define _STLP_INTERNAL_EXCEPTION
+
+#if !defined (_STLP_NO_EXCEPTION_HEADER)
+
+# if defined ( _UNCAUGHT_EXCEPTION )
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# endif
+
+# if defined (_STLP_BROKEN_EXCEPTION_CLASS)
+# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
+# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
+# endif
+# undef exception
+# undef bad_exception
+# else
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception.h>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+# endif
+
+# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1300)
+// dwa 02/04/00
+// The header <yvals.h> which ships with vc6 and is included by its native <exception>
+// actually turns on warnings, so we have to turn them back off.
+# include <stl/config/_warnings_off.h>
+# endif
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
+# if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
+using _STLP_VENDOR_EXCEPT_STD::exception;
+# else
+using ::exception;
+# endif
+using _STLP_VENDOR_EXCEPT_STD::bad_exception;
+# endif
+
+# if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
+// fbp : many platforms present strange mix of
+// those in various namespaces
+# if !defined (_STLP_VENDOR_UNEXPECTED_STD)
+# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
+# else
+/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
+ * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
+ * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
+ */
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
+# endif
+# endif
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+// weird errors
+# if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
+# if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+//See config/_intel.h for reason about this workaround
+using std::unexpected;
+# else
+using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
+# endif
+using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
+using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
+# endif
+using _STLP_VENDOR_TERMINATE_STD::terminate;
+using _STLP_VENDOR_TERMINATE_STD::terminate_handler;
+using _STLP_VENDOR_TERMINATE_STD::set_terminate;
+
+# if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception;
+# endif
+# endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_OWN_NAMESPACE */
+#else /* _STLP_NO_EXCEPTION_HEADER */
+
+/* fbp : absence of <exception> usually means that those
+ * functions are not going to be called by compiler.
+ * Still, define them for the user.
+ * dums: Policy modification, if the function do not behave like the Standard
+ * defined it we do not grant it in the STLport namespace. We will have
+ * compile time error rather than runtime error.
+ */
+#if 0
+/*
+typedef void (*unexpected_handler)();
+unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
+void unexpected();
+
+typedef void (*terminate_handler)();
+terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
+void terminate();
+
+bool uncaught_exception(); // not implemented under mpw as of Jan/1999
+*/
+#endif
+
+#endif /* _STLP_NO_EXCEPTION_HEADER */
+
+#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
+_STLP_BEGIN_NAMESPACE
+
+// section 18.6.1
+class _STLP_CLASS_DECLSPEC exception {
+public:
+# ifndef _STLP_USE_NO_IOSTREAMS
+ exception() _STLP_NOTHROW;
+ virtual ~exception() _STLP_NOTHROW;
+ virtual const char* what() const _STLP_NOTHROW;
+# else
+ exception() _STLP_NOTHROW {}
+ virtual ~exception() _STLP_NOTHROW {}
+ virtual const char* what() const _STLP_NOTHROW {return "class exception";}
+# endif
+};
+
+// section 18.6.2.1
+class _STLP_CLASS_DECLSPEC bad_exception : public exception {
+public:
+# ifndef _STLP_USE_NO_IOSTREAMS
+ bad_exception() _STLP_NOTHROW;
+ ~bad_exception() _STLP_NOTHROW;
+ const char* what() const _STLP_NOTHROW;
+# else
+ bad_exception() _STLP_NOTHROW {}
+ ~bad_exception() _STLP_NOTHROW {}
+ const char* what() const _STLP_NOTHROW {return "class bad_exception";}
+# endif
+};
+
+#ifdef _STLP_USE_EXCEPTIONS
+// forward declaration
+class __Named_exception;
+#endif
+
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_EXCEPTION */
diff --git a/build/stlport/stlport/stl/_facets_fwd.h b/build/stlport/stlport/stl/_facets_fwd.h
new file mode 100644
index 000000000..d4c8451f5
--- /dev/null
+++ b/build/stlport/stlport/stl/_facets_fwd.h
@@ -0,0 +1,53 @@
+#ifndef _STLP_FACETS_FWD_H
+#define _STLP_FACETS_FWD_H
+
+
+#include <stl/_iosfwd.h>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _InputIter>
+#else
+template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class money_get;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _OutputIter>
+#else
+template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class money_put;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _InputIter>
+#else
+template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class num_get;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _OutputIter>
+#else
+template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class num_put;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _InIt>
+#else
+template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_get;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _OutIt>
+#else
+template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_put;
+
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/build/stlport/stlport/stl/_fstream.c b/build/stlport/stlport/stl/_fstream.c
new file mode 100644
index 000000000..7306f9eda
--- /dev/null
+++ b/build/stlport/stlport/stl/_fstream.c
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_FSTREAM_C
+#define _STLP_FSTREAM_C
+
+#ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wchar_t is supported for this mode
+# define __BF_int_type__ int
+# define __BF_pos_type__ streampos
+# define __BF_off_type__ streamoff
+# else
+# define __BF_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
+# define __BF_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::pos_type
+# define __BF_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::off_type
+# endif
+
+
+//----------------------------------------------------------------------
+// Public basic_filebuf<> member functions
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::basic_filebuf()
+ : basic_streambuf<_CharT, _Traits>(), _M_base(),
+ _M_constant_width(false), _M_always_noconv(false),
+ _M_int_buf_dynamic(false),
+ _M_in_input_mode(false), _M_in_output_mode(false),
+ _M_in_error_mode(false), _M_in_putback_mode(false),
+ _M_int_buf(0), _M_int_buf_EOS(0),
+ _M_ext_buf(0), _M_ext_buf_EOS(0),
+ _M_ext_buf_converted(0), _M_ext_buf_end(0),
+ _M_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
+ _M_end_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
+ _M_mmap_base(0), _M_mmap_len(0),
+ _M_saved_eback(0), _M_saved_gptr(0), _M_saved_egptr(0),
+ _M_codecvt(0),
+ _M_width(1), _M_max_width(1)
+{
+ this->_M_setup_codecvt(locale(), false);
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
+ this->close();
+ _M_deallocate_buffers();
+}
+
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
+basic_filebuf<_CharT, _Traits>::underflow() {
+ return _Underflow<_CharT, _Traits>::_M_doit(this);
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::close() {
+ bool __ok = this->is_open();
+
+ if (_M_in_output_mode) {
+ __ok = __ok && !_Traits::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof());
+ __ok = __ok && this->_M_unshift();
+ }
+ else if (_M_in_input_mode)
+ this->_M_exit_input_mode();
+
+ // Note order of arguments. We close the file even if __ok is false.
+ __ok = _M_base._M_close() && __ok;
+
+ // Restore the initial state, except that we don't deallocate the buffer
+ // or mess with the cached codecvt information.
+ _M_state = _M_end_state = _State_type();
+ _M_ext_buf_converted = _M_ext_buf_end = 0;
+
+ _M_mmap_base = 0;
+ _M_mmap_len = 0;
+
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+
+ _M_saved_eback = _M_saved_gptr = _M_saved_egptr = 0;
+
+ _M_in_input_mode = _M_in_output_mode = _M_in_error_mode = _M_in_putback_mode
+ = false;
+
+ return __ok ? this : 0;
+}
+
+// This member function is called whenever we exit input mode.
+// It unmaps the memory-mapped file, if any, and sets
+// _M_in_input_mode to false.
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_exit_input_mode() {
+ if (_M_mmap_base != 0) {
+ _M_base._M_unmap(_M_mmap_base, _M_mmap_len);
+ _M_mmap_base = 0;
+ _M_mmap_len = 0;
+ }
+ _M_in_input_mode = false;
+}
+
+
+//----------------------------------------------------------------------
+// basic_filebuf<> overridden protected virtual member functions
+
+template <class _CharT, class _Traits>
+streamsize basic_filebuf<_CharT, _Traits>::showmanyc() {
+ // Is there any possibility that reads can succeed?
+ if (!this->is_open() || _M_in_output_mode || _M_in_error_mode)
+ return -1;
+ else if (_M_in_putback_mode)
+ return this->egptr() - this->gptr();
+ else if (_M_constant_width) {
+ streamoff __pos = _M_base._M_seek(0, ios_base::cur);
+ streamoff __size = _M_base._M_file_size();
+ return __pos >= 0 && __size > __pos ? __size - __pos : 0;
+ }
+ else
+ return 0;
+}
+
+
+// Make a putback position available, if necessary, by switching to a
+// special internal buffer used only for putback. The buffer is
+// [_M_pback_buf, _M_pback_buf + _S_pback_buf_size), but the base
+// class only sees a piece of it at a time. (We want to make sure
+// that we don't try to read a character that hasn't been initialized.)
+// The end of the putback buffer is always _M_pback_buf + _S_pback_buf_size,
+// but the beginning is usually not _M_pback_buf.
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) {
+ const int_type __eof = traits_type::eof();
+
+ // If we aren't already in input mode, pushback is impossible.
+ if (!_M_in_input_mode)
+ return __eof;
+
+ // We can use the ordinary get buffer if there's enough space, and
+ // if it's a buffer that we're allowed to write to.
+ if (this->gptr() != this->eback() &&
+ (traits_type::eq_int_type(__c, __eof) ||
+ traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) ||
+ !_M_mmap_base)) {
+ this->gbump(-1);
+ if (traits_type::eq_int_type(__c, __eof) ||
+ traits_type::eq(traits_type::to_char_type(__c), *this->gptr()))
+ return traits_type::to_int_type(*this->gptr());
+ }
+ else if (!traits_type::eq_int_type(__c, __eof)) {
+ // Are we in the putback buffer already?
+ _CharT* __pback_end = _M_pback_buf + __STATIC_CAST(int,_S_pback_buf_size);
+ if (_M_in_putback_mode) {
+ // Do we have more room in the putback buffer?
+ if (this->eback() != _M_pback_buf)
+ this->setg(this->egptr() - 1, this->egptr() - 1, __pback_end);
+ else
+ return __eof; // No more room in the buffer, so fail.
+ }
+ else { // We're not yet in the putback buffer.
+ _M_saved_eback = this->eback();
+ _M_saved_gptr = this->gptr();
+ _M_saved_egptr = this->egptr();
+ this->setg(__pback_end - 1, __pback_end - 1, __pback_end);
+ _M_in_putback_mode = true;
+ }
+ }
+ else
+ return __eof;
+
+ // We have made a putback position available. Assign to it, and return.
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
+}
+
+// This member function flushes the put area, and also outputs the
+// character __c (unless __c is eof). Invariant: we always leave room
+// in the internal buffer for one character more than the base class knows
+// about. We see the internal buffer as [_M_int_buf, _M_int_buf_EOS), but
+// the base class only sees [_M_int_buf, _M_int_buf_EOS - 1).
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
+ // Switch to output mode, if necessary.
+ if (!_M_in_output_mode)
+ if (!_M_switch_to_output_mode())
+ return traits_type::eof();
+
+ _CharT* __ibegin = this->_M_int_buf;
+ _CharT* __iend = this->pptr();
+ this->setp(_M_int_buf, _M_int_buf_EOS - 1);
+
+ // Put __c at the end of the internal buffer.
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
+ *__iend++ = _Traits::to_char_type(__c);
+
+ // For variable-width encodings, output may take more than one pass.
+ while (__ibegin != __iend) {
+ const _CharT* __inext = __ibegin;
+ char* __enext = _M_ext_buf;
+ typename _Codecvt::result __status
+ = _M_codecvt->out(_M_state, __ibegin, __iend, __inext,
+ _M_ext_buf, _M_ext_buf_EOS, __enext);
+ if (__status == _Codecvt::noconv) {
+ return _Noconv_output<_Traits>::_M_doit(this, __ibegin, __iend)
+ ? traits_type::not_eof(__c)
+ : _M_output_error();
+ }
+
+ // For a constant-width encoding we know that the external buffer
+ // is large enough, so failure to consume the entire internal buffer
+ // or to produce the correct number of external characters, is an error.
+ // For a variable-width encoding, however, we require only that we
+ // consume at least one internal character
+ else if (__status != _Codecvt::error &&
+ (((__inext == __iend) &&
+ (__enext - _M_ext_buf == _M_width * (__iend - __ibegin))) ||
+ (!_M_constant_width && __inext != __ibegin))) {
+ // We successfully converted part or all of the internal buffer.
+ ptrdiff_t __n = __enext - _M_ext_buf;
+ if (_M_write(_M_ext_buf, __n))
+ __ibegin += __inext - __ibegin;
+ else
+ return _M_output_error();
+ }
+ else
+ return _M_output_error();
+ }
+
+ return traits_type::not_eof(__c);
+}
+
+// This member function must be called before any I/O has been
+// performed on the stream, otherwise it has no effect.
+//
+// __buf == 0 && __n == 0 means to make this stream unbuffered.
+// __buf != 0 && __n > 0 means to use __buf as the stream's internal
+// buffer, rather than the buffer that would otherwise be allocated
+// automatically. __buf must be a pointer to an array of _CharT whose
+// size is at least __n.
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::setbuf(_CharT* __buf, streamsize __n) {
+ if (!_M_in_input_mode &&! _M_in_output_mode && !_M_in_error_mode &&
+ _M_int_buf == 0) {
+ if (__buf == 0 && __n == 0)
+ _M_allocate_buffers(0, 1);
+ else if (__buf != 0 && __n > 0)
+ _M_allocate_buffers(__buf, __n);
+ }
+ return this;
+}
+
+#if defined (_STLP_ASSERTIONS)
+// helper class.
+template <class _CharT>
+struct _Filebuf_Tmp_Buf {
+ _CharT* _M_ptr;
+ _Filebuf_Tmp_Buf(ptrdiff_t __n) : _M_ptr(0) { _M_ptr = new _CharT[__n]; }
+ ~_Filebuf_Tmp_Buf() { delete[] _M_ptr; }
+};
+#endif
+
+template <class _CharT, class _Traits>
+__BF_pos_type__
+basic_filebuf<_CharT, _Traits>::seekoff(off_type __off,
+ ios_base::seekdir __whence,
+ ios_base::openmode /* dummy */) {
+ if (!this->is_open())
+ return pos_type(-1);
+
+ if (!_M_constant_width && __off != 0)
+ return pos_type(-1);
+
+ if (!_M_seek_init(__off != 0 || __whence != ios_base::cur))
+ return pos_type(-1);
+
+ // Seek to beginning or end, regardless of whether we're in input mode.
+ if (__whence == ios_base::beg || __whence == ios_base::end)
+ return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
+ _State_type());
+
+ // Seek relative to current position. Complicated if we're in input mode.
+ _STLP_ASSERT(__whence == ios_base::cur)
+ if (!_M_in_input_mode)
+ return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
+ _State_type());
+
+ if (_M_mmap_base != 0) {
+ // __off is relative to gptr(). We need to do a bit of arithmetic
+ // to get an offset relative to the external file pointer.
+ streamoff __adjust = _M_mmap_len - (this->gptr() - (_CharT*) _M_mmap_base);
+
+ // if __off == 0, we do not need to exit input mode and to shift file pointer
+ return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __adjust)
+ : _M_seek_return(_M_base._M_seek(__off - __adjust, ios_base::cur), _State_type());
+ }
+
+ if (_M_constant_width) { // Get or set the position.
+ streamoff __iadj = _M_width * (this->gptr() - this->eback());
+
+ // Compensate for offset relative to gptr versus offset relative
+ // to external pointer. For a text-oriented stream, where the
+ // compensation is more than just pointer arithmetic, we may get
+ // but not set the current position.
+
+ if (__iadj <= _M_ext_buf_end - _M_ext_buf) {
+ streamoff __eadj = _M_base._M_get_offset(_M_ext_buf + __STATIC_CAST(ptrdiff_t, __iadj), _M_ext_buf_end);
+
+ return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __eadj)
+ : _M_seek_return(_M_base._M_seek(__off - __eadj, ios_base::cur), _State_type());
+ }
+ }
+ else { // Get the position. Encoding is var width.
+ // Get position in internal buffer.
+ ptrdiff_t __ipos = this->gptr() - this->eback();
+
+ // Get corresponding position in external buffer.
+ _State_type __state = _M_state;
+ int __epos = _M_codecvt->length(__state, _M_ext_buf, _M_ext_buf_converted,
+ __ipos);
+#if defined (_STLP_ASSERTIONS)
+ // Sanity check (expensive): make sure __epos is the right answer.
+ _STLP_ASSERT(__epos >= 0)
+ _State_type __tmp_state = _M_state;
+ _Filebuf_Tmp_Buf<_CharT> __buf(__ipos);
+ _CharT* __ibegin = __buf._M_ptr;
+ _CharT* __inext = __ibegin;
+ const char* __dummy;
+ typename _Codecvt::result __status
+ = _M_codecvt->in(__tmp_state,
+ _M_ext_buf, _M_ext_buf + __epos, __dummy,
+ __ibegin, __ibegin + __ipos, __inext);
+ // The result code is necessarily ok because:
+ // - noconv: impossible for a variable encoding
+ // - error: length method is supposed to count until it reach max value or find an error so we cannot have
+ // an error again when decoding an external buffer up to length return value.
+ // - partial: idem error, it is also a reason for length to stop counting.
+ _STLP_ASSERT(__status == _Codecvt::ok)
+ _STLP_ASSERT(__inext == __ibegin + __ipos)
+ _STLP_ASSERT(equal(this->eback(), this->gptr(), __ibegin, _STLP_PRIV _Eq_traits<traits_type>()))
+#endif
+ // Get the current position (at the end of the external buffer),
+ // then adjust it. Again, it might be a text-oriented stream.
+ streamoff __cur = _M_base._M_seek(0, ios_base::cur);
+ streamoff __adj = _M_base._M_get_offset(_M_ext_buf, _M_ext_buf + __epos) -
+ _M_base._M_get_offset(_M_ext_buf, _M_ext_buf_end);
+ if (__cur != -1 && __cur + __adj >= 0)
+ return __off == 0 ? pos_type(__cur + __adj)
+ : _M_seek_return(__cur + __adj, __state);
+ }
+
+ return pos_type(-1);
+}
+
+
+template <class _CharT, class _Traits>
+__BF_pos_type__
+basic_filebuf<_CharT, _Traits>::seekpos(pos_type __pos,
+ ios_base::openmode /* dummy */) {
+ if (this->is_open()) {
+ if (!_M_seek_init(true))
+ return pos_type(-1);
+
+ streamoff __off = off_type(__pos);
+ if (__off != -1 && _M_base._M_seek(__off, ios_base::beg) != -1) {
+ _M_state = __pos.state();
+ return _M_seek_return(__off, __pos.state());
+ }
+ }
+
+ return pos_type(-1);
+}
+
+
+template <class _CharT, class _Traits>
+int basic_filebuf<_CharT, _Traits>::sync() {
+ if (_M_in_output_mode)
+ return traits_type::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof()) ? -1 : 0;
+ return 0;
+}
+
+
+// Change the filebuf's locale. This member function has no effect
+// unless it is called before any I/O is performed on the stream.
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
+ if (!_M_in_input_mode && !_M_in_output_mode && !_M_in_error_mode) {
+ this->_M_setup_codecvt(__loc);
+ }
+}
+
+//----------------------------------------------------------------------
+// basic_filebuf<> helper functions.
+
+//----------------------------------------
+// Helper functions for switching between modes.
+
+// This member function is called if we're performing the first I/O
+// operation on a filebuf, or if we're performing an input operation
+// immediately after a seek.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_switch_to_input_mode() {
+ if (this->is_open() && (((int)_M_base.__o_mode() & (int)ios_base::in) !=0)
+ && (_M_in_output_mode == 0) && (_M_in_error_mode == 0)) {
+ if (!_M_int_buf && !_M_allocate_buffers())
+ return false;
+
+ _M_ext_buf_converted = _M_ext_buf;
+ _M_ext_buf_end = _M_ext_buf;
+
+ _M_end_state = _M_state;
+
+ _M_in_input_mode = true;
+ return true;
+ }
+
+ return false;
+}
+
+
+// This member function is called if we're performing the first I/O
+// operation on a filebuf, or if we're performing an output operation
+// immediately after a seek.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_switch_to_output_mode() {
+ if (this->is_open() && (_M_base.__o_mode() & (int)ios_base::out) &&
+ _M_in_input_mode == 0 && _M_in_error_mode == 0) {
+
+ if (!_M_int_buf && !_M_allocate_buffers())
+ return false;
+
+ // In append mode, every write does an implicit seek to the end
+ // of the file. Whenever leaving output mode, the end of file
+ // get put in the initial shift state.
+ if (_M_base.__o_mode() & ios_base::app)
+ _M_state = _State_type();
+
+ this->setp(_M_int_buf, _M_int_buf_EOS - 1);
+ _M_in_output_mode = true;
+ return true;
+ }
+
+ return false;
+}
+
+
+//----------------------------------------
+// Helper functions for input
+
+// This member function is called if there is an error during input.
+// It puts the filebuf in error mode, clear the get area buffer, and
+// returns eof.
+// returns eof. Error mode is sticky; it is cleared only by close or
+// seek.
+
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_input_error() {
+ this->_M_exit_input_mode();
+ _M_in_output_mode = false;
+ _M_in_error_mode = true;
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_underflow_aux() {
+ // We have the state and file position from the end of the internal
+ // buffer. This round, they become the beginning of the internal buffer.
+ _M_state = _M_end_state;
+
+ // Fill the external buffer. Start with any leftover characters that
+ // didn't get converted last time.
+ if (_M_ext_buf_end > _M_ext_buf_converted)
+
+ _M_ext_buf_end = _STLP_STD::copy(_M_ext_buf_converted, _M_ext_buf_end, _M_ext_buf);
+ // boris : copy_backward did not work
+ //_M_ext_buf_end = copy_backward(_M_ext_buf_converted, _M_ext_buf_end,
+ //_M_ext_buf+ (_M_ext_buf_end - _M_ext_buf_converted));
+ else
+ _M_ext_buf_end = _M_ext_buf;
+
+ // Now fill the external buffer with characters from the file. This is
+ // a loop because occasionally we don't get enough external characters
+ // to make progress.
+ for (;;) {
+ ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end);
+ if (__n < 0) {
+ // Read failed, maybe we should set err bit on associated stream...
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+ }
+
+ _M_ext_buf_end += __n;
+
+ // If external buffer is empty there is nothing to do.
+ if (_M_ext_buf == _M_ext_buf_end) {
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+ }
+
+ // Convert the external buffer to internal characters.
+ const char* __enext;
+ _CharT* __inext;
+
+ typename _Codecvt::result __status
+ = _M_codecvt->in(_M_end_state,
+ _M_ext_buf, _M_ext_buf_end, __enext,
+ _M_int_buf, _M_int_buf_EOS, __inext);
+
+ /* Error conditions:
+ * (1) Return value of error.
+ * (2) Producing internal characters without consuming external characters.
+ * (3) In fixed-width encodings, producing an internal sequence whose length
+ * is inconsistent with that of the internal sequence.
+ * (4) Failure to produce any characters if we have enough characters in
+ * the external buffer, where "enough" means the largest possible width
+ * of a single character. */
+ if (__status == _Codecvt::noconv)
+ return _Noconv_input<_Traits>::_M_doit(this);
+ else if (__status == _Codecvt::error ||
+ (__inext != _M_int_buf && __enext == _M_ext_buf) ||
+ (_M_constant_width && (__inext - _M_int_buf) * _M_width != (__enext - _M_ext_buf)) ||
+ (__inext == _M_int_buf && __enext - _M_ext_buf >= _M_max_width))
+ return _M_input_error();
+ else if (__inext != _M_int_buf) {
+ _M_ext_buf_converted = _M_ext_buf + (__enext - _M_ext_buf);
+ this->setg(_M_int_buf, _M_int_buf, __inext);
+ return traits_type::to_int_type(*_M_int_buf);
+ }
+ /* We need to go around the loop again to get more external characters.
+ * But if the previous read failed then don't try again for now.
+ * Don't enter error mode for a failed read. Error mode is sticky,
+ * and we might succeed if we try again. */
+ if (__n <= 0) {
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+ }
+ }
+}
+
+//----------------------------------------
+// Helper functions for output
+
+// This member function is called if there is an error during output.
+// It puts the filebuf in error mode, clear the put area buffer, and
+// returns eof. Error mode is sticky; it is cleared only by close or
+// seek.
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_output_error() {
+ _M_in_output_mode = false;
+ _M_in_input_mode = false;
+ _M_in_error_mode = true;
+ this->setp(0, 0);
+ return traits_type::eof();
+}
+
+
+// Write whatever sequence of characters is necessary to get back to
+// the initial shift state. This function overwrites the external
+// buffer, changes the external file position, and changes the state.
+// Precondition: the internal buffer is empty.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_unshift() {
+ if (_M_in_output_mode && !_M_constant_width) {
+ typename _Codecvt::result __status;
+ do {
+ char* __enext = _M_ext_buf;
+ __status = _M_codecvt->unshift(_M_state,
+ _M_ext_buf, _M_ext_buf_EOS, __enext);
+ if (__status == _Codecvt::noconv ||
+ (__enext == _M_ext_buf && __status == _Codecvt::ok))
+ return true;
+ else if (__status == _Codecvt::error)
+ return false;
+ else if (!_M_write(_M_ext_buf, __enext - _M_ext_buf))
+ return false;
+ } while (__status == _Codecvt::partial);
+ }
+
+ return true;
+}
+
+
+//----------------------------------------
+// Helper functions for buffer allocation and deallocation
+
+// This member function is called when we're initializing a filebuf's
+// internal and external buffers. The argument is the size of the
+// internal buffer; the external buffer is sized using the character
+// width in the current encoding. Preconditions: the buffers are currently
+// null. __n >= 1. __buf is either a null pointer or a pointer to an
+// array show size is at least __n.
+
+// We need __n >= 1 for two different reasons. For input, the base
+// class always needs a buffer because of the semantics of underflow().
+// For output, we want to have an internal buffer that's larger by one
+// element than the buffer that the base class knows about. (See
+// basic_filebuf<>::overflow() for the reason.)
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsize __n) {
+ //The major hypothesis in the following implementation is that size_t is unsigned.
+ //We also need streamsize byte representation to be larger or equal to the int
+ //representation to correctly store the encoding information.
+ _STLP_STATIC_ASSERT(!numeric_limits<size_t>::is_signed &&
+ sizeof(streamsize) >= sizeof(int))
+
+ if (__buf == 0) {
+ streamsize __bufsize = __n * sizeof(_CharT);
+ //We first check that the streamsize representation can't overflow a size_t one.
+ //If it can, we check that __bufsize is not higher than the size_t max value.
+ if ((sizeof(streamsize) > sizeof(size_t)) &&
+ (__bufsize > __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)())))
+ return false;
+ _M_int_buf = __STATIC_CAST(_CharT*, malloc(__STATIC_CAST(size_t, __bufsize)));
+ if (!_M_int_buf)
+ return false;
+ _M_int_buf_dynamic = true;
+ }
+ else {
+ _M_int_buf = __buf;
+ _M_int_buf_dynamic = false;
+ }
+
+ streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width),
+ __STATIC_CAST(streamsize, _M_codecvt->max_length()));
+
+ _M_ext_buf = 0;
+ if ((sizeof(streamsize) < sizeof(size_t)) ||
+ ((sizeof(streamsize) == sizeof(size_t)) && numeric_limits<streamsize>::is_signed) ||
+ (__ebufsiz <= __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()))) {
+ _M_ext_buf = __STATIC_CAST(char*, malloc(__STATIC_CAST(size_t, __ebufsiz)));
+ }
+
+ if (!_M_ext_buf) {
+ _M_deallocate_buffers();
+ return false;
+ }
+
+ _M_int_buf_EOS = _M_int_buf + __STATIC_CAST(ptrdiff_t, __n);
+ _M_ext_buf_EOS = _M_ext_buf + __STATIC_CAST(ptrdiff_t, __ebufsiz);
+ return true;
+}
+
+// Abbreviation for the most common case.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers() {
+ // Choose a buffer that's at least 4096 characters long and that's a
+ // multiple of the page size.
+ streamsize __default_bufsiz =
+ ((_M_base.__page_size() + 4095UL) / _M_base.__page_size()) * _M_base.__page_size();
+ return _M_allocate_buffers(0, __default_bufsiz);
+}
+
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_deallocate_buffers() {
+ if (_M_int_buf_dynamic)
+ free(_M_int_buf);
+ free(_M_ext_buf);
+ _M_int_buf = 0;
+ _M_int_buf_EOS = 0;
+ _M_ext_buf = 0;
+ _M_ext_buf_EOS = 0;
+}
+
+
+//----------------------------------------
+// Helper functiosn for seek and imbue
+
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_seek_init(bool __do_unshift) {
+ // If we're in error mode, leave it.
+ _M_in_error_mode = false;
+
+ // Flush the output buffer if we're in output mode, and (conditionally)
+ // emit an unshift sequence.
+ if (_M_in_output_mode) {
+ bool __ok = !traits_type::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof());
+ if (__do_unshift)
+ __ok = __ok && this->_M_unshift();
+ if (!__ok) {
+ _M_in_output_mode = false;
+ _M_in_error_mode = true;
+ this->setp(0, 0);
+ return false;
+ }
+ }
+
+ // Discard putback characters, if any.
+ if (_M_in_input_mode && _M_in_putback_mode)
+ _M_exit_putback_mode();
+
+ return true;
+}
+
+
+/* Change the filebuf's locale. This member function has no effect
+ * unless it is called before any I/O is performed on the stream.
+ * This function is called on construction and on an imbue call. In the
+ * case of the construction the codecvt facet might be a custom one if
+ * the basic_filebuf user has instanciate it with a custom char_traits.
+ * The user will have to call imbue before any I/O operation.
+ */
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool __on_imbue) {
+ if (has_facet<_Codecvt>(__loc)) {
+ _M_codecvt = &use_facet<_Codecvt>(__loc) ;
+ int __encoding = _M_codecvt->encoding();
+
+ _M_width = (max)(__encoding, 1);
+ _M_max_width = _M_codecvt->max_length();
+ _M_constant_width = __encoding > 0;
+ _M_always_noconv = _M_codecvt->always_noconv();
+ }
+ else {
+ _M_codecvt = 0;
+ _M_width = _M_max_width = 1;
+ _M_constant_width = _M_always_noconv = false;
+ if (__on_imbue) {
+ //This call will generate an exception reporting the problem.
+ use_facet<_Codecvt>(__loc);
+ }
+ }
+}
+
+_STLP_END_NAMESPACE
+
+# undef __BF_int_type__
+# undef __BF_pos_type__
+# undef __BF_off_type__
+
+#endif /* _STLP_FSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_fstream.h b/build/stlport/stlport/stl/_fstream.h
new file mode 100644
index 000000000..1945e4118
--- /dev/null
+++ b/build/stlport/stlport/stl/_fstream.h
@@ -0,0 +1,714 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// This header defines classes basic_filebuf, basic_ifstream,
+// basic_ofstream, and basic_fstream. These classes represent
+// streambufs and streams whose sources or destinations are files.
+
+#ifndef _STLP_INTERNAL_FSTREAM_H
+#define _STLP_INTERNAL_FSTREAM_H
+
+#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS)
+# error This header file requires the -LANG:std option
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CODECVT_H
+# include <stl/_codecvt.h>
+#endif
+
+#if defined (_STLP_USE_WIN32_IO)
+typedef void* _STLP_fd;
+#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO)
+typedef int _STLP_fd;
+#else
+# error "Configure i/o !"
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class _Filebuf_base, a private base class to factor out the system-
+// dependent code from basic_filebuf<>.
+
+class _STLP_CLASS_DECLSPEC _Filebuf_base {
+public: // Opening and closing files.
+ _Filebuf_base();
+
+ bool _M_open(const char*, ios_base::openmode, long __protection);
+ bool _M_open(const char*, ios_base::openmode);
+ bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode);
+#if defined (_STLP_USE_WIN32_IO)
+ bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode);
+#endif /* _STLP_USE_WIN32_IO */
+ bool _M_close();
+
+public: // Low-level I/O, like Unix read/write
+ ptrdiff_t _M_read(char* __buf, ptrdiff_t __n);
+ streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir);
+ streamoff _M_file_size();
+ bool _M_write(char* __buf, ptrdiff_t __n);
+
+public: // Memory-mapped I/O.
+ void* _M_mmap(streamoff __offset, streamoff __len);
+ void _M_unmap(void* __mmap_base, streamoff __len);
+
+public:
+ // Returns a value n such that, if pos is the file pointer at the
+ // beginning of the range [first, last), pos + n is the file pointer at
+ // the end. On many operating systems n == __last - __first.
+ // In Unix, writing n characters always bumps the file position by n.
+ // In Windows text mode, however, it bumps the file position by n + m,
+ // where m is the number of newlines in the range. That's because an
+ // internal \n corresponds to an external two-character sequence.
+ streamoff _M_get_offset(char* __first, char* __last) {
+#if defined (_STLP_UNIX) || defined (_STLP_MAC)
+ return __last - __first;
+#else // defined (_STLP_WIN32)
+ return ( (_M_openmode & ios_base::binary) != 0 )
+ ? (__last - __first)
+ : count(__first, __last, '\n') + (__last - __first);
+#endif
+ }
+
+ // Returns true if we're in binary mode or if we're using an OS or file
+ // system where there is no distinction between text and binary mode.
+ bool _M_in_binary_mode() const {
+#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__)
+ return true;
+#elif defined (_STLP_WIN32) || defined (_STLP_VM)
+ return (_M_openmode & ios_base::binary) != 0;
+#else
+# error "Port!"
+#endif
+ }
+
+ static void _S_initialize();
+
+protected: // Static data members.
+ static size_t _M_page_size;
+
+protected: // Data members.
+ _STLP_fd _M_file_id;
+#if defined (_STLP_USE_STDIO_IO)
+ // for stdio, the whole FILE* is being kept here
+ FILE* _M_file;
+#endif
+ ios_base::openmode _M_openmode ;
+ unsigned char _M_is_open ;
+ unsigned char _M_should_close ;
+ unsigned char _M_regular_file ;
+
+#if defined (_STLP_USE_WIN32_IO)
+ _STLP_fd _M_view_id;
+#endif
+
+public :
+ static size_t _STLP_CALL __page_size() { return _M_page_size; }
+ int __o_mode() const { return (int)_M_openmode; }
+ bool __is_open() const { return (_M_is_open !=0 ); }
+ bool __should_close() const { return (_M_should_close != 0); }
+ bool __regular_file() const { return (_M_regular_file != 0); }
+ _STLP_fd __get_fd() const { return _M_file_id; }
+};
+
+//----------------------------------------------------------------------
+// Class basic_filebuf<>.
+
+// Forward declaration of two helper classes.
+template <class _Traits> class _Noconv_input;
+template <class _Traits> class _Noconv_output;
+
+// There is a specialized version of underflow, for basic_filebuf<char>,
+// in fstream.cpp.
+template <class _CharT, class _Traits>
+class _Underflow;
+
+template <class _CharT, class _Traits>
+class basic_filebuf : public basic_streambuf<_CharT, _Traits> {
+public: // Types.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef typename _Traits::state_type _State_type;
+ typedef basic_streambuf<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Self;
+
+public: // Constructors, destructor.
+ basic_filebuf();
+ ~basic_filebuf();
+
+public: // Opening and closing files.
+ bool is_open() const { return _M_base.__is_open(); }
+
+ _Self* open(const char* __s, ios_base::openmode __m) {
+ return _M_base._M_open(__s, __m) ? this : 0;
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ // These two version of open() and file descriptor getter are extensions.
+ _Self* open(const char* __s, ios_base::openmode __m,
+ long __protection) {
+ return _M_base._M_open(__s, __m, __protection) ? this : 0;
+ }
+
+ _STLP_fd fd() const { return _M_base.__get_fd(); }
+
+ _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return this->_M_open(__id, _Init_mode);
+ }
+
+# if defined (_STLP_USE_WIN32_IO)
+ _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return _M_base._M_open(__id, _Init_mode) ? this : 0;
+ }
+# endif /* _STLP_USE_WIN32_IO */
+
+#endif
+
+ _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return _M_base._M_open(__id, _Init_mode) ? this : 0;
+ }
+
+ _Self* close();
+
+protected: // Virtual functions from basic_streambuf.
+ virtual streamsize showmanyc();
+ virtual int_type underflow();
+
+ virtual int_type pbackfail(int_type = traits_type::eof());
+ virtual int_type overflow(int_type = traits_type::eof());
+
+ virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
+ virtual pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type,
+ ios_base::openmode = ios_base::in | ios_base::out);
+
+ virtual int sync();
+ virtual void imbue(const locale&);
+
+private: // Helper functions.
+
+ // Precondition: we are currently in putback input mode. Effect:
+ // switches back to ordinary input mode.
+ void _M_exit_putback_mode() {
+ this->setg(_M_saved_eback, _M_saved_gptr, _M_saved_egptr);
+ _M_in_putback_mode = false;
+ }
+ bool _M_switch_to_input_mode();
+ void _M_exit_input_mode();
+ bool _M_switch_to_output_mode();
+
+ int_type _M_input_error();
+ int_type _M_underflow_aux();
+ friend class _Underflow<_CharT, _Traits>;
+
+ int_type _M_output_error();
+ bool _M_unshift();
+
+ bool _M_allocate_buffers(_CharT* __buf, streamsize __n);
+ bool _M_allocate_buffers();
+ void _M_deallocate_buffers();
+
+ pos_type _M_seek_return(off_type __off, _State_type __state) {
+ if (__off != -1) {
+ if (_M_in_input_mode)
+ _M_exit_input_mode();
+ _M_in_input_mode = false;
+ _M_in_output_mode = false;
+ _M_in_putback_mode = false;
+ _M_in_error_mode = false;
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+ }
+
+ pos_type __result(__off);
+ __result.state(__state);
+ return __result;
+ }
+
+ bool _M_seek_init(bool __do_unshift);
+
+ void _M_setup_codecvt(const locale&, bool __on_imbue = true);
+
+private: // Data members used in all modes.
+
+ _Filebuf_base _M_base;
+
+private: // Locale-related information.
+
+ unsigned char _M_constant_width;
+ unsigned char _M_always_noconv;
+
+ // private: // Mode flags.
+ unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated,
+ // false if it was supplied by the user.
+ unsigned char _M_in_input_mode;
+ unsigned char _M_in_output_mode;
+ unsigned char _M_in_error_mode;
+ unsigned char _M_in_putback_mode;
+
+ // Internal buffer: characters seen by the filebuf's clients.
+ _CharT* _M_int_buf;
+ _CharT* _M_int_buf_EOS;
+
+ // External buffer: characters corresponding to the external file.
+ char* _M_ext_buf;
+ char* _M_ext_buf_EOS;
+
+ // The range [_M_ext_buf, _M_ext_buf_converted) contains the external
+ // characters corresponding to the sequence in the internal buffer. The
+ // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that
+ // have been read into the external buffer but have not been converted
+ // to an internal sequence.
+ char* _M_ext_buf_converted;
+ char* _M_ext_buf_end;
+
+ // State corresponding to beginning of internal buffer.
+ _State_type _M_state;
+
+private: // Data members used only in input mode.
+
+ // Similar to _M_state except that it corresponds to
+ // the end of the internal buffer instead of the beginning.
+ _State_type _M_end_state;
+
+ // This is a null pointer unless we are in mmap input mode.
+ void* _M_mmap_base;
+ streamoff _M_mmap_len;
+
+private: // Data members used only in putback mode.
+ _CharT* _M_saved_eback;
+ _CharT* _M_saved_gptr;
+ _CharT* _M_saved_egptr;
+
+ typedef codecvt<_CharT, char, _State_type> _Codecvt;
+ const _Codecvt* _M_codecvt;
+
+ int _M_width; // Width of the encoding (if constant), else 1
+ int _M_max_width; // Largest possible width of single character.
+
+
+ enum { _S_pback_buf_size = 8 };
+ _CharT _M_pback_buf[_S_pback_buf_size];
+
+ // for _Noconv_output
+public:
+ bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); }
+
+public:
+ int_type
+ _M_do_noconv_input() {
+ _M_ext_buf_converted = _M_ext_buf_end;
+ /* this-> */ _Base::setg((char_type*)_M_ext_buf, (char_type*)_M_ext_buf, (char_type*)_M_ext_buf_end);
+ return traits_type::to_int_type(*_M_ext_buf);
+ }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+//
+// This class had to be designed very carefully to work
+// with Visual C++.
+//
+template <class _Traits>
+class _Noconv_output {
+public:
+ typedef typename _Traits::char_type char_type;
+ static bool _STLP_CALL _M_doit(basic_filebuf<char_type, _Traits >*,
+ char_type*, char_type*)
+ { return false; }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC _Noconv_output< char_traits<char> > {
+public:
+ static bool _STLP_CALL
+ _M_doit(basic_filebuf<char, char_traits<char> >* __buf,
+ char* __first, char* __last) {
+ ptrdiff_t __n = __last - __first;
+ return (__buf->_M_write(__first, __n));
+ }
+};
+
+//----------------------------------------------------------------------
+// basic_filebuf<> helper functions.
+
+
+//----------------------------------------
+// Helper functions for switching between modes.
+
+//
+// This class had to be designed very carefully to work
+// with Visual C++.
+//
+template <class _Traits>
+class _Noconv_input {
+public:
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::char_type char_type;
+
+ static inline int_type _STLP_CALL
+ _M_doit(basic_filebuf<char_type, _Traits>*)
+ { return _Traits::eof(); }
+};
+
+_STLP_TEMPLATE_NULL
+class _Noconv_input<char_traits<char> > {
+public:
+ static inline int _STLP_CALL
+ _M_doit(basic_filebuf<char, char_traits<char> >* __buf) {
+ return __buf->_M_do_noconv_input();
+ }
+};
+
+// underflow() may be called for one of two reasons. (1) We've
+// been going through the special putback buffer, and we need to move back
+// to the regular internal buffer. (2) We've exhausted the internal buffer,
+// and we need to replentish it.
+template <class _CharT, class _Traits>
+class _Underflow {
+public:
+ typedef typename _Traits::int_type int_type;
+ typedef _Traits traits_type;
+
+ // There is a specialized version of underflow, for basic_filebuf<char>,
+ // in fstream.cpp.
+ static int_type _STLP_CALL _M_doit(basic_filebuf<_CharT, _Traits>* __this) {
+ if (!__this->_M_in_input_mode) {
+ if (!__this->_M_switch_to_input_mode())
+ return traits_type::eof();
+ }
+ else if (__this->_M_in_putback_mode) {
+ __this->_M_exit_putback_mode();
+ if (__this->gptr() != __this->egptr()) {
+ int_type __c = traits_type::to_int_type(*__this->gptr());
+ return __c;
+ }
+ }
+
+ return __this->_M_underflow_aux();
+ }
+};
+
+// Specialization of underflow: if the character type is char, maybe
+// we can use mmap instead of read.
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC _Underflow< char, char_traits<char> >
+{
+ public:
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char> traits_type;
+ static int_type _STLP_CALL _M_doit(basic_filebuf<char, traits_type >* __this);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _Underflow<wchar_t, char_traits<wchar_t> >;
+#endif
+
+//----------------------------------------------------------------------
+// Class basic_ifstream<>
+
+template <class _CharT, class _Traits>
+class basic_ifstream : public basic_istream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_istream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+
+ basic_ifstream() :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+
+ explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+ basic_ifstream(const char* __s, ios_base::openmode __m,
+ long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m | ios_base::in, __protection))
+ this->setstate(ios_base::failbit);
+ }
+
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+
+ ~basic_ifstream() {}
+
+public: // File and buffer operations.
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s, ios_base::openmode __mod = ios_base::in) {
+ if (!this->rdbuf()->open(__s, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_ofstream<>
+
+template <class _CharT, class _Traits>
+class basic_ofstream : public basic_ostream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_ostream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+ basic_ofstream() :
+ basic_ios<_CharT, _Traits>(),
+ basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+ explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+ basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m | ios_base::out, __protection))
+ this->setstate(ios_base::failbit);
+ }
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+
+ ~basic_ofstream() {}
+
+public: // File and buffer operations.
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s, ios_base::openmode __mod= ios_base::out) {
+ if (!this->rdbuf()->open(__s, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_fstream<>
+
+template <class _CharT, class _Traits>
+class basic_fstream : public basic_iostream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_iostream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+
+ basic_fstream()
+ : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+
+ explicit basic_fstream(const char* __s,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_fstream(int __id,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod))
+ this->setstate(ios_base::failbit);
+ }
+ basic_fstream(const char* __s, ios_base::openmode __m, long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m, __protection))
+ this->setstate(ios_base::failbit);
+ }
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_fstream(_STLP_fd __id,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+ ~basic_fstream() {}
+
+public: // File and buffer operations.
+
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s,
+ ios_base::openmode __mod =
+ ios_base::in | ios_base::out) {
+ if (!this->rdbuf()->open(__s, __mod))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_fstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_fstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_fstream.c>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_FSTREAM */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_function.h b/build/stlport/stlport/stl/_function.h
new file mode 100644
index 000000000..bf4ad3ee4
--- /dev/null
+++ b/build/stlport/stlport/stl/_function.h
@@ -0,0 +1,433 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_FUNCTION_H
+#define _STLP_INTERNAL_FUNCTION_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+struct not_equal_to : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; }
+};
+
+template <class _Tp>
+struct greater : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; }
+};
+
+template <class _Tp>
+struct greater_equal : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; }
+};
+
+template <class _Tp>
+struct less_equal : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; }
+};
+
+template <class _Tp>
+struct divides : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; }
+};
+
+template <class _Tp>
+struct modulus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; }
+};
+
+template <class _Tp>
+struct negate : public unary_function<_Tp, _Tp> {
+ _Tp operator()(const _Tp& __x) const { return -__x; }
+};
+
+template <class _Tp>
+struct logical_and : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; }
+};
+
+template <class _Tp>
+struct logical_or : public binary_function<_Tp, _Tp,bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; }
+};
+
+template <class _Tp>
+struct logical_not : public unary_function<_Tp, bool> {
+ bool operator()(const _Tp& __x) const { return !__x; }
+};
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// identity_element (not part of the C++ standard).
+template <class _Tp> inline _Tp identity_element(plus<_Tp>) { return _Tp(0); }
+template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); }
+#endif
+
+#if defined (_STLP_BASE_TYPEDEF_BUG)
+// this workaround is needed for SunPro 4.0.1
+// suggested by "Martin Abernethy" <gma@paston.co.uk>:
+
+// We have to introduce the XXary_predicate_aux structures in order to
+// access the argument and return types of predicate functions supplied
+// as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters
+// of the form 'name1::name2', where name1 is itself a type parameter.
+template <class _Pair>
+struct __pair_aux : private _Pair {
+ typedef typename _Pair::first_type first_type;
+ typedef typename _Pair::second_type second_type;
+};
+
+template <class _Operation>
+struct __unary_fun_aux : private _Operation {
+ typedef typename _Operation::argument_type argument_type;
+ typedef typename _Operation::result_type result_type;
+};
+
+template <class _Operation>
+struct __binary_fun_aux : private _Operation {
+ typedef typename _Operation::first_argument_type first_argument_type;
+ typedef typename _Operation::second_argument_type second_argument_type;
+ typedef typename _Operation::result_type result_type;
+};
+
+# define __UNARY_ARG(__Operation,__type) __unary_fun_aux<__Operation>::__type
+# define __BINARY_ARG(__Operation,__type) __binary_fun_aux<__Operation>::__type
+# define __PAIR_ARG(__Pair,__type) __pair_aux<__Pair>::__type
+#else
+# define __UNARY_ARG(__Operation,__type) __Operation::__type
+# define __BINARY_ARG(__Operation,__type) __Operation::__type
+# define __PAIR_ARG(__Pair,__type) __Pair::__type
+#endif
+
+template <class _Predicate>
+class unary_negate
+ : public unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> {
+ typedef unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Predicate _M_pred;
+public:
+ explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
+ bool operator()(_ArgParamType __x) const {
+ return !_M_pred(__x);
+ }
+};
+
+template <class _Predicate>
+inline unary_negate<_Predicate>
+not1(const _Predicate& __pred) {
+ return unary_negate<_Predicate>(__pred);
+}
+
+template <class _Predicate>
+class binary_negate
+ : public binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
+ typename __BINARY_ARG(_Predicate, second_argument_type),
+ bool> {
+ typedef binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
+ typename __BINARY_ARG(_Predicate, second_argument_type),
+ bool> _Base;
+public:
+ typedef typename _Base::first_argument_type first_argument_type;
+ typedef typename _Base::second_argument_type second_argument_type;
+private:
+ typedef typename __call_traits<first_argument_type>::const_param_type _FstArgParamType;
+ typedef typename __call_traits<second_argument_type>::const_param_type _SndArgParamType;
+protected:
+ _Predicate _M_pred;
+public:
+ explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
+ bool operator()(_FstArgParamType __x, _SndArgParamType __y) const {
+ return !_M_pred(__x, __y);
+ }
+};
+
+template <class _Predicate>
+inline binary_negate<_Predicate>
+not2(const _Predicate& __pred) {
+ return binary_negate<_Predicate>(__pred);
+}
+
+template <class _Operation>
+class binder1st :
+ public unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
+ typename __BINARY_ARG(_Operation, result_type) > {
+ typedef unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
+ typename __BINARY_ARG(_Operation, result_type) > _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::param_type _ArgParamType;
+ typedef typename __call_traits<argument_type>::const_param_type _ConstArgParamType;
+ typedef typename __call_traits<typename _Operation::first_argument_type>::const_param_type _ValueParamType;
+protected:
+ //op is a Standard name (20.3.6.1), do no make it STLport naming convention compliant.
+ _Operation op;
+ typename _Operation::first_argument_type _M_value;
+public:
+ binder1st(const _Operation& __x, _ValueParamType __y)
+ : op(__x), _M_value(__y) {}
+
+ result_type operator()(_ConstArgParamType __x) const
+ { return op(_M_value, __x); }
+ // DR 109 Missing binders for non-const sequence elements
+ result_type operator()(_ArgParamType __x) const
+ { return op(_M_value, __x); }
+};
+
+template <class _Operation, class _Tp>
+inline binder1st<_Operation>
+bind1st(const _Operation& __fn, const _Tp& __x) {
+ typedef typename _Operation::first_argument_type _Arg1_type;
+ return binder1st<_Operation>(__fn, _Arg1_type(__x));
+}
+
+template <class _Operation>
+class binder2nd
+ : public unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
+ typename __BINARY_ARG(_Operation, result_type)> {
+ typedef unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
+ typename __BINARY_ARG(_Operation, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::param_type _ArgParamType;
+ typedef typename __call_traits<argument_type>::const_param_type _ConstArgParamType;
+ typedef typename __call_traits<typename _Operation::second_argument_type>::const_param_type _ValueParamType;
+protected:
+ //op is a Standard name (20.3.6.3), do no make it STLport naming convention compliant.
+ _Operation op;
+ typename _Operation::second_argument_type value;
+public:
+ binder2nd(const _Operation& __x, _ValueParamType __y)
+ : op(__x), value(__y) {}
+
+ result_type operator()(_ConstArgParamType __x) const
+ { return op(__x, value); }
+ // DR 109 Missing binders for non-const sequence elements
+ result_type operator()(_ArgParamType __x) const
+ { return op(__x, value); }
+};
+
+template <class _Operation, class _Tp>
+inline binder2nd<_Operation>
+bind2nd(const _Operation& __fn, const _Tp& __x) {
+ typedef typename _Operation::second_argument_type _Arg2_type;
+ return binder2nd<_Operation>(__fn, _Arg2_type(__x));
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// unary_compose and binary_compose (extensions, not part of the standard).
+
+template <class _Operation1, class _Operation2>
+class unary_compose :
+ public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __UNARY_ARG(_Operation1, result_type)> {
+ typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __UNARY_ARG(_Operation1, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+public:
+ unary_compose(const _Operation1& __x, const _Operation2& __y)
+ : _M_fn1(__x), _M_fn2(__y) {}
+
+ result_type operator()(_ArgParamType __x) const {
+ return _M_fn1(_M_fn2(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2>
+inline unary_compose<_Operation1,_Operation2>
+compose1(const _Operation1& __fn1, const _Operation2& __fn2) {
+ return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
+}
+
+template <class _Operation1, class _Operation2, class _Operation3>
+class binary_compose :
+ public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __BINARY_ARG(_Operation1, result_type)> {
+ typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __BINARY_ARG(_Operation1, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+ _Operation3 _M_fn3;
+public:
+ binary_compose(const _Operation1& __x, const _Operation2& __y,
+ const _Operation3& __z)
+ : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
+
+ result_type operator()(_ArgParamType __x) const {
+ return _M_fn1(_M_fn2(__x), _M_fn3(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2, class _Operation3>
+inline binary_compose<_Operation1, _Operation2, _Operation3>
+compose2(const _Operation1& __fn1, const _Operation2& __fn2,
+ const _Operation3& __fn3) {
+ return binary_compose<_Operation1,_Operation2,_Operation3>(__fn1, __fn2, __fn3);
+}
+
+// identity is an extension: it is not part of the standard.
+template <class _Tp> struct identity : public _STLP_PRIV _Identity<_Tp> {};
+// select1st and select2nd are extensions: they are not part of the standard.
+template <class _Pair> struct select1st : public _STLP_PRIV _Select1st<_Pair> {};
+template <class _Pair> struct select2nd : public _STLP_PRIV _Select2nd<_Pair> {};
+
+template <class _Arg1, class _Arg2>
+struct project1st : public _STLP_PRIV _Project1st<_Arg1, _Arg2> {};
+
+template <class _Arg1, class _Arg2>
+struct project2nd : public _STLP_PRIV _Project2nd<_Arg1, _Arg2> {};
+
+
+// constant_void_fun, constant_unary_fun, and constant_binary_fun are
+// extensions: they are not part of the standard. (The same, of course,
+// is true of the helper functions constant0, constant1, and constant2.)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Result>
+struct _Constant_void_fun {
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()() const { return _M_val; }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Result>
+struct constant_void_fun : public _STLP_PRIV _Constant_void_fun<_Result> {
+ constant_void_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_void_fun<_Result>(__v) {}
+};
+
+template <class _Result, _STLP_DFL_TMPL_PARAM( _Argument , _Result) >
+struct constant_unary_fun : public _STLP_PRIV _Constant_unary_fun<_Result, _Argument> {
+ constant_unary_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_unary_fun<_Result, _Argument>(__v) {}
+};
+
+template <class _Result, _STLP_DFL_TMPL_PARAM( _Arg1 , _Result), _STLP_DFL_TMPL_PARAM( _Arg2 , _Arg1) >
+struct constant_binary_fun
+ : public _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2> {
+ constant_binary_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
+};
+
+template <class _Result>
+inline constant_void_fun<_Result> constant0(const _Result& __val) {
+ return constant_void_fun<_Result>(__val);
+}
+
+template <class _Result>
+inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) {
+ return constant_unary_fun<_Result,_Result>(__val);
+}
+
+template <class _Result>
+inline constant_binary_fun<_Result,_Result,_Result>
+constant2(const _Result& __val) {
+ return constant_binary_fun<_Result,_Result,_Result>(__val);
+}
+
+// subtractive_rng is an extension: it is not part of the standard.
+// Note: this code assumes that int is 32 bits.
+class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> {
+private:
+ _STLP_UINT32_T _M_table[55];
+ _STLP_UINT32_T _M_index1;
+ _STLP_UINT32_T _M_index2;
+public:
+ _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) {
+ _M_index1 = (_M_index1 + 1) % 55;
+ _M_index2 = (_M_index2 + 1) % 55;
+ _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
+ return _M_table[_M_index1] % __limit;
+ }
+
+ void _M_initialize(_STLP_UINT32_T __seed) {
+ _STLP_UINT32_T __k = 1;
+ _M_table[54] = __seed;
+ _STLP_UINT32_T __i;
+ for (__i = 0; __i < 54; __i++) {
+ _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1;
+ _M_table[__ii] = __k;
+ __k = __seed - __k;
+ __seed = _M_table[__ii];
+ }
+ for (int __loop = 0; __loop < 4; __loop++) {
+ for (__i = 0; __i < 55; __i++)
+ _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
+ }
+ _M_index1 = 0;
+ _M_index2 = 31;
+ }
+
+ subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
+ subtractive_rng() { _M_initialize(161803398ul); }
+};
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+#include <stl/_function_adaptors.h>
+
+#endif /* _STLP_INTERNAL_FUNCTION_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_function_adaptors.h b/build/stlport/stlport/stl/_function_adaptors.h
new file mode 100644
index 000000000..0da419b9a
--- /dev/null
+++ b/build/stlport/stlport/stl/_function_adaptors.h
@@ -0,0 +1,783 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2000
+ * Pavel Kuznetsov
+ *
+ * Copyright (c) 2001
+ * Meridian'93
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// This file has noo macro protection as it is meant to be included several times
+// from other header.
+// Adaptor function objects: pointers to member functions.
+
+// There are a total of 16 = 2^4 function objects in this family.
+// (1) Member functions taking no arguments vs member functions taking
+// one argument.
+// (2) Call through pointer vs call through reference.
+// (3) Member function with void return type vs member function with
+// non-void return type.
+// (4) Const vs non-const member function.
+
+// Note that choice (3) is nothing more than a workaround: according
+// to the draft, compilers should handle void and non-void the same way.
+// This feature is not yet widely implemented, though. You can only use
+// member functions returning void if your compiler supports partial
+// specialization.
+
+// All of this complexity is in the function objects themselves. You can
+// ignore it by using the helper function mem_fun and mem_fun_ref,
+// which create whichever type of adaptor is appropriate.
+
+_STLP_BEGIN_NAMESPACE
+
+//This implementation will only be used if needed, that is to say when there is the return void bug
+//and when there is no partial template specialization
+#if defined (_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+
+template<class _Result, class _Tp>
+class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) ();
+ explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg);
+ explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) () const;
+ explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg) const;
+ explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp* __p, _Arg __x) const {
+ return (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Mem_fun0_ref : public unary_function<_Tp,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) ();
+ explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg);
+ explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Const_mem_fun0_ref : public unary_function<_Tp,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) () const;
+ explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Const_mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg) const;
+ explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result>
+struct _Mem_fun_traits {
+ template<class _Tp>
+ struct _Args0 {
+ typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr;
+ typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const;
+ typedef _Mem_fun0_ref<_Result,_Tp> _Ref;
+ typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const;
+ };
+
+ template<class _Tp, class _Arg>
+ struct _Args1 {
+ typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr;
+ typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
+ typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref;
+ typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
+ };
+};
+
+template<class _Arg, class _Result>
+class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
+protected:
+ typedef _Result (*__fun_type) (_Arg);
+ explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator()(_Arg __x) const { return _M_f(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
+protected:
+ typedef _Result (*__fun_type) (_Arg1, _Arg2);
+ explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result>
+struct _Ptr_fun_traits {
+ template<class _Arg> struct _Args1 {
+ typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
+ };
+
+ template<class _Arg1, class _Arg2> struct _Args2 {
+ typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
+ };
+};
+
+/* Specializations for void return type */
+template<class _Tp>
+class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
+protected:
+ typedef void (_Tp::*__fun_type) ();
+ explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg);
+ explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
+protected:
+ typedef void (_Tp::*__fun_type) () const;
+ explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg) const;
+ explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_mem_fun0_ref : public unary_function<_Tp,void> {
+protected:
+ typedef void (_Tp::*__fun_type) ();
+ explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_mem_fun1_ref : public binary_function<_Tp,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg);
+ explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_const_mem_fun0_ref : public unary_function<_Tp,void> {
+protected:
+ typedef void (_Tp::*__fun_type) () const;
+ explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_const_mem_fun1_ref : public binary_function<_Tp,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg) const;
+ explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Mem_fun_traits<void> {
+ template<class _Tp> struct _Args0 {
+ typedef _Void_mem_fun0_ptr<_Tp> _Ptr;
+ typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const;
+ typedef _Void_mem_fun0_ref<_Tp> _Ref;
+ typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const;
+ };
+
+ template<class _Tp, class _Arg> struct _Args1 {
+ typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr;
+ typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const;
+ typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref;
+ typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const;
+ };
+};
+
+template<class _Arg>
+class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
+protected:
+ typedef void (*__fun_type) (_Arg);
+ explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator()(_Arg __x) const { _M_f(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg1, class _Arg2>
+class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
+protected:
+ typedef void (*__fun_type) (_Arg1, _Arg2);
+ explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
+
+private:
+ __fun_type _M_f;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Ptr_fun_traits<void> {
+ template<class _Arg> struct _Args1 {
+ typedef _Ptr_void_fun1_base<_Arg> _Fun;
+ };
+
+ template<class _Arg1, class _Arg2> struct _Args2 {
+ typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
+ };
+};
+
+// pavel: need extra level of inheritance here since MSVC++ does not
+// accept traits-based fake partial specialization for template
+// arguments other than first
+
+template<class _Result, class _Arg>
+class _Ptr_fun1 :
+ public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
+protected:
+ typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
+ explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template<class _Result, class _Arg1, class _Arg2>
+class _Ptr_fun2 :
+ public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
+protected:
+ typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
+ explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class mem_fun_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
+public:
+ explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class const_mem_fun_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
+public:
+ explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class mem_fun_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
+public:
+ explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class const_mem_fun_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
+public:
+ explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class mem_fun1_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
+public:
+ explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class const_mem_fun1_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
+public:
+ explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class mem_fun1_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
+public:
+ explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class const_mem_fun1_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
+public:
+ explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Arg, class _Result>
+class pointer_to_unary_function :
+ public _Ptr_fun1<_Result,_Arg> {
+ typedef typename
+ _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
+public:
+ explicit pointer_to_unary_function(__fun_type __f)
+ : _Ptr_fun1<_Result,_Arg>(__f) {}
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class pointer_to_binary_function :
+ public _Ptr_fun2<_Result,_Arg1,_Arg2> {
+ typedef typename
+ _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
+public:
+ explicit pointer_to_binary_function(__fun_type __f)
+ : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
+};
+
+#else
+
+template <class _Ret, class _Tp>
+class mem_fun_t : public unary_function<_Tp*,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp* __p, _Arg __x) const
+ { return (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg, class _Result>
+class pointer_to_unary_function : public unary_function<_Arg, _Result> {
+protected:
+ _Result (*_M_ptr)(_Arg);
+public:
+ pointer_to_unary_function() {}
+ explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
+ _Result operator()(_Arg __x) const { return _M_ptr(__x); }
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class pointer_to_binary_function :
+ public binary_function<_Arg1,_Arg2,_Result> {
+protected:
+ _Result (*_M_ptr)(_Arg1, _Arg2);
+public:
+ pointer_to_binary_function() {}
+ explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
+ : _M_ptr(__x) {}
+ _Result operator()(_Arg1 __x, _Arg2 __y) const {
+ return _M_ptr(__x, __y);
+ }
+};
+
+# if defined (_STLP_DONT_RETURN_VOID) && !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
+//Partial specializations for the void type
+template <class _Tp>
+class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
+ typedef void (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p) const { (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
+ typedef void (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
+ typedef void (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp& __r) const { (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
+ typedef void (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class const_mem_fun1_t<void, _Tp, _Arg>
+ : public binary_function<const _Tp*,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_ref_t<void, _Tp, _Arg>
+ : public binary_function<_Tp,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class const_mem_fun1_ref_t<void, _Tp, _Arg>
+ : public binary_function<_Tp,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg>
+class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> {
+ typedef void (*__fun_type)(_Arg);
+ __fun_type _M_ptr;
+public:
+ pointer_to_unary_function() {}
+ explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
+ void operator()(_Arg __x) const { _M_ptr(__x); }
+};
+
+template <class _Arg1, class _Arg2>
+class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> {
+ typedef void (*__fun_type)(_Arg1, _Arg2);
+ __fun_type _M_ptr;
+public:
+ pointer_to_binary_function() {}
+ explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
+ void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
+};
+
+# endif
+
+#endif
+
+#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
+// Mem_fun adaptor helper functions. There are only two:
+// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
+// are provided for backward compatibility, but they are no longer
+// part of the C++ standard.)
+
+template <class _Result, class _Tp>
+inline mem_fun_t<_Result,_Tp>
+mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline const_mem_fun_t<_Result,_Tp>
+mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline mem_fun_ref_t<_Result,_Tp>
+mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline const_mem_fun_ref_t<_Result,_Tp>
+mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
+// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
+// but they are provided for backward compatibility.
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+# endif
+
+#endif
+
+template <class _Arg, class _Result>
+inline pointer_to_unary_function<_Arg, _Result>
+ptr_fun(_Result (*__f)(_Arg))
+{ return pointer_to_unary_function<_Arg, _Result>(__f); }
+
+template <class _Arg1, class _Arg2, class _Result>
+inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
+ptr_fun(_Result (*__f)(_Arg1, _Arg2))
+{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/stlport/stl/_function_base.h b/build/stlport/stlport/stl/_function_base.h
new file mode 100644
index 000000000..1e7f4f548
--- /dev/null
+++ b/build/stlport/stlport/stl/_function_base.h
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+#define _STLP_INTERNAL_FUNCTION_BASE_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H)
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Arg, class _Result>
+struct unary_function {
+ typedef _Arg argument_type;
+ typedef _Result result_type;
+#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+protected:
+ /* This class purpose is to be derived but it is not polymorphic so users should never try
+ * to destroy an instance of it directly. The protected non-virtual destructor make this
+ * fact obvious at compilation time. */
+ ~unary_function() {}
+#endif
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+struct binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+protected:
+ /* See unary_function comment. */
+ ~binary_function() {}
+#endif
+};
+
+template <class _Tp>
+struct equal_to : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
+};
+
+template <class _Tp>
+struct less : public binary_function<_Tp,_Tp,bool>
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* less is the default template parameter for many STL containers, to fully use
+ * the move constructor feature we need to know that the default less is just a
+ * functor.
+ */
+ , public __stlport_class<less<_Tp> >
+#endif
+{
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(less<_Tp>& __x) {}
+#endif
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<less<_Tp> > {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<less<_Tp> >::_Ret _STLportLess;
+#else
+ enum { _Is = _IsSTLportClass<less<_Tp> >::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportLess;
+#endif
+ typedef _STLportLess has_trivial_default_constructor;
+ typedef _STLportLess has_trivial_copy_constructor;
+ typedef _STLportLess has_trivial_assignment_operator;
+ typedef _STLportLess has_trivial_destructor;
+ typedef _STLportLess is_POD_type;
+};
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+less<_Tp> __less(_Tp* ) { return less<_Tp>(); }
+
+template <class _Tp>
+equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+struct plus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; }
+};
+
+template <class _Tp>
+struct minus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; }
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); }
+
+template <class _Tp>
+minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+struct multiplies : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Pair>
+struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
+ const typename _Pair::first_type& operator()(const _Pair& __x) const {
+ return __x.first;
+ }
+};
+
+template <class _Pair>
+struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> {
+ const typename _Pair::second_type& operator()(const _Pair& __x) const {
+ return __x.second;
+ }
+};
+
+// project1st and project2nd are extensions: they are not part of the standard
+template <class _Arg1, class _Arg2>
+struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
+ _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
+};
+
+template <class _Arg1, class _Arg2>
+struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
+ _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
+};
+
+#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
+// fbp : sort of select1st just for maps
+template <class _Pair, class _Whatever>
+// JDJ (CW Pro1 doesn't like const when first_type is also const)
+struct __Select1st_hint : public unary_function<_Pair, _Whatever> {
+ const _Whatever& operator () (const _Pair& __x) const { return __x.first; }
+};
+# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y >
+#else
+# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x >
+#endif
+
+template <class _Tp>
+struct _Identity : public unary_function<_Tp,_Tp> {
+ const _Tp& operator()(const _Tp& __x) const { return __x; }
+};
+
+template <class _Result, class _Argument>
+struct _Constant_unary_fun {
+ typedef _Argument argument_type;
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Argument&) const { return _M_val; }
+};
+
+template <class _Result, class _Arg1, class _Arg2>
+struct _Constant_binary_fun {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ _Result _M_val;
+
+ _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Arg1&, const _Arg2&) const {
+ return _M_val;
+ }
+};
+
+// identity_element (not part of the C++ standard).
+template <class _Tp> inline _Tp __identity_element(plus<_Tp>) { return _Tp(0); }
+template <class _Tp> inline _Tp __identity_element(multiplies<_Tp>) { return _Tp(1); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_FUNCTION_BASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_hash_fun.h b/build/stlport/stlport/stl/_hash_fun.h
new file mode 100644
index 000000000..6197d7b2e
--- /dev/null
+++ b/build/stlport/stlport/stl/_hash_fun.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_HASH_FUN_H
+#define _STLP_HASH_FUN_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Key> struct hash { };
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+inline size_t __stl_hash_string(const char* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ unsigned long __h = 0;
+ for ( ; *__s; ++__s)
+ __h = 5*__h + *__s;
+
+ return size_t(__h);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+struct hash<char*> {
+ size_t operator()(const char* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _STLP_PRIV __stl_hash_string(__s);
+ }
+};
+
+_STLP_TEMPLATE_NULL
+struct hash<const char*> {
+ size_t operator()(const char* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _STLP_PRIV __stl_hash_string(__s);
+ }
+};
+
+_STLP_TEMPLATE_NULL struct hash<char> {
+ size_t operator()(char __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned char> {
+ size_t operator()(unsigned char __x) const { return __x; }
+};
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_TEMPLATE_NULL struct hash<signed char> {
+ size_t operator()(unsigned char __x) const { return __x; }
+};
+#endif
+_STLP_TEMPLATE_NULL struct hash<short> {
+ size_t operator()(short __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned short> {
+ size_t operator()(unsigned short __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<int> {
+ size_t operator()(int __x) const { return __x; }
+};
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) || defined (_WIN64)
+_STLP_TEMPLATE_NULL struct hash<unsigned int> {
+ size_t operator()(unsigned int __x) const { return __x; }
+};
+#else
+/* MSVC .Net since 2002 has a 64 bits portability warning feature. typedef
+ * like size_t are tagged as potential 64 bits variables making them different from
+ * unsigned int. To avoid the warning when a hash container is instanciated with
+ * the size_t key we prefer to grant the size_t specialization rather than the
+ * unsigned int one.
+ */
+_STLP_TEMPLATE_NULL struct hash<size_t> {
+ size_t operator()(size_t __x) const { return __x; }
+};
+#endif
+
+_STLP_TEMPLATE_NULL struct hash<long> {
+ size_t operator()(long __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned long> {
+ size_t operator()(unsigned long __x) const { return __x; }
+};
+
+#if defined (_STLP_LONG_LONG)
+_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> {
+ size_t operator()(_STLP_LONG_LONG x) const { return (size_t)x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned _STLP_LONG_LONG> {
+ size_t operator()(unsigned _STLP_LONG_LONG x) const { return (size_t)x; }
+};
+#endif
+
+_STLP_TEMPLATE_NULL
+struct hash<void *>
+{
+ union __vp {
+ size_t s;
+ void *p;
+ };
+
+ size_t operator()(void *__x) const
+ {
+ __vp vp;
+ vp.p = __x;
+ return vp.s;
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HASH_FUN_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_hash_map.h b/build/stlport/stlport/stl/_hash_map.h
new file mode 100644
index 000000000..cd4660315
--- /dev/null
+++ b/build/stlport/stlport/stl/_hash_map.h
@@ -0,0 +1,500 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASH_MAP_H
+#define _STLP_INTERNAL_HASH_MAP_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class hash_map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMapTraitsT<value_type> _HashMapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _HashMapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+public:
+ hash_map() : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_map(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_map(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# endif
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+#else
+ hash_map(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ hash_map(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ pair<iterator,bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_unique(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_unique(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ pair<iterator,bool> insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __key) {
+ iterator __it = _M_ht.find(__key);
+ return (__it == _M_ht.end() ?
+ _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
+ (*__it).second );
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class hash_multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMultimapTraitsT<value_type> _HashMultimapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _HashMultimapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+public:
+ hash_multimap() : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_multimap(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_multimap(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# endif
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+#else
+ hash_multimap(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ hash_multimap(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l) {
+ _M_ht.insert_equal(__f,__l);
+ }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ iterator insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator>
+ equal_range(const _KT& __key) { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator>
+ equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+# endif
+
+// Specialization of insert_iterator so that it will work for hash_map
+// and hash_multimap.
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASH_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_hash_set.h b/build/stlport/stlport/stl/_hash_set.h
new file mode 100644
index 000000000..29b168b8d
--- /dev/null
+++ b/build/stlport/stlport/stl/_hash_set.h
@@ -0,0 +1,495 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASH_SET_H
+#define _STLP_INTERNAL_HASH_SET_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashSetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class hash_set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashSetTraitsT<_Value> _HashSetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _HashSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ hash_set()
+ : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_set(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_set(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+#else
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type()) {}
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a)
+#endif
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# endif
+#else
+ hash_set(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ hash_set(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ pair<iterator, bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const_iterator __f, const_iterator __l)
+ {_M_ht.insert_unique(__f, __l); }
+ void insert(const value_type* __f, const value_type* __l)
+#endif
+ { _M_ht.insert_unique(__f,__l); }
+
+ pair<iterator, bool> insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultisetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class hash_multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMultisetTraitsT<_Value> _HashMultisetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _HashMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ hash_multiset()
+ : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_multiset(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a)
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# endif
+#else
+ hash_multiset(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ hash_multiset(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ iterator insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+// Specialization of insert_iterator so that it will work for hash_set
+// and hash_multiset.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename hash_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASH_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_hashtable.c b/build/stlport/stlport/stl/_hashtable.c
new file mode 100644
index 000000000..b743156e4
--- /dev/null
+++ b/build/stlport/stlport/stl/_hashtable.c
@@ -0,0 +1,553 @@
+/*
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_HASHTABLE_C
+#define _STLP_HASHTABLE_C
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+# define __PRIME_LIST_BODY { \
+ 7ul, 23ul, \
+ 53ul, 97ul, 193ul, 389ul, 769ul, \
+ 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \
+ 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \
+ 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \
+ 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\
+ 1610612741ul, 3221225473ul, 4294967291ul \
+}
+
+template <class _Dummy>
+const size_t* _STLP_CALL
+_Stl_prime<_Dummy>::_S_primes(size_t &__size) {
+ static const size_t _list[] = __PRIME_LIST_BODY;
+# ifndef __MWERKS__
+ __size = sizeof(_list) / sizeof(_list[0]);
+# else
+ __size = 30;
+# endif
+ return _list;
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_max_nb_buckets() {
+ size_t __size;
+ const size_t* __first = _S_primes(__size);
+ return *(__first + __size - 1);
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_next_size(size_t __n) {
+ size_t __size;
+ const size_t* __first = _S_primes(__size);
+ const size_t* __last = __first + __size;
+ const size_t* pos = __lower_bound(__first, __last, __n,
+ __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
+ return (pos == __last ? *(__last - 1) : *pos);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Stl_prime<_Dummy>::_S_prev_sizes(size_t __n, size_t const*&__begin, size_t const*&__pos) {
+ size_t __size;
+ __begin = _S_primes(__size);
+ const size_t* __last = __begin + __size;
+ __pos = __lower_bound(__begin, __last, __n,
+ __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
+
+ if (__pos== __last)
+ --__pos;
+ else if (*__pos == __n) {
+ if (__pos != __begin)
+ --__pos;
+ }
+}
+
+# undef __PRIME_LIST_BODY
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif
+
+#if defined (_STLP_DEBUG)
+# define hashtable _STLP_NON_DBG_NAME(hashtable)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// fbp: these defines are for outline methods definitions.
+// needed to definitions to be portable. Should not be used in method bodies.
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __size_type__ size_t
+# define size_type size_t
+# define value_type _Val
+# define key_type _Key
+# define __reference__ _Val&
+
+# define __iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits, \
+ _Key, _HF, _ExK, _EqK, _All>
+# define __const_iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_ConstTraits, \
+ _Key, _HF, _ExK, _EqK, _All>
+#else
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::size_type
+# define __reference__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::iterator
+# define __const_iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::const_iterator
+#endif
+
+/*
+ * This method is too difficult to implement for hashtable that do not
+ * require a sorted operation on the stored type.
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+bool hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_equal(
+ const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht1,
+ const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht2) {
+ return __ht1._M_buckets == __ht2._M_buckets &&
+ __ht1._M_elems == __ht2._M_elems;
+}
+*/
+
+/* Returns the iterator before the first iterator of the bucket __n and set
+ * __n to the first previous bucket having the same first iterator as bucket
+ * __n.
+ */
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_before_begin(size_type &__n) const {
+ return _S_before_begin(_M_elems, _M_buckets, __n);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
+ size_type &__n) {
+ _ElemsCont &__mutable_elems = __CONST_CAST(_ElemsCont&, __elems);
+ typename _BucketVector::const_iterator __bpos(__buckets.begin() + __n);
+
+ _ElemsIte __pos(*__bpos);
+ if (__pos == __mutable_elems.begin()) {
+ __n = 0;
+ return __mutable_elems.before_begin();
+ }
+
+ typename _BucketVector::const_iterator __bcur(__bpos);
+ _BucketType *__pos_node = __pos._M_node;
+ for (--__bcur; __pos_node == *__bcur; --__bcur);
+
+ __n = __bcur - __buckets.begin() + 1;
+ _ElemsIte __cur(*__bcur);
+ _ElemsIte __prev = __cur++;
+ for (; __cur != __pos; ++__prev, ++__cur);
+ return __prev;
+}
+
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_insert_noresize(size_type __n, const value_type& __obj) {
+ //We always insert this element as 1st in the bucket to not break
+ //the elements order as equal elements must be kept next to each other.
+ size_type __prev = __n;
+ _ElemsIte __pos = _M_before_begin(__prev)._M_ite;
+
+ fill(_M_buckets.begin() + __prev, _M_buckets.begin() + __n + 1,
+ _M_elems.insert_after(__pos, __obj)._M_node);
+ ++_M_num_elements;
+ return iterator(_ElemsIte(_M_buckets[__n]));
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+pair<__iterator__, bool>
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::insert_unique_noresize(const value_type& __obj) {
+ const size_type __n = _M_bkt_num(__obj);
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+
+ if (__cur != __last) {
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
+ //We check that equivalent keys have equals hash code as otherwise, on resize,
+ //equivalent value might not be in the same bucket
+ _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
+ return pair<iterator, bool>(iterator(__cur), false);
+ }
+ }
+ /* Here we do not rely on the _M_insert_noresize method as we know
+ * that we cannot break element orders, elements are unique, and
+ * insertion after the first bucket element is faster than what is
+ * done in _M_insert_noresize.
+ */
+ __cur = _M_elems.insert_after(_ElemsIte(_M_buckets[__n]), __obj);
+ ++_M_num_elements;
+ return pair<iterator, bool>(iterator(__cur), true);
+ }
+
+ return pair<iterator, bool>(_M_insert_noresize(__n, __obj), true);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::insert_equal_noresize(const value_type& __obj) {
+ const size_type __n = _M_bkt_num(__obj);
+ {
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
+ //We check that equivalent keys have equals hash code as otherwise, on resize,
+ //equivalent value might not be in the same bucket
+ _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
+ ++_M_num_elements;
+ return _M_elems.insert_after(__cur, __obj);
+ }
+ }
+ }
+
+ return _M_insert_noresize(__n, __obj);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__reference__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_insert(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return *insert_unique_noresize(__obj).first;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__size_type__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const key_type& __key) {
+ const size_type __n = _M_bkt_num_key(__key);
+
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ if (__cur == __last)
+ return 0;
+
+ size_type __erased = 0;
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ //We look for the pos before __cur:
+ size_type __prev_b = __n;
+ _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
+ do {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
+ fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, __cur._M_node);
+ }
+ else {
+ _ElemsIte __prev = __cur++;
+ for (; __cur != __last; ++__prev, ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ do {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
+ break;
+ }
+ }
+ }
+
+ _M_num_elements -= __erased;
+ _M_reduce();
+ return __erased;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const_iterator __it) {
+ const size_type __n = _M_bkt_num(*__it);
+ _ElemsIte __cur(_M_buckets[__n]);
+
+ size_type __erased = 0;
+ if (__cur == __it._M_ite) {
+ size_type __prev_b = __n;
+ _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
+ fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1,
+ _M_elems.erase_after(__prev)._M_node);
+ ++__erased;
+ }
+ else {
+ _ElemsIte __prev = __cur++;
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for (; __cur != __last; ++__prev, ++__cur) {
+ if (__cur == __it._M_ite) {
+ _M_elems.erase_after(__prev);
+ ++__erased;
+ break;
+ }
+ }
+ }
+
+ _M_num_elements -= __erased;
+ _M_reduce();
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const_iterator __first, const_iterator __last) {
+ if (__first == __last)
+ return;
+ size_type __f_bucket = _M_bkt_num(*__first);
+ size_type __l_bucket = __last != end() ? _M_bkt_num(*__last) : (_M_buckets.size() - 1);
+
+ _ElemsIte __cur(_M_buckets[__f_bucket]);
+ _ElemsIte __prev;
+ if (__cur == __first._M_ite) {
+ __prev = _M_before_begin(__f_bucket)._M_ite;
+ }
+ else {
+ _ElemsIte __last(_M_buckets[++__f_bucket]);
+ __prev = __cur++;
+ for (; (__cur != __last) && (__cur != __first._M_ite); ++__prev, ++__cur);
+ }
+ size_type __erased = 0;
+ //We do not use the slist::erase_after method taking a range to count the
+ //number of erased elements:
+ while (__cur != __last._M_ite) {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ }
+ fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node);
+ _M_num_elements -= __erased;
+ _M_reduce();
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::rehash(size_type __num_buckets_hint) {
+ if (bucket_count() >= __num_buckets_hint) {
+ // We are trying to reduce number of buckets, we have to validate it:
+ size_type __limit_num_buckets = (size_type)((float)size() / max_load_factor());
+ if (__num_buckets_hint < __limit_num_buckets) {
+ // Targetted number of buckets __num_buckets_hint would break
+ // load_factor() <= max_load_factor() rule.
+ return;
+ }
+ }
+
+ _M_rehash(__num_buckets_hint);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_enlarge(size_type __to_size) {
+ size_type __num_buckets = bucket_count();
+ size_type __num_buckets_hint = (size_type)((float)__to_size / max_load_factor());
+ if (__num_buckets_hint <= __num_buckets) {
+ return;
+ }
+ __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
+
+ _M_rehash(__num_buckets);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_reduce() {
+ size_type __num_buckets = bucket_count();
+ // We only try to reduce the hashtable if the theorical load factor
+ // is lower than a fraction of the max load factor:
+ // 4 factor is coming from the fact that prime number list is almost a
+ // geometrical suite with reason 2, as we try to jump 2 levels is means
+ // a 4 factor.
+ if ((float)size() / (float)__num_buckets > max_load_factor() / 4.0f)
+ return;
+
+ const size_type *__first;
+ const size_type *__prev;
+ _STLP_PRIV _Stl_prime_type::_S_prev_sizes(__num_buckets, __first, __prev);
+
+ /* We are only going to reduce number of buckets if moving to yet the previous number
+ * of buckets in the prime numbers would respect the load rule. Otherwise algorithm
+ * successively removing and adding an element would each time perform an expensive
+ * rehash operation. */
+ const size_type *__prev_prev = __prev;
+ if (__prev_prev != __first) {
+ --__prev_prev;
+ if ((float)size() / (float)*__prev_prev > max_load_factor())
+ return;
+ }
+ else {
+ if (*__prev >= __num_buckets)
+ return;
+ }
+
+ // Can we reduce further:
+ while (__prev_prev != __first) {
+ --__prev_prev;
+ if ((float)size() / (float)*__prev_prev > max_load_factor())
+ // We cannot reduce further.
+ break;
+ --__prev;
+ }
+
+ _M_rehash(*__prev);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_resize() {
+ if (load_factor() > max_load_factor()) {
+ // We have to enlarge
+ _M_enlarge(size());
+ }
+ else {
+ // We can try to reduce size:
+ _M_reduce();
+ }
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_rehash(size_type __num_buckets) {
+#if defined (_STLP_DEBUG)
+ _M_check();
+#endif
+ _ElemsCont __tmp_elems(_M_elems.get_allocator());
+ _BucketVector __tmp(__num_buckets + 1, __STATIC_CAST(_BucketType*, 0), _M_buckets.get_allocator());
+ _ElemsIte __cur, __last(_M_elems.end());
+ while (!_M_elems.empty()) {
+ __cur = _M_elems.begin();
+ size_type __new_bucket = _M_bkt_num(*__cur, __num_buckets);
+ _ElemsIte __ite(__cur), __before_ite(__cur);
+ for (++__ite;
+ __ite != __last && _M_equals(_M_get_key(*__cur), _M_get_key(*__ite));
+ ++__ite, ++__before_ite);
+ size_type __prev_bucket = __new_bucket;
+ _ElemsIte __prev = _S_before_begin(__tmp_elems, __tmp, __prev_bucket)._M_ite;
+ __tmp_elems.splice_after(__prev, _M_elems, _M_elems.before_begin(), __before_ite);
+ fill(__tmp.begin() + __prev_bucket, __tmp.begin() + __new_bucket + 1, __cur._M_node);
+ }
+ _M_elems.swap(__tmp_elems);
+ _M_buckets.swap(__tmp);
+}
+
+#if defined (_STLP_DEBUG)
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_check() const {
+ //We check that hash code of stored keys haven't change and also that equivalent
+ //relation hasn't been modified
+ size_t __num_buckets = bucket_count();
+ for (size_t __b = 0; __b < __num_buckets; ++__b) {
+ _ElemsIte __cur(_M_buckets[__b]), __last(_M_buckets[__b + 1]);
+ _ElemsIte __fst(__cur), __snd(__cur);
+ for (; __cur != __last; ++__cur) {
+ _STLP_ASSERT( _M_bkt_num(*__cur, __num_buckets) == __b )
+ _STLP_ASSERT( !_M_equals(_M_get_key(*__fst), _M_get_key(*__cur)) || _M_equals(_M_get_key(*__snd), _M_get_key(*__cur)) )
+ if (__fst != __snd)
+ ++__fst;
+ if (__snd != __cur)
+ ++__snd;
+ }
+ }
+}
+#endif
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::clear() {
+ _M_elems.clear();
+ _M_buckets.assign(_M_buckets.size(), __STATIC_CAST(_BucketType*, 0));
+ _M_num_elements = 0;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_copy_from(const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht) {
+ _M_elems.clear();
+ _M_elems.insert(_M_elems.end(), __ht._M_elems.begin(), __ht._M_elems.end());
+ _M_buckets.resize(__ht._M_buckets.size());
+ _ElemsConstIte __src(__ht._M_elems.begin()), __src_end(__ht._M_elems.end());
+ _ElemsIte __dst(_M_elems.begin());
+ typename _BucketVector::const_iterator __src_b(__ht._M_buckets.begin()),
+ __src_end_b(__ht._M_buckets.end());
+ typename _BucketVector::iterator __dst_b(_M_buckets.begin()), __dst_end_b(_M_buckets.end());
+ for (; __src != __src_end; ++__src, ++__dst) {
+ for (; __src_b != __src_end_b; ++__src_b, ++__dst_b) {
+ if (*__src_b == __src._M_node) {
+ *__dst_b = __dst._M_node;
+ }
+ else
+ break;
+ }
+ }
+ fill(__dst_b, __dst_end_b, __STATIC_CAST(_BucketType*, 0));
+ _M_num_elements = __ht._M_num_elements;
+ _M_max_load_factor = __ht._M_max_load_factor;
+}
+
+#undef __iterator__
+#undef const_iterator
+#undef __size_type__
+#undef __reference__
+#undef size_type
+#undef value_type
+#undef key_type
+#undef __stl_num_primes
+
+#if defined (_STLP_DEBUG)
+# undef hashtable
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HASHTABLE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_hashtable.h b/build/stlport/stlport/stl/_hashtable.h
new file mode 100644
index 000000000..1c8e2f543
--- /dev/null
+++ b/build/stlport/stlport/stl/_hashtable.h
@@ -0,0 +1,658 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+#define _STLP_INTERNAL_HASHTABLE_H
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+/*
+ * Hashtable class, used to implement the hashed associative containers
+ * hash_set, hash_map, hash_multiset, hash_multimap,
+ * unordered_set, unordered_map, unordered_multiset, unordered_multimap.
+ */
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+//Export of the classes used to represent buckets in the hashtable implementation.
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+//If pointer specialization is enabled vector<_Slist_node_base*> will use the void*
+//storage type for which internal classes have already been exported.
+_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _Slist_node_base*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+_STLP_EXPORT_TEMPLATE_CLASS vector<_STLP_PRIV _Slist_node_base*,
+ allocator<_STLP_PRIV _Slist_node_base*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define hashtable _STLP_NON_DBG_NAME(hashtable)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// some compilers require the names of template parameters to be the same
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable;
+
+#if !defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _BaseIte, class _Traits>
+struct _Ht_iterator {
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+
+ typedef _Ht_iterator<_BaseIte,_Traits> _Self;
+
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ typedef _Ht_iterator<_BaseIte, _NonConstTraits> iterator;
+ typedef _Ht_iterator<_BaseIte, _ConstTraits> const_iterator;
+
+ _Ht_iterator() {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Ht_iterator(const iterator& __it) : _M_ite(__it._M_ite) {}
+ _Ht_iterator(_BaseIte __it) : _M_ite(__it) {}
+
+ reference operator*() const {
+ return *_M_ite;
+ }
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ ++_M_ite;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ bool operator == (const_iterator __rhs) const {
+ return _M_ite == __rhs._M_ite;
+ }
+ bool operator != (const_iterator __rhs) const {
+ return _M_ite != __rhs._M_ite;
+ }
+
+ _BaseIte _M_ite;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _BaseIte, class _Traits>
+struct __type_traits<_STLP_PRIV _Ht_iterator<_BaseIte, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _BaseIte, class _Traits>
+inline
+# if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+_STLP_TYPENAME_ON_RETURN_TYPE _Traits::value_type *
+# else
+_STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type *
+# endif
+value_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type _Val;
+ return (_Val*) 0;
+}
+template <class _BaseIte, class _Traits>
+inline forward_iterator_tag iterator_category(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
+{ return forward_iterator_tag(); }
+template <class _BaseIte, class _Traits>
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
+{ return (ptrdiff_t*) 0; }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+class _Stl_prime {
+ // Returns begining of primes list and size by reference.
+ static const size_t* _S_primes(size_t&);
+public:
+ //Returns the maximum number of buckets handled by the hashtable implementation
+ static size_t _STLP_CALL _S_max_nb_buckets();
+
+ //Returns the bucket size next to a required size
+ static size_t _STLP_CALL _S_next_size(size_t);
+
+ // Returns the bucket range containing sorted list of prime numbers <= __hint.
+ static void _STLP_CALL _S_prev_sizes(size_t __hint, const size_t *&__begin, const size_t *&__end);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Stl_prime<bool>;
+#endif
+
+typedef _Stl_prime<bool> _Stl_prime_type;
+
+#if !defined (_STLP_DEBUG)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+/*
+ * Hashtables handle allocators a bit differently than other containers
+ * do. If we're using standard-conforming allocators, then a hashtable
+ * unconditionally has a member variable to hold its allocator, even if
+ * it so happens that all instances of the allocator type are identical.
+ * This is because, for hashtables, this extra storage is negligible.
+ * Additionally, a base class wouldn't serve any other purposes; it
+ * wouldn't, for example, simplify the exception-handling code.
+ */
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable {
+ typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
+ typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
+
+public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef _HF hasher;
+ typedef _EqK key_equal;
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef typename _NonConstTraits::pointer pointer;
+ typedef const value_type* const_pointer;
+ typedef typename _NonConstTraits::reference reference;
+ typedef const value_type& const_reference;
+ typedef forward_iterator_tag _Iterator_category;
+
+ hasher hash_funct() const { return _M_hash; }
+ key_equal key_eq() const { return _M_equals; }
+
+private:
+ _STLP_FORCE_ALLOCATORS(_Val, _All)
+#if defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _STLP_NON_DBG_NAME(slist)<value_type, _All> _ElemsCont;
+#else
+ typedef slist<value_type, _All> _ElemsCont;
+#endif
+ typedef typename _ElemsCont::iterator _ElemsIte;
+ typedef typename _ElemsCont::const_iterator _ElemsConstIte;
+ typedef _STLP_PRIV _Slist_node_base _BucketType;
+ typedef typename _Alloc_traits<_BucketType*, _All>::allocator_type _BucketAllocType;
+ /*
+ * We are going to use vector of _Slist_node_base pointers for 2 reasons:
+ * - limit code bloat, all hashtable instanciation use the same buckets representation.
+ * - avoid _STLP_DEBUG performance trouble: with a vector of iterator on slist the resize
+ * method would be too slow because the slist::splice_after method become linear on
+ * the number of iterators in the buckets rather than constant in time as the iterator
+ * has to be move from a slist to the other.
+ */
+#if defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _STLP_NON_DBG_NAME(vector)<_BucketType*, _BucketAllocType> _BucketVector;
+#else
+ typedef vector<_BucketType*, _BucketAllocType> _BucketVector;
+#endif
+
+ hasher _M_hash;
+ key_equal _M_equals;
+ _ElemsCont _M_elems;
+ _BucketVector _M_buckets;
+ size_type _M_num_elements;
+ float _M_max_load_factor;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+ static const key_type& _M_get_key(const value_type& __val) {
+ _ExK k;
+ return k(__val);
+ }
+public:
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstTraits> iterator;
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstTraits> const_iterator;
+ //TODO: Avoids this debug check and make the local_iterator different from
+ //iterator in debug mode too.
+#if !defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstLocalTraits> local_iterator;
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstLocalTraits> const_local_iterator;
+#else
+ typedef iterator local_iterator;
+ typedef const_iterator const_local_iterator;
+#endif
+
+ typedef _All allocator_type;
+ allocator_type get_allocator() const { return _M_elems.get_allocator(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a = allocator_type())
+#else
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql)
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_elems(allocator_type()),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a)
+#endif
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_elems(__a),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(const _Self& __ht)
+ : _M_hash(__ht._M_hash),
+ _M_equals(__ht._M_equals),
+ _M_elems(__ht.get_allocator()),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(), _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_copy_from(__ht); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hashtable(__move_source<_Self> src)
+ : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)),
+ _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)),
+ _M_elems(__move_source<_ElemsCont>(src.get()._M_elems)),
+ _M_buckets(__move_source<_BucketVector>(src.get()._M_buckets)),
+ _M_num_elements(src.get()._M_num_elements),
+ _M_max_load_factor(src.get()._M_max_load_factor) {}
+#endif
+
+ _Self& operator= (const _Self& __ht) {
+ if (&__ht != this) {
+ clear();
+ _M_hash = __ht._M_hash;
+ _M_equals = __ht._M_equals;
+ _M_copy_from(__ht);
+ }
+ return *this;
+ }
+
+ ~hashtable() { clear(); }
+
+ size_type size() const { return _M_num_elements; }
+ size_type max_size() const { return size_type(-1); }
+ bool empty() const { return size() == 0; }
+
+ void swap(_Self& __ht) {
+ _STLP_STD::swap(_M_hash, __ht._M_hash);
+ _STLP_STD::swap(_M_equals, __ht._M_equals);
+ _M_elems.swap(__ht._M_elems);
+ _M_buckets.swap(__ht._M_buckets);
+ _STLP_STD::swap(_M_num_elements, __ht._M_num_elements);
+ _STLP_STD::swap(_M_max_load_factor, __ht._M_max_load_factor);
+ }
+
+ iterator begin() { return _M_elems.begin(); }
+ iterator end() { return _M_elems.end(); }
+ local_iterator begin(size_type __n) { return _ElemsIte(_M_buckets[__n]); }
+ local_iterator end(size_type __n) { return _ElemsIte(_M_buckets[__n + 1]); }
+
+ const_iterator begin() const { return __CONST_CAST(_ElemsCont&, _M_elems).begin(); }
+ const_iterator end() const { return __CONST_CAST(_ElemsCont&, _M_elems).end(); }
+ const_local_iterator begin(size_type __n) const { return _ElemsIte(_M_buckets[__n]); }
+ const_local_iterator end(size_type __n) const { return _ElemsIte(_M_buckets[__n + 1]); }
+
+ //static bool _STLP_CALL _M_equal (const _Self&, const _Self&);
+
+public:
+ //The number of buckets is size() - 1 because the last bucket always contains
+ //_M_elems.end() to make algo easier to implement.
+ size_type bucket_count() const { return _M_buckets.size() - 1; }
+ size_type max_bucket_count() const { return _STLP_PRIV _Stl_prime_type::_S_max_nb_buckets(); }
+ size_type elems_in_bucket(size_type __bucket) const
+ { return _STLP_STD::distance(_ElemsIte(_M_buckets[__bucket]), _ElemsIte(_M_buckets[__bucket + 1])); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_bkt_num_key(__k); }
+
+ // hash policy
+ float load_factor() const { return (float)size() / (float)bucket_count(); }
+ float max_load_factor() const { return _M_max_load_factor; }
+ void max_load_factor(float __z) {
+ _M_max_load_factor = __z;
+ _M_resize();
+ }
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return insert_unique_noresize(__obj);
+ }
+
+ iterator insert_equal(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return insert_equal_noresize(__obj);
+ }
+
+protected:
+ iterator _M_insert_noresize(size_type __n, const value_type& __obj);
+public:
+ pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
+ iterator insert_equal_noresize(const value_type& __obj);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l)
+ { insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l)
+ { insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
+
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l,
+ const input_iterator_tag &) {
+ for ( ; __f != __l; ++__f)
+ insert_unique(*__f);
+ }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l,
+ const input_iterator_tag &) {
+ for ( ; __f != __l; ++__f)
+ insert_equal(*__f);
+ }
+
+ template <class _ForwardIterator>
+ void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ template <class _ForwardIterator>
+ void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_unique(const value_type* __f, const value_type* __l) {
+ size_type __n = __l - __f;
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ void insert_equal(const value_type* __f, const value_type* __l) {
+ size_type __n = __l - __f;
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+ void insert_unique(const_iterator __f, const_iterator __l) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ void insert_equal(const_iterator __f, const_iterator __l) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ //reference find_or_insert(const value_type& __obj);
+
+private:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _ElemsIte _M_find(const _KT& __key) const {
+ size_type __n = _M_bkt_num_key(__key);
+ _ElemsIte __first(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for ( ; (__first != __last) && !_M_equals(_M_get_key(*__first), __key); ++__first);
+ if (__first != __last)
+ return __first;
+ else
+ return __CONST_CAST(_ElemsCont&, _M_elems).end();
+ }
+
+public:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const {
+ const size_type __n = _M_bkt_num_key(__key);
+
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ size_type __result = 1;
+ for (++__cur;
+ __cur != __last && _M_equals(_M_get_key(*__cur), __key);
+ ++__result, ++__cur);
+ return __result;
+ }
+ }
+ return 0;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key) {
+ typedef pair<iterator, iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
+ __first != __last; ++__first) {
+ if (_M_equals(_M_get_key(*__first), __key)) {
+ _ElemsIte __cur(__first);
+ for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur);
+ return _Pii(__first, __cur);
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
+ typedef pair<const_iterator, const_iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
+ __first != __last; ++__first) {
+ if (_M_equals(_M_get_key(*__first), __key)) {
+ _ElemsIte __cur(__first);
+ for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur);
+ return _Pii(__first, __cur);
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ size_type erase(const key_type& __key);
+ void erase(const_iterator __it);
+ void erase(const_iterator __first, const_iterator __last);
+
+private:
+ void _M_enlarge(size_type __n);
+ void _M_reduce();
+ void _M_resize();
+ void _M_rehash(size_type __num_buckets);
+#if defined (_STLP_DEBUG)
+ void _M_check() const;
+#endif
+
+public:
+ void rehash(size_type __num_buckets_hint);
+ void resize(size_type __num_buckets_hint)
+ { rehash(__num_buckets_hint); }
+ void clear();
+
+ // this is for hash_map::operator[]
+ reference _M_insert(const value_type& __obj);
+
+private:
+ //__n is set to the first bucket that has to be modified if any
+ //erase/insert operation is done after the returned iterator.
+ iterator _M_before_begin(size_type &__n) const;
+
+ static iterator _S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
+ size_type &__n);
+
+ void _M_initialize_buckets(size_type __n) {
+ const size_type __n_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__n) + 1;
+ _M_buckets.reserve(__n_buckets);
+ _M_buckets.assign(__n_buckets, __STATIC_CAST(_BucketType*, 0));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type _M_bkt_num_key(const _KT& __key) const
+ { return _M_bkt_num_key(__key, bucket_count()); }
+
+ size_type _M_bkt_num(const value_type& __obj) const
+ { return _M_bkt_num_key(_M_get_key(__obj)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type _M_bkt_num_key(const _KT& __key, size_type __n) const
+ { return _M_hash(__key) % __n; }
+
+ size_type _M_bkt_num(const value_type& __obj, size_t __n) const
+ { return _M_bkt_num_key(_M_get_key(__obj), __n); }
+
+ void _M_copy_from(const _Self& __ht);
+};
+
+#if defined (_STLP_DEBUG)
+# undef hashtable
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_hashtable.c>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_HEADER template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
+#define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
+struct __move_traits<hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> > {
+ //Hashtables are movable:
+ typedef __true_type implemented;
+
+ //Completeness depends on many template parameters, for the moment we consider it not complete:
+ typedef __false_type complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_heap.c b/build/stlport/stlport/stl/_heap.c
new file mode 100644
index 000000000..a4ab049fe
--- /dev/null
+++ b/build/stlport/stlport/stl/_heap.c
@@ -0,0 +1,246 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_HEAP_C
+#define _STLP_HEAP_C
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+_STLP_INLINE_LOOP
+void
+__push_heap(_RandomAccessIterator __first,
+ _Distance __holeIndex, _Distance __topIndex, _Tp __val)
+{
+ _Distance __parent = (__holeIndex - 1) / 2;
+ while (__holeIndex > __topIndex && *(__first + __parent) < __val) {
+ *(__first + __holeIndex) = *(__first + __parent);
+ __holeIndex = __parent;
+ __parent = (__holeIndex - 1) / 2;
+ }
+ *(__first + __holeIndex) = __val;
+}
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+inline void
+__push_heap_aux(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Distance*, _Tp*)
+{
+ __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
+ _Tp(*(__last - 1)));
+}
+
+template <class _RandomAccessIterator>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+ __push_heap_aux(__first, __last,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator));
+}
+
+
+template <class _RandomAccessIterator, class _Distance, class _Tp,
+ class _Compare>
+_STLP_INLINE_LOOP
+void
+__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __topIndex, _Tp __val, _Compare __comp)
+{
+ _Distance __parent = (__holeIndex - 1) / 2;
+ while (__holeIndex > __topIndex && __comp(*(__first + __parent), __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__val, *(__first + __parent)), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *(__first + __holeIndex) = *(__first + __parent);
+ __holeIndex = __parent;
+ __parent = (__holeIndex - 1) / 2;
+ }
+ *(__first + __holeIndex) = __val;
+}
+
+template <class _RandomAccessIterator, class _Compare,
+ class _Distance, class _Tp>
+inline void
+__push_heap_aux(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp,
+ _Distance*, _Tp*)
+{
+ __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
+ _Tp(*(__last - 1)), __comp);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+{
+ __push_heap_aux(__first, __last, __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val) {
+ _Distance __topIndex = __holeIndex;
+ _Distance __secondChild = 2 * __holeIndex + 2;
+ while (__secondChild < __len) {
+ if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
+ __secondChild--;
+ *(__first + __holeIndex) = *(__first + __secondChild);
+ __holeIndex = __secondChild;
+ __secondChild = 2 * (__secondChild + 1);
+ }
+ if (__secondChild == __len) {
+ *(__first + __holeIndex) = *(__first + (__secondChild - 1));
+ __holeIndex = __secondChild - 1;
+ }
+ __push_heap(__first, __holeIndex, __topIndex, __val);
+}
+
+
+template <class _RandomAccessIterator, class _Tp>
+inline void
+__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, _Tp*) {
+ __pop_heap(__first, __last - 1, __last - 1,
+ _Tp(*(__last - 1)), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator>
+void pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last) {
+ __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator, class _Distance,
+ class _Tp, class _Compare>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val, _Compare __comp)
+{
+ _Distance __topIndex = __holeIndex;
+ _Distance __secondChild = 2 * __holeIndex + 2;
+ while (__secondChild < __len) {
+ if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1)))) {
+ _STLP_VERBOSE_ASSERT(!__comp(*(__first + (__secondChild - 1)), *(__first + __secondChild)),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __secondChild--;
+ }
+ *(__first + __holeIndex) = *(__first + __secondChild);
+ __holeIndex = __secondChild;
+ __secondChild = 2 * (__secondChild + 1);
+ }
+ if (__secondChild == __len) {
+ *(__first + __holeIndex) = *(__first + (__secondChild - 1));
+ __holeIndex = __secondChild - 1;
+ }
+ __push_heap(__first, __holeIndex, __topIndex, __val, __comp);
+}
+
+
+template <class _RandomAccessIterator, class _Tp, class _Compare>
+inline void
+__pop_heap_aux(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Tp*, _Compare __comp)
+{
+ __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+
+template <class _RandomAccessIterator, class _Compare>
+void
+pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+{
+ __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator), __comp);
+}
+
+template <class _RandomAccessIterator, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void
+__make_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Tp*, _Distance*)
+{
+ if (__last - __first < 2) return;
+ _Distance __len = __last - __first;
+ _Distance __parent = (__len - 2)/2;
+
+ for (;;) {
+ __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)));
+ if (__parent == 0) return;
+ __parent--;
+ }
+}
+
+template <class _RandomAccessIterator>
+void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+ __make_heap(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+template <class _RandomAccessIterator, class _Compare,
+ class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void
+__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp, _Tp*, _Distance*)
+{
+ if (__last - __first < 2) return;
+ _Distance __len = __last - __first;
+ _Distance __parent = (__len - 2)/2;
+
+ for (;;) {
+ __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)),
+ __comp);
+ if (__parent == 0) return;
+ __parent--;
+ }
+}
+
+template <class _RandomAccessIterator, class _Compare>
+void
+make_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+{
+ __make_heap(__first, __last, __comp,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator));
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HEAP_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_heap.h b/build/stlport/stlport/stl/_heap.h
new file mode 100644
index 000000000..016dc490e
--- /dev/null
+++ b/build/stlport/stlport/stl/_heap.h
@@ -0,0 +1,125 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HEAP_H
+#define _STLP_INTERNAL_HEAP_H
+
+_STLP_BEGIN_NAMESPACE
+
+// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
+
+template <class _RandomAccessIterator>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last);
+
+
+template <class _RandomAccessIterator, class _Compare>
+void
+push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp);
+
+template <class _RandomAccessIterator, class _Distance, class _Tp>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val);
+
+template <class _RandomAccessIterator, class _Tp, class _Distance>
+inline void
+__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomAccessIterator __result, _Tp __val, _Distance*)
+{
+ *__result = *__first;
+ __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __val);
+}
+
+template <class _RandomAccessIterator>
+void pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last);
+
+template <class _RandomAccessIterator, class _Distance,
+ class _Tp, class _Compare>
+void
+__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __val, _Compare __comp);
+
+template <class _RandomAccessIterator, class _Tp, class _Compare,
+ class _Distance>
+inline void
+__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomAccessIterator __result, _Tp __val, _Compare __comp,
+ _Distance*)
+{
+ *__result = *__first;
+ __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
+ __val, __comp);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+void
+pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp);
+
+template <class _RandomAccessIterator>
+void
+make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last);
+
+template <class _RandomAccessIterator, class _Compare>
+void
+make_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp);
+
+template <class _RandomAccessIterator>
+_STLP_INLINE_LOOP
+void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+{
+ while (__last - __first > 1)
+ pop_heap(__first, __last--);
+}
+
+template <class _RandomAccessIterator, class _Compare>
+_STLP_INLINE_LOOP
+void
+sort_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+{
+ while (__last - __first > 1)
+ pop_heap(__first, __last--, __comp);
+}
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_heap.c>
+# endif
+
+#endif /* _STLP_INTERNAL_HEAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_iomanip.h b/build/stlport/stlport/stl/_iomanip.h
new file mode 100644
index 000000000..a27d95164
--- /dev/null
+++ b/build/stlport/stlport/stl/_iomanip.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_IOMANIP
+#define _STLP_INTERNAL_IOMANIP
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream> and <ios>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//----------------------------------------------------------------------
+// Machinery for defining manipulators.
+
+// Class that calls one of ios_base's single-argument member functions.
+template <class _Arg>
+struct _Ios_Manip_1 {
+ typedef _Arg (ios_base::*__f_ptr_type)(_Arg);
+
+ _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg)
+ : _M_f(__f), _M_arg(__arg) {}
+
+ void operator()(ios_base& __ios) const
+ { (__ios.*_M_f)(_M_arg); }
+
+ __f_ptr_type _M_f;
+ _Arg _M_arg;
+};
+
+// Class that calls one of ios_base's two-argument member functions.
+struct _Ios_Setf_Manip {
+ ios_base::fmtflags _M_flag;
+ ios_base::fmtflags _M_mask;
+ bool _M_two_args;
+
+ _Ios_Setf_Manip(ios_base::fmtflags __f)
+ : _M_flag(__f), _M_mask(0), _M_two_args(false) {}
+
+ _Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m)
+ : _M_flag(__f), _M_mask(__m), _M_two_args(true) {}
+
+ void operator()(ios_base& __ios) const {
+ if (_M_two_args)
+ __ios.setf(_M_flag, _M_mask);
+ else
+ __ios.setf(_M_flag);
+ }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits, class _Arg>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __istr,
+ const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) {
+ __f(__istr);
+ return __istr;
+}
+
+template <class _CharT, class _Traits, class _Arg>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) {
+ __f(__os);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __istr,
+ const _STLP_PRIV _Ios_Setf_Manip& __f) {
+ __f(__istr);
+ return __istr;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV _Ios_Setf_Manip& __f) {
+ __f(__os);
+ return __os;
+}
+
+//----------------------------------------------------------------------
+// The ios_base manipulators.
+inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask)
+{ return _STLP_PRIV _Ios_Setf_Manip(0, __mask); }
+
+inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
+{ return _STLP_PRIV _Ios_Setf_Manip(__flag); }
+
+inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL setbase(int __n) {
+ ios_base::fmtflags __base = __n == 8 ? ios_base::oct :
+ __n == 10 ? ios_base::dec :
+ __n == 16 ? ios_base::hex :
+ ios_base::fmtflags(0);
+ return _STLP_PRIV _Ios_Setf_Manip(__base, ios_base::basefield);
+}
+
+inline _STLP_PRIV _Ios_Manip_1<streamsize> _STLP_CALL
+setprecision(int __n) {
+ _STLP_PRIV _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::precision;
+ return _STLP_PRIV _Ios_Manip_1<streamsize>(__f, __n);
+}
+
+inline _STLP_PRIV _Ios_Manip_1<streamsize> _STLP_CALL
+setw(int __n) {
+ _STLP_PRIV _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::width;
+ return _STLP_PRIV _Ios_Manip_1<streamsize>(__f, __n);
+}
+
+//----------------------------------------------------------------------
+// setfill, a manipulator that operates on basic_ios<> instead of ios_base.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT>
+struct _Setfill_Manip {
+ _Setfill_Manip(_CharT __c) : _M_c(__c) {}
+ _CharT _M_c;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _CharT2, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV _Setfill_Manip<_CharT2>& __m) {
+ __os.fill(__m._M_c);
+ return __os;
+}
+
+template <class _CharT, class _CharT2, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is,
+ const _STLP_PRIV _Setfill_Manip<_CharT2>& __m) {
+ __is.fill(__m._M_c);
+ return __is;
+}
+
+template <class _CharT>
+inline _STLP_PRIV _Setfill_Manip<_CharT> _STLP_CALL setfill(_CharT __c)
+{ return _STLP_PRIV _Setfill_Manip<_CharT>(__c); }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_IOMANIP */
diff --git a/build/stlport/stlport/stl/_ios.c b/build/stlport/stlport/stl/_ios.c
new file mode 100644
index 000000000..7dec77f08
--- /dev/null
+++ b/build/stlport/stlport/stl/_ios.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_IOS_C
+#define _STLP_IOS_C
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// basic_ios<>'s non-inline member functions
+
+// Public constructor, taking a streambuf.
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>
+ ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
+ : ios_base(), _M_cached_ctype(0),
+ _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) {
+ basic_ios<_CharT, _Traits>::init(__streambuf);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) {
+ basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
+ _M_streambuf = __buf;
+ this->clear();
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>&
+basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) {
+ _M_invoke_callbacks(erase_event);
+ _M_copy_state(__x); // Inherited from ios_base.
+ _M_cached_ctype = __x._M_cached_ctype;
+ _M_fill = __x._M_fill;
+ _M_tied_ostream = __x._M_tied_ostream;
+ _M_invoke_callbacks(copyfmt_event);
+ this->_M_set_exception_mask(__x.exceptions());
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
+ locale __tmp = ios_base::imbue(__loc);
+ _STLP_TRY {
+ if (_M_streambuf)
+ _M_streambuf->pubimbue(__loc);
+
+ // no throwing here
+ _M_cached_ctype = &use_facet<ctype<char_type> >(__loc);
+ }
+ _STLP_CATCH_ALL {
+ __tmp = ios_base::imbue(__tmp);
+ _M_handle_exception(ios_base::failbit);
+ }
+ return __tmp;
+}
+
+// Protected constructor and initialization functions. The default
+// constructor creates an uninitialized basic_ios, and init() initializes
+// all of the members to the values in Table 89 of the C++ standard.
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>::basic_ios()
+ : ios_base(),
+ _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
+{}
+
+template <class _CharT, class _Traits>
+void
+basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
+{
+ this->rdbuf(__sb);
+ this->imbue(locale());
+ this->tie(0);
+ this->_M_set_exception_mask(ios_base::goodbit);
+ this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
+ ios_base::flags(ios_base::skipws | ios_base::dec);
+ ios_base::width(0);
+ ios_base::precision(6);
+ this->fill(widen(' '));
+ // We don't need to worry about any of the three arrays: they are
+ // initialized correctly in ios_base's constructor.
+}
+
+// This is never called except from within a catch clause.
+template <class _CharT, class _Traits>
+void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag)
+{
+ this->_M_setstate_nothrow(__flag);
+ if (this->_M_get_exception_mask() & __flag)
+ _STLP_RETHROW;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_IOS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_ios.h b/build/stlport/stlport/stl/_ios.h
new file mode 100644
index 000000000..20422f0ea
--- /dev/null
+++ b/build/stlport/stlport/stl/_ios.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_IOS_H
+#define _STLP_INTERNAL_IOS_H
+
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ----------------------------------------------------------------------
+
+// Class basic_ios, a subclass of ios_base. The only important difference
+// between the two is that basic_ios is a class template, parameterized
+// by the character type. ios_base exists to factor out all of the
+// common properties that don't depend on the character type.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_ios : public ios_base {
+ friend class ios_base;
+public: // Synonyms for types.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+public: // Constructor, destructor.
+ explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
+ virtual ~basic_ios() {}
+
+public: // Members from clause 27.4.4.2
+ basic_ostream<_CharT, _Traits>* tie() const {
+ return _M_tied_ostream;
+ }
+ basic_ostream<_CharT, _Traits>*
+ tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
+ basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
+ _M_tied_ostream = __new_tied_ostream;
+ return __tmp;
+ }
+
+ basic_streambuf<_CharT, _Traits>* rdbuf() const
+ { return _M_streambuf; }
+
+ basic_streambuf<_CharT, _Traits>*
+ rdbuf(basic_streambuf<char_type, traits_type>*);
+
+ // Copies __x's state to *this.
+ basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
+
+ char_type fill() const { return _M_fill; }
+ char_type fill(char_type __fill) {
+ char_type __tmp(_M_fill);
+ _M_fill = __fill;
+ return __tmp;
+ }
+
+public: // Members from 27.4.4.3. These four functions
+ // can almost be defined in ios_base.
+
+ void clear(iostate __state = goodbit) {
+ _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
+ _M_check_exception_mask();
+ }
+ void setstate(iostate __state) { this->clear(rdstate() | __state); }
+
+ iostate exceptions() const { return this->_M_get_exception_mask(); }
+ void exceptions(iostate __mask) {
+ this->_M_set_exception_mask(__mask);
+ this->clear(this->rdstate());
+ }
+
+public: // Locale-related member functions.
+ locale imbue(const locale&);
+
+ inline char narrow(_CharT, char) const ;
+ inline _CharT widen(char) const;
+
+ // Helper function that makes testing for EOF more convenient.
+ static bool _STLP_CALL _S_eof(int_type __c) {
+ const int_type __eof = _Traits::eof();
+ return _Traits::eq_int_type(__c, __eof);
+ }
+
+protected:
+ // Cached copy of the curent locale's ctype facet. Set by init() and imbue().
+ const ctype<char_type>* _M_cached_ctype;
+
+public:
+ // Equivalent to &use_facet< Facet >(getloc()), but faster.
+ const ctype<char_type>* _M_ctype_facet() const { return _M_cached_ctype; }
+
+protected:
+ basic_ios();
+
+ void init(basic_streambuf<_CharT, _Traits>* __streambuf);
+
+public:
+
+ // Helper function used in istream and ostream. It is called only from
+ // a catch clause.
+ void _M_handle_exception(ios_base::iostate __flag);
+
+private: // Data members
+ char_type _M_fill; // The fill character, used for padding.
+
+ basic_streambuf<_CharT, _Traits>* _M_streambuf;
+ basic_ostream<_CharT, _Traits>* _M_tied_ostream;
+
+};
+
+
+template <class _CharT, class _Traits>
+inline char
+basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
+{ return _M_ctype_facet()->narrow(__c, __default); }
+
+template <class _CharT, class _Traits>
+inline _CharT
+basic_ios<_CharT, _Traits>::widen(char __c) const
+{ return _M_ctype_facet()->widen(__c); }
+
+# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+_STLP_TEMPLATE_NULL
+inline char
+basic_ios<char, char_traits<char> >::narrow(char __c, char) const
+{
+ return __c;
+}
+
+_STLP_TEMPLATE_NULL
+inline char
+basic_ios<char, char_traits<char> >::widen(char __c) const
+{
+ return __c;
+}
+# endif /* _STLP_NO_METHOD_SPECIALIZATION */
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_ios.c>
+#endif
+
+#endif /* _STLP_IOS */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_ios_base.h b/build/stlport/stlport/stl/_ios_base.h
new file mode 100644
index 000000000..8c7a65bb2
--- /dev/null
+++ b/build/stlport/stlport/stl/_ios_base.h
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_IOS_BASE_H
+#define _STLP_IOS_BASE_H
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+# include <stl/_stdexcept_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ----------------------------------------------------------------------
+
+// Class ios_base. This is the base class of the ios hierarchy, which
+// includes basic_istream and basic_ostream. Classes in the ios
+// hierarchy are actually quite simple: they are just glorified
+// wrapper classes. They delegate buffering and physical character
+// manipulation to the streambuf classes, and they delegate most
+// formatting tasks to a locale.
+
+class _STLP_CLASS_DECLSPEC ios_base {
+public:
+
+# ifdef _STLP_USE_EXCEPTIONS
+ class _STLP_CLASS_DECLSPEC failure : public __Named_exception {
+ public:
+ explicit failure(const string&);
+ virtual ~failure() _STLP_NOTHROW_INHERENTLY;
+ };
+#endif
+
+ typedef int fmtflags;
+ typedef int iostate;
+ typedef int openmode;
+ typedef int seekdir;
+
+# ifndef _STLP_NO_ANACHRONISMS
+ typedef fmtflags fmt_flags;
+# endif
+
+ // Formatting flags.
+ _STLP_STATIC_CONSTANT(int, left = 0x0001);
+ _STLP_STATIC_CONSTANT(int, right = 0x0002);
+ _STLP_STATIC_CONSTANT(int, internal = 0x0004);
+ _STLP_STATIC_CONSTANT(int, dec = 0x0008);
+ _STLP_STATIC_CONSTANT(int, hex = 0x0010);
+ _STLP_STATIC_CONSTANT(int, oct = 0x0020);
+ _STLP_STATIC_CONSTANT(int, fixed = 0x0040);
+ _STLP_STATIC_CONSTANT(int, scientific = 0x0080);
+ _STLP_STATIC_CONSTANT(int, boolalpha = 0x0100);
+ _STLP_STATIC_CONSTANT(int, showbase = 0x0200);
+ _STLP_STATIC_CONSTANT(int, showpoint = 0x0400);
+ _STLP_STATIC_CONSTANT(int, showpos = 0x0800);
+ _STLP_STATIC_CONSTANT(int, skipws = 0x1000);
+ _STLP_STATIC_CONSTANT(int, unitbuf = 0x2000);
+ _STLP_STATIC_CONSTANT(int, uppercase = 0x4000);
+ _STLP_STATIC_CONSTANT(int, adjustfield = left | right | internal);
+ _STLP_STATIC_CONSTANT(int, basefield = dec | hex | oct);
+ _STLP_STATIC_CONSTANT(int, floatfield = scientific | fixed);
+
+ // State flags.
+ _STLP_STATIC_CONSTANT(int, goodbit = 0x00);
+ _STLP_STATIC_CONSTANT(int, badbit = 0x01);
+ _STLP_STATIC_CONSTANT(int, eofbit = 0x02);
+ _STLP_STATIC_CONSTANT(int, failbit = 0x04);
+
+ // Openmode flags.
+ _STLP_STATIC_CONSTANT(int, __default_mode = 0x0); /* implementation detail */
+ _STLP_STATIC_CONSTANT(int, app = 0x01);
+ _STLP_STATIC_CONSTANT(int, ate = 0x02);
+ _STLP_STATIC_CONSTANT(int, binary = 0x04);
+ _STLP_STATIC_CONSTANT(int, in = 0x08);
+ _STLP_STATIC_CONSTANT(int, out = 0x10);
+ _STLP_STATIC_CONSTANT(int, trunc = 0x20);
+
+ // Seekdir flags
+ _STLP_STATIC_CONSTANT(int, beg = 0x01);
+ _STLP_STATIC_CONSTANT(int, cur = 0x02);
+ _STLP_STATIC_CONSTANT(int, end = 0x04);
+
+public: // Flag-manipulation functions.
+ fmtflags flags() const { return _M_fmtflags; }
+ fmtflags flags(fmtflags __flags) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags = __flags;
+ return __tmp;
+ }
+
+ fmtflags setf(fmtflags __flag) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags |= __flag;
+ return __tmp;
+ }
+ fmtflags setf(fmtflags __flag, fmtflags __mask) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags &= ~__mask;
+ _M_fmtflags |= __flag & __mask;
+ return __tmp;
+ }
+ void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; }
+
+ streamsize precision() const { return _M_precision; }
+ streamsize precision(streamsize __newprecision) {
+ streamsize __tmp = _M_precision;
+ _M_precision = __newprecision;
+ return __tmp;
+ }
+
+ streamsize width() const { return _M_width; }
+ streamsize width(streamsize __newwidth) {
+ streamsize __tmp = _M_width;
+ _M_width = __newwidth;
+ return __tmp;
+ }
+
+public: // Locales
+ locale imbue(const locale&);
+ locale getloc() const { return _M_locale; }
+
+public: // Auxiliary storage.
+ static int _STLP_CALL xalloc();
+ long& iword(int __index);
+ void*& pword(int __index);
+
+public: // Destructor.
+ virtual ~ios_base();
+
+public: // Callbacks.
+ enum event { erase_event, imbue_event, copyfmt_event };
+ typedef void (*event_callback)(event, ios_base&, int __index);
+ void register_callback(event_callback __fn, int __index);
+
+public: // This member function affects only
+ // the eight predefined ios objects:
+ // cin, cout, etc.
+ static bool _STLP_CALL sync_with_stdio(bool __sync = true);
+
+public: // The C++ standard requires only that these
+ // member functions be defined in basic_ios.
+ // We define them in the non-template
+ // base class to avoid code duplication.
+ operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; }
+ bool operator!() const { return fail(); }
+
+ iostate rdstate() const { return _M_iostate; }
+
+ bool good() const { return _M_iostate == 0; }
+ bool eof() const { return (_M_iostate & eofbit) != 0; }
+ bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; }
+ bool bad() const { return (_M_iostate & badbit) != 0; }
+
+protected: // The functional protected interface.
+
+ // Copies the state of __x to *this. This member function makes it
+ // possible to implement basic_ios::copyfmt without having to expose
+ // ios_base's private data members. Does not copy _M_exception_mask
+ // or _M_iostate.
+ void _M_copy_state(const ios_base& __x);
+
+ void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; }
+ void _M_clear_nothrow(iostate __state) { _M_iostate = __state; }
+ iostate _M_get_exception_mask() const { return _M_exception_mask; }
+ void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; }
+ void _M_check_exception_mask() {
+ if (_M_iostate & _M_exception_mask)
+ _M_throw_failure();
+ }
+
+ void _M_invoke_callbacks(event);
+ void _STLP_FUNCTION_THROWS _M_throw_failure();
+
+ ios_base(); // Default constructor.
+
+protected: // Initialization of the I/O system
+ static void _STLP_CALL _S_initialize();
+ static void _STLP_CALL _S_uninitialize();
+ static bool _S_is_synced;
+
+private: // Invalidate the copy constructor and
+ // assignment operator.
+ ios_base(const ios_base&);
+ void operator=(const ios_base&);
+
+private: // Data members.
+
+ fmtflags _M_fmtflags; // Flags
+ iostate _M_iostate;
+ openmode _M_openmode;
+ seekdir _M_seekdir;
+ iostate _M_exception_mask;
+
+ streamsize _M_precision;
+ streamsize _M_width;
+
+ locale _M_locale;
+
+ pair<event_callback, int>* _M_callbacks;
+ size_t _M_num_callbacks; // Size of the callback array.
+ size_t _M_callback_index; // Index of the next available callback;
+ // initially zero.
+
+ long* _M_iwords; // Auxiliary storage. The count is zero
+ size_t _M_num_iwords; // if and only if the pointer is null.
+
+ void** _M_pwords;
+ size_t _M_num_pwords;
+
+public:
+ // ----------------------------------------------------------------------
+ // Nested initializer class. This is an implementation detail, but it's
+ // prescribed by the standard. The static initializer object (on
+ // implementations where such a thing is required) is declared in
+ // <iostream>
+ class _STLP_CLASS_DECLSPEC Init
+ {
+ public:
+ Init();
+ ~Init();
+ private:
+ static long _S_count;
+ friend class ios_base;
+ };
+
+ friend class Init;
+
+public:
+# ifndef _STLP_NO_ANACHRONISMS
+ // 31.6 Old iostreams members [depr.ios.members]
+ typedef iostate io_state;
+ typedef openmode open_mode;
+ typedef seekdir seek_dir;
+ typedef _STLP_STD::streamoff streamoff;
+ typedef _STLP_STD::streampos streampos;
+# endif
+};
+
+// ----------------------------------------------------------------------
+// ios_base manipulator functions, from section 27.4.5 of the C++ standard.
+// All of them are trivial one-line wrapper functions.
+
+// fmtflag manipulators, section 27.4.5.1
+inline ios_base& _STLP_CALL boolalpha(ios_base& __s)
+ { __s.setf(ios_base::boolalpha); return __s;}
+
+inline ios_base& _STLP_CALL noboolalpha(ios_base& __s)
+ { __s.unsetf(ios_base::boolalpha); return __s;}
+
+inline ios_base& _STLP_CALL showbase(ios_base& __s)
+ { __s.setf(ios_base::showbase); return __s;}
+
+inline ios_base& _STLP_CALL noshowbase(ios_base& __s)
+ { __s.unsetf(ios_base::showbase); return __s;}
+
+inline ios_base& _STLP_CALL showpoint(ios_base& __s)
+ { __s.setf(ios_base::showpoint); return __s;}
+
+inline ios_base& _STLP_CALL noshowpoint(ios_base& __s)
+ { __s.unsetf(ios_base::showpoint); return __s;}
+
+inline ios_base& _STLP_CALL showpos(ios_base& __s)
+ { __s.setf(ios_base::showpos); return __s;}
+
+inline ios_base& _STLP_CALL noshowpos(ios_base& __s)
+ { __s.unsetf(ios_base::showpos); return __s;}
+
+inline ios_base& _STLP_CALL skipws(ios_base& __s)
+ { __s.setf(ios_base::skipws); return __s;}
+
+inline ios_base& _STLP_CALL noskipws(ios_base& __s)
+ { __s.unsetf(ios_base::skipws); return __s;}
+
+inline ios_base& _STLP_CALL uppercase(ios_base& __s)
+ { __s.setf(ios_base::uppercase); return __s;}
+
+inline ios_base& _STLP_CALL nouppercase(ios_base& __s)
+ { __s.unsetf(ios_base::uppercase); return __s;}
+
+inline ios_base& _STLP_CALL unitbuf(ios_base& __s)
+ { __s.setf(ios_base::unitbuf); return __s;}
+
+inline ios_base& _STLP_CALL nounitbuf(ios_base& __s)
+ { __s.unsetf(ios_base::unitbuf); return __s;}
+
+
+// adjustfield manipulators, section 27.4.5.2
+inline ios_base& _STLP_CALL internal(ios_base& __s)
+ { __s.setf(ios_base::internal, ios_base::adjustfield); return __s; }
+
+inline ios_base& _STLP_CALL left(ios_base& __s)
+ { __s.setf(ios_base::left, ios_base::adjustfield); return __s; }
+
+inline ios_base& _STLP_CALL right(ios_base& __s)
+ { __s.setf(ios_base::right, ios_base::adjustfield); return __s; }
+
+// basefield manipulators, section 27.4.5.3
+inline ios_base& _STLP_CALL dec(ios_base& __s)
+ { __s.setf(ios_base::dec, ios_base::basefield); return __s; }
+
+inline ios_base& _STLP_CALL hex(ios_base& __s)
+ { __s.setf(ios_base::hex, ios_base::basefield); return __s; }
+
+inline ios_base& _STLP_CALL oct(ios_base& __s)
+ { __s.setf(ios_base::oct, ios_base::basefield); return __s; }
+
+
+// floatfield manipulators, section 27.4.5.3
+inline ios_base& _STLP_CALL fixed(ios_base& __s)
+ { __s.setf(ios_base::fixed, ios_base::floatfield); return __s; }
+
+inline ios_base& _STLP_CALL scientific(ios_base& __s)
+ { __s.setf(ios_base::scientific, ios_base::floatfield); return __s; }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_IOS_BASE */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_ioserr.h b/build/stlport/stlport/stl/_ioserr.h
new file mode 100644
index 000000000..83ba8775b
--- /dev/null
+++ b/build/stlport/stlport/stl/_ioserr.h
@@ -0,0 +1,12 @@
+/*
+ * This file is included in every header that needs the STLport library to be
+ * built; the header files mostly are the iostreams-headers. The file checks for
+ * _STLP_USE_NO_IOSTREAMS or _STLP_NO_IOSTREAMS being not defined, so that the
+ * iostreams part of STLport cannot be used when the symbols were defined
+ * accidentally.
+ */
+#if defined (_STLP_NO_IOSTREAMS)
+# error STLport iostreams header cannot be used; you chose not to use iostreams in the STLport configuration file (stlport/stl/config/user_config.h).
+#elif defined (_STLP_USE_NO_IOSTREAMS )
+# error STLport iostreams header cannot be used; your compiler do not support it.
+#endif
diff --git a/build/stlport/stlport/stl/_iosfwd.h b/build/stlport/stlport/stl/_iosfwd.h
new file mode 100644
index 000000000..e31db319c
--- /dev/null
+++ b/build/stlport/stlport/stl/_iosfwd.h
@@ -0,0 +1,159 @@
+#ifndef _STLP_INTERNAL_IOSFWD
+#define _STLP_INTERNAL_IOSFWD
+
+#if defined (__sgi) && !defined (__GNUC__) && !defined (_STANDARD_C_PLUS_PLUS)
+# error This header file requires the -LANG:std option
+#endif
+
+// This file provides forward declarations of the most important I/O
+// classes. Note that almost all of those classes are class templates,
+// with default template arguments. According to the C++ standard,
+// if a class template is declared more than once in the same scope
+// then only one of those declarations may have default arguments.
+
+// <iosfwd> contains the same declarations as other headers, and including
+// both <iosfwd> and (say) <iostream> is permitted. This means that only
+// one header may contain those default template arguments.
+
+// In this implementation, the declarations in <iosfwd> contain default
+// template arguments. All of the other I/O headers include <iosfwd>.
+
+#ifndef _STLP_CHAR_TRAITS_H
+# include <stl/char_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class ios_base;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ios;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_streambuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_istream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ostream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_iostream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM( _Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_stringbuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_istringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_ostringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_stringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_filebuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ifstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ofstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_fstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class istreambuf_iterator;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class ostreambuf_iterator;
+
+typedef basic_ios<char, char_traits<char> > ios;
+
+#if !defined (_STLP_NO_WCHAR_T)
+typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
+#endif
+
+// Forward declaration of class locale, and of the most important facets.
+class locale;
+template <class _Facet>
+#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+struct _Use_facet {
+ const locale& __loc;
+ _Use_facet(const locale& __p_loc) : __loc(__p_loc) {}
+ inline const _Facet& operator *() const;
+};
+# define use_facet *_Use_facet
+#else
+inline const _Facet& use_facet(const locale&);
+#endif
+
+template <class _CharT> class ctype;
+template <class _CharT> class ctype_byname;
+template <class _CharT> class collate;
+template <class _CharT> class collate_byname;
+
+_STLP_TEMPLATE_NULL class ctype<char>;
+_STLP_TEMPLATE_NULL class ctype_byname<char>;
+_STLP_TEMPLATE_NULL class collate<char>;
+_STLP_TEMPLATE_NULL class collate_byname<char>;
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL class ctype<wchar_t>;
+_STLP_TEMPLATE_NULL class ctype_byname<wchar_t>;
+_STLP_TEMPLATE_NULL class collate<wchar_t>;
+_STLP_TEMPLATE_NULL class collate_byname<wchar_t>;
+#endif
+
+#if !(defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500 )
+// Typedefs for ordinary (narrow-character) streams.
+//_STLP_TEMPLATE_NULL class basic_streambuf<char, char_traits<char> >;
+#endif
+
+typedef basic_istream<char, char_traits<char> > istream;
+typedef basic_ostream<char, char_traits<char> > ostream;
+typedef basic_iostream<char, char_traits<char> > iostream;
+typedef basic_streambuf<char,char_traits<char> > streambuf;
+
+typedef basic_stringbuf<char, char_traits<char>, allocator<char> > stringbuf;
+typedef basic_istringstream<char, char_traits<char>, allocator<char> > istringstream;
+typedef basic_ostringstream<char, char_traits<char>, allocator<char> > ostringstream;
+typedef basic_stringstream<char, char_traits<char>, allocator<char> > stringstream;
+
+typedef basic_filebuf<char, char_traits<char> > filebuf;
+typedef basic_ifstream<char, char_traits<char> > ifstream;
+typedef basic_ofstream<char, char_traits<char> > ofstream;
+typedef basic_fstream<char, char_traits<char> > fstream;
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Typedefs for wide-character streams.
+typedef basic_streambuf<wchar_t, char_traits<wchar_t> > wstreambuf;
+typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
+typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
+typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
+
+typedef basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringbuf;
+typedef basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wistringstream;
+typedef basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wostringstream;
+typedef basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringstream;
+
+typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
+typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
+typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
+typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_iostream_string.h b/build/stlport/stlport/stl/_iostream_string.h
new file mode 100644
index 000000000..87656a4ce
--- /dev/null
+++ b/build/stlport/stlport/stl/_iostream_string.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+ /*
+ * This is an internal string for the STLport own iostream implementation.
+ * The only diference rely on the allocator used to instanciate the basic_string.
+ * Its goals is to improve performance limitating the number of dynamic allocation
+ * that could occur when requesting a big float ouput for instance. This allocator
+ * is not standard conformant as it has an internal state (the static buffer)
+ */
+
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+#define _STLP_INTERNAL_IOSTREAM_STRING_H
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif /* _STLP_INTERNAL_ALLOC_H */
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif /* _STLP_INTERNAL_STRING_H */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT>
+class __iostring_allocator : public allocator<_CharT> {
+public:
+ enum { _STR_SIZE = 256 };
+
+private:
+ enum { _BUF_SIZE = _STR_SIZE + 1 };
+ typedef allocator<_CharT> _Base;
+ _CharT _M_static_buf[_BUF_SIZE];
+
+public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::pointer pointer;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300)
+ typedef __iostring_allocator<_Tp1> other;
+# else
+ typedef _STLP_PRIV __iostring_allocator<_Tp1> other;
+# endif
+ };
+#endif
+
+ _CharT* allocate(size_type __n, const void* __ptr = 0) {
+ if (__n > _BUF_SIZE) {
+ return _Base::allocate(__n, __ptr);
+ }
+ return _M_static_buf;
+ }
+ void deallocate(pointer __p, size_type __n) {
+ if (__p != _M_static_buf) _Base::deallocate(__p, __n);
+ }
+};
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES)
+/*
+ * As the __iostring_allocator allocator will only be used in the basic_string implementation
+ * we known that it is never going to be bound to another type that the one used to instantiate
+ * the basic_string. This is why the associated __stl_alloc_rebind has only one template
+ * parameter.
+ */
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+inline _STLP_PRIV __iostring_allocator<_Tp>& _STLP_CALL
+__stl_alloc_rebind(_STLP_PRIV __iostring_allocator<_Tp>& __a, const _Tp*)
+{ return __a; }
+template <class _Tp>
+inline _STLP_PRIV __iostring_allocator<_Tp> _STLP_CALL
+__stl_alloc_create(const _STLP_PRIV __iostring_allocator<_Tp>&, const _Tp*)
+{ return _STLP_PRIV __iostring_allocator<_Tp>(); }
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+
+#if !defined (_STLP_DEBUG)
+template <class _CharT>
+struct __basic_iostring : public basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > {
+ /*
+ * A consequence of the non standard conformant allocator is that a string using it
+ * must always be presized to the allocator static buffer size because the basic_string implementation
+ * do not manage an allocator returning always the same memory adress as long as the
+ * requested memory block size is under a certain value.
+ */
+ typedef __basic_iostring<_CharT> _Self;
+ typedef basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > _Base;
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+ __basic_iostring() : _Base(_Reserve_t(), __iostring_allocator<_CharT>::_STR_SIZE)
+ {}
+
+ _Self& operator=(const _CharT* __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+};
+
+typedef __basic_iostring<char> __iostring;
+
+# if !defined (_STLP_NO_WCHAR_T)
+typedef __basic_iostring<wchar_t> __iowstring;
+# endif
+
+# define _STLP_BASIC_IOSTRING(_CharT) _STLP_PRIV __basic_iostring<_CharT>
+
+#else
+
+typedef string __iostring;
+# if !defined (_STLP_NO_WCHAR_T)
+typedef wstring __iowstring;
+# endif
+
+# define _STLP_BASIC_IOSTRING(_CharT) basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
+
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_IOSTREAM_STRING_H */
diff --git a/build/stlport/stlport/stl/_istream.c b/build/stlport/stlport/stl/_istream.c
new file mode 100644
index 000000000..724ad24b7
--- /dev/null
+++ b/build/stlport/stlport/stl/_istream.c
@@ -0,0 +1,1428 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_ISTREAM_C
+#define _STLP_ISTREAM_C
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wchar_t is supported for this mode
+# define __BIS_int_type__ int
+# define __BIS_pos_type__ streampos
+# define __BIS_off_type__ streamoff
+#else
+# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type
+# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type
+# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Function object structs used by some member functions.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Traits>
+struct _Is_not_wspace {
+ typedef typename _Traits::char_type argument_type;
+ typedef bool result_type;
+
+ const ctype<argument_type>* _M_ctype;
+
+ _Is_not_wspace(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
+ bool operator()(argument_type __c) const
+ { return !_M_ctype->is(ctype_base::space, __c); }
+};
+
+template <class _Traits>
+struct _Is_wspace_null {
+ typedef typename _Traits::char_type argument_type;
+ typedef bool result_type;
+
+ const ctype<argument_type>* _M_ctype;
+
+ _Is_wspace_null(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
+ bool operator()(argument_type __c) const {
+ return _Traits::eq(__c, argument_type()) ||
+ _M_ctype->is(ctype_base::space, __c);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_wspace {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_for_wspace(const ctype<char_type>* __ctype) : _M_ctype(__ctype) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return _M_ctype->scan_is(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_wspace_null {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_wspace_null(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ __last = find_if(__first, __last,
+ _Eq_char_bound<_Traits>(char_type()));
+ return _M_ctype->scan_is(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_not_wspace {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_for_not_wspace(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return _M_ctype->scan_not(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_char_val {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ char_type _M_val;
+
+ _Scan_for_char_val(char_type __val) : _M_val(__val) {}
+
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val));
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_int_val {
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ int_type _M_val;
+
+ _Scan_for_int_val(int_type __val) : _M_val(__val) {}
+
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return find_if(__first, __last,
+ _Eq_int_bound<_Traits>(_M_val));
+ }
+};
+
+// Helper function: try to push back a character to a streambuf,
+// return true if the pushback succeeded. Does not throw.
+
+template <class _CharT, class _Traits>
+bool _STLP_CALL
+__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c) {
+ bool ret;
+ _STLP_TRY {
+ const typename _Traits::int_type __eof = _Traits::eof();
+ ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof);
+ }
+ _STLP_CATCH_ALL {
+ ret = false;
+ }
+ return ret;
+}
+
+//----------------------------------------------------------------------
+// Definitions of basic_istream<>'s noninline member functions.
+
+// Helper function for formatted input of numbers.
+template <class _CharT, class _Traits, class _Number>
+ios_base::iostate _STLP_CALL
+__get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) {
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ ios_base::iostate __err = 0;
+ _Sentry __sentry( __that ); // Skip whitespace.
+ if (__sentry) {
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get;
+ _STLP_TRY {
+ // Do not remove additional parenthesis around use_facet instanciation, some compilers (VC6)
+ // require it when building the library.
+ (use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()),
+ 0, __that, __err, __val);
+ }
+ _STLP_CATCH_ALL {
+ __that._M_handle_exception(ios_base::badbit);
+ }
+ if (__err) __that.setstate(__err);
+ }
+ return __err;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (short& __val) {
+ long __lval;
+ _STLP_PRIV __get_num(*this, __lval);
+ if ( this->fail() ) {
+ return *this;
+ }
+ short __tmp = __STATIC_CAST(short, __lval);
+ unsigned short __uval = __STATIC_CAST(unsigned short, __lval);
+ // check if we lose digits
+ // if ((__val != __lval) && ((unsigned short)__val != __lval))
+ if ((__tmp != __lval) && ((long)__uval != __lval))
+ this->setstate(ios_base::failbit);
+ else
+ __val = __tmp;
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (int& __val) {
+ long __lval;
+ _STLP_PRIV __get_num(*this, __lval);
+ if ( this->fail() ) {
+ return *this;
+ }
+ int __tmp = __lval;
+ unsigned int __uval = __lval;
+ // check if we lose digits
+ // if ((__val != __lval) && ((unsigned int)__val != __lval))
+ if ((__tmp != __lval) && ((long)__uval != __lval))
+ this->setstate(ios_base::failbit);
+ else
+ __val = __tmp;
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned short& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned int& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned long& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (_STLP_LONG_LONG& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned _STLP_LONG_LONG& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (float& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (double& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long double& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (bool& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (void*& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+// Unformatted input
+
+template <class _CharT, class _Traits>
+__BIS_int_type__
+basic_istream<_CharT, _Traits>::peek() {
+ typename _Traits::int_type __tmp = _Traits::eof();
+
+ this->_M_gcount = 0;
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sgetc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ if (this->_S_eof(__tmp))
+ this->setstate(ios_base::eofbit);
+ }
+
+ return __tmp;
+}
+
+
+template <class _CharT, class _Traits>
+__BIS_int_type__
+basic_istream<_CharT, _Traits>::get() {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (!this->_S_eof(__tmp))
+ this->_M_gcount = 1;
+ }
+
+ if (_M_gcount == 0)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(_CharT& __c) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (!this->_S_eof(__tmp)) {
+ this->_M_gcount = 1;
+ __c = _Traits::to_char_type(__tmp);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return *this;
+}
+
+
+// Read characters and discard them. The standard specifies a single
+// function with two arguments, each with a default. We instead use
+// three overloded functions, because it's possible to implement the
+// first two more efficiently than the fully general third version.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ int_type __c;
+ _STLP_TRY {
+ __c = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return *this;
+ }
+
+ if (!this->_S_eof(__c))
+ this->_M_gcount = 1;
+ else
+ this->setstate(ios_base::eofbit);
+ }
+
+ return *this;
+}
+
+// Putback
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::putback(_CharT __c) {
+ this->_M_gcount = 0;
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
+ if (__buf) {
+ _STLP_TRY {
+ __tmp = __buf->sputbackc(__c);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+ if (this->_S_eof(__tmp))
+ this->setstate(ios_base::badbit);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
+ this->_M_gcount = 0;
+
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
+ if (__buf) {
+ _STLP_TRY {
+ if (this->_S_eof(__buf->sungetc()))
+ this->setstate(ios_base::badbit);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ } else
+ this->setstate(ios_base::badbit);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Positioning and buffer control.
+
+template <class _CharT, class _Traits>
+int basic_istream<_CharT, _Traits>::sync() {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (__buf) {
+ if (__buf->pubsync() == -1) {
+ this->setstate(ios_base::badbit);
+ return -1;
+ }
+ else
+ return 0;
+ }
+ else
+ return -1;
+}
+
+template <class _CharT, class _Traits>
+__BIS_pos_type__
+basic_istream<_CharT, _Traits>::tellg() {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
+ : pos_type(-1);
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!this->fail() && __buf) {
+ if (__buf->pubseekpos(__pos, ios_base::in) == pos_type(-1)) {
+ this->setstate(ios_base::failbit);
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!this->fail() && __buf)
+ __buf->pubseekoff(__off, __dir, ios_base::in);
+ return *this;
+}
+
+// Formatted input of characters and character arrays.
+
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c) {
+// typename _Traits::int_type __tmp = _Traits::eof();
+
+ sentry __sentry(*this); // Skip whitespace.
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp;// = _Traits::eof();
+
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return;
+ }
+
+ if (!this->_S_eof(__tmp))
+ __c = _Traits::to_char_type(__tmp);
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+}
+
+
+//---------------------------------------------------------------------------
+// istream's helper functions.
+
+// A generic function for unbuffered input. We stop when we reach EOF,
+// or when we have extracted _Num characters, or when the function object
+// __is_delim return true. In the last case, it extracts the character
+// for which __is_delim is true, if and only if __extract_delim is true.
+// It appends a null character to the end of the string; this means that
+// it may store up to _Num + 1 characters.
+//
+// __is_getline governs two corner cases: reading _Num characters without
+// encountering delim or eof (in which case failbit is set if __is_getline
+// is true); and reading _Num characters where the _Num+1'st character is
+// eof (in which case eofbit is set if __is_getline is true).
+//
+// It is assumed that __is_delim never throws.
+//
+// Return value is the number of characters extracted, including the
+// delimiter if it is extracted. Note that the number of characaters
+// extracted isn't necessarily the same as the number stored.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template < class _CharT, class _Traits, class _Is_Delim>
+streamsize _STLP_CALL
+__read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline)
+{
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ // The operations that can potentially throw are sbumpc, snextc, and sgetc.
+ _STLP_TRY {
+ for (;;) {
+ if (__n == _Num) {
+ if (__is_getline) // didn't find delimiter as one of the _Num chars
+ __status |= ios_base::failbit;
+ break;
+ }
+ int_type __c = __buf->sbumpc(); // sschwarz
+
+ if (__that->_S_eof(__c)) {
+ if (__n < _Num || __is_getline)
+ __status |= ios_base::eofbit;
+ break;
+ } else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (__extract_delim) { // Extract and discard current character.
+ ++__n;
+ } else if ( !__pushback(__buf, _Traits::to_char_type(__c)) ) { // leave delimiter
+ __status |= ios_base::failbit;
+ }
+ break;
+ }
+ // regular character
+ *__s++ = _Traits::to_char_type(__c);
+ ++__n;
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return __n;
+ }
+
+ if (__append_null)
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __n;
+}
+
+// Much like __read_unbuffered, but with one additional function object:
+// __scan_delim(first, last) returns the first pointer p in [first, last)
+// such that __is_delim(p) is true.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+__read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+ bool __done = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
+ const _CharT* __first = __buf->_M_gptr();
+ const _CharT* __last = __buf->_M_egptr();
+ //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
+ //is larger than ptrdiff_t one.
+ _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
+ ((sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits<ptrdiff_t>::is_signed))
+ ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), _Num - __n));
+
+ const _CharT* __p = __scan_delim(__first, __last);
+ ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
+ _Traits::copy(__s, __first, __chunk);
+ __s += __chunk;
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ // We terminated by finding delim.
+ if (__p != __last && __p - __first <= __request) {
+ if (__extract_delim) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+ __done = true;
+ }
+
+ // We terminated by reading all the characters we were asked for.
+ else if (__n == _Num) {
+
+ // Find out if we have reached eof. This matters for getline.
+ if (__is_getline) {
+ if (__chunk == __last - __first) {
+ if (__that->_S_eof(__buf->sgetc()))
+ __status |= ios_base::eofbit;
+ }
+ else
+ __status |= ios_base::failbit;
+ }
+ __done = true;
+ }
+
+ // The buffer contained fewer than _Num - __n characters. Either we're
+ // at eof, or we should refill the buffer and try again.
+ else {
+ if (__that->_S_eof(__buf->sgetc())) {
+ __status |= ios_base::eofbit;
+ __done = true;
+ }
+ }
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ __done = true;
+ }
+
+ if (__done) {
+ if (__append_null)
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ if (__status != 0)
+ __that->setstate(__status); // This might throw.
+ return __n;
+ }
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from buffered to unbuffered input. We switch to
+ // to __read_unbuffered.
+
+ return __n + __read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim,
+ __extract_delim,__append_null,__is_getline);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n,
+ _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ if (__n > 0) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+
+ if (__buf->egptr() != __buf->gptr())
+ this->_M_gcount =
+ _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ false, true, false);
+ else
+ this->_M_gcount =
+ _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, true, false);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Getline is essentially identical to get, except that it extracts
+// the delimiter.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n,
+ _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ if (__n > 0) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ this->_M_gcount = __buf->egptr() != __buf->gptr()
+ ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ true, true, true)
+ : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ true, true, true);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Read n characters. We don't look for any delimiter, and we don't
+// put in a terminating null character.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry && !this->eof()) {
+ basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf();
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount
+ = _STLP_PRIV __read_buffered(this, __buf, __n, __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false, false);
+ else
+ _M_gcount
+ = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, false, false);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ if (this->eof())
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return *this;
+}
+
+
+// Read n or fewer characters. We don't look for any delimiter, and
+// we don't put in a terminating null character.
+template <class _CharT, class _Traits>
+streamsize
+basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry && !this->eof() && __nmax >= 0) {
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ streamsize __avail = __buf->in_avail();
+
+ // fbp : isn't full-blown setstate required here ?
+ if (__avail == -1)
+ this->_M_setstate_nothrow(ios_base::eofbit);
+
+ else if (__avail != 0) {
+
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount
+ = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false, false);
+ else
+ _M_gcount
+ = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, false, false);
+ }
+ }
+ else {
+ // fbp : changed so that failbit is set only there, to pass Dietmar's test
+ if (this->eof())
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ else
+ this->setstate(ios_base::failbit);
+ }
+
+ // if (this->eof())
+ // this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return _M_gcount;
+}
+
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s) {
+ sentry __sentry(*this); // Skip whitespace.
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ streamsize __nmax = this->width() > 0
+ ? this->width() - 1
+ : ((numeric_limits<streamsize>::max)() / sizeof(_CharT)) - 1;
+
+ streamsize __n = __buf->gptr() != __buf->egptr()
+ ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s,
+ _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()),
+ _STLP_PRIV _Scan_wspace_null<_Traits>(this->_M_ctype_facet()),
+ false, true, false)
+ : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s,
+ _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()),
+ false, true, false);
+ if (__n == 0)
+ this->setstate(ios_base::failbit);
+ }
+ this->width(0);
+}
+
+// A generic unbuffered function for ignoring characters. We stop
+// when we reach EOF, or when the function object __is_delim returns
+// true. In the last case, it extracts the character for which
+// __is_delim is true, if and only if __extract_delim is true.
+
+template < class _CharT, class _Traits, class _Is_Delim>
+void _STLP_CALL
+_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __set_failbit) {
+ bool __done = false;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+
+ _STLP_TRY {
+ while (!__done) {
+ int_type __c = __buf->sbumpc();
+
+ if (__that->_S_eof(__c)) {
+ __done = true;
+ __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit;
+ }
+
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ __done = true;
+ if (!__extract_delim)
+ if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
+ __status |= ios_base::failbit;
+ }
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ }
+
+ __that->setstate(__status);
+}
+
+// A generic buffered function for ignoring characters. Much like
+// _M_ignore_unbuffered, but with one additional function object:
+// __scan_delim(first, last) returns the first pointer p in [first,
+// last) such that __is_delim(p) is true.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+void _STLP_CALL
+_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __set_failbit) {
+ bool __at_eof = false;
+ bool __found_delim = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) {
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
+ __buf->_M_gbump((int)(__p - __buf->_M_gptr()));
+
+ if (__p != __buf->_M_egptr()) { // We found delim, so we're done.
+ if (__extract_delim)
+ __buf->_M_gbump(1);
+ __found_delim = true;
+ }
+
+ else // No delim. Try to refil the buffer.
+ __at_eof = __that->_S_eof(__buf->sgetc());
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ return;
+ }
+
+ if (__at_eof) {
+ __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit);
+ return;
+ }
+ if (__found_delim)
+ return;
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from a buffered to an unbuffered mode. We switch
+ // to _M_ignore_unbuffered.
+ _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit);
+}
+
+// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered
+// with an explicit count _Num. Return value is the number of
+// characters extracted.
+//
+// The function object __max_chars takes two arguments, _Num and __n
+// (the latter being the number of characters we have already read),
+// and returns the maximum number of characters to read from the buffer.
+// We parameterize _M_ignore_buffered so that we can use it for both
+// bounded and unbounded input; for the former the function object should
+// be minus<>, and for the latter it should return a constant maximum value.
+
+template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim>
+streamsize _STLP_CALL
+_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _Max_Chars __max_chars,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __set_failbit) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+
+ _STLP_TRY {
+ while (__max_chars(_Num, __n) > 0) {
+ int_type __c = __buf->sbumpc();
+
+ if (__that->_S_eof(__c)) {
+ __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit;
+ break;
+ }
+
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (__extract_delim)
+ ++__n;
+ else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
+ __status |= ios_base::failbit;
+
+ break;
+ }
+ // fbp : added counter increment to pass Dietmar's test
+ ++__n;
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __n;
+}
+
+template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num,
+ _Max_Chars __max_chars,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __set_failbit) {
+ streamsize __n = 0;
+ bool __at_eof = false;
+ bool __done = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
+ ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr();
+ streamsize __m = __max_chars(_Num, __n);
+
+ if (__avail >= __m) { // We have more characters than we need.
+ const _CharT* __last = __buf->_M_gptr() + __STATIC_CAST(ptrdiff_t, __m);
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last);
+ ptrdiff_t __chunk = __p - __buf->_M_gptr();
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ if (__extract_delim && __p != __last) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+
+ __done = true;
+ }
+
+ else {
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
+ ptrdiff_t __chunk = __p - __buf->_M_gptr();
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ if (__p != __buf->_M_egptr()) { // We found delim.
+ if (__extract_delim) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+
+ __done = true;
+ }
+
+ // We didn't find delim. Try to refill the buffer.
+ else if (__that->_S_eof(__buf->sgetc())) {
+ __done = true;
+ __at_eof = true;
+ }
+ }
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ return __n;
+ }
+
+ if (__at_eof)
+ __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit);
+
+ if (__done)
+ return __n;
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from buffered to unbuffered input. We switch to
+ // to _M_ignore_unbuffered.
+
+ return __n + _M_ignore_unbuffered(__that, __buf, _Num, __max_chars,
+ __is_delim, __extract_delim, __set_failbit);
+}
+
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
+ typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize> _Const_streamsize;
+ const streamsize __maxss = (numeric_limits<streamsize>::max)();
+
+ if (__n == (numeric_limits<int>::max)()) {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _Const_bool(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _Const_bool(false), false, false);
+ }
+ else {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __n, minus<streamsize>(),
+ _Const_bool(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
+ _Const_bool(false), false, false);
+ }
+ }
+
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize>
+ _Const_streamsize;
+ const streamsize __maxss = (numeric_limits<streamsize>::max)();
+
+ if (__n == (numeric_limits<int>::max)()) {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
+ true, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ true, false);
+ }
+ else {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __n, minus<streamsize>(),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
+ true, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ true, false);
+ }
+ }
+
+ return *this;
+}
+
+// This member function does not construct a sentry object, because
+// it is called from sentry's constructor.
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!__buf)
+ this->setstate(ios_base::badbit);
+ else if (__buf->gptr() != __buf->egptr())
+ _M_ignore_buffered(this, __buf,
+ _STLP_PRIV _Is_not_wspace<_Traits>(this->_M_ctype_facet()),
+ _STLP_PRIV _Scan_for_not_wspace<_Traits>(this->_M_ctype_facet()),
+ false, __set_failbit);
+ else
+ _M_ignore_unbuffered(this, __buf,
+ _STLP_PRIV _Is_not_wspace<_Traits>(this->_M_ctype_facet()),
+ false, __set_failbit);
+}
+
+
+// This is a very simple loop that reads characters from __src and puts
+// them into __dest. It looks complicated because of the (standard-
+// mandated) exception handling policy.
+//
+// We stop when we get an exception, when we fail to insert into the
+// output streambuf, or when __is_delim is true.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template < class _CharT, class _Traits, class _Is_Delim>
+streamsize _STLP_CALL
+__copy_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
+ basic_streambuf<_CharT, _Traits>* __dest,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __rethrow) {
+ streamsize __extracted = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ int_type __c;
+
+ _STLP_TRY {
+ for (;;) {
+ // Get a character. If there's an exception, catch and (maybe) rethrow it.
+ __c = __src->sbumpc();
+
+ // If we failed to get a character, then quit.
+ if (__that->_S_eof(__c)) {
+ __status |= ios_base::eofbit;
+ break;
+ }
+ // If it's the delimiter, then quit.
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c)))
+ __status |= ios_base::failbit;
+ break;
+ }
+ else {
+ // Try to put the character in the output streambuf.
+ bool __failed = false;
+ _STLP_TRY {
+ if (!__that->_S_eof(__dest->sputc(_Traits::to_char_type(__c))))
+ ++__extracted;
+ else
+ __failed = true;
+ }
+ _STLP_CATCH_ALL {
+ __failed = true;
+ }
+
+ // If we failed to put the character in the output streambuf, then
+ // try to push it back to the input streambuf.
+ if (__failed && !__pushback(__src, _Traits::to_char_type(__c)))
+ __status |= ios_base::failbit;
+
+ // fbp : avoiding infinite loop in io-27-6-1-2-3.exp
+ if (__failed)
+ break;
+ }
+
+ } /* for (;;) */
+
+ }
+ // fbp : this try/catch moved here in reasonable assumption
+ // __is_delim never throw (__pushback is guaranteed not to)
+ _STLP_CATCH_ALL {
+ // See 27.6.1.2.3, paragraph 13.
+ if (__rethrow && __extracted == 0)
+ __that->_M_handle_exception(ios_base::failbit);
+ }
+ __that->setstate(__status);
+ return __extracted;
+}
+
+// Buffered copying from one streambuf to another. We copy the characters
+// in chunks, rather than one at a time. We still have to worry about all
+// of the error conditions we checked in __copy_unbuffered, plus one more:
+// the streambuf might decide to switch from a buffered to an unbuffered mode.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+__copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
+ basic_streambuf<_CharT, _Traits>* __dest,
+ _Scan_Delim __scan_delim, _Is_Delim __is_delim,
+ bool __extract_delim, bool __rethrow) {
+ streamsize __extracted = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ //Borland compiler generates a warning if assignment because value is never used:
+ int_type __c /*= _Traits::eof()*/;
+ _CharT* __first = __src->_M_gptr();
+ ptrdiff_t __avail = __src->_M_egptr() - __first;
+ // fbp : introduced to move catch/try blocks out of the loop
+ bool __do_handle_exceptions = false;
+
+ _STLP_TRY {
+ for (;;) {
+ const _CharT* __last = __scan_delim(__first, __src->_M_egptr());
+
+ // Try to copy the entire input buffer to the output buffer.
+ streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr()
+ ? (__last - __first) + 1
+ : (__last - __first));
+ __src->_M_gbump((int)__n);
+ __extracted += __n;
+
+ // from this on, catch() will call _M_handle_exceptions()
+ __do_handle_exceptions = true;
+
+ if (__n < __avail) // We found the delimiter, or else failed to
+ break; // copy some characters.
+
+ __c = __src->sgetc();
+
+ // Three possibilities: we succeeded in refilling the buffer, or
+ // we got EOF, or the streambuf has switched to unbuffered mode.
+ __first = __src->_M_gptr();
+ __avail = __src->_M_egptr() - __first;
+
+ if (__avail > 0)
+ {} // dwa 1/16/00 -- suppress a Metrowerks warning
+ else if (__that->_S_eof(__c)) {
+ __status |= ios_base::eofbit;
+ break;
+ }
+ else {
+ return __extracted + __copy_unbuffered(__that, __src, __dest, __is_delim,
+ __extract_delim, __rethrow);
+ }
+
+ __do_handle_exceptions = false;
+ }
+ }
+
+ _STLP_CATCH_ALL {
+ // See 27.6.1.2.3, paragraph 13.
+ if (__rethrow && __do_handle_exceptions && __extracted == 0)
+ __that->_M_handle_exception(ios_base::failbit);
+ }
+
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __extracted;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>
+ ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
+
+ if (__src)
+ this->_M_gcount = __src->egptr() != __src->gptr()
+ ? _STLP_PRIV __copy_buffered(this, __src, &__dest,
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, false)
+ : _STLP_PRIV __copy_unbuffered(this, __src, &__dest,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, false);
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Copying characters into a streambuf.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>
+ ::operator>>(basic_streambuf<_CharT, _Traits>* __dest) {
+ streamsize __n = 0;
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(*this);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
+ if (__src && __dest)
+ __n = __src->egptr() != __src->gptr()
+ ? _STLP_PRIV __copy_buffered(this, __src, __dest,
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, true)
+ : _STLP_PRIV __copy_unbuffered(this, __src, __dest,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, true);
+ }
+
+ if (__n == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// ----------------------------------------------------------------
+// basic_iostream<> class
+// ----------------------------------------------------------------
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>
+ ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf)
+ : basic_ios<_CharT, _Traits>(),
+ basic_istream<_CharT, _Traits>(__buf),
+ basic_ostream<_CharT, _Traits>(__buf) {
+ this->init(__buf);
+}
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>::~basic_iostream()
+{}
+
+_STLP_END_NAMESPACE
+
+#undef __BIS_int_type__
+#undef __BIS_pos_type__
+#undef __BIS_off_type__
+
+#endif /* _STLP_ISTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_istream.h b/build/stlport/stlport/stl/_istream.h
new file mode 100644
index 000000000..6b38d03c7
--- /dev/null
+++ b/build/stlport/stlport/stl/_istream.h
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_ISTREAM
+#define _STLP_INTERNAL_ISTREAM
+
+// this block is included by _ostream.h, we include it here to lower #include level
+#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h> // Needed as a base class of basic_iostream.
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#include <stl/_ctraits_fns.h> // Helper functions that allow char traits
+ // to be used as function objects.
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+template <class _CharT, class _Traits>
+class _Isentry;
+#endif
+
+struct _No_Skip_WS {}; // Dummy class used by sentry.
+
+template <class _CharT, class _Traits>
+bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr);
+template <class _CharT, class _Traits>
+bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr);
+
+//----------------------------------------------------------------------
+// Class basic_istream, a class that performs formatted input through
+// a stream buffer.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ typedef basic_istream<_CharT, _Traits> _Self;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ //explicitely defined as private to avoid warnings:
+ basic_istream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+
+public:
+ // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+ typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
+ typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
+ typedef _Self& (_STLP_CALL *__istream_fn)(_Self&);
+
+public: // Constructor and destructor.
+ explicit basic_istream(basic_streambuf<_CharT, _Traits>* __buf) :
+ basic_ios<_CharT, _Traits>(), _M_gcount(0) {
+ this->init(__buf);
+ }
+ ~basic_istream() {};
+
+public: // Nested sentry class.
+
+public: // Hooks for manipulators. The arguments are
+ // function pointers.
+ _Self& operator>> (__istream_fn __f) { return __f(*this); }
+ _Self& operator>> (__ios_fn __f) { __f(*this); return *this; }
+ _Self& operator>> (__ios_base_fn __f) { __f(*this); return *this; }
+
+public: // Formatted input of numbers.
+ _Self& operator>> (short& __val);
+ _Self& operator>> (int& __val);
+ _Self& operator>> (unsigned short& __val);
+ _Self& operator>> (unsigned int& __val);
+ _Self& operator>> (long& __val);
+ _Self& operator>> (unsigned long& __val);
+#ifdef _STLP_LONG_LONG
+ _Self& operator>> (_STLP_LONG_LONG& __val);
+ _Self& operator>> (unsigned _STLP_LONG_LONG& __val);
+#endif
+ _Self& operator>> (float& __val);
+ _Self& operator>> (double& __val);
+# ifndef _STLP_NO_LONG_DOUBLE
+ _Self& operator>> (long double& __val);
+# endif
+# ifndef _STLP_NO_BOOL
+ _Self& operator>> (bool& __val);
+# endif
+ _Self& operator>> (void*& __val);
+
+public: // Copying characters into a streambuf.
+ _Self& operator>>(basic_streambuf<_CharT, _Traits>*);
+
+public: // Unformatted input.
+ streamsize gcount() const { return _M_gcount; }
+ int_type peek();
+
+public: // get() for single characters
+ int_type get();
+ _Self& get(char_type& __c);
+
+public: // get() for character arrays.
+ _Self& get(char_type* __s, streamsize __n, char_type __delim);
+ _Self& get(char_type* __s, streamsize __n)
+ { return get(__s, __n, this->widen('\n')); }
+
+public: // get() for streambufs
+ _Self& get(basic_streambuf<_CharT, _Traits>& __buf,
+ char_type __delim);
+ _Self& get(basic_streambuf<_CharT, _Traits>& __buf)
+ { return get(__buf, this->widen('\n')); }
+
+public: // getline()
+ _Self& getline(char_type* __s, streamsize __n, char_type delim);
+ _Self& getline(char_type* __s, streamsize __n)
+ { return getline(__s, __n, this->widen('\n')); }
+
+public: // read(), readsome(), ignore()
+ _Self& ignore();
+ _Self& ignore(streamsize __n);
+ _Self& ignore(streamsize __n, int_type __delim);
+
+ _Self& read(char_type* __s, streamsize __n);
+ streamsize readsome(char_type* __s, streamsize __n);
+
+public: // putback
+ _Self& putback(char_type __c);
+ _Self& unget();
+
+public: // Positioning and buffer control.
+ int sync();
+
+ pos_type tellg();
+ _Self& seekg(pos_type __pos);
+ _Self& seekg(off_type, ios_base::seekdir);
+
+public: // Helper functions for non-member extractors.
+ void _M_formatted_get(_CharT& __c);
+ void _M_formatted_get(_CharT* __s);
+ void _M_skip_whitespace(bool __set_failbit);
+
+private: // Number of characters extracted by the
+ streamsize _M_gcount; // most recent unformatted input function.
+
+public:
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+ // If we are using DLL specs, we have not to use inner classes
+ // end class declaration here
+ typedef _Isentry<_CharT, _Traits> sentry;
+};
+# define sentry _Isentry
+template <class _CharT, class _Traits>
+class _Isentry {
+ typedef _Isentry<_CharT, _Traits> _Self;
+# else
+ class sentry {
+ typedef sentry _Self;
+#endif
+
+ private:
+ const bool _M_ok;
+ // basic_streambuf<_CharT, _Traits>* _M_buf;
+
+ public:
+ typedef _Traits traits_type;
+
+ explicit sentry(basic_istream<_CharT, _Traits>& __istr,
+ bool __noskipws = false) :
+ _M_ok((__noskipws || !(__istr.flags() & ios_base::skipws)) ? _M_init_noskip(__istr) : _M_init_skip(__istr) )
+ /* , _M_buf(__istr.rdbuf()) */
+ {}
+
+ // Calling this constructor is the same as calling the previous one with
+ // __noskipws = true, except that it doesn't require a runtime test.
+ sentry(basic_istream<_CharT, _Traits>& __istr, _No_Skip_WS) : /* _M_buf(__istr.rdbuf()), */
+ _M_ok(_M_init_noskip(__istr)) {}
+
+ ~sentry() {}
+
+ operator bool() const { return _M_ok; }
+
+ private: // Disable assignment and copy constructor.
+ //Implementation is here only to avoid warning with some compilers.
+ sentry(const _Self&) : _M_ok(false) {}
+ _Self& operator=(const _Self&) { return *this; }
+ };
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+# undef sentry
+# else
+ // close basic_istream class definition here
+};
+# endif
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Isentry<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_istream<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _Isentry<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_istream<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+// Non-member character and string extractor functions.
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT& __c) {
+ __in_str._M_formatted_get(__c);
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, unsigned char& __c) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, signed char& __c) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
+ return __in_str;
+}
+
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT* __s) {
+ __in_str._M_formatted_get(__s);
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, unsigned char* __s) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, signed char* __s) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
+ return __in_str;
+}
+
+//----------------------------------------------------------------------
+// istream manipulator.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+ws(basic_istream<_CharT, _Traits>& __istr) {
+ if (!__istr.eof()) {
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(__istr, _No_Skip_WS()); // Don't skip whitespace.
+ if (__sentry)
+ __istr._M_skip_whitespace(false);
+ }
+ return __istr;
+}
+
+// Helper functions for istream<>::sentry constructor.
+template <class _CharT, class _Traits>
+inline bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr) {
+ if (__istr.good()) {
+ if (__istr.tie())
+ __istr.tie()->flush();
+
+ __istr._M_skip_whitespace(true);
+ }
+
+ if (!__istr.good()) {
+ __istr.setstate(ios_base::failbit);
+ return false;
+ } else
+ return true;
+}
+
+template <class _CharT, class _Traits>
+inline bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr) {
+ if (__istr.good()) {
+ if (__istr.tie())
+ __istr.tie()->flush();
+
+ if (!__istr.rdbuf())
+ __istr.setstate(ios_base::badbit);
+ }
+ else
+ __istr.setstate(ios_base::failbit);
+ return __istr.good();
+}
+
+//----------------------------------------------------------------------
+// Class iostream.
+template <class _CharT, class _Traits>
+class basic_iostream
+ : public basic_istream<_CharT, _Traits>,
+ public basic_ostream<_CharT, _Traits>
+{
+public:
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+ explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __buf);
+ virtual ~basic_iostream();
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<char, char_traits<char> >;
+
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& __istr)
+{ return __istr.rdbuf(); }
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_istream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ISTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_istreambuf_iterator.h b/build/stlport/stlport/stl/_istreambuf_iterator.h
new file mode 100644
index 000000000..9f340cb51
--- /dev/null
+++ b/build/stlport/stlport/stl/_istreambuf_iterator.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// defined in _istream.h
+template <class _CharT, class _Traits>
+extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ;
+
+// We do not read any characters until operator* is called. operator* calls sgetc
+// unless the iterator is unchanged from the last call in which case a cached value is
+// used. Calls to operator++ use sbumpc.
+
+template<class _CharT, class _Traits>
+class istreambuf_iterator :
+ public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT&>
+{
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _CharT value_type;
+ typedef typename _Traits::off_type difference_type;
+ typedef const _CharT* pointer;
+ typedef const _CharT& reference;
+
+public:
+ istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
+ // istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); }
+ inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is);
+
+ char_type operator*() const { this->_M_getc(); return _M_c; }
+ istreambuf_iterator<_CharT, _Traits>& operator++() {
+ _M_buf->sbumpc();
+ _M_have_c = false;
+ return *this;
+ }
+ istreambuf_iterator<_CharT, _Traits> operator++(int);
+
+ bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const {
+ if (this->_M_buf)
+ this->_M_getc();
+ if (__i._M_buf)
+ __i._M_getc();
+ return this->_M_eof == __i._M_eof;
+ }
+
+private:
+ void _M_init(streambuf_type* __p) {
+ _M_buf = __p;
+ _M_eof = (__p == 0);
+ _M_have_c = false;
+ }
+
+ void _M_getc() const {
+ if (_M_have_c)
+ return;
+ int_type __c = _M_buf->sgetc();
+ _STLP_MUTABLE(_Self, _M_c) = traits_type::to_char_type(__c);
+ _STLP_MUTABLE(_Self, _M_eof) = traits_type::eq_int_type(__c, traits_type::eof());
+ _STLP_MUTABLE(_Self, _M_have_c) = true;
+ }
+
+private:
+ streambuf_type* _M_buf;
+ mutable _CharT _M_c;
+ mutable bool _M_eof;
+ mutable bool _M_have_c;
+};
+
+template<class _CharT, class _Traits>
+inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is)
+{ this->_M_init(_M_get_istreambuf(__is)); }
+
+template<class _CharT, class _Traits>
+inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return __x.equal(__y);
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template<class _CharT, class _Traits>
+inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return !__x.equal(__y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<char, char_traits<char> >;
+# if defined (INSTANTIATE_WIDE_STREAMS)
+_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _CharT, class _Traits>
+inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); }
+template <class _CharT, class _Traits>
+inline streamoff* _STLP_CALL
+distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; }
+template <class _CharT, class _Traits>
+inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; }
+# endif
+
+template <class _CharT, class _Traits>
+istreambuf_iterator<_CharT, _Traits>
+istreambuf_iterator<_CharT, _Traits>::operator++(int) {
+ _M_getc(); // __tmp should avoid any future actions under
+ // underlined buffer---during call of operator *()
+ // (due to buffer for *this and __tmp are the same).
+ istreambuf_iterator<_CharT, _Traits> __tmp = *this;
+ _M_buf->sbumpc();
+ _M_have_c = false;
+ return __tmp;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_iterator.h b/build/stlport/stlport/stl/_iterator.h
new file mode 100644
index 000000000..8e3b7b032
--- /dev/null
+++ b/build/stlport/stlport/stl/_iterator.h
@@ -0,0 +1,265 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+#define _STLP_INTERNAL_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+// This is the new version of reverse_iterator, as defined in the
+// draft C++ standard. It relies on the iterator_traits template,
+// which in turn relies on partial specialization. The class
+// reverse_bidirectional_iterator is no longer part of the draft
+// standard, but it is retained for backward compatibility.
+
+template <class _Iterator>
+class reverse_iterator :
+ public iterator<typename iterator_traits<_Iterator>::iterator_category,
+ typename iterator_traits<_Iterator>::value_type,
+ typename iterator_traits<_Iterator>::difference_type,
+ typename iterator_traits<_Iterator>::pointer,
+ typename iterator_traits<_Iterator>::reference> {
+protected:
+ _Iterator current;
+ typedef reverse_iterator<_Iterator> _Self;
+public:
+ typedef typename iterator_traits<_Iterator>::difference_type difference_type;
+ // pointer type required for arrow operator hidden behind _STLP_DEFINE_ARROW_OPERATOR:
+ typedef typename iterator_traits<_Iterator>::pointer pointer;
+ typedef typename iterator_traits<_Iterator>::reference reference;
+ typedef _Iterator iterator_type;
+public:
+ reverse_iterator() {}
+ explicit reverse_iterator(iterator_type __x) : current(__x) {}
+ reverse_iterator(const _Self& __x) : current(__x.current) {}
+ _Self& operator = (const _Self& __x) { current = __x.base(); return *this; }
+# if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Iter>
+ reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {}
+ template <class _Iter>
+ _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; }
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator_type base() const { return current; }
+ reference operator*() const {
+ _Iterator __tmp = current;
+ return *--__tmp;
+ }
+ _STLP_DEFINE_ARROW_OPERATOR
+ _Self& operator++() {
+ --current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+
+ _Self operator+(difference_type __n) const { return _Self(current - __n); }
+ _Self& operator+=(difference_type __n) {
+ current -= __n;
+ return *this;
+ }
+ _Self operator-(difference_type __n) const { return _Self(current + __n); }
+ _Self& operator-=(difference_type __n) {
+ current += __n;
+ return *this;
+ }
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+template <class _Iterator>
+inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __x.base() == __y.base(); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y.base() < __x.base(); }
+
+# if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _Iterator>
+inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__x == __y); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y < __x; }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__y < __x); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__x < __y); }
+# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _Iterator>
+# if defined (__SUNPRO_CC)
+inline ptrdiff_t _STLP_CALL
+# else
+inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL
+# endif
+operator-(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y.base() - __x.base(); }
+
+template <class _Iterator, class _DifferenceType>
+inline reverse_iterator<_Iterator> _STLP_CALL
+operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x)
+{ return x.operator+(n); }
+#endif
+
+template <class _Container>
+class back_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef back_insert_iterator<_Container> _Self;
+protected:
+ //c is a Standard name (24.4.2.1), do no make it STLport naming convention compliant.
+ _Container *container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+
+ explicit back_insert_iterator(_Container& __x) : container(&__x) {}
+
+ _Self& operator=(const _Self& __other) {
+ container = __other.container;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ container->push_back(__val);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self operator++(int) { return *this; }
+};
+
+template <class _Container>
+inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x)
+{ return back_insert_iterator<_Container>(__x); }
+
+template <class _Container>
+class front_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef front_insert_iterator<_Container> _Self;
+protected:
+ //c is a Standard name (24.4.2.3), do no make it STLport naming convention compliant.
+ _Container *container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ explicit front_insert_iterator(_Container& __x) : container(&__x) {}
+
+ _Self& operator=(const _Self& __other) {
+ container = __other.container;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ container->push_front(__val);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self operator++(int) { return *this; }
+};
+
+template <class _Container>
+inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x)
+{ return front_insert_iterator<_Container>(__x); }
+
+template <class _Container>
+class insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef insert_iterator<_Container> _Self;
+protected:
+ //container is a Standard name (24.4.2.5), do no make it STLport naming convention compliant.
+ _Container *container;
+ typename _Container::iterator _M_iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : container(&__x), _M_iter(__i) {}
+
+ _Self& operator=(_Self const& __other) {
+ container = __other.container;
+ _M_iter = __other._M_iter;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ _M_iter = container->insert(_M_iter, __val);
+ ++_M_iter;
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+};
+
+template <class _Container, class _Iterator>
+inline insert_iterator<_Container> _STLP_CALL
+inserter(_Container& __x, _Iterator __i) {
+ typedef typename _Container::iterator __iter;
+ return insert_iterator<_Container>(__x, __iter(__i));
+}
+
+_STLP_END_NAMESPACE
+
+#if ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# include <stl/_iterator_old.h>
+#endif
+
+#endif /* _STLP_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_iterator_base.h b/build/stlport/stlport/stl/_iterator_base.h
new file mode 100644
index 000000000..ef590486d
--- /dev/null
+++ b/build/stlport/stlport/stl/_iterator_base.h
@@ -0,0 +1,525 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+#define _STLP_INTERNAL_ITERATOR_BASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+//# if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+//_STLP_BEGIN_NAMESPACE
+//using namespace _STLP_VENDOR_CSTD;
+//_STLP_END_NAMESPACE
+//#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+struct input_iterator_tag {};
+struct output_iterator_tag {};
+struct forward_iterator_tag : public input_iterator_tag {};
+struct bidirectional_iterator_tag : public forward_iterator_tag {};
+struct random_access_iterator_tag : public bidirectional_iterator_tag {};
+
+template <class _Category, class _Tp, _STLP_DFL_TMPL_PARAM(_Distance,ptrdiff_t),
+ _STLP_DFL_TMPL_PARAM(_Pointer,_Tp*), _STLP_DFL_TMPL_PARAM(_Reference,_Tp&) >
+struct iterator {
+ typedef _Category iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+};
+_STLP_TEMPLATE_NULL
+struct iterator<output_iterator_tag, void, void, void, void> {
+ typedef output_iterator_tag iterator_category;
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+#endif
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_category(_It)
+# define _STLP_DISTANCE_TYPE(_It, _Tp) _STLP_STD::distance_type(_It)
+# define _STLP_VALUE_TYPE(_It, _Tp) _STLP_STD::value_type(_It)
+//Old HP iterator queries do not give information about the iterator
+//associated reference type so we consider that it is not a real reference.
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
+#else
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# define _STLP_VALUE_TYPE(_It, _Tp) (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::value_type*)0
+# define _STLP_DISTANCE_TYPE(_It, _Tp) (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::difference_type*)0
+# if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
+ (defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_traits< _Tp >::iterator_category()
+# else
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::iterator_category()
+# endif
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _STLP_STD::_IsRefType< _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::reference >::_Ret()
+# else
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::__iterator_category(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
+# define _STLP_DISTANCE_TYPE(_It, _Tp) _STLP_STD::__distance_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
+# define _STLP_VALUE_TYPE(_It, _Tp) _STLP_STD::__value_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
+# endif
+#endif
+
+#if defined (_STLP_DONT_REDEFINE_STD) && defined (_STLP_WHOLE_NATIVE_STD)
+/* In this mode we will see both STLport implementation and native
+ * one. To allow some interaction between both implementations through
+ * iterators we have to map std iterator categories to stlport ones. This
+ * way we will be able to initialize STLport containers with native
+ * iterators, the other side won't work except when STLport iterators are
+ * simple pointers. */
+
+_STLP_END_NAMESPACE
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iterator>
+# else
+# include _STLP_NATIVE_HEADER(iterator)
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _IteCat>
+struct _CategoryMapping
+{ typedef _IteCat _Tag; };
+
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::input_iterator_tag>
+{ typedef input_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::output_iterator_tag>
+{ typedef output_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::forward_iterator_tag>
+{ typedef forward_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::bidirectional_iterator_tag>
+{ typedef bidirectional_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::random_access_iterator_tag>
+{ typedef random_access_iterator_tag _Tag; };
+
+template <class _Iterator>
+struct iterator_traits {
+ typedef typename _Iterator::iterator_category _OriginalTag;
+ typedef typename _CategoryMapping<_OriginalTag>::_Tag iterator_category;
+#else
+template <class _Iterator>
+struct iterator_traits {
+ typedef typename _Iterator::iterator_category iterator_category;
+#endif
+ typedef typename _Iterator::value_type value_type;
+ typedef typename _Iterator::difference_type difference_type;
+ typedef typename _Iterator::pointer pointer;
+ typedef typename _Iterator::reference reference;
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (__SUNPRO_CC)
+# define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
+#else
+# define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
+#endif
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+
+// fbp : this order keeps gcc happy
+template <class _Tp>
+struct iterator_traits<const _Tp*> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+};
+
+template <class _Tp>
+struct iterator_traits<_Tp*> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+};
+
+# if defined (__BORLANDC__)
+template <class _Tp>
+struct iterator_traits<_Tp* const> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+};
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+#include <stl/_ptrs_specialize.h>
+_STLP_BEGIN_NAMESPACE
+
+#ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+// The overloaded functions iterator_category, distance_type, and
+// value_type are not part of the C++ standard. (They have been
+// replaced by struct iterator_traits.) They are included for
+// backward compatibility with the HP STL.
+// We introduce internal names for these functions.
+
+# ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
+
+template <class _Tp>
+inline _STLP_STD::random_access_iterator_tag
+__iterator_category(const _Tp*, const __true_type&)
+{ return _STLP_STD::random_access_iterator_tag(); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::iterator_category
+__iterator_category(const _Iter&, const __false_type&) {
+ typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::iterator_category _Category;
+ return _Category();
+}
+
+template <class _Tp>
+inline ptrdiff_t*
+__distance_type(const _Tp*, const __true_type&)
+{ return __STATIC_CAST(ptrdiff_t*, 0); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::difference_type*
+__distance_type(const _Iter&, const __false_type&) {
+ typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::difference_type _diff_type;
+ return __STATIC_CAST(_diff_type*,0);
+}
+
+template <class _Tp>
+inline _Tp*
+__value_type(const _Tp*, const __true_type&)
+{ return __STATIC_CAST(_Tp*, 0); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::value_type*
+__value_type(const _Iter&, const __false_type&) {
+ typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::value_type _value_type;
+ return __STATIC_CAST(_value_type*,0);
+}
+
+# endif
+
+#else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp>
+inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
+template <class _Tp>
+inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp>
+inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); }
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+// The base classes input_iterator, output_iterator, forward_iterator,
+// bidirectional_iterator, and random_access_iterator are not part of
+// the C++ standard. (They have been replaced by struct iterator.)
+// They are included for backward compatibility with the HP STL.
+template <class _Tp, class _Distance> struct input_iterator :
+ public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
+template <class _Tp, class _Distance> struct forward_iterator :
+ public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+template <class _Tp, class _Distance> struct bidirectional_iterator :
+ public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+template <class _Tp, class _Distance> struct random_access_iterator :
+ public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+
+# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _Tp, class _Distance>
+inline input_iterator_tag _STLP_CALL
+iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
+inline output_iterator_tag _STLP_CALL
+iterator_category(const output_iterator&) { return output_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline forward_iterator_tag _STLP_CALL
+iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline bidirectional_iterator_tag _STLP_CALL
+iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline random_access_iterator_tag _STLP_CALL
+iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);}
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+# endif
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator>
+inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
+__distance(const _InputIterator& __first, const _InputIterator& __last,
+ const input_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
+ _InputIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator>
+inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL
+__distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
+ const forward_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
+ _ForwardIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+
+template <class _BidirectionalIterator>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL
+__distance(const _BidirectionalIterator& __first, const _BidirectionalIterator& __last,
+ const bidirectional_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
+ _BidirectionalIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+#endif
+
+template <class _RandomAccessIterator>
+inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
+__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
+ const random_access_iterator_tag &)
+{ return __last - __first; }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator>
+inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
+distance(_InputIterator __first, _InputIterator __last)
+{ return _STLP_PRIV __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL distance(const _InputIterator& __first,
+ const _InputIterator& __last, _Distance& __n)
+{ __n += _STLP_STD::distance(__first, __last); }
+
+# if defined (_STLP_MSVC)
+// MSVC specific
+template <class _InputIterator, class _Dist>
+inline void _STLP_CALL _Distance(_InputIterator __first,
+ _InputIterator __last, _Dist& __n)
+{ __n += _STLP_STD::distance(__first, __last); }
+# endif
+#endif
+
+// fbp: those are being used for iterator/const_iterator definitions everywhere
+template <class _Tp>
+struct _Nonconst_traits;
+
+template <class _Tp>
+struct _Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_traits<_Tp> _NonConstTraits;
+};
+
+template <class _Tp>
+struct _Nonconst_traits {
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+ typedef _Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_traits<_Tp> _NonConstTraits;
+};
+
+/*
+ * dums: A special iterator/const_iterator traits for set and multiset for which even
+ * the iterator is not mutable
+ */
+template <class _Tp>
+struct _Nonconst_Const_traits;
+
+template <class _Tp>
+struct _Const_Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
+};
+
+template <class _Tp>
+struct _Nonconst_Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
+};
+
+/*
+ * A macro to generate a new iterator traits from one of the
+ * previous one. Changing the iterator traits type make iterators
+ * from different containers not comparable.
+ */
+#define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
+template <class _Tp> \
+struct _##Motif; \
+template <class _Tp> \
+struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> { \
+ typedef _Const##Motif<_Tp> _ConstTraits; \
+ typedef _##Motif<_Tp> _NonConstTraits; \
+}; \
+template <class _Tp> \
+struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> { \
+ typedef _Const##Motif<_Tp> _ConstTraits; \
+ typedef _##Motif<_Tp> _NonConstTraits; \
+};
+
+#define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits) \
+_STLP_MOVE_TO_PRIV_NAMESPACE \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits) \
+_STLP_MOVE_TO_PRIV_NAMESPACE \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits) \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits) \
+template <class _Tp> \
+struct _##Motif { \
+ typedef _ConstNonLocal##Motif<_Tp> _ConstTraits; \
+ typedef _NonLocal##Motif<_Tp> _NonConstTraits; \
+ typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits; \
+ typedef _Local##Motif<_Tp> _NonConstLocalTraits; \
+}; \
+_STLP_MOVE_TO_STD_NAMESPACE
+
+/*
+# if defined (_STLP_BASE_TYPEDEF_BUG)
+// this workaround is needed for SunPro 4.0.1
+template <class _Traits>
+struct __cnst_traits_aux : private _Traits {
+ typedef typename _Traits::value_type value_type;
+};
+# define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
+# else
+# define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
+# endif
+*/
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_InputIter& __i, _Distance __n, const input_iterator_tag &)
+{ while (__n--) ++__i; }
+
+// fbp : added output iterator tag variant
+template <class _InputIter, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_InputIter& __i, _Distance __n, const output_iterator_tag &)
+{ while (__n--) ++__i; }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &)
+{ while (n--) ++i; }
+#endif
+
+template <class _BidirectionalIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_BidirectionalIterator& __i, _Distance __n,
+ const bidirectional_iterator_tag &) {
+ if (__n > 0)
+ while (__n--) ++__i;
+ else
+ while (__n++) --__i;
+}
+
+template <class _RandomAccessIterator, class _Distance>
+inline void _STLP_CALL
+__advance(_RandomAccessIterator& __i, _Distance __n,
+ const random_access_iterator_tag &)
+{ __i += __n; }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n)
+{ _STLP_PRIV __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator)); }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_iterator_old.h b/build/stlport/stlport/stl/_iterator_old.h
new file mode 100644
index 000000000..144b9ab38
--- /dev/null
+++ b/build/stlport/stlport/stl/_iterator_old.h
@@ -0,0 +1,334 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ITERATOR_OLD_H
+#define _STLP_INTERNAL_ITERATOR_OLD_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
+
+#endif
+
+template <class _BidirectionalIterator, class _Tp,
+ _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
+#if defined (_STLP_MSVC50_COMPATIBILITY)
+# define __Reference _Reference, class _Pointer
+# define Reference__ _Reference, _Pointer
+ _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
+#else
+# define __Reference _Reference
+# define Reference__ _Reference
+#endif
+ _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
+class reverse_bidirectional_iterator {
+ typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance> _Self;
+ // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
+protected:
+ _BidirectionalIterator current;
+public:
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ typedef _Pointer pointer;
+# else
+ typedef _Tp* pointer;
+# endif
+ typedef _Reference reference;
+
+ reverse_bidirectional_iterator() {}
+ explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
+ : current(__x) {}
+ _BidirectionalIterator base() const { return current; }
+ _Reference operator*() const {
+ _BidirectionalIterator __tmp = current;
+ return *(--__tmp);
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ --current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+};
+
+#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline bidirectional_iterator_tag _STLP_CALL
+iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return bidirectional_iterator_tag(); }
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline _Tp* _STLP_CALL
+value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return (_Tp*) 0; }
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline _Distance* _STLP_CALL
+distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return (_Distance*) 0; }
+#endif
+
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline bool _STLP_CALL operator==(
+ const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance>& __y)
+{ return __x.base() == __y.base(); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _BiIter, class _Tp, class __Reference, class _Distance>
+inline bool _STLP_CALL operator!=(
+ const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
+ const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
+{ return !(__x == __y); }
+
+#endif
+
+#if !defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
+
+// This is the old version of reverse_iterator, as found in the original
+// HP STL. It does not use partial specialization.
+
+template <class _RandomAccessIterator, class _Tp,
+ _STLP_DFL_TMPL_PARAM(_Reference,_Tp&),
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
+# endif
+ _STLP_DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
+class reverse_iterator {
+ typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance> _Self;
+protected:
+ _RandomAccessIterator __current;
+public:
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ typedef _Pointer pointer;
+# else
+ typedef _Tp* pointer;
+# endif
+ typedef _Reference reference;
+
+ reverse_iterator() {}
+ reverse_iterator(const _Self& __x) : __current(__x.base()) {}
+ explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
+ _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
+
+ _RandomAccessIterator base() const { return __current; }
+ _Reference operator*() const { return *(__current - (difference_type)1); }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ --__current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --__current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++__current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++__current;
+ return __tmp;
+ }
+ _Self operator+(_Distance __n) const {
+ return _Self(__current - __n);
+ }
+ _Self& operator+=(_Distance __n) {
+ __current -= __n;
+ return *this;
+ }
+ _Self operator-(_Distance __n) const {
+ return _Self(__current + __n);
+ }
+ _Self& operator-=(_Distance __n) {
+ __current += __n;
+ return *this;
+ }
+ _Reference operator[](_Distance __n) const { return *(*this + __n); }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline random_access_iterator_tag _STLP_CALL
+iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return random_access_iterator_tag(); }
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return (_Tp*) 0; }
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Distance* _STLP_CALL
+distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return (_Distance*) 0; }
+# endif
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __x.base() == __y.base();
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __y.base() < __x.base();
+}
+
+# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__x == __y);
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return __y < __x;
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__y < __x);
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__x < __y);
+}
+
+# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Distance _STLP_CALL
+operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __y.base() - __x.base();
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance> _STLP_CALL
+operator+(_Distance __n,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x)
+{
+ return reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>(__x.base() - __n);
+}
+
+#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_limits.c b/build/stlport/stlport/stl/_limits.c
new file mode 100644
index 000000000..39380249e
--- /dev/null
+++ b/build/stlport/stlport/stl/_limits.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 1998,1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIMITS_C
+#define _STLP_LIMITS_C
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+//==========================================================
+// numeric_limits static members
+//==========================================================
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+
+# define __declare_numeric_base_member(__type, __mem) \
+template <class __number> \
+ const __type _Numeric_limits_base<__number>:: __mem
+
+__declare_numeric_base_member(bool, is_specialized);
+__declare_numeric_base_member(int, digits);
+__declare_numeric_base_member(int, digits10);
+__declare_numeric_base_member(bool, is_signed);
+__declare_numeric_base_member(bool, is_integer);
+__declare_numeric_base_member(bool, is_exact);
+__declare_numeric_base_member(int, radix);
+__declare_numeric_base_member(int, min_exponent);
+__declare_numeric_base_member(int, max_exponent);
+__declare_numeric_base_member(int, min_exponent10);
+__declare_numeric_base_member(int, max_exponent10);
+__declare_numeric_base_member(bool, has_infinity);
+__declare_numeric_base_member(bool, has_quiet_NaN);
+__declare_numeric_base_member(bool, has_signaling_NaN);
+__declare_numeric_base_member(float_denorm_style, has_denorm);
+__declare_numeric_base_member(bool, has_denorm_loss);
+__declare_numeric_base_member(bool, is_iec559);
+__declare_numeric_base_member(bool, is_bounded);
+__declare_numeric_base_member(bool, is_modulo);
+__declare_numeric_base_member(bool, traps);
+__declare_numeric_base_member(bool, tinyness_before);
+__declare_numeric_base_member(float_round_style, round_style);
+
+# undef __declare_numeric_base_member
+
+# define __declare_integer_limits_member(__type, __mem) \
+template <class _Int, _STLP_LIMITS_MIN_TYPE __imin, _STLP_LIMITS_MAX_TYPE __imax, int __idigits, bool __ismod> \
+ const __type _Integer_limits<_Int, __imin, __imax, __idigits, __ismod>:: __mem
+
+__declare_integer_limits_member(bool, is_specialized);
+__declare_integer_limits_member(int, digits);
+__declare_integer_limits_member(int, digits10);
+__declare_integer_limits_member(bool, is_signed);
+__declare_integer_limits_member(bool, is_integer);
+__declare_integer_limits_member(bool, is_exact);
+__declare_integer_limits_member(int, radix);
+__declare_integer_limits_member(bool, is_bounded);
+__declare_integer_limits_member(bool, is_modulo);
+# undef __declare_integer_limits_member
+
+# if defined (__GNUC__) && (__GNUC__ != 2 || __GNUC_MINOR__ > 96) && (__GNUC__ != 3 || __GNUC_MINOR__ == 0) && (__GNUC__ <= 3)
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# define __declare_numeric_limits_member(__integer) \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits; \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits10; \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::radix; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_specialized; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_signed; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_integer; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_exact; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_bounded; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_modulo
+
+__declare_numeric_limits_member(_STLP_LONG_LONG);
+__declare_numeric_limits_member(unsigned _STLP_LONG_LONG);
+
+# undef __declare_numeric_limits_member
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# endif
+
+# define __declare_float_limits_member(__type, __mem) \
+template <class __number, \
+ int __Digits, int __Digits10, \
+ int __MinExp, int __MaxExp, \
+ int __MinExp10, int __MaxExp10, \
+ bool __IsIEC559, \
+ float_denorm_style __DenormStyle, \
+ float_round_style __RoundStyle> \
+const __type _Floating_limits< __number, __Digits, __Digits10, \
+ __MinExp, __MaxExp, __MinExp10, __MaxExp10, \
+ __IsIEC559, __DenormStyle, __RoundStyle>::\
+ __mem
+
+__declare_float_limits_member(bool, is_specialized);
+__declare_float_limits_member(int, digits);
+__declare_float_limits_member(int, digits10);
+__declare_float_limits_member(bool, is_signed);
+__declare_float_limits_member(int, radix);
+__declare_float_limits_member(int, min_exponent);
+__declare_float_limits_member(int, max_exponent);
+__declare_float_limits_member(int, min_exponent10);
+__declare_float_limits_member(int, max_exponent10);
+__declare_float_limits_member(bool, has_infinity);
+__declare_float_limits_member(bool, has_quiet_NaN);
+__declare_float_limits_member(bool, has_signaling_NaN);
+__declare_float_limits_member(float_denorm_style, has_denorm);
+__declare_float_limits_member(bool, has_denorm_loss);
+__declare_float_limits_member(bool, is_iec559);
+__declare_float_limits_member(bool, is_bounded);
+__declare_float_limits_member(bool, traps);
+__declare_float_limits_member(bool, tinyness_before);
+__declare_float_limits_member(float_round_style, round_style);
+# undef __declare_float_limits_member
+
+#endif
+
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# if defined (__GNUC__) || defined (__BORLANDC__)
+# define _STLP_ADDITIONAL_OPEN_BRACKET {
+# define _STLP_ADDITIONAL_CLOSE_BRACKET }
+# else
+# define _STLP_ADDITIONAL_OPEN_BRACKET
+# define _STLP_ADDITIONAL_CLOSE_BRACKET
+# endif
+
+/* The following code has been extracted from the boost libraries (www.boost.org) and
+ * adapted with the STLport portability macros. Advantage on previous technique is that
+ * computation of infinity and NaN values is only based on big/little endianess, compiler
+ * float, double or long double representation is taken into account thanks to the sizeof
+ * operator. */
+template<class _Number, unsigned short _Word>
+struct float_helper {
+ union _WordsNumber {
+ unsigned short _Words[8];
+ _Number _num;
+ };
+ static _Number get_word_higher() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ return __tmp._num;
+ }
+ static _Number get_word_lower() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word;
+ return __tmp._num;
+ }
+ static _Number get_from_last_word() _STLP_NOTHROW {
+# if defined (_STLP_BIG_ENDIAN)
+ return get_word_higher();
+# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_lower();
+# endif
+ }
+ static _Number get_from_first_word() _STLP_NOTHROW {
+# if defined (_STLP_BIG_ENDIAN)
+ return get_word_lower();
+# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_higher();
+# endif
+ }
+};
+
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_BIG_ENDIAN)
+template<class _Number, unsigned short _Word1, unsigned short _Word2>
+struct float_helper2 {
+ union _WordsNumber {
+ unsigned short _Words[8];
+ _Number _num;
+ };
+ //static _Number get_word_higher() _STLP_NOTHROW {
+ // _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word1, _Word2, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ // return __tmp._num;
+ //}
+ static _Number get_word_lower() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 2] = _Word1;
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word2;
+ return __tmp._num;
+ }
+ static _Number get_from_last_word() _STLP_NOTHROW {
+//# if defined (_STLP_BIG_ENDIAN)
+// return get_word_higher();
+//# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_lower();
+//# endif
+ }
+};
+# endif
+
+/* Former values kept in case moving to boost code has introduce a regression on
+ * some platform. */
+#if 0
+# if defined (_STLP_BIG_ENDIAN)
+# if defined (__OS400__)
+# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0xffc0, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0xff80, 0 }
+# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0xfff8, 0, 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0xfff0, 0, 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0xfff8, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0xfff0, 0, 0, 0, 0, 0, 0, 0 }
+# else /* __OS400__ */
+# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0x7fc1, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0x7f81, 0 }
+# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0x7ff9, 0, 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0x7ff1, 0, 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0x7ff1, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0x7ff9, 0, 0, 0, 0, 0, 0, 0 }
+# endif /* __OS400__ */
+# else /* _STLP_LITTLE_ENDIAN */
+# if defined(__DECCXX)
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 }
+# define _STLP_FLOAT_SNAN_REP { 0x5555, 0x7f85 }
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x7ff5 }
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0, 0, 0, 0, 0x7fff }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0, 0, 0, 0x8000, 0xffff }
+# define _STLP_LDOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x7fff}
+# else
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0x7fc0 }
+# define _STLP_FLOAT_SNAN_REP { 0, 0x7fa0 }
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0x7ff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0x7ff4 }
+# if defined (_STLP_MSVC) || defined (__ICL)
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF8, 0 }
+# elif defined (__BORLANDC__)
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0x7fff }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xa000, 0x7fff }
+# else
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xa000, 0x7fff, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xc000, 0x7fff, 0 }
+# endif
+# endif
+# endif
+
+union _F_rep {
+ unsigned short rep[2];
+ float val;
+};
+union _D_rep {
+ unsigned short rep[4];
+ double val;
+};
+
+# ifndef _STLP_NO_LONG_DOUBLE
+union _LD_rep {
+ unsigned short rep[8];
+ long double val;
+};
+# endif
+#endif
+
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_inf() {
+ typedef float_helper<float, 0x7f80u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_qNaN() {
+ typedef float_helper<float, 0x7f81u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_sNaN() {
+ typedef float_helper<float, 0x7fc1u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_denormMin() {
+ typedef float_helper<float, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+
+template <int __use_double_limits>
+class _NumericLimitsAccess;
+
+_STLP_TEMPLATE_NULL
+class _NumericLimitsAccess<1> {
+public:
+ static double get_inf() {
+ typedef float_helper<double, 0x7ff0u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+ static double get_qNaN() {
+ typedef float_helper<double, 0x7ff1u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+ static double get_sNaN() {
+ typedef float_helper<double, 0x7ff9u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+};
+
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_inf()
+{ return _NumericLimitsAccess<1>::get_inf(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_qNaN()
+{ return _NumericLimitsAccess<1>::get_qNaN(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_sNaN()
+{ return _NumericLimitsAccess<1>::get_sNaN(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_denormMin() {
+ typedef float_helper<double, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+class _NumericLimitsAccess<0> {
+public:
+ static long double get_inf() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff0u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0x8000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+ static long double get_qNaN() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff1u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0xc000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+ static long double get_sNaN() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff9u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0x9000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+};
+
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_inf() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_inf();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_qNaN();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_sNaN();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_denormMin() {
+ typedef float_helper<long double, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+# endif
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+#undef _STLP_LIMITS_MIN_TYPE
+#undef _STLP_LIMITS_MAX_TYPE
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIMITS_C_INCLUDED */
diff --git a/build/stlport/stlport/stl/_limits.h b/build/stlport/stlport/stl/_limits.h
new file mode 100644
index 000000000..c0091f6aa
--- /dev/null
+++ b/build/stlport/stlport/stl/_limits.h
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This may be not portable code. Parts of numeric_limits<> are
+ * inherently machine-dependent. At present this file is suitable
+ * for the MIPS, SPARC, Alpha and ia32 architectures.
+ */
+
+#ifndef _STLP_INTERNAL_LIMITS
+#define _STLP_INTERNAL_LIMITS
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_CFLOAT
+# include <cfloat>
+#endif
+
+#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
+};
+
+enum float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Base class for all specializations of numeric_limits.
+template <class __number>
+class _Numeric_limits_base {
+public:
+
+ static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); }
+ static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); }
+
+ _STLP_STATIC_CONSTANT(int, digits = 0);
+ _STLP_STATIC_CONSTANT(int, digits10 = 0);
+ _STLP_STATIC_CONSTANT(int, radix = 0);
+ _STLP_STATIC_CONSTANT(int, min_exponent = 0);
+ _STLP_STATIC_CONSTANT(int, min_exponent10 = 0);
+ _STLP_STATIC_CONSTANT(int, max_exponent = 0);
+ _STLP_STATIC_CONSTANT(int, max_exponent10 = 0);
+
+ _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = denorm_absent);
+ _STLP_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
+
+ _STLP_STATIC_CONSTANT(bool, is_specialized = false);
+ _STLP_STATIC_CONSTANT(bool, is_signed = false);
+ _STLP_STATIC_CONSTANT(bool, is_integer = false);
+ _STLP_STATIC_CONSTANT(bool, is_exact = false);
+ _STLP_STATIC_CONSTANT(bool, has_infinity = false);
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = false);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = false);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = false);
+ _STLP_STATIC_CONSTANT(bool, traps = false);
+ _STLP_STATIC_CONSTANT(bool, tinyness_before = false);
+
+ static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); }
+
+ static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); }
+};
+
+// Base class for integers.
+
+#ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
+# ifdef _STLP_LONG_LONG
+# define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG
+# define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG
+# else
+# define _STLP_LIMITS_MIN_TYPE long
+# define _STLP_LIMITS_MAX_TYPE unsigned long
+# endif
+#else
+# define _STLP_LIMITS_MIN_TYPE _Int
+# define _STLP_LIMITS_MAX_TYPE _Int
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+template <class _Int,
+ _STLP_LIMITS_MIN_TYPE __imin,
+ _STLP_LIMITS_MAX_TYPE __imax,
+ int __idigits, bool __ismod>
+class _Integer_limits : public _Numeric_limits_base<_Int> {
+public:
+
+ static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; }
+ static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; }
+
+ _STLP_STATIC_CONSTANT(int, digits = (__idigits < 0) ? ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) : (__idigits));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = (__imin != 0));
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = __ismod);
+};
+
+// Base class for floating-point numbers.
+template <class __number,
+ int __Digits, int __Digits10,
+ int __MinExp, int __MaxExp,
+ int __MinExp10, int __MaxExp10,
+ bool __IsIEC559,
+ float_denorm_style __DenormStyle,
+ float_round_style __RoundStyle>
+class _Floating_limits : public _Numeric_limits_base<__number> {
+public:
+
+ _STLP_STATIC_CONSTANT(int, digits = __Digits);
+ _STLP_STATIC_CONSTANT(int, digits10 = __Digits10);
+ _STLP_STATIC_CONSTANT(int, radix = FLT_RADIX);
+ _STLP_STATIC_CONSTANT(int, min_exponent = __MinExp);
+ _STLP_STATIC_CONSTANT(int, max_exponent = __MaxExp);
+ _STLP_STATIC_CONSTANT(int, min_exponent10 = __MinExp10);
+ _STLP_STATIC_CONSTANT(int, max_exponent10 = __MaxExp10);
+
+ _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = __DenormStyle);
+ _STLP_STATIC_CONSTANT(float_round_style, round_style = __RoundStyle);
+
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = true);
+
+ _STLP_STATIC_CONSTANT(bool, has_infinity = true);
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC > 1300)) && \
+ (!defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)) && \
+ (!defined (_CRAY) || defined (_CRAYIEEE))
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = true);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = true);
+#else
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+#endif
+
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = __IsIEC559 && has_infinity && has_quiet_NaN && has_signaling_NaN && (has_denorm == denorm_present));
+ _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, traps = true);
+ _STLP_STATIC_CONSTANT(bool, tinyness_before = false);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Class numeric_limits
+
+// The unspecialized class.
+
+template<class _Tp>
+class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {};
+
+// Specializations for all built-in integral types.
+
+#if !defined (_STLP_NO_BOOL)
+_STLP_TEMPLATE_NULL
+class numeric_limits<bool>
+ : public _STLP_PRIV _Integer_limits<bool, false, true, 1, false>
+{};
+#endif /* _STLP_NO_BOOL */
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<char>
+ : public _STLP_PRIV _Integer_limits<char, CHAR_MIN, CHAR_MAX, -1, true>
+{};
+
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_TEMPLATE_NULL
+class numeric_limits<signed char>
+ : public _STLP_PRIV _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX, -1, true>
+{};
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned char>
+ : public _STLP_PRIV _Integer_limits<unsigned char, 0, UCHAR_MAX, -1, true>
+{};
+
+#if !(defined (_STLP_NO_WCHAR_T) || defined (_STLP_WCHAR_T_IS_USHORT))
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<wchar_t>
+ : public _STLP_PRIV _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true>
+{};
+
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<short>
+ : public _STLP_PRIV _Integer_limits<short, SHRT_MIN, SHRT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned short>
+ : public _STLP_PRIV _Integer_limits<unsigned short, 0, USHRT_MAX, -1, true>
+{};
+
+#if defined (__xlC__) && (__xlC__ == 0x500)
+# undef INT_MIN
+# define INT_MIN -2147483648
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<int>
+ : public _STLP_PRIV _Integer_limits<int, INT_MIN, INT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned int>
+ : public _STLP_PRIV _Integer_limits<unsigned int, 0, UINT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<long>
+ : public _STLP_PRIV _Integer_limits<long, LONG_MIN, LONG_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned long>
+ : public _STLP_PRIV _Integer_limits<unsigned long, 0, ULONG_MAX, -1, true>
+{};
+
+#if defined (_STLP_LONG_LONG)
+
+# if defined (_STLP_MSVC) || defined (__BORLANDC__)
+# define LONGLONG_MAX 0x7fffffffffffffffi64
+# define LONGLONG_MIN (-LONGLONG_MAX-1i64)
+# define ULONGLONG_MAX 0xffffffffffffffffUi64
+# else
+# ifndef LONGLONG_MAX
+# define LONGLONG_MAX 0x7fffffffffffffffLL
+# endif
+# ifndef LONGLONG_MIN
+# define LONGLONG_MIN (-LONGLONG_MAX-1LL)
+# endif
+# ifndef ULONGLONG_MAX
+# define ULONGLONG_MAX 0xffffffffffffffffULL
+# endif
+# endif
+
+# if !defined (__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 3)
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<_STLP_LONG_LONG>
+ : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned _STLP_LONG_LONG>
+ : public _STLP_PRIV _Integer_limits<unsigned _STLP_LONG_LONG, 0, ULONGLONG_MAX, -1, true>
+{};
+# else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */
+/*
+ newest gcc has new mangling scheme, that has problem
+ with generating name [instantiated] of template specialization like
+ _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
+ ~~~~~~~~~~~~ ~~~~~~~~~~~~
+ Below is code that solve this problem.
+ - ptr
+ */
+_STLP_TEMPLATE_NULL
+class numeric_limits<_STLP_LONG_LONG>
+ : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> {
+public:
+
+ static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; }
+ static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; }
+
+ _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = true);
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = true);
+};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned _STLP_LONG_LONG>
+ : public _STLP_PRIV _Numeric_limits_base<unsigned _STLP_LONG_LONG> {
+public:
+
+ static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; }
+ static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; }
+
+ _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = false);
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = true);
+};
+
+# endif /* __GNUC__ > 2000-11-01 */
+
+#endif /* _STLP_LONG_LONG */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Specializations for all built-in floating-point types.
+template <class __dummy>
+class _LimG {
+public:
+ static float _STLP_CALL get_F_inf();
+ static float _STLP_CALL get_F_qNaN();
+ static float _STLP_CALL get_F_sNaN();
+ static float _STLP_CALL get_F_denormMin();
+ static double _STLP_CALL get_D_inf();
+ static double _STLP_CALL get_D_qNaN();
+ static double _STLP_CALL get_D_sNaN();
+ static double _STLP_CALL get_D_denormMin();
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ static long double _STLP_CALL get_LD_inf();
+ static long double _STLP_CALL get_LD_qNaN();
+ static long double _STLP_CALL get_LD_sNaN();
+ static long double _STLP_CALL get_LD_denormMin();
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>;
+#endif
+
+#if defined (__GNUC__)
+# if defined (__FLT_DENORM_MIN__)
+# define _STLP_FLT_DENORM_MIN __FLT_DENORM_MIN__
+# else
+# define _STLP_FLT_DENORM_STYLE denorm_absent
+# endif
+# if defined (__DBL_DENORM_MIN__)
+# define _STLP_DBL_DENORM_MIN __DBL_DENORM_MIN__
+# else
+# define _STLP_DBL_DENORM_STYLE denorm_absent
+# endif
+# if defined (__LDBL_DENORM_MIN__)
+# define _STLP_LDBL_DENORM_MIN __LDBL_DENORM_MIN__
+# else
+# define _STLP_LDBL_DENORM_STYLE denorm_absent
+# endif
+#endif
+
+/* If compiler do not expose thanks to some macro its status regarding
+ * denormalized floating point numbers, we consider that denormalization
+ * is present. Unit tests will tell us if compiler do not support them. */
+#if !defined (_STLP_FLT_DENORM_STYLE)
+# define _STLP_FLT_DENORM_STYLE denorm_present
+#endif
+
+#if !defined (_STLP_DBL_DENORM_STYLE)
+# define _STLP_DBL_DENORM_STYLE denorm_present
+#endif
+
+#if !defined (_STLP_LDBL_DENORM_STYLE)
+# define _STLP_LDBL_DENORM_STYLE denorm_present
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<float>
+ : public _STLP_PRIV _Floating_limits<float,
+ FLT_MANT_DIG, // Binary digits of precision
+ FLT_DIG, // Decimal digits of precision
+ FLT_MIN_EXP, // Minimum exponent
+ FLT_MAX_EXP, // Maximum exponent
+ FLT_MIN_10_EXP, // Minimum base 10 exponent
+ FLT_MAX_10_EXP, // Maximum base 10 exponent
+ true,
+ _STLP_FLT_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; }
+ static float _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_FLT_DENORM_MIN)
+ { return _STLP_FLT_DENORM_MIN; }
+#else
+ { return _STLP_FLT_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_F_denormMin() : FLT_MIN; }
+#endif
+ static float (_STLP_CALL max) () _STLP_NOTHROW { return FLT_MAX; }
+ static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; }
+ static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps.
+ static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_inf(); }
+ static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_qNaN(); }
+ static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_sNaN(); }
+};
+
+#undef _STLP_FLT_DENORM_MIN
+#undef _STLP_FLT_DNORM_STYLE
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<double>
+ : public _STLP_PRIV _Floating_limits<double,
+ DBL_MANT_DIG, // Binary digits of precision
+ DBL_DIG, // Decimal digits of precision
+ DBL_MIN_EXP, // Minimum exponent
+ DBL_MAX_EXP, // Maximum exponent
+ DBL_MIN_10_EXP, // Minimum base 10 exponent
+ DBL_MAX_10_EXP, // Maximum base 10 exponent
+ true,
+ _STLP_DBL_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; }
+ static double _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_DBL_DENORM_MIN)
+ { return _STLP_DBL_DENORM_MIN; }
+#else
+ { return _STLP_DBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_D_denormMin() : DBL_MIN; }
+#endif
+ static double (_STLP_CALL max)() _STLP_NOTHROW { return DBL_MAX; }
+ static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; }
+ static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps.
+ static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
+ static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
+ static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
+};
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<long double>
+ : public _STLP_PRIV _Floating_limits<long double,
+ LDBL_MANT_DIG, // Binary digits of precision
+ LDBL_DIG, // Decimal digits of precision
+ LDBL_MIN_EXP, // Minimum exponent
+ LDBL_MAX_EXP, // Maximum exponent
+ LDBL_MIN_10_EXP,// Minimum base 10 exponent
+ LDBL_MAX_10_EXP,// Maximum base 10 exponent
+ false, // do not conform to iec559
+ _STLP_LDBL_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static long double (_STLP_CALL min) () _STLP_NOTHROW { return LDBL_MIN; }
+ static long double _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_LDBL_DENORM_MIN)
+ { return _STLP_LDBL_DENORM_MIN; }
+#else
+ { return _STLP_LDBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_LD_denormMin() : LDBL_MIN; }
+#endif
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = false);
+ static long double (_STLP_CALL max) () _STLP_NOTHROW { return LDBL_MAX; }
+ static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; }
+ static long double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5l; }
+ static long double _STLP_CALL infinity() _STLP_NOTHROW
+ //For MSVC, long double is nothing more than an alias for double.
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_inf(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
+#endif
+ static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_qNaN(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
+#endif
+ static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_sNaN(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
+#endif
+};
+
+#endif
+
+// We write special values (Inf and NaN) as bit patterns and
+// cast the the appropriate floating-point types.
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_limits.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_list.c b/build/stlport/stlport/stl/_list.c
new file mode 100644
index 000000000..86e420b72
--- /dev/null
+++ b/build/stlport/stlport/stl/_list.c
@@ -0,0 +1,250 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_LIST_C
+#define _STLP_LIST_C
+
+#ifndef _STLP_INTERNAL_LIST_H
+# include <stl/_list.h>
+#endif
+
+#ifndef _STLP_CARRAY_H
+# include <stl/_carray.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+template <class _Dummy>
+void _STLP_CALL
+_List_global<_Dummy>::_Transfer(_List_node_base* __position,
+ _List_node_base* __first, _List_node_base* __last) {
+ if (__position != __last) {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = __position;
+ __first->_M_prev->_M_next = __last;
+ __position->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _Node_base* __tmp = __position->_M_prev;
+ __position->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+}
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+template <class _Tp, class _Alloc>
+void _List_base<_Tp,_Alloc>::clear() {
+ _Node* __cur = __STATIC_CAST(_Node*, _M_node._M_data._M_next);
+ while (
+#if defined (__BORLANDC__) // runtime error
+ __cur &&
+#endif
+ __cur != &(_M_node._M_data)) {
+ _Node* __tmp = __cur;
+ __cur = __STATIC_CAST(_Node*, __cur->_M_next);
+ _STLP_STD::_Destroy(&__tmp->_M_data);
+ this->_M_node.deallocate(__tmp, 1);
+ }
+ _M_node._M_data._M_next = &_M_node._M_data;
+ _M_node._M_data._M_prev = &_M_node._M_data;
+}
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define size_type size_t
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define list _STLP_PTR_IMPL_NAME(list)
+#elif defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) {
+ iterator __i = begin();
+ size_type __len = 0;
+ for ( ; __i != end() && __len < __new_size; ++__i, ++__len);
+
+ if (__len == __new_size)
+ erase(__i, end());
+ else // __i == end()
+ insert(end(), __new_size - __len, __x);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) {
+ if (this != &__x) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ const_iterator __first2 = __x.begin();
+ const_iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ *__first1++ = *__first2++;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) {
+ iterator __i = begin();
+ for ( ; __i != end() && __n > 0; ++__i, --__n)
+ *__i = __val;
+ if (__n > 0)
+ insert(end(), __n, __val);
+ else
+ erase(__i, end());
+}
+
+#if !defined (list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc, class _Predicate>
+void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first = __that.begin();
+ _Literator __last = __that.end();
+ while (__first != __last) {
+ _Literator __next = __first;
+ ++__next;
+ if (__pred(*__first)) __that.erase(__first);
+ __first = __next;
+ }
+}
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first = __that.begin();
+ _Literator __last = __that.end();
+ if (__first == __last) return;
+ _Literator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next))
+ __that.erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first1 = __that.begin();
+ _Literator __last1 = __that.end();
+ _Literator __first2 = __x.begin();
+ _Literator __last2 = __x.end();
+ if (__that.get_allocator() == __x.get_allocator()) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _Literator __next = __first2;
+ _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ }
+ if (__first2 != __last2)
+ _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node);
+ }
+ else {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first1 = __that.insert(__first1, *__first2);
+ }
+ else
+ ++__first1;
+ }
+ if (__first2 != __last2) {
+ __that.insert(__first1, __first2, __last2);
+ }
+ __x.clear();
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) {
+ // Do nothing if the list has length 0 or 1.
+ if (__that._M_node._M_data._M_next == &__that._M_node._M_data ||
+ __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data)
+ return;
+
+ list<_Tp, _Alloc> __carry(__that.get_allocator());
+ const int NB = 64;
+ _STLP_PRIV _CArray<list<_Tp, _Alloc>, NB> __counter(__carry);
+ int __fill = 0;
+ while (!__that.empty()) {
+ __carry.splice(__carry.begin(), __that, __that.begin());
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty()) {
+ _S_merge(__counter[__i], __carry, __comp);
+ __carry.swap(__counter[__i++]);
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill) {
+ ++__fill;
+ if (__fill >= NB) {
+ //Looks like the list has too many elements to be sorted with this algorithm:
+ __stl_throw_overflow_error("list::sort");
+ }
+ }
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ _S_merge(__counter[__i], __counter[__i - 1], __comp);
+ __that.swap(__counter[__fill - 1]);
+}
+
+#if defined (list)
+# undef list
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIST_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_list.h b/build/stlport/stlport/stl/_list.h
new file mode 100644
index 000000000..6cd3f2b1a
--- /dev/null
+++ b/build/stlport/stlport/stl/_list.h
@@ -0,0 +1,742 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_LIST_IMPL_H
+#define _STLP_INTERNAL_LIST_IMPL_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _List_node_base {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+};
+
+template <class _Dummy>
+class _List_global {
+public:
+ typedef _List_node_base _Node_base;
+ static void _STLP_CALL _Transfer(_Node_base* __pos,
+ _Node_base* __first, _Node_base* __last);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
+#endif
+typedef _List_global<bool> _List_global_inst;
+
+template <class _Tp>
+class _List_node : public _List_node_base {
+public:
+ _Tp _M_data;
+ __TRIVIAL_STUFF(_List_node)
+};
+
+struct _List_iterator_base {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef bidirectional_iterator_tag iterator_category;
+
+ _List_node_base* _M_node;
+
+ _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
+
+ void _M_incr() { _M_node = _M_node->_M_next; }
+ void _M_decr() { _M_node = _M_node->_M_prev; }
+};
+
+
+template<class _Tp, class _Traits>
+struct _List_iterator : public _List_iterator_base {
+ typedef _Tp value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+
+ typedef _List_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _List_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _List_iterator<_Tp, _ConstTraits> const_iterator;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _List_node<_Tp> _Node;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {}
+ _List_iterator() : _List_iterator_base(0) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
+
+ reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ this->_M_incr();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ this->_M_incr();
+ return __tmp;
+ }
+ _Self& operator--() {
+ this->_M_decr();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ this->_M_decr();
+ return __tmp;
+ }
+ bool operator==(const_iterator __y ) const {
+ return this->_M_node == __y._M_node;
+ }
+ bool operator!=(const_iterator __y ) const {
+ return this->_M_node != __y._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; }
+inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();}
+inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// Base class that encapsulates details of allocators and helps
+// to simplify EH
+
+template <class _Tp, class _Alloc>
+class _List_base {
+protected:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _List_node_base _Node_base;
+ typedef _List_node<_Tp> _Node;
+ typedef _List_base<_Tp, _Alloc> _Self;
+ typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type;
+public:
+ typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy;
+ typedef _Alloc allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); }
+
+ _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base())
+ { _M_empty_initialize(); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _List_base(__move_source<_Self> src) :
+ _M_node(__move_source<_AllocProxy>(src.get()._M_node)) {
+ if (src.get().empty())
+ //We force this to empty.
+ _M_empty_initialize();
+ else {
+ src.get()._M_empty_initialize();
+ _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data;
+ }
+ }
+#endif
+
+ ~_List_base()
+ { clear(); }
+
+ void clear();
+ bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; }
+
+ void _M_empty_initialize() {
+ _M_node._M_data._M_next = &_M_node._M_data;
+ _M_node._M_data._M_prev = _M_node._M_data._M_next;
+ }
+
+public:
+ _AllocProxy _M_node;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define list _STLP_PTR_IMPL_NAME(list)
+#elif defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class list;
+
+#if !defined (list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// helper functions to reduce code duplication
+template <class _Tp, class _Alloc, class _Predicate>
+void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
+
+#if !defined (list)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+class list : public _STLP_PRIV _List_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
+ , public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base;
+ typedef list<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV _List_node<_Tp> _Node;
+ typedef _STLP_PRIV _List_node_base _Node_base;
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+
+public:
+ typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+protected:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node_base* _M_create_node(const_reference __x = value_type()) {
+#else
+ _Node_base* _M_create_node(const_reference __x) {
+#endif
+ _Node* __p = this->_M_node.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__p->_M_data, __x);
+ }
+ _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
+ return __p;
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node_base* _M_create_node() {
+ _Node* __p = this->_M_node.allocate(1);
+ _STLP_TRY {
+ _STLP_STD::_Construct(&__p->_M_data);
+ }
+ _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
+ return __p;
+ }
+#endif
+
+public:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+ const allocator_type& __a = allocator_type())
+#else
+ explicit list(size_type __n)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ list(size_type __n, const_reference __val)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { this->insert(begin(), __n, __val); }
+ list(size_type __n, const_reference __val, const allocator_type& __a)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { this->insert(begin(), __n, __val); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because insert does all of
+ // that anyway.
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { _M_insert(begin(), __first, __last); }
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ list(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(const allocator_type& __a = allocator_type())
+#else
+ list()
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {}
+ list(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {}
+
+ list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator())
+ { _M_insert(begin(), __x.begin(), __x.end()); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ list(__move_source<_Self> src)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ ~list() {}
+
+ _Self& operator = (const _Self& __x);
+
+ iterator begin() { return iterator(this->_M_node._M_data._M_next); }
+ const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); }
+
+ iterator end() { return iterator(&this->_M_node._M_data); }
+ const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const {
+ size_type __result = _STLP_STD::distance(begin(), end());
+ return __result;
+ }
+ size_type max_size() const { return size_type(-1); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(--end()); }
+ const_reference back() const { return *(--end()); }
+
+private:
+ void _M_swap_aux(_Self& __x) {
+ __x._M_node._M_swap_alloc(this->_M_node);
+ __x._M_node._M_data._M_next = this->_M_node._M_data._M_next;
+ __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data;
+ __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev;
+ __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data;
+ this->_M_empty_initialize();
+ }
+
+public:
+ void swap(_Self& __x) {
+ if (__x.empty()) {
+ if (this->empty()) {
+ return;
+ }
+ this->_M_swap_aux(__x);
+ } else if (this->empty()) {
+ __x._M_swap_aux(*this);
+ } else {
+ this->_M_node.swap(__x._M_node);
+ _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next);
+ _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev);
+ }
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const_reference __x = value_type())
+#else
+ iterator insert(iterator __pos, const_reference __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ {
+ _Node_base* __tmp = _M_create_node(__x);
+ _Node_base* __n = __pos._M_node;
+ _Node_base* __p = __n->_M_prev;
+ __tmp->_M_next = __n;
+ __tmp->_M_prev = __p;
+ __p->_M_next = __tmp;
+ __n->_M_prev = __tmp;
+ return iterator(__tmp);
+ }
+
+private:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template<class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) {
+ for (; __first != __last; ++__first)
+ insert(__pos, *__first);
+ }
+ void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary list to avoid the auto reference troubles (infinite loop)
+ for (; __first != __last; ++__first)
+ insert(__pos, *__first);
+ }
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_splice_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+private:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template<class _Integer>
+ void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+ template <class _InputIter>
+ void _M_splice_insert_dispatch(iterator __pos,
+ _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type* __first, const value_type* __last) {
+ _Self __tmp(__first, __last, this->get_allocator());
+ _STLP_ASSERT(__tmp.get_allocator() == this->get_allocator())
+ splice(__pos, __tmp);
+ }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary list to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(__pos, __tmp);
+ }
+
+public:
+ void insert(iterator __pos, size_type __n, const_reference __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+private:
+ void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) {
+ for ( ; __n > 0; --__n)
+ insert(__pos, __x);
+ }
+
+public:
+ void push_front(const_reference __x) { insert(begin(), __x); }
+ void push_back (const_reference __x) { insert(end(), __x); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ void push_front() {insert(begin());}
+ void push_back() {insert(end());}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ iterator erase(iterator __pos) {
+ _Node_base* __next_node = __pos._M_node->_M_next;
+ _Node_base* __prev_node = __pos._M_node->_M_prev;
+ _Node* __n = __STATIC_CAST(_Node*, __pos._M_node);
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ _STLP_STD::_Destroy(&__n->_M_data);
+ this->_M_node.deallocate(__n, 1);
+ return iterator(__next_node);
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ while (__first != __last)
+ erase(__first++);
+ return __last;
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const_reference __x = value_type());
+#else
+ void resize(size_type __new_size, const_reference __x);
+ void resize(size_type __new_size)
+ { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void pop_front() { erase(begin()); }
+ void pop_back() {
+ iterator __tmp = end();
+ erase(--__tmp);
+ }
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); }
+
+ void _M_fill_assign(size_type __n, const_reference __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_assign(__n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
+ const __false_type& /*_IsIntegral*/) {
+#else
+ void assign(const value_type *__first2, const value_type *__last2) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ void assign(const_iterator __first2, const_iterator __last2) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+
+public:
+ void splice(iterator __pos, _Self& __x) {
+ if (!__x.empty()) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node);
+ }
+ else {
+ insert(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+ }
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ iterator __j = __i;
+ ++__j;
+ if (__pos == __i || __pos == __j) return;
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node);
+ }
+ else {
+ insert(__pos, *__i);
+ __x.erase(__i);
+ }
+ }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ if (__first != __last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node);
+ }
+ else {
+ insert(__pos, __first, __last);
+ __x.erase(__first, __last);
+ }
+ }
+ }
+
+ void remove(const_reference __val) {
+ iterator __first = begin();
+ iterator __last = end();
+ while (__first != __last) {
+ iterator __next = __first;
+ ++__next;
+ if (__val == *__first) erase(__first);
+ __first = __next;
+ }
+ }
+
+ void unique()
+ { _STLP_PRIV _S_unique(*this, equal_to<value_type>()); }
+
+ void merge(_Self& __x)
+ { _STLP_PRIV _S_merge(*this, __x, less<value_type>()); }
+
+ void reverse() {
+ _Node_base* __p = &this->_M_node._M_data;
+ _Node_base* __tmp = __p;
+ do {
+ _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
+ __tmp = __tmp->_M_prev; // Old next node is now prev.
+ } while (__tmp != __p);
+ }
+
+ void sort()
+ { _STLP_PRIV _S_sort(*this, less<value_type>()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _STLP_PRIV _S_remove_if(*this, __pred); }
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __binary_pred)
+ { _STLP_PRIV _S_unique(*this, __binary_pred); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x,
+ _StrictWeakOrdering __comp) {
+ _STLP_PRIV _S_merge(*this, __x, __comp);
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _STLP_PRIV _S_sort(*this, __comp); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (list)
+# undef list
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_list.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_list.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_list.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp, class _Alloc>
+_STLP_INLINE_LOOP bool _STLP_CALL
+operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) {
+ typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = __x.end();
+ const_iterator __end2 = __y.end();
+
+ const_iterator __i1 = __x.begin();
+ const_iterator __i2 = __y.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+}
+
+#define _STLP_EQUAL_OPERATOR_SPECIALIZED
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<list<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_LIST_IMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_locale.h b/build/stlport/stlport/stl/_locale.h
new file mode 100644
index 000000000..93faed934
--- /dev/null
+++ b/build/stlport/stlport/stl/_locale.h
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+#define _STLP_INTERNAL_LOCALE_H
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+#endif
+
+#include <stl/_string.h>
+
+#include <stl/_facets_fwd.h>
+
+_STLP_BEGIN_NAMESPACE
+
+class _Locale_impl; // Forward declaration of opaque type.
+class locale;
+
+template <class _CharT, class _Traits, class _Alloc>
+bool __locale_do_operator_call(const locale& __loc,
+ const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y);
+
+_STLP_DECLSPEC _Locale_impl * _STLP_CALL _get_Locale_impl( _Locale_impl *locimpl );
+_STLP_DECLSPEC _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl *locimpl );
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Facet>
+bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW;
+
+template <class _Facet>
+_Facet* _UseFacet(const locale& __loc, const _Facet* __facet);
+
+template <class _Facet>
+void _InsertFacet(locale& __loc, _Facet* __facet);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# define locale _STLP_NO_MEM_T_NAME(loc)
+#endif
+
+class _STLP_CLASS_DECLSPEC locale {
+public:
+ // types:
+ class _STLP_CLASS_DECLSPEC facet : protected _Refcount_Base {
+ protected:
+ /* Here we filter __init_count user value to 0 or 1 because __init_count is a
+ * size_t instance and _Refcount_Base use __stl_atomic_t instances that might
+ * have lower sizeof and generate roll issues. 1 is enough to keep the facet
+ * alive when required. */
+ explicit facet(size_t __init_count = 0) : _Refcount_Base( __init_count == 0 ? 0 : 1 ) {}
+ virtual ~facet();
+ friend class locale;
+ friend class _Locale_impl;
+ friend facet * _STLP_CALL _get_facet( facet * );
+ friend void _STLP_CALL _release_facet( facet *& );
+
+ private: // Invalidate assignment and copying.
+ facet(const facet& ) /* : _Refcount_Base(1) {} */;
+ void operator=(const facet&);
+ };
+
+#if defined (__MVS__) || defined (__OS400__)
+ struct
+#else
+ class
+#endif
+ _STLP_CLASS_DECLSPEC id {
+ public:
+ size_t _M_index;
+ static size_t _S_max;
+ };
+
+ typedef int category;
+ _STLP_STATIC_CONSTANT(category, none = 0x000);
+ _STLP_STATIC_CONSTANT(category, collate = 0x010);
+ _STLP_STATIC_CONSTANT(category, ctype = 0x020);
+ _STLP_STATIC_CONSTANT(category, monetary = 0x040);
+ _STLP_STATIC_CONSTANT(category, numeric = 0x100);
+ _STLP_STATIC_CONSTANT(category, time = 0x200);
+ _STLP_STATIC_CONSTANT(category, messages = 0x400);
+ _STLP_STATIC_CONSTANT(category, all = collate | ctype | monetary | numeric | time | messages);
+
+ // construct/copy/destroy:
+ locale() _STLP_NOTHROW;
+ locale(const locale&) _STLP_NOTHROW;
+ explicit locale(const char *);
+ locale(const locale&, const char*, category);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Facet>
+ locale(const locale& __loc, _Facet* __f) {
+ if ( __f != 0 ) {
+ this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) );
+ _STLP_PRIV _InsertFacet(*this, __f);
+ } else {
+ this->_M_impl = _get_Locale_impl( __loc._M_impl );
+ }
+ }
+#endif
+
+protected:
+ // those are for internal use
+ locale(_Locale_impl*);
+
+public:
+ locale(const locale&, const locale&, category);
+ const locale& operator=(const locale&) _STLP_NOTHROW;
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+protected:
+#endif
+ ~locale() _STLP_NOTHROW;
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && \
+ !defined(_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Facet>
+ locale combine(const locale& __loc) const {
+ _Facet *__facet = 0;
+ if (!_STLP_PRIV _HasFacet(__loc, __facet))
+ _M_throw_on_combine_error(__loc.name());
+
+ return locale(*this, _STLP_PRIV _UseFacet(__loc, __facet));
+ }
+#endif
+
+ // locale operations:
+ string name() const;
+
+ bool operator==(const locale&) const;
+ bool operator!=(const locale&) const;
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301)
+ bool operator()(const string& __x, const string& __y) const;
+# ifndef _STLP_NO_WCHAR_T
+ bool operator()(const wstring& __x, const wstring& __y) const;
+# endif
+#elif !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _CharT, class _Traits, class _Alloc>
+ bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) const
+ { return __locale_do_operator_call(*this, __x, __y); }
+#endif
+
+ // global locale objects:
+#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ static locale _STLP_CALL global(const locale&);
+#else
+ static _Locale_impl* _STLP_CALL global(const locale&);
+#endif
+ static const locale& _STLP_CALL classic();
+
+//protected: // Helper functions for locale globals.
+ facet* _M_get_facet(const id&) const;
+ // same, but throws
+ facet* _M_use_facet(const id&) const;
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_combine_error(const string& name);
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_null_name();
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_creation_failure(int __err_code,
+ const char* name, const char* facet);
+
+//protected: // More helper functions.
+ void _M_insert(facet* __f, id& __id);
+
+ // friends:
+ friend class _Locale_impl;
+
+protected: // Data members
+ _Locale_impl* _M_impl;
+ _Locale_impl* _M_get_impl() const { return _M_impl; }
+};
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# undef locale
+# define _Locale _STLP_NO_MEM_T_NAME(loc)
+
+class locale : public _Locale {
+public:
+
+ // construct/copy/destroy:
+ locale() _STLP_NOTHROW {
+#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ _STLP_CHECK_RUNTIME_COMPATIBILITY();
+#endif
+ }
+ locale(const locale& __loc) _STLP_NOTHROW : _Locale(__loc) {}
+ explicit locale(const char *__str) : _Locale(__str) {}
+ locale(const locale& __loc, const char* __str, category __cat)
+ : _Locale(__loc, __str, __cat) {}
+
+ template <class _Facet>
+ locale(const locale& __loc, _Facet* __f)
+ : _Locale(__f != 0 ? _copy_Nameless_Locale_impl(__loc._M_impl) : __loc._M_impl) {
+ if ( __f != 0 ) {
+ _STLP_PRIV _InsertFacet(*this, __f);
+ }
+ }
+
+private:
+ // those are for internal use
+ locale(_Locale_impl* __impl) : _Locale(__impl) {}
+ locale(const _Locale& __loc) : _Locale(__loc) {}
+
+public:
+
+ locale(const locale& __loc1, const locale& __loc2, category __cat)
+ : _Locale(__loc1, __loc2, __cat) {}
+
+ const locale& operator=(const locale& __loc) _STLP_NOTHROW {
+ _Locale::operator=(__loc);
+ return *this;
+ }
+
+ template <class _Facet>
+ locale combine(const locale& __loc) const {
+ _Facet *__facet = 0;
+ if (!_STLP_PRIV _HasFacet(__loc, __facet))
+ _M_throw_on_combine_error(__loc.name());
+
+ return locale(*this, _STLP_PRIV _UseFacet(__loc, __facet));
+ }
+
+ // locale operations:
+ bool operator==(const locale& __loc) const { return _Locale::operator==(__loc); }
+ bool operator!=(const locale& __loc) const { return _Locale::operator!=(__loc); }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) const
+ { return __locale_do_operator_call(*this, __x, __y); }
+
+ // global locale objects:
+ static locale _STLP_CALL global(const locale& __loc) {
+ return _Locale::global(__loc);
+ }
+ static const locale& _STLP_CALL classic() {
+ return __STATIC_CAST(const locale&, _Locale::classic());
+ }
+
+ // friends:
+ friend class _Locale_impl;
+};
+
+# undef _Locale
+#endif
+
+//----------------------------------------------------------------------
+// locale globals
+
+template <class _Facet>
+inline const _Facet&
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+_Use_facet<_Facet>::operator *() const
+#else
+use_facet(const locale& __loc)
+#endif
+{
+ _Facet *__facet = 0;
+ return *(_STLP_PRIV _UseFacet(__loc, __facet));
+}
+
+template <class _Facet>
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+struct has_facet {
+ const locale& __loc;
+ has_facet(const locale& __p_loc) : __loc(__p_loc) {}
+ operator bool() const _STLP_NOTHROW
+#else
+inline bool has_facet(const locale& __loc) _STLP_NOTHROW
+#endif
+{
+ _Facet *__facet = 0;
+ return _STLP_PRIV _HasFacet(__loc, __facet);
+}
+
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+}; // close class definition
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/* _GetFacetId is a helper function that allow delaying access to
+ * facet id static instance in the library source code to avoid
+ * the other static instances that many compilers are generating
+ * in all dynamic library or executable when instanciating facet
+ * template class.
+ */
+template <class _Facet>
+inline locale::id& _GetFacetId(const _Facet*)
+{ return _Facet::id; }
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<char, istreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<char, ostreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<char, istreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<char, ostreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<char, istreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<char, ostreambuf_iterator<char, char_traits<char> > >*);
+
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+#endif
+
+template <class _Facet>
+inline bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW
+{ return (__loc._M_get_facet(_GetFacetId(__facet)) != 0); }
+
+template <class _Facet>
+inline _Facet* _UseFacet(const locale& __loc, const _Facet* __facet)
+{ return __STATIC_CAST(_Facet*, __loc._M_use_facet(_GetFacetId(__facet))); }
+
+template <class _Facet>
+inline void _InsertFacet(locale& __loc, _Facet* __facet)
+{ __loc._M_insert(__facet, _GetFacetId(__facet)); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_LOCALE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_map.h b/build/stlport/stlport/stl/_map.h
new file mode 100644
index 000000000..bf46a5ddd
--- /dev/null
+++ b/build/stlport/stlport/stl/_map.h
@@ -0,0 +1,435 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_MAP_H
+#define _STLP_INTERNAL_MAP_H
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<map<_Key, _Tp, _Compare, _Alloc> >
+#endif
+{
+ typedef map<_Key, _Tp, _Compare, _Alloc> _Self;
+public:
+
+// typedefs:
+
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+
+ class value_compare
+ : public binary_function<value_type, value_type, bool> {
+ friend class map<_Key,_Tp,_Compare,_Alloc>;
+ protected :
+ //c is a Standard name (23.3.1), do no make it STLport naming convention compliant.
+ _Compare comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+protected:
+ typedef _STLP_PRIV _MapTraitsT<value_type> _MapTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_SELECT1ST(value_type, _Key),
+ _MapTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing map
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ // allocation/deallocation
+ map() : _M_t(_Compare(), allocator_type()) {}
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit map(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+#else
+ explicit map(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ explicit map(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
+# endif
+
+#else
+ map(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ map(const value_type* __first,
+ const value_type* __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+ map(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ map(const_iterator __first, const_iterator __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ map(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ map(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __k) {
+ iterator __i = lower_bound(__k);
+ // __i->first is greater than or equivalent to __k.
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ __i = insert(__i, value_type(__k, _STLP_DEFAULT_CONSTRUCTED(_Tp)));
+ return (*__i).second;
+ }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x)
+ { return _M_t.insert_unique(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_unique(__pos, __x); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_unique(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void erase(iterator __pos) { _M_t.erase(__pos); }
+ size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
+ void clear() { _M_t.clear(); }
+
+ // map operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range_unique(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range_unique(__x); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultimapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multimap<_Key, _Tp, _Compare, _Alloc> >
+#endif
+{
+ typedef multimap<_Key, _Tp, _Compare, _Alloc> _Self;
+public:
+
+// typedefs:
+
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+
+ class value_compare : public binary_function<value_type, value_type, bool> {
+ friend class multimap<_Key,_Tp,_Compare,_Alloc>;
+ protected:
+ //comp is a Standard name (23.3.2), do no make it STLport naming convention compliant.
+ _Compare comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultimapTraitsT<value_type> _MultimapTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_SELECT1ST(value_type, _Key),
+ _MultimapTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multimap
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ // allocation/deallocation
+ multimap() : _M_t(_Compare(), allocator_type()) { }
+ explicit multimap(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
+# endif
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#else
+ multimap(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+ multimap(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+
+ multimap(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+ multimap(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multimap(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ multimap(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
+ iterator insert(iterator __pos, const value_type& __x) { return _M_t.insert_equal(__pos, __x); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_equal(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase(__pos); }
+ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
+ void clear() { _M_t.clear(); }
+
+ // multimap operations:
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.count(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range(__x); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _Compare, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER map<_Key,_Tp,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER multimap<_Key,_Tp,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+struct __move_traits<map<_Key,_Tp,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename map<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
+{};
+
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+struct __move_traits<multimap<_Key,_Tp,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename multimap<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_mbstate_t.h b/build/stlport/stlport/stl/_mbstate_t.h
new file mode 100644
index 000000000..83f085e8d
--- /dev/null
+++ b/build/stlport/stlport/stl/_mbstate_t.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_MBSTATE_T
+#define _STLP_INTERNAL_MBSTATE_T
+
+#if (defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__hpux)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
+# define _STLP_CPP_MBSTATE_T /* mbstate_t defined in native <cwchar>, so not defined in C! */
+#endif
+
+#if defined (_STLP_NO_NATIVE_MBSTATE_T) || defined (_STLP_CPP_MBSTATE_T) && !defined (_MBSTATE_T)
+# define _STLP_USE_OWN_MBSTATE_T
+# define _MBSTATE_T
+#endif
+
+#if defined (_STLP_USE_OWN_MBSTATE_T)
+# if !defined (_STLP_CPP_MBSTATE_T) || !defined (__cplusplus) || !defined (_STLP_USE_NEW_C_HEADERS)
+# if !defined (__ANDROID__) /* mbstate_t conflicts with Android's definition */
+typedef int mbstate_t;
+# endif
+# endif
+
+# if !defined (_STLP_CPP_MBSTATE_T) && defined (__cplusplus) && defined (_STLP_USE_NAMESPACES)
+_STLP_BEGIN_NAMESPACE
+using ::mbstate_t;
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* _STLP_USE_OWN_MBSTATE_T */
+
+#endif /* _STLP_INTERNAL_MBSTATE_T */
diff --git a/build/stlport/stlport/stl/_messages_facets.h b/build/stlport/stlport/stl/_messages_facets.h
new file mode 100644
index 000000000..aca559657
--- /dev/null
+++ b/build/stlport/stlport/stl/_messages_facets.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_MESSAGES_H
+#define _STLP_INTERNAL_MESSAGES_H
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// messages facets
+
+class messages_base {
+ public:
+ typedef int catalog;
+};
+
+template <class _CharT> class messages {};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+class _Messages;
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
+public:
+ typedef messages_base::catalog catalog;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit messages(size_t __refs = 0);
+
+ catalog open(const string& __fn, const locale& __loc) const
+ { return do_open(__fn, __loc); }
+ string_type get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return do_get(__c, __set, __msgid, __dfault); }
+ inline void close(catalog __c) const
+ { do_close(__c); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~messages() {}
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const
+ { return -1; }
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return __dfault; }
+ virtual void do_close(catalog __c) const
+ {}
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
+public:
+ typedef messages_base::catalog catalog;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit messages(size_t __refs = 0);
+
+ inline catalog open(const string& __fn, const locale& __loc) const
+ { return do_open(__fn, __loc); }
+ inline string_type get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return do_get(__c, __set, __msgid, __dfault); }
+ inline void close(catalog __c) const
+ { do_close(__c); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~messages() {}
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const
+ { return -1; }
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return __dfault; }
+ virtual void do_close(catalog __c) const
+ {}
+};
+
+#endif
+
+template <class _CharT> class messages_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
+ friend class _Locale_impl;
+public:
+ typedef messages_base::catalog catalog;
+ typedef string string_type;
+
+ explicit messages_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~messages_byname();
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const;
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const;
+ virtual void do_close(catalog __c) const;
+
+private:
+ messages_byname(_Locale_messages*);
+ typedef messages_byname<char> _Self;
+ //explicitely defined as private to avoid warnings:
+ messages_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _STLP_PRIV _Messages* _M_impl;
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
+ friend class _Locale_impl;
+public:
+ typedef messages_base::catalog catalog;
+ typedef wstring string_type;
+
+ explicit messages_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~messages_byname();
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const;
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const;
+ virtual void do_close(catalog __c) const;
+
+private:
+ messages_byname(_Locale_messages*);
+ typedef messages_byname<wchar_t> _Self;
+ //explicitely defined as private to avoid warnings:
+ messages_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _STLP_PRIV _Messages* _M_impl;
+};
+#endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_MESSAGES_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_monetary.c b/build/stlport/stlport/stl/_monetary.c
new file mode 100644
index 000000000..3de937cbc
--- /dev/null
+++ b/build/stlport/stlport/stl/_monetary.c
@@ -0,0 +1,527 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_MONETARY_C
+#define _STLP_MONETARY_C
+
+# ifndef _STLP_INTERNAL_MONETARY_H
+# include <stl/_monetary.h>
+# endif
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _InputIterator>
+locale::id money_get<_CharT, _InputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+locale::id money_put<_CharT, _OutputIterator>::id;
+
+// money_get facets
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// helper functions for do_get
+template <class _InIt1, class _InIt2>
+pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last,
+ _InIt2 __str_first, _InIt2 __str_last) {
+ while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) {
+ ++__first;
+ ++__str_first;
+ }
+ return make_pair(__first, __str_first == __str_last);
+}
+
+template <class _InIt, class _OuIt, class _CharT>
+bool
+__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
+ const ctype<_CharT>& _c_type,
+ _CharT __point, int __frac_digits, _CharT __sep,
+ const string& __grouping, bool &__syntax_ok) {
+ if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
+ return false;
+
+ char __group_sizes[128];
+ char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
+ char __current_group_size = 0;
+
+ while (__first != __last) {
+ if (_c_type.is(ctype_base::digit, *__first)) {
+ ++__current_group_size;
+ *__out_ite++ = *__first++;
+ }
+ else if (__group_sizes_end) {
+ if (*__first == __sep) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ ++__first;
+ }
+ else break;
+ }
+ else
+ break;
+ }
+
+ if (__grouping.empty())
+ __syntax_ok = true;
+ else {
+ if (__group_sizes_end != __group_sizes)
+ *__group_sizes_end++ = __current_group_size;
+
+ __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size());
+
+ if (__first == __last || *__first != __point) {
+ for (int __digits = 0; __digits != __frac_digits; ++__digits)
+ *__out_ite++ = _CharT('0');
+ return true; // OK not to have decimal point
+ }
+ }
+
+ ++__first;
+
+ int __digits = 0;
+
+ while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
+ *__out_ite++ = *__first++;
+ ++__digits;
+ }
+
+ __syntax_ok = __syntax_ok && (__digits == __frac_digits);
+
+ return true;
+}
+
+
+template <class _CharT, class _InputIter, class _StrType>
+_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) {
+ if (__s == __end) {
+ __err |= ios_base::eofbit;
+ return __s;
+ }
+
+ typedef _CharT char_type;
+ typedef _StrType string_type;
+ typedef _InputIter iter_type;
+ typedef moneypunct<char_type, false> _Punct;
+ typedef moneypunct<char_type, true> _Punct_intl;
+ typedef ctype<char_type> _Ctype;
+
+ locale __loc = __str.getloc();
+ const _Punct& __punct = use_facet<_Punct>(__loc) ;
+ const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
+ const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
+
+ money_base::pattern __format = __intl ? __punct_intl.neg_format()
+ : __punct.neg_format();
+ string_type __ns = __intl ? __punct_intl.negative_sign()
+ : __punct.negative_sign();
+ string_type __ps = __intl ? __punct_intl.positive_sign()
+ : __punct.positive_sign();
+ int __i;
+ bool __symbol_required = (__str.flags() & ios_base::showbase) != 0;
+ string_type __buf;
+ back_insert_iterator<string_type> __out_ite(__buf);
+
+ for (__i = 0; __i < 4; ++__i) {
+ switch (__format.field[__i]) {
+ case money_base::space:
+ if (!__c_type.is(ctype_base::space, *__s)) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ ++__s;
+ case money_base::none:
+ while (__s != __end && __c_type.is(ctype_base::space, *__s))
+ ++__s;
+ break;
+ case money_base::symbol: {
+ string_type __curs = __intl ? __punct_intl.curr_symbol()
+ : __punct.curr_symbol();
+ pair<iter_type, bool>
+ __result = __get_string(__s, __end, __curs.begin(), __curs.end());
+ if (!__result.second && __symbol_required)
+ __err = ios_base::failbit;
+ __s = __result.first;
+ break;
+ }
+ case money_base::sign: {
+ if (__s == __end) {
+ if (__ps.empty())
+ break;
+ if (__ns.empty()) {
+ __is_positive = false;
+ break;
+ }
+ __err = ios_base::failbit;
+ return __s;
+ }
+ else {
+ if (__ps.empty()) {
+ if (__ns.empty())
+ break;
+ if (*__s == __ns[0]) {
+ ++__s;
+ __is_positive = false;
+ }
+ break;
+ }
+ else {
+ if (*__s == __ps[0]) {
+ ++__s;
+ break;
+ }
+ if (__ns.empty())
+ break;
+ if (*__s == __ns[0]) {
+ ++__s;
+ __is_positive = false;
+ break;
+ }
+ __err = ios_base::failbit;
+ }
+ }
+ return __s;
+ }
+ case money_base::value: {
+ char_type __point = __intl ? __punct_intl.decimal_point()
+ : __punct.decimal_point();
+ int __frac_digits = __intl ? __punct_intl.frac_digits()
+ : __punct.frac_digits();
+ string __grouping = __intl ? __punct_intl.grouping()
+ : __punct.grouping();
+ bool __syntax_ok = true;
+
+ bool __result;
+
+ char_type __sep = __grouping.empty() ? char_type() :
+ __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
+
+ __result = __get_monetary_value(__s, __end, __out_ite, __c_type,
+ __point, __frac_digits,
+ __sep,
+ __grouping, __syntax_ok);
+
+ if (!__syntax_ok)
+ __err |= ios_base::failbit;
+ if (!__result) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ break;
+
+ } // Close money_base::value case
+ } // Close switch statement
+ } // Close for loop
+
+ if (__is_positive) {
+ if (__ps.size() > 1) {
+ pair<_InputIter, bool>
+ __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
+ __s = __result.first;
+ if (!__result.second)
+ __err |= ios::failbit;
+ }
+ if (!(__err & ios_base::failbit))
+ __digits = __buf;
+ }
+ else {
+ if (__ns.size() > 1) {
+ pair<_InputIter, bool>
+ __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
+ __s = __result.first;
+ if (!__result.second)
+ __err |= ios::failbit;
+ }
+ if (!(__err & ios::failbit)) {
+ __digits = __c_type.widen('-');
+ __digits += __buf;
+ }
+ }
+ if (__s == __end)
+ __err |= ios::eofbit;
+
+ return __s;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//===== methods ======
+template <class _CharT, class _InputIter>
+_InputIter
+money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const {
+ string_type __buf;
+ bool __is_positive = true;
+ __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0);
+
+ if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
+ typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
+
+ if (!__is_positive) ++__b;
+ // Can't use atold, since it might be wchar_t. Don't get confused by name below :
+ // it's perfectly capable of reading long double.
+ _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0);
+
+ if (!__is_positive) {
+ __units = -__units;
+ }
+ }
+
+ return __s;
+}
+
+template <class _CharT, class _InputIter>
+_InputIter
+money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const {
+ bool __is_positive = true;
+ return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0);
+}
+
+// money_put facets
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _OutputIter, class _Str_Type, class _Str>
+_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ _CharT __fill, const _Str& __digits, bool __check_digits,
+ _Str_Type * /*__dummy*/) {
+ typedef _CharT char_type;
+ typedef _Str_Type string_type;
+ typedef ctype<char_type> _Ctype;
+ typedef moneypunct<char_type, false> _Punct;
+ typedef moneypunct<char_type, true> _Punct_intl;
+
+ locale __loc = __str.getloc();
+ const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
+ const _Punct& __punct = use_facet<_Punct>(__loc) ;
+ const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
+
+ // some special characters
+ char_type __minus = __c_type.widen('-');
+ char_type __plus = __c_type.widen('+');
+ char_type __space = __c_type.widen(' ');
+ char_type __zero = __c_type.widen('0');
+ char_type __point = __intl ? __punct_intl.decimal_point()
+ : __punct.decimal_point();
+
+ char_type __sep = __intl ? __punct_intl.thousands_sep()
+ : __punct.thousands_sep();
+
+ string __grouping = __intl ? __punct_intl.grouping()
+ : __punct.grouping();
+
+ int __frac_digits = __intl ? __punct_intl.frac_digits()
+ : __punct.frac_digits();
+
+ string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
+ : __punct.curr_symbol();
+
+ // if there are no digits we are going to return __s. If there
+ // are digits, but not enough to fill the frac_digits, we are
+ // going to add zeros. I don't know whether this is right or
+ // not.
+ if (__digits.empty())
+ return __s;
+
+ typename string_type::const_iterator __digits_first = __digits.begin();
+ typename string_type::const_iterator __digits_last = __digits.end();
+
+ bool __is_negative = *__digits_first == __minus;
+ if (__is_negative)
+ ++__digits_first;
+
+#if !defined (__BORLANDC__)
+ string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign()
+ : __punct_intl.positive_sign()
+ : __is_negative ? __punct.negative_sign()
+ : __punct.positive_sign();
+#else
+ string_type __sign;
+ if (__intl) {
+ if (__is_negative)
+ __sign = __punct_intl.negative_sign();
+ else
+ __sign = __punct_intl.positive_sign();
+ }
+ else {
+ if (__is_negative)
+ __sign = __punct.negative_sign();
+ else
+ __sign = __punct.positive_sign();
+ }
+#endif
+
+ if (__check_digits) {
+ typename string_type::const_iterator __cp = __digits_first;
+ while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
+ ++__cp;
+ if (__cp == __digits_first)
+ return __s;
+ __digits_last = __cp;
+ }
+
+ // If grouping is required, we make a copy of __digits and
+ // insert the grouping.
+ _STLP_BASIC_IOSTRING(char_type) __new_digits;
+ if (!__grouping.empty()) {
+ __new_digits.assign(__digits_first, __digits_last);
+ __insert_grouping(__new_digits,
+ __new_digits.size() - __frac_digits,
+ __grouping,
+ __sep, __plus, __minus, 0);
+ __digits_first = __new_digits.begin(); // <<--
+ __digits_last = __new_digits.end(); // <<--
+ }
+
+ // Determine the amount of padding required, if any.
+ streamsize __width = __str.width();
+
+#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1))
+ size_t __value_length = operator -(__digits_last, __digits_first);
+#else
+ size_t __value_length = __digits_last - __digits_first;
+#endif
+
+ size_t __length = __value_length + __sign.size();
+
+ if (__frac_digits != 0)
+ ++__length;
+
+ bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
+ if (__generate_curr)
+ __length += __curr_sym.size();
+ money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format()
+ : __punct_intl.pos_format())
+ : (__is_negative ? __punct.neg_format()
+ : __punct.pos_format());
+ {
+ //For the moment the following is commented for decoding reason.
+ //No reason to add a space last if the money symbol do not have to be display
+ //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) {
+ // if (__format.field[2] == (char) money_base::space) {
+ // __format.field[2] = (char) money_base::none;
+ // }
+ //}
+ //space can only be second or third and only once (22.2.6.3-1):
+ if ((__format.field[1] == (char) money_base::space) ||
+ (__format.field[2] == (char) money_base::space))
+ ++__length;
+ }
+
+ const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width))));
+ streamsize __fill_amt = __need_fill ? __width - __length : 0;
+
+ ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
+
+ if (__fill_amt != 0 &&
+ !(__fill_pos & (ios_base::left | ios_base::internal)))
+ __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill);
+
+ for (int __i = 0; __i < 4; ++__i) {
+ char __ffield = __format.field[__i];
+ switch (__ffield) {
+ case money_base::space:
+ *__s++ = __space;
+ case money_base::none:
+ if (__fill_amt != 0 && __fill_pos == ios_base::internal)
+ __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill);
+ break;
+ case money_base::symbol:
+ if (__generate_curr)
+ __s = _STLP_STD::copy(__curr_sym.begin(), __curr_sym.end(), __s);
+ break;
+ case money_base::sign:
+ if (!__sign.empty())
+ *__s++ = __sign[0];
+ break;
+ case money_base::value:
+ if (__frac_digits == 0) {
+ __s = _STLP_STD::copy(__digits_first, __digits_last, __s);
+ } else {
+ if ((int)__value_length <= __frac_digits) {
+ // if we see '9' here, we should out 0.09
+ *__s++ = __zero; // integer part is zero
+ *__s++ = __point; // decimal point
+ __s = _STLP_PRIV __fill_n(__s, __frac_digits - __value_length, __zero); // zeros
+ __s = _STLP_STD::copy(__digits_first, __digits_last, __s); // digits
+ } else {
+ __s = _STLP_STD::copy(__digits_first, __digits_last - __frac_digits, __s);
+ if (__frac_digits != 0) {
+ *__s++ = __point;
+ __s = _STLP_STD::copy(__digits_last - __frac_digits, __digits_last, __s);
+ }
+ }
+ }
+ break;
+ } //Close for switch
+ } // Close for loop
+
+ // Ouput rest of sign if necessary.
+ if (__sign.size() > 1)
+ __s = _STLP_STD::copy(__sign.begin() + 1, __sign.end(), __s);
+ if (__fill_amt != 0 &&
+ !(__fill_pos & (ios_base::right | ios_base::internal)))
+ __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill);
+
+ return __s;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+money_put<_CharT, _OutputIter>
+ ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const {
+ _STLP_BASIC_IOSTRING(char_type) __digits;
+ _STLP_PRIV __get_money_digits(__digits, __str, __units);
+ return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0));
+}
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+money_put<_CharT, _OutputIter>
+ ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ char_type __fill, const string_type& __digits) const {
+ return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0));
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_MONETARY_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_monetary.h b/build/stlport/stlport/stl/_monetary.h
new file mode 100644
index 000000000..7b9301076
--- /dev/null
+++ b/build/stlport/stlport/stl/_monetary.h
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_MONETARY_H
+#define _STLP_INTERNAL_MONETARY_H
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class money_base {
+public:
+ enum part {none, space, symbol, sign, value};
+ struct pattern {
+ char field[4];
+ };
+};
+
+// moneypunct facets: forward declaration
+template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
+
+// money_get facets
+
+template <class _CharT, class _InputIter>
+class money_get : public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _InputIter iter_type;
+ typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
+
+ explicit money_get(size_t __refs = 0) : locale::facet(__refs) {}
+ iter_type get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const
+ { return do_get(__s, __end, __intl, __str, __err, __units); }
+ iter_type get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const
+ { return do_get(__s, __end, __intl, __str, __err, __digits); }
+
+ static locale::id id;
+
+protected:
+ ~money_get() {}
+ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const;
+ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const;
+};
+
+
+// moneypunct facets: definition of specializations
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base {
+public:
+ typedef char char_type;
+ typedef string string_type;
+ explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = true);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(char, true) ();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string do_curr_symbol() const;
+
+ virtual string do_positive_sign() const;
+ virtual string do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = false);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(char, false) ();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string do_curr_symbol() const;
+
+ virtual string do_positive_sign() const;
+ virtual string do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+
+#ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+ explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = true);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+ explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = false);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+# endif
+
+template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(char, true) ();
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(char, true) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<char, true> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(char, false) ();
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(char, false) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<char, false> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(wchar_t, true) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<wchar_t, true> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(wchar_t, false) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<wchar_t, false> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+#endif
+
+//===== methods ======
+
+
+// money_put facets
+
+template <class _CharT, class _OutputIter>
+class money_put : public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _OutputIter iter_type;
+ typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
+
+ explicit money_put(size_t __refs = 0) : locale::facet(__refs) {}
+ iter_type put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
+ { return do_put(__s, __intl, __str, __fill, __units); }
+ iter_type put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill,
+ const string_type& __digits) const
+ { return do_put(__s, __intl, __str, __fill, __digits); }
+
+ static locale::id id;
+
+protected:
+ ~money_put() {}
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill,
+ const string_type& __digits) const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
+_STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+_STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_monetary.c>
+#endif
+
+#endif /* _STLP_INTERNAL_MONETARY_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
diff --git a/build/stlport/stlport/stl/_move_construct_fwk.h b/build/stlport/stlport/stl/_move_construct_fwk.h
new file mode 100644
index 000000000..4a85fe32d
--- /dev/null
+++ b/build/stlport/stlport/stl/_move_construct_fwk.h
@@ -0,0 +1,159 @@
+/*
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
+#define _STLP_MOVE_CONSTRUCT_FWK_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+/*************************************************************
+ * Move constructor framework
+ *************************************************************/
+
+/*************************************************************
+ *Partial move:
+ *The source HAS to be a valid instance after the move!
+ *************************************************************/
+template <class _Tp>
+class __move_source {
+public:
+ explicit __move_source (_Tp &_src) : _M_data(_src)
+ {}
+
+ _Tp& get() const
+ { return _M_data; }
+private:
+ _Tp &_M_data;
+
+ //We explicitely forbid assignment to avoid warning:
+ typedef __move_source<_Tp> _Self;
+ _Self& operator = (_Self const&);
+};
+
+//Class used to signal move constructor support, implementation and type.
+template <class _Tp>
+struct __move_traits {
+ /*
+ * implemented tells if a the special move constructor has to be called or the classic
+ * copy constructor is just fine. Most of the time the copy constructor is fine only
+ * if the following info is true.
+ */
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \
+ !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
+ !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename _IsSTLportClass<_Tp>::_Ret implemented;
+#else
+ typedef __false_type implemented;
+#endif
+ /*
+ * complete tells if the move is complete or partial, that is to say, does the source
+ * needs to be destroyed once it has been moved.
+ */
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
+ typedef __type_traits<_Tp>::has_trivial_destructor _TpMoveComplete;
+ typedef typename __bool2type<__type2bool<_TpMoveComplete>::_Ret>::_Ret complete;
+# else
+ typedef typename __type_traits<_Tp>::has_trivial_destructor complete;
+# endif
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * This struct should never be used if the user has not explicitely stipulated
+ * that its class support the full move concept. To check that the return type
+ * in such a case will be __invalid_source<_Tp> to generate a compile error
+ * revealing the configuration problem.
+ */
+template <class _Tp>
+struct _MoveSourceTraits {
+ typedef typename __move_traits<_Tp>::implemented _MvImpRet;
+#if defined (__BORLANDC__)
+ typedef typename __selectT<_MvImpRet,
+#else
+ enum {_MvImp = __type2bool<_MvImpRet>::_Ret};
+ typedef typename __select<_MvImp,
+#endif
+ __move_source<_Tp>,
+ _Tp const&>::_Ret _Type;
+};
+
+//The helper function
+template <class _Tp>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits<_Tp>::_Type
+_AsMoveSource (_Tp &src) {
+ typedef typename _MoveSourceTraits<_Tp>::_Type _SrcType;
+ return _SrcType(src);
+}
+
+//Helper structs used for many class.
+template <class _Tp>
+struct __move_traits_aux {
+ typedef typename __move_traits<_Tp>::implemented implemented;
+ typedef typename __move_traits<_Tp>::complete complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_aux2 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef typename _Lor2<typename _MoveTraits1::implemented,
+ typename _MoveTraits2::implemented>::_Ret implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+/*
+ * Most of the time a class implement a move constructor but its use depends
+ * on a third party, this is what the following struct are for.
+ */
+template <class _Tp>
+struct __move_traits_help {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Tp>::complete complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_help1 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef typename _Lor2<typename _MoveTraits1::implemented,
+ typename _MoveTraits2::implemented>::_Ret implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_help2 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef __true_type implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_MOVE_CONSTRUCT_FWK_H */
diff --git a/build/stlport/stlport/stl/_new.h b/build/stlport/stlport/stl/_new.h
new file mode 100644
index 000000000..ffa25f4e2
--- /dev/null
+++ b/build/stlport/stlport/stl/_new.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_NEW
+#define _STLP_INTERNAL_NEW
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+// size_t
+# include <stl/_cstddef.h>
+#endif
+
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x570)
+// new.h uses ::malloc ;(
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+using _STLP_VENDOR_CSTD::malloc;
+#endif
+
+#if !defined (_STLP_NO_NEW_NEW_HEADER)
+// eMbedded Visual C++ .NET unfortunately uses _INC_NEW for both <new.h> and <new>
+// we undefine the symbol to get the stuff in the SDK's <new>
+# if defined (_STLP_WCE_NET) && defined (_INC_NEW)
+# undef _INC_NEW
+# endif
+
+# if defined (new)
+/* STLport cannot replace native Std library new header if new is a macro,
+ * please define new macro after <new> header inclusion.
+ */
+# error Cannot include native new header as new is a macro.
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <new>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
+# endif
+#else
+# include <new.h>
+#endif
+
+#if defined (_STLP_NO_BAD_ALLOC) && !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#endif
+
+#if defined (_STLP_USE_EXCEPTIONS) && defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined (_STLP_NO_BAD_ALLOC)
+struct nothrow_t {};
+# define nothrow nothrow_t()
+# endif
+
+/*
+ * STLport own bad_alloc exception to be used if the native C++ library
+ * do not define it or when the new operator do not throw it to avoid
+ * a useless library dependency.
+ */
+class bad_alloc : public exception {
+public:
+ bad_alloc () _STLP_NOTHROW_INHERENTLY { }
+ bad_alloc(const bad_alloc&) _STLP_NOTHROW_INHERENTLY { }
+ bad_alloc& operator=(const bad_alloc&) _STLP_NOTHROW_INHERENTLY {return *this;}
+ ~bad_alloc () _STLP_NOTHROW_INHERENTLY { }
+ const char* what() const _STLP_NOTHROW_INHERENTLY { return "bad alloc"; }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_USE_EXCEPTIONS && (_STLP_NO_BAD_ALLOC || _STLP_NEW_DONT_THROW_BAD_ALLOC) */
+
+#if defined (_STLP_USE_OWN_NAMESPACE)
+
+_STLP_BEGIN_NAMESPACE
+
+# if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
+# endif
+
+# if !defined (_STLP_NO_BAD_ALLOC)
+using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
+using _STLP_VENDOR_EXCEPT_STD::nothrow;
+# if defined (_STLP_GLOBAL_NEW_HANDLER)
+using ::new_handler;
+using ::set_new_handler;
+# else
+using _STLP_VENDOR_EXCEPT_STD::new_handler;
+using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
+# endif
+# endif /* !_STLP_NO_BAD_ALLOC */
+
+_STLP_END_NAMESPACE
+#endif /* _STLP_USE_OWN_NAMESPACE */
+
+#ifndef _STLP_THROW_BAD_ALLOC
+# if !defined (_STLP_USE_EXCEPTIONS)
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# define _STLP_THROW_BAD_ALLOC puts("out of memory\n"); abort()
+# else
+# define _STLP_THROW_BAD_ALLOC _STLP_THROW(_STLP_STD::bad_alloc())
+# endif
+#endif
+
+#if defined (_STLP_NO_NEW_NEW_HEADER) || defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+# define _STLP_CHECK_NULL_ALLOC(__x) void* __y = __x; if (__y == 0) { _STLP_THROW_BAD_ALLOC; } return __y
+#else
+# define _STLP_CHECK_NULL_ALLOC(__x) return __x
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if ((defined (__IBMCPP__) || defined (__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined (_STLP_DEBUG_ALLOC))
+inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator new(__n, __FILE__, __LINE__)); }
+inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p, __FILE__, __LINE__); }
+#else
+inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator new(__n)); }
+inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p); }
+#endif
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_NEW */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/build/stlport/stlport/stl/_num_get.c b/build/stlport/stlport/stl/_num_get.c
new file mode 100644
index 000000000..1e7d23487
--- /dev/null
+++ b/build/stlport/stlport/stl/_num_get.c
@@ -0,0 +1,623 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_NUM_GET_C
+#define _STLP_NUM_GET_C
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned);
+_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms();
+
+// __do_get_integer, __do_get_float and its helper functions.
+
+inline bool _STLP_CALL __get_fdigit(char __c, const char*)
+{ return __c >= '0' && __c <= '9'; }
+
+inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) {
+ if (__c == __sep) {
+ __c = ',' ;
+ return true ;
+ }
+ else
+ return __get_fdigit(__c, __digits);
+}
+
+inline int _STLP_CALL
+__get_digit_from_table(unsigned __index)
+{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
+
+template <class _InputIter, class _CharT>
+int
+__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end,
+ ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) {
+ _CharT __atoms[5];
+ __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
+
+ bool __negative = false;
+ _CharT __c = *__in_ite;
+
+ if (__c == __atoms[1] /* __xminus_char */ ) {
+ __negative = true;
+ ++__in_ite;
+ }
+ else if (__c == __atoms[0] /* __xplus_char */ )
+ ++__in_ite;
+
+ int __base;
+ int __valid_zero = 0;
+
+ ios_base::fmtflags __basefield = __flags & ios_base::basefield;
+
+ switch (__basefield) {
+ case ios_base::oct:
+ __base = 8;
+ break;
+ case ios_base::dec:
+ __base = 10;
+ break;
+ case ios_base::hex:
+ __base = 16;
+ if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
+ ++__in_ite;
+ if (__in_ite != __end &&
+ (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
+ ++__in_ite;
+ else
+ __valid_zero = 1; // That zero is valid by itself.
+ }
+ break;
+ default:
+ if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
+ ++__in_ite;
+ if (__in_ite != __end &&
+ (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
+ ++__in_ite;
+ __base = 16;
+ }
+ else
+ {
+ __base = 8;
+ __valid_zero = 1; // That zero is still valid by itself.
+ }
+ }
+ else
+ __base = 10;
+ break;
+ }
+ return (__base << 2) | ((int)__negative << 1) | __valid_zero;
+}
+
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_integer(_InputIter& __first, _InputIter& __last,
+ int __base, _Integer& __val,
+ int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) {
+ bool __ovflow = false;
+ _Integer __result = 0;
+ bool __is_group = !__grouping.empty();
+ char __group_sizes[64];
+ char __current_group_size = 0;
+ char* __group_sizes_end = __group_sizes;
+
+ _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
+
+ for ( ; __first != __last ; ++__first) {
+
+ const _CharT __c = *__first;
+
+ if (__is_group && __c == __separator) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ continue;
+ }
+
+ int __n = __get_digit_from_table(__c);
+
+ if (__n >= __base)
+ break;
+
+ ++__got;
+ ++__current_group_size;
+
+ if (__result < __over_base)
+ __ovflow = true; // don't need to keep accumulating
+ else {
+ _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
+ if (__result != 0)
+ __ovflow = __ovflow || __next >= __result;
+ __result = __next;
+ }
+ }
+
+ if (__is_group && __group_sizes_end != __group_sizes) {
+ *__group_sizes_end++ = __current_group_size;
+ }
+
+ // fbp : added to not modify value if nothing was read
+ if (__got > 0) {
+ __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
+ : (numeric_limits<_Integer>::max)()
+ : __is_negative ? __result
+ : __STATIC_CAST(_Integer, -__result);
+ }
+ // overflow is being treated as failure
+ return ((__got > 0) && !__ovflow) &&
+ (__is_group == 0 ||
+ __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size()));
+}
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_integer(_InputIter& __first, _InputIter& __last,
+ int __base, _Integer& __val,
+ int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) {
+ bool __ovflow = false;
+ _Integer __result = 0;
+ bool __is_group = !__grouping.empty();
+ char __group_sizes[64];
+ char __current_group_size = 0;
+ char* __group_sizes_end = __group_sizes;
+
+ _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
+
+ for ( ; __first != __last ; ++__first) {
+
+ const _CharT __c = *__first;
+
+ if (__is_group && __c == __separator) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ continue;
+ }
+
+ int __n = __get_digit_from_table(__c);
+
+ if (__n >= __base)
+ break;
+
+ ++__got;
+ ++__current_group_size;
+
+ if (__result > __over_base)
+ __ovflow = true; //don't need to keep accumulating
+ else {
+ _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
+ if (__result != 0)
+ __ovflow = __ovflow || __next <= __result;
+ __result = __next;
+ }
+ }
+
+ if (__is_group && __group_sizes_end != __group_sizes) {
+ *__group_sizes_end++ = __current_group_size;
+ }
+
+ // fbp : added to not modify value if nothing was read
+ if (__got > 0) {
+ __val = __ovflow ? (numeric_limits<_Integer>::max)()
+ : (__is_negative ? __STATIC_CAST(_Integer, -__result)
+ : __result);
+ }
+
+ // overflow is being treated as failure
+ return ((__got > 0) && !__ovflow) &&
+ (__is_group == 0 ||
+ __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size()));
+}
+
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) {
+ string __grp;
+ //Here there is no grouping so separator is not important, we just pass the default character.
+ return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
+}
+
+template <class _InputIter, class _Integer, class _CharT>
+_InputIter _STLP_CALL
+__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, _Integer& __val, _CharT* /*__pc*/) {
+ locale __loc = __str.getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+#if defined (__HP_aCC) && (__HP_aCC == 1)
+ bool _IsSigned = !((_Integer)(-1) > 0);
+#else
+ typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
+#endif
+
+ const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str.flags(), __ctype);
+ int __got = __base_or_zero & 1;
+
+ bool __result;
+
+ if (__in_ite == __end) { // We may have already read a 0. If so,
+
+ if (__got > 0) { // the result is 0 even if we're at eof.
+ __val = 0;
+ __result = true;
+ }
+ else
+ __result = false;
+ }
+ else {
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ const bool __negative = (__base_or_zero & 2) != 0;
+ const int __base = __base_or_zero >> 2;
+
+#if defined (__HP_aCC) && (__HP_aCC == 1)
+ if (_IsSigned)
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __true_type() );
+ else
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __false_type() );
+#else
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), _IsSigned());
+# endif
+ }
+
+ __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
+
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+// __read_float and its helper functions.
+template <class _InputIter, class _CharT>
+_InputIter _STLP_CALL
+__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v,
+ _CharT __xplus, _CharT __xminus) {
+ if (__first != __last) {
+ _CharT __c = *__first;
+ if (__c == __xplus)
+ ++__first;
+ else if (__c == __xminus) {
+ __v.push_back('-');
+ ++__first;
+ }
+ }
+ return __first;
+}
+
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__copy_digits(_InputIter& __first, _InputIter __last,
+ __iostring& __v, const _CharT* __digits) {
+ bool __ok = false;
+
+ for ( ; __first != __last; ++__first) {
+ _CharT __c = *__first;
+ if (__get_fdigit(__c, __digits)) {
+ __v.push_back((char)__c);
+ __ok = true;
+ }
+ else
+ break;
+ }
+ return __ok;
+}
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__copy_grouped_digits(_InputIter& __first, _InputIter __last,
+ __iostring& __v, const _CharT * __digits,
+ _CharT __sep, const string& __grouping,
+ bool& __grouping_ok) {
+ bool __ok = false;
+ char __group_sizes[64];
+ char*__group_sizes_end = __group_sizes;
+ char __current_group_size = 0;
+
+ for ( ; __first != __last; ++__first) {
+ _CharT __c = *__first;
+ bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
+ if (__tmp) {
+ if (__c == ',') {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ }
+ else {
+ __ok = true;
+ __v.push_back((char)__c);
+ ++__current_group_size;
+ }
+ }
+ else
+ break;
+ }
+
+ if (__group_sizes_end != __group_sizes)
+ *__group_sizes_end++ = __current_group_size;
+ __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
+ return __ok;
+}
+
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end,
+ const ctype<_CharT> &__ct, const numpunct<_CharT> &__numpunct) {
+ // Create a string, copying characters of the form
+ // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
+
+ string __grouping = __numpunct.grouping();
+ bool __digits_before_dot /* = false */;
+ bool __digits_after_dot = false;
+ bool __ok;
+
+ bool __grouping_ok = true;
+
+ _CharT __dot = __numpunct.decimal_point();
+ _CharT __sep = __numpunct.thousands_sep();
+
+ _CharT __digits[10];
+ _CharT __xplus;
+ _CharT __xminus;
+
+ _CharT __pow_e;
+ _CharT __pow_E;
+
+ _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
+
+ // Get an optional sign
+ __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
+
+ // Get an optional string of digits.
+ if (!__grouping.empty())
+ __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
+ __sep, __grouping, __grouping_ok);
+ else
+ __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
+
+ // Get an optional decimal point, and an optional string of digits.
+ if (__in_ite != __end && *__in_ite == __dot) {
+ __buf.push_back('.');
+ ++__in_ite;
+ __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
+ }
+
+ // There have to be some digits, somewhere.
+ __ok = __digits_before_dot || __digits_after_dot;
+
+ // Get an optional exponent.
+ if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
+ __buf.push_back('e');
+ ++__in_ite;
+ __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
+ __ok = __copy_digits(__in_ite, __end, __buf, __digits);
+ // If we have an exponent then the sign
+ // is optional but the digits aren't.
+ }
+
+ return __ok;
+}
+
+template <class _InputIter, class _Float, class _CharT>
+_InputIter _STLP_CALL
+__do_get_float(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, _Float& __val, _CharT* /*__pc*/) {
+ locale __loc = __str.getloc();
+ const ctype<_CharT> &__ctype = use_facet<ctype<_CharT> >(__loc);
+ const numpunct<_CharT> &__numpunct = use_facet<numpunct<_CharT> >(__loc);
+
+ __iostring __buf ;
+ bool __ok = __read_float(__buf, __in_ite, __end, __ctype, __numpunct);
+ if (__ok) {
+ __string_to_float(__buf, __val);
+ __err = ios_base::goodbit;
+ }
+ else {
+ __err = ios_base::failbit;
+ }
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+template <class _InputIter, class _CharT>
+_InputIter _STLP_CALL
+__do_get_alphabool(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __x, _CharT* /*__pc*/) {
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__str.getloc());
+ const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __truename = __np.truename();
+ const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __falsename = __np.falsename();
+ bool __true_ok = true;
+ bool __false_ok = true;
+
+ size_t __n = 0;
+ for ( ; __in_ite != __end; ++__in_ite) {
+ _CharT __c = *__in_ite;
+ __true_ok = __true_ok && (__c == __truename[__n]);
+ __false_ok = __false_ok && (__c == __falsename[__n]);
+ ++__n;
+
+ if ((!__true_ok && !__false_ok) ||
+ (__true_ok && __n >= __truename.size()) ||
+ (__false_ok && __n >= __falsename.size())) {
+ ++__in_ite;
+ break;
+ }
+ }
+ if (__true_ok && __n < __truename.size()) __true_ok = false;
+ if (__false_ok && __n < __falsename.size()) __false_ok = false;
+
+ if (__true_ok || __false_ok) {
+ __err = ios_base::goodbit;
+ __x = __true_ok;
+ }
+ else
+ __err = ios_base::failbit;
+
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+
+ return __in_ite;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// num_get<>, num_put<>
+//
+
+template <class _CharT, class _InputIterator>
+locale::id num_get<_CharT, _InputIterator>::id;
+
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end,
+ ios_base& __s, ios_base::iostate& __err, bool& __x) const {
+ if (__s.flags() & ios_base::boolalpha) {
+ return _STLP_PRIV __do_get_alphabool(__in_ite, __end, __s, __err, __x, (_CharT*)0);
+ }
+ else {
+ long __lx;
+ _InputIter __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __s, __err, __lx, (_CharT*)0 );
+ if (!(__err & ios_base::failbit)) {
+ if (__lx == 0)
+ __x = false;
+ else if (__lx == 1)
+ __x = true;
+ else
+ __err |= ios_base::failbit;
+ }
+ return __tmp;
+ }
+}
+#endif
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+#endif
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned short& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned int& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned long& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ float& __val) const
+{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ double& __val) const
+{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ long double& __val) const
+{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+#endif
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ void*& __p) const {
+#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void*
+ unsigned _STLP_LONG_LONG __val;
+#else
+ unsigned long __val;
+#endif
+ iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
+ if (!(__err & ios_base::failbit))
+ __p = __REINTERPRET_CAST(void*, __val);
+ return __tmp;
+}
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ _STLP_LONG_LONG& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned _STLP_LONG_LONG& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMERIC_FACETS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_num_get.h b/build/stlport/stlport/stl/_num_get.h
new file mode 100644
index 000000000..95f7935f9
--- /dev/null
+++ b/build/stlport/stlport/stl/_num_get.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+#define _STLP_INTERNAL_NUM_GET_H
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_get facets
+
+template <class _CharT, class _InputIter>
+class num_get: public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _InputIter iter_type;
+
+ explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
+
+#if !defined (_STLP_NO_BOOL)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned short& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned int& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned long& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+#if defined (_STLP_LONG_LONG)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif /* _STLP_LONG_LONG */
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, float& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, double& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long double& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+# endif
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, void*& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ static locale::id id;
+
+protected:
+ ~num_get() {}
+
+ typedef string string_type;
+ typedef ctype<_CharT> _Ctype;
+ typedef numpunct<_CharT> _Numpunct;
+
+#if !defined (_STLP_NO_BOOL)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __val) const;
+#endif
+
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned short& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned int& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned long& __val) const;
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+ // issue 118 : those are actually not supposed to be here
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const;
+#endif
+
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, float& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, double& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, void*& __p) const;
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long double& __val) const;
+#endif
+
+#if defined (_STLP_LONG_LONG)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
+#endif
+
+};
+
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
+# endif
+#endif
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
+
+# if !defined (_STLP_NO_WCHAR_T)
+bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
+bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
+# endif
+
+inline void _STLP_CALL
+_Initialize_get_float(const ctype<char>&,
+ char& Plus, char& Minus,
+ char& pow_e, char& pow_E,
+ char*) {
+ Plus = '+';
+ Minus = '-';
+ pow_e = 'e';
+ pow_E = 'E';
+}
+
+# if !defined (_STLP_NO_WCHAR_T)
+void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
+ wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
+# endif
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
+
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_num_get.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUM_GET_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_num_put.c b/build/stlport/stlport/stl/_num_put.c
new file mode 100644
index 000000000..0c0783821
--- /dev/null
+++ b/build/stlport/stlport/stl/_num_put.c
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_NUM_PUT_C
+#define _STLP_NUM_PUT_C
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// __do_put_float and its helper functions. Strategy: write the output
+// to a buffer of char, transform the buffer to _CharT, and then copy
+// it to the output.
+
+//----------------------------------------------------------------------
+// num_put facet
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__copy_float_and_fill(const _CharT* __first, const _CharT* __last,
+ _OutputIter __oi,
+ ios_base::fmtflags __flags,
+ streamsize __width, _CharT __fill,
+ _CharT __xplus, _CharT __xminus) {
+ if (__width <= __last - __first)
+ return _STLP_STD::copy(__first, __last, __oi);
+ else {
+ streamsize __pad = __width - (__last - __first);
+ ios_base::fmtflags __dir = __flags & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __oi = _STLP_STD::copy(__first, __last, __oi);
+ return _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ }
+ else if (__dir == ios_base::internal && __first != __last &&
+ (*__first == __xplus || *__first == __xminus)) {
+ *__oi++ = *__first++;
+ __oi = _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__first, __last, __oi);
+ }
+ else {
+ __oi = _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__first, __last, __oi);
+ }
+ }
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Helper routine for wchar_t
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_float(__iostring &__str, _OutputIter __oi,
+ ios_base& __f, wchar_t __fill,
+ wchar_t __decimal_point, wchar_t __sep,
+ size_t __group_pos, const string& __grouping) {
+ const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__f.getloc());
+
+ __iowstring __wbuf;
+ __convert_float_buffer(__str, __wbuf, __ct, __decimal_point);
+
+ if (!__grouping.empty()) {
+ __insert_grouping(__wbuf, __group_pos, __grouping,
+ __sep, __ct.widen('+'), __ct.widen('-'), 0);
+ }
+
+ return __copy_float_and_fill(__wbuf.data(), __wbuf.data() + __wbuf.size(), __oi,
+ __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-'));
+}
+#endif /* WCHAR_T */
+
+// Helper routine for char
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_float(__iostring &__str, _OutputIter __oi,
+ ios_base& __f, char __fill,
+ char __decimal_point, char __sep,
+ size_t __group_pos, const string& __grouping) {
+ if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) {
+ __str[__group_pos] = __decimal_point;
+ }
+
+ if (!__grouping.empty()) {
+ __insert_grouping(__str, __group_pos,
+ __grouping, __sep, '+', '-', 0);
+ }
+
+ return __copy_float_and_fill(__str.data(), __str.data() + __str.size(), __oi,
+ __f.flags(), __f.width(0), __fill, '+', '-');
+}
+
+template <class _CharT, class _OutputIter, class _Float>
+_OutputIter _STLP_CALL
+__do_put_float(_OutputIter __s, ios_base& __f,
+ _CharT __fill, _Float __x) {
+ __iostring __buf;
+
+ size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
+
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__f.getloc());
+ return __put_float(__buf, __s, __f, __fill,
+ __np.decimal_point(), __np.thousands_sep(),
+ __group_pos, __np.grouping());
+}
+
+inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x)
+{ __get_floor_digits(__buf, __x); }
+
+#if !defined (_STLP_NO_WCHAR_T)
+inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) {
+ __iostring __buf;
+ __get_floor_digits(__buf, __x);
+
+ const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__f.getloc());
+ __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false);
+}
+#endif
+
+template <class _CharT>
+void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x)
+{ __get_money_digits_aux(__buf, __f, __x); }
+
+// _M_do_put_integer and its helper functions.
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
+ _OutputIter __oi,
+ ios_base::fmtflags __flg, streamsize __wid, _CharT __fill,
+ _CharT __xplus, _CharT __xminus) {
+ if (__len >= __wid)
+ return _STLP_STD::copy(__buf, __buf + __len, __oi);
+ else {
+ //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
+ //is larger than ptrdiff_t one.
+ _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
+ ((sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits<ptrdiff_t>::is_signed))
+ ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
+ __STATIC_CAST(streamsize, __wid - __len)));
+ ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __oi = _STLP_STD::copy(__buf, __buf + __len, __oi);
+ return _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ }
+ else if (__dir == ios_base::internal && __len != 0 &&
+ (__buf[0] == __xplus || __buf[0] == __xminus)) {
+ *__oi++ = __buf[0];
+ __oi = __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__buf + 1, __buf + __len, __oi);
+ }
+ else if (__dir == ios_base::internal && __len >= 2 &&
+ (__flg & ios_base::showbase) &&
+ (__flg & ios_base::basefield) == ios_base::hex) {
+ *__oi++ = __buf[0];
+ *__oi++ = __buf[1];
+ __oi = __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__buf + 2, __buf + __len, __oi);
+ }
+ else {
+ __oi = __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__buf, __buf + __len, __oi);
+ }
+ }
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Helper function for wchar_t
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_integer(char* __buf, char* __iend, _OutputIter __s,
+ ios_base& __f,
+ ios_base::fmtflags __flags, wchar_t __fill) {
+ locale __loc = __f.getloc();
+ const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
+
+ wchar_t __xplus = __ct.widen('+');
+ wchar_t __xminus = __ct.widen('-');
+
+ wchar_t __wbuf[64];
+ __ct.widen(__buf, __iend, __wbuf);
+ ptrdiff_t __len = __iend - __buf;
+ wchar_t* __eend = __wbuf + __len;
+
+ const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
+ const string& __grouping = __np.grouping();
+
+ if (!__grouping.empty()) {
+ int __basechars;
+ if (__flags & ios_base::showbase)
+ switch (__flags & ios_base::basefield) {
+ case ios_base::hex: __basechars = 2; break;
+ case ios_base::oct: __basechars = 1; break;
+ default: __basechars = 0;
+ }
+ else
+ __basechars = 0;
+
+ __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(),
+ __xplus, __xminus, __basechars);
+ }
+
+ return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s,
+ __flags, __f.width(0), __fill, __xplus, __xminus);
+}
+#endif
+
+// Helper function for char
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_integer(char* __buf, char* __iend, _OutputIter __s,
+ ios_base& __f, ios_base::fmtflags __flags, char __fill) {
+ char __grpbuf[64];
+ ptrdiff_t __len = __iend - __buf;
+
+ const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
+ const string& __grouping = __np.grouping();
+
+ if (!__grouping.empty()) {
+ int __basechars;
+ if (__flags & ios_base::showbase)
+ switch (__flags & ios_base::basefield) {
+ case ios_base::hex: __basechars = 2; break;
+ case ios_base::oct: __basechars = 1; break;
+ default: __basechars = 0;
+ }
+ else
+ __basechars = 0;
+
+ // make sure there is room at the end of the buffer
+ // we pass to __insert_grouping
+ _STLP_STD::copy(__buf, __iend, (char *) __grpbuf);
+ __buf = __grpbuf;
+ __iend = __grpbuf + __len;
+ __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
+ '+', '-', __basechars);
+ }
+
+ return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-');
+}
+
+#if defined (_STLP_LONG_LONG)
+typedef _STLP_LONG_LONG __max_int_t;
+typedef unsigned _STLP_LONG_LONG __umax_int_t;
+#else
+typedef long __max_int_t;
+typedef unsigned long __umax_int_t;
+#endif
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo();
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi();
+
+template <class _Integer>
+inline char* _STLP_CALL
+__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) {
+ const bool __negative = __x < 0 ;
+ __max_int_t __temp = __x;
+ __umax_int_t __utemp = __negative?-__temp:__temp;
+
+ for (; __utemp != 0; __utemp /= 10)
+ *--__ptr = (char)((int)(__utemp % 10) + '0');
+ // put sign if needed or requested
+ if (__negative)
+ *--__ptr = '-';
+ else if (__flags & ios_base::showpos)
+ *--__ptr = '+';
+ return __ptr;
+}
+
+template <class _Integer>
+inline char* _STLP_CALL
+__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) {
+ for (; __x != 0; __x /= 10)
+ *--__ptr = (char)((int)(__x % 10) + '0');
+ // put sign if requested
+ if (__flags & ios_base::showpos)
+ *--__ptr = '+';
+ return __ptr;
+}
+
+template <class _Integer>
+char* _STLP_CALL
+__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) {
+ char* __ptr = __buf;
+
+ if (__x == 0) {
+ *--__ptr = '0';
+ if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0))
+ *--__ptr = '+';
+ // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings)
+ }
+ else {
+ switch (__flags & ios_base::basefield) {
+ case ios_base::oct:
+ {
+ __umax_int_t __temp = __x;
+ // if the size of integer is less than 8, clear upper part
+ if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
+ __temp &= 0xFFFFFFFF;
+
+ for (; __temp != 0; __temp >>=3)
+ *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0');
+
+ // put leading '0' if showbase is set
+ if (__flags & ios_base::showbase)
+ *--__ptr = '0';
+ }
+ break;
+ case ios_base::hex:
+ {
+ const char* __table_ptr = (__flags & ios_base::uppercase) ?
+ __hex_char_table_hi() : __hex_char_table_lo();
+ __umax_int_t __temp = __x;
+ // if the size of integer is less than 8, clear upper part
+ if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
+ __temp &= 0xFFFFFFFF;
+
+ for (; __temp != 0; __temp >>=4)
+ *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
+
+ if (__flags & ios_base::showbase) {
+ *--__ptr = __table_ptr[16];
+ *--__ptr = '0';
+ }
+ }
+ break;
+ //case ios_base::dec:
+ default:
+ {
+#if defined(__HP_aCC) && (__HP_aCC == 1)
+ bool _IsSigned = !((_Integer)-1 > 0);
+ if (_IsSigned)
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
+ else
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
+#else
+ typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
+#endif
+ }
+ break;
+ }
+ }
+
+ // return pointer to beginning of the string
+ return __ptr;
+}
+
+template <class _CharT, class _OutputIter, class _Integer>
+_OutputIter _STLP_CALL
+__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) {
+ // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte)
+ // plus the longest base representation '0x'
+ // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as
+ // the specification of a static buffer size.
+ char __buf[sizeof(_Integer) * 3 + 2];
+ const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char);
+ ios_base::fmtflags __flags = __f.flags();
+ char* __ibeg = __write_integer_backward((char*)__buf + __buf_size, __flags, __x);
+ return __put_integer(__ibeg, (char*)__buf + __buf_size, __s, __f, __flags, __fill);
+}
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__do_put_bool(_OutputIter __s, ios_base& __f, _CharT __fill, bool __x) {
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__f.getloc());
+
+ basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __str = __x ? __np.truename() : __np.falsename();
+
+ streamsize __wid = __f.width(0);
+ if (__str.size() >= __STATIC_CAST(size_t, __wid))
+ return _STLP_STD::copy(__str.begin(), __str.end(), __s);
+ else {
+ streamsize __pad = __wid - __str.size();
+ ios_base::fmtflags __dir = __f.flags() & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __s = _STLP_STD::copy(__str.begin(), __str.end(), __s);
+ return __fill_n(__s, __pad, __fill);
+ }
+ else /* covers right and internal padding */ {
+ __s = __fill_n(__s, __pad, __fill);
+ return _STLP_STD::copy(__str.begin(), __str.end(), __s);
+ }
+ }
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// num_put<>
+//
+
+template <class _CharT, class _OutputIterator>
+locale::id num_put<_CharT, _OutputIterator>::id;
+
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ bool __val) const {
+ if (!(__f.flags() & ios_base::boolalpha))
+ // 22.2.2.2.2.23: shall return do_put for int and not directly __do_put_integer.
+ return do_put(__s, __f, __fill, __STATIC_CAST(long, __val));
+
+ return _STLP_PRIV __do_put_bool(__s, __f, __fill, __val);
+}
+#endif
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ long __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned long __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ double __val) const
+{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ long double __val) const
+{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
+#endif
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ _STLP_LONG_LONG __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned _STLP_LONG_LONG __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+#endif /* _STLP_LONG_LONG */
+
+
+// 22.2.2.2.2 Stage 1: "For conversion from void* the specifier is %p."
+// This is not clear and I'm really don't follow this (below).
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/,
+ const void* __val) const {
+ const ctype<_CharT>& __c_type = use_facet<ctype<_CharT> >(__f.getloc());
+ ios_base::fmtflags __save_flags = __f.flags();
+
+ __f.setf(ios_base::hex, ios_base::basefield);
+ __f.setf(ios_base::showbase);
+ __f.setf(ios_base::internal, ios_base::adjustfield);
+ __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
+ if ( __val == 0 ) {
+ // base ('0x') not shown for null, but I really want to type it
+ // for pointer. Print it first in this case.
+ const char* __table_ptr = (__save_flags & ios_base::uppercase) ?
+ _STLP_PRIV __hex_char_table_hi() : _STLP_PRIV __hex_char_table_lo();
+ __s++ = __c_type.widen( '0' );
+ __s++ = __c_type.widen( __table_ptr[16] );
+ __f.width((sizeof(void*) * 2)); // digits in pointer type
+ } else {
+ __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
+ }
+#if defined (_STLP_MSVC)
+# pragma warning (push)
+# pragma warning (disable : 4311) //pointer truncation from 'const void*' to 'unsigned long'
+#endif
+ _OutputIter result =
+#ifdef _STLP_LONG_LONG
+ ( sizeof(void*) == sizeof(unsigned long) ) ?
+#endif
+ _STLP_PRIV __do_put_integer(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val))
+#ifdef _STLP_LONG_LONG
+ : /* ( sizeof(void*) == sizeof(unsigned _STLP_LONG_LONG) ) ? */
+ _STLP_PRIV __do_put_integer(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val))
+#endif
+ ;
+#if defined (_STLP_MSVC)
+# pragma warning (pop)
+#endif
+ __f.flags(__save_flags);
+ return result;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUM_PUT_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_num_put.h b/build/stlport/stlport/stl/_num_put.h
new file mode 100644
index 000000000..29bfc01cb
--- /dev/null
+++ b/build/stlport/stlport/stl/_num_put.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+#define _STLP_INTERNAL_NUM_PUT_H
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_put facet
+
+template <class _CharT, class _OutputIter>
+class num_put: public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _OutputIter iter_type;
+
+ explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
+
+#if !defined (_STLP_NO_BOOL)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ bool __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ long __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+#if defined (_STLP_LONG_LONG)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ _STLP_LONG_LONG __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned _STLP_LONG_LONG __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ double __val) const {
+ return do_put(__s, __f, __fill, (double)__val);
+ }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ long double __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ const void * __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ static locale::id id;
+
+protected:
+ ~num_put() {}
+#if !defined (_STLP_NO_BOOL)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
+#endif
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
+#endif
+
+#if defined (_STLP_LONG_LONG)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned _STLP_LONG_LONG __val) const ;
+#endif
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+#endif
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Integer>
+char* _STLP_CALL
+__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
+
+/*
+ * Returns the position on the right of the digits that has to be considered
+ * for the application of the grouping policy.
+ */
+extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double);
+# endif
+
+/*
+ * Gets the digits of the integer part.
+ */
+void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
+
+template <class _CharT>
+void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
+
+# if !defined (_STLP_NO_WCHAR_T)
+extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype<wchar_t>&, wchar_t, bool = true);
+# endif
+extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
+
+extern char* _STLP_CALL
+__write_integer(char* buf, ios_base::fmtflags flags, long x);
+
+extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
+extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int);
+# if !defined (_STLP_NO_WCHAR_T)
+extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
+extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int);
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_num_put.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_numeric.c b/build/stlport/stlport/stl/_numeric.c
new file mode 100644
index 000000000..6bd07ff12
--- /dev/null
+++ b/build/stlport/stlport/stl/_numeric.c
@@ -0,0 +1,106 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_NUMERIC_C
+#define _STLP_NUMERIC_C
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*, _BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last))
+ if (__first == __last) return __result;
+ *__result = *__first;
+
+ _Tp __val = *__first;
+ while (++__first != __last) {
+ __val = __binary_op(__val, *__first);
+ *++__result = __val;
+ }
+ return ++__result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*,
+ _BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last))
+ if (__first == __last) return __result;
+ *__result = *__first;
+ _Tp __val = *__first;
+ while (++__first != __last) {
+ _Tp __tmp = *__first;
+ *++__result = __binary_op(__tmp, __val);
+ __val = __tmp;
+ }
+ return ++__result;
+}
+
+
+template <class _Tp, class _Integer, class _MonoidOperation>
+_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr) {
+ _STLP_MPWFIX_TRY
+ if (__n == 0)
+ return __identity_element(__opr);
+ else {
+ while ((__n & 1) == 0) {
+ __n >>= 1;
+ __x = __opr(__x, __x);
+ }
+ _Tp __result = __x;
+ _STLP_MPWFIX_TRY
+ __n >>= 1;
+ while (__n != 0) {
+ __x = __opr(__x, __x);
+ if ((__n & 1) != 0)
+ __result = __opr(__result, __x);
+ __n >>= 1;
+ }
+ return __result;
+ _STLP_MPWFIX_CATCH
+ }
+ _STLP_MPWFIX_CATCH_ACTION(__x = _Tp())
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMERIC_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_numeric.h b/build/stlport/stlport/stl/_numeric.h
new file mode 100644
index 000000000..4844da165
--- /dev/null
+++ b/build/stlport/stlport/stl/_numeric.h
@@ -0,0 +1,191 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+#define _STLP_INTERNAL_NUMERIC_H
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _InputIterator, class _Tp>
+_STLP_INLINE_LOOP
+_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ _Init = _Init + *__first;
+ return _Init;
+}
+
+template <class _InputIterator, class _Tp, class _BinaryOperation>
+_STLP_INLINE_LOOP
+_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init,
+ _BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ _Init = __binary_op(_Init, *__first);
+ return _Init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp>
+_STLP_INLINE_LOOP
+_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp _Init) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ _Init = _Init + (*__first1 * *__first2);
+ return _Init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp,
+ class _BinaryOperation1, class _BinaryOperation2>
+_STLP_INLINE_LOOP
+_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp _Init,
+ _BinaryOperation1 __binary_op1,
+ _BinaryOperation2 __binary_op2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ _Init = __binary_op1(_Init, __binary_op2(*__first1, *__first2));
+ return _Init;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*, _BinaryOperation __binary_op);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator>
+inline _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result) {
+ return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
+ _STLP_PRIV __plus(_STLP_VALUE_TYPE(__first, _InputIterator)));
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
+inline _OutputIterator
+partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOperation __binary_op) {
+ return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator),
+ __binary_op);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOperation>
+_OutputIterator
+__adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Tp*,
+ _BinaryOperation __binary_op);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator>
+inline _OutputIterator
+adjacent_difference(_InputIterator __first,
+ _InputIterator __last, _OutputIterator __result) {
+ return _STLP_PRIV __adjacent_difference(__first, __last, __result,
+ _STLP_VALUE_TYPE(__first, _InputIterator),
+ _STLP_PRIV __minus(_STLP_VALUE_TYPE(__first, _InputIterator)));
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
+_OutputIterator
+adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOperation __binary_op) {
+ return _STLP_PRIV __adjacent_difference(__first, __last, __result,
+ _STLP_VALUE_TYPE(__first, _InputIterator),
+ __binary_op);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Integer, class _MonoidOperation>
+_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+// Returns __x ** __n, where __n >= 0. _Note that "multiplication"
+// is required to be associative, but not necessarily commutative.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Integer>
+inline _Tp __power(_Tp __x, _Integer __n) {
+ return __power(__x, __n, multiplies<_Tp>());
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Alias for the internal name __power. Note that power is an extension,
+// not part of the C++ standard.
+template <class _Tp, class _Integer, class _MonoidOperation>
+inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) {
+ return _STLP_PRIV __power(__x, __n, __opr);
+}
+
+template <class _Tp, class _Integer>
+inline _Tp power(_Tp __x, _Integer __n) {
+ return _STLP_PRIV __power(__x, __n, multiplies<_Tp>());
+}
+
+// iota is not part of the C++ standard. It is an extension.
+
+template <class _ForwardIterator, class _Tp>
+_STLP_INLINE_LOOP
+void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ while (__first != __last)
+ *__first++ = __val++;
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_numeric.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUMERIC_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_numpunct.h b/build/stlport/stlport/stl/_numpunct.h
new file mode 100644
index 000000000..c0d0ff4d5
--- /dev/null
+++ b/build/stlport/stlport/stl/_numpunct.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+#define _STLP_INTERNAL_NUMPUNCT_H
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+# ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+# endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// numpunct facets
+
+template <class _CharT> class numpunct {};
+template <class _CharT> class numpunct_byname {};
+template <class _Ch, class _InIt> class num_get;
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit numpunct(size_t __refs = 0)
+ : locale::facet(__refs) {}
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string truename() const { return do_truename(); }
+ string falsename() const { return do_falsename(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~numpunct();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string do_truename() const;
+ virtual string do_falsename() const;
+};
+
+# if ! defined (_STLP_NO_WCHAR_T)
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit numpunct(size_t __refs = 0)
+ : locale::facet(__refs) {}
+
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ wstring truename() const { return do_truename(); }
+ wstring falsename() const { return do_falsename(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~numpunct();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual wstring do_truename() const;
+ virtual wstring do_falsename() const;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
+ friend class _Locale_impl;
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit numpunct_byname(const char* __name, size_t __refs = 0);
+
+protected:
+
+ ~numpunct_byname();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string do_truename() const;
+ virtual string do_falsename() const;
+
+private:
+ numpunct_byname(_Locale_numeric *__numeric)
+ : _M_numeric(__numeric) {}
+
+ //explicitely defined as private to avoid warnings:
+ typedef numpunct_byname<char> _Self;
+ numpunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_numeric* _M_numeric;
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
+ friend class _Locale_impl;
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit numpunct_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~numpunct_byname();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual wstring do_truename() const;
+ virtual wstring do_falsename() const;
+
+private:
+ numpunct_byname(_Locale_numeric *__numeric)
+ : _M_numeric(__numeric) {}
+
+ //explicitely defined as private to avoid warnings:
+ typedef numpunct_byname<wchar_t> _Self;
+ numpunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_numeric* _M_numeric;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMPUNCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_ostream.c b/build/stlport/stlport/stl/_ostream.c
new file mode 100644
index 000000000..faba6c272
--- /dev/null
+++ b/build/stlport/stlport/stl/_ostream.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_OSTREAM_C
+#define _STLP_OSTREAM_C
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+#endif
+
+#if !defined (_STLP_INTERNAL_NUM_PUT_H)
+# include <stl/_num_put.h> // For basic_streambuf and iterators
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Definitions of non-inline member functions.
+
+// Constructor, destructor
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<_CharT, _Traits>* __buf)
+ : basic_ios<_CharT, _Traits>() {
+ this->init(__buf);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::~basic_ostream()
+{}
+
+// Output directly from a streambuf.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ if (__from) {
+ bool __any_inserted = __from->gptr() != __from->egptr()
+ ? this->_M_copy_buffered(__from, this->rdbuf())
+ : this->_M_copy_unbuffered(__from, this->rdbuf());
+ if (!__any_inserted)
+ this->setstate(ios_base::failbit);
+ }
+ else
+ this->setstate(ios_base::badbit);
+ }
+
+ return *this;
+}
+
+// Helper functions for the streambuf version of operator<<. The
+// exception-handling code is complicated because exceptions thrown
+// while extracting characters are treated differently than exceptions
+// thrown while inserting characters.
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>
+ ::_M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to) {
+ bool __any_inserted = false;
+
+ while (__from->egptr() != __from->gptr()) {
+ const ptrdiff_t __avail = __from->egptr() - __from->gptr();
+
+ streamsize __nwritten;
+ _STLP_TRY {
+ __nwritten = __to->sputn(__from->gptr(), __avail);
+ __from->gbump((int)__nwritten);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return __any_inserted;
+ }
+
+ if (__nwritten == __avail) {
+ _STLP_TRY {
+ if (this->_S_eof(__from->sgetc()))
+ return true;
+ else
+ __any_inserted = true;
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::failbit);
+ return false;
+ }
+ }
+ else if (__nwritten != 0)
+ return true;
+ else
+ return __any_inserted;
+ }
+
+ // No characters are in the buffer, but we aren't at EOF. Switch to
+ // unbuffered mode.
+ return __any_inserted || this->_M_copy_unbuffered(__from, __to);
+}
+
+/*
+ * Helper struct (guard) to put back a character in a streambuf
+ * whenever an exception or an eof occur.
+ */
+template <class _CharT, class _Traits>
+struct _SPutBackC {
+ typedef basic_streambuf<_CharT, _Traits> _StreamBuf;
+ typedef typename _StreamBuf::int_type int_type;
+ _SPutBackC(_StreamBuf *pfrom)
+ : __pfrom(pfrom), __c(0), __do_guard(false) {}
+ ~_SPutBackC() {
+ if (__do_guard) {
+ __pfrom->sputbackc(_Traits::to_char_type(__c));
+ }
+ }
+
+ void guard(int_type c) {
+ __c = c;
+ __do_guard = true;
+ }
+ void release() {
+ __do_guard = false;
+ }
+
+private:
+ _StreamBuf *__pfrom;
+ int_type __c;
+ bool __do_guard;
+};
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>
+ ::_M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to) {
+ typedef _SPutBackC<_CharT, _Traits> _SPutBackCGuard;
+ bool __any_inserted = false;
+ int_type __c;
+
+ _STLP_TRY {
+ _SPutBackCGuard __cguard(__from);
+ for (;;) {
+ _STLP_TRY {
+ __c = __from->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::failbit);
+ break;
+ }
+
+ if (this->_S_eof(__c))
+ break;
+
+ __cguard.guard(__c);
+#if defined (__DMC__)
+ _STLP_TRY {
+#endif
+ if (this->_S_eof(__to->sputc(_Traits::to_char_type(__c))))
+ break;
+
+#if defined (__DMC__)
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ break;
+ }
+#endif
+ __cguard.release();
+ __any_inserted = true;
+ }
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ return __any_inserted;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper function for numeric output.
+template <class _CharT, class _Traits, class _Number>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+__put_num(basic_ostream<_CharT, _Traits>& __os, _Number __x) {
+ typedef typename basic_ostream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(__os);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > _NumPut;
+ __failed = (use_facet<_NumPut>(__os.getloc())).put(ostreambuf_iterator<_CharT, _Traits>(__os.rdbuf()),
+ __os, __os.fill(),
+ __x).failed();
+ }
+ _STLP_CATCH_ALL {
+ __os._M_handle_exception(ios_base::badbit);
+ }
+ }
+ if (__failed)
+ __os.setstate(ios_base::badbit);
+ return __os;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+/*
+ * In the following operators we try to limit code bloat by limiting the
+ * number of __put_num instanciations.
+ */
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __x) {
+ _STLP_STATIC_ASSERT( sizeof(short) <= sizeof(long) )
+ long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
+ __STATIC_CAST(long, __STATIC_CAST(unsigned short, __x)): __x;
+ return _STLP_PRIV __put_num(*this, __tmp);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __x) {
+ _STLP_STATIC_ASSERT( sizeof(unsigned short) <= sizeof(unsigned long) )
+ return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __x) {
+ _STLP_STATIC_ASSERT( sizeof(int) <= sizeof(long) )
+ long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
+ __STATIC_CAST(long, __STATIC_CAST(unsigned int, __x)): __x;
+ return _STLP_PRIV __put_num(*this, __tmp);
+}
+
+template <class _CharT, class _Traits>
+#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __x) {
+ _STLP_STATIC_ASSERT( sizeof(unsigned int) <= sizeof(unsigned long) )
+#else
+/* We define this operator with size_t rather than unsigned int to avoid
+ * 64 bits warning.
+ */
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(size_t __x) {
+ _STLP_STATIC_ASSERT( sizeof(size_t) <= sizeof(unsigned long) )
+#endif
+ return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifdef _STLP_LONG_LONG
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (_STLP_LONG_LONG __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (unsigned _STLP_LONG_LONG __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __x)
+{ return _STLP_PRIV __put_num(*this, __STATIC_CAST(double,__x)); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifndef _STLP_NO_BOOL
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_char(_CharT __c) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ _STLP_TRY {
+ streamsize __npad = this->width() > 0 ? this->width() - 1 : 0;
+ // if (__npad <= 1)
+ if (__npad == 0)
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || this->_S_eof(this->rdbuf()->sputc(__c));
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_nowiden(const _CharT* __s) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ streamsize __n = _Traits::length(__s);
+ streamsize __npad = this->width() > __n ? this->width() - __n : 0;
+
+ _STLP_TRY {
+ if (__npad == 0)
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || this->rdbuf()->sputn(__s, __n) != __n;
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::failbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_widen(const char* __s) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ streamsize __n = char_traits<char>::length(__s);
+ streamsize __npad = this->width() > __n ? this->width() - __n : 0;
+
+ _STLP_TRY {
+ if (__npad == 0)
+ __failed = !this->_M_put_widen_aux(__s, __n);
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = !this->_M_put_widen_aux(__s, __n);
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || !this->_M_put_widen_aux(__s, __n);
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::failbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>::_M_put_widen_aux(const char* __s,
+ streamsize __n) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+
+ for ( ; __n > 0 ; --__n)
+ if (this->_S_eof(__buf->sputc(this->widen(*__s++))))
+ return false;
+ return true;
+}
+
+// Unformatted output of a single character.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::put(char_type __c) {
+ sentry __sentry(*this);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+
+ return *this;
+}
+
+// Unformatted output of a single character.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
+ sentry __sentry(*this);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+
+ return *this;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_OSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_ostream.h b/build/stlport/stlport/stl/_ostream.h
new file mode 100644
index 000000000..3335b66f5
--- /dev/null
+++ b/build/stlport/stlport/stl/_ostream.h
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+#define _STLP_INTERNAL_OSTREAM_H
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) && !defined (_STLP_INTERNAL_EXCEPTION)
+# include <stl/_exception.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+template <class _CharT, class _Traits>
+class _Osentry;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _Traits>
+bool __init_bostr(basic_ostream<_CharT, _Traits>& __str);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// class basic_ostream<>
+
+template <class _CharT, class _Traits>
+class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ typedef basic_ostream<_CharT, _Traits> _Self;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ //explicitely defined as private to avoid warnings:
+ basic_ostream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+public: // Constructor and destructor.
+ explicit basic_ostream(basic_streambuf<_CharT, _Traits>* __buf);
+ ~basic_ostream();
+
+public: // Hooks for manipulators.
+ typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
+ typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
+ typedef _Self& (_STLP_CALL *__ostream_fn)(_Self&);
+ _Self& operator<< (__ostream_fn __f) { return __f(*this); }
+ _Self & operator<< (__ios_base_fn __f) { __f(*this); return *this; }
+ _Self& operator<< (__ios_fn __ff) { __ff(*this); return *this; }
+
+private:
+ bool _M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to);
+ bool _M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to);
+
+public:
+ void _M_put_char(_CharT __c);
+
+ void _M_put_nowiden(const _CharT* __s);
+ void _M_put_widen(const char* __s);
+ bool _M_put_widen_aux(const char* __s, streamsize __n);
+
+public: // Unformatted output.
+ _Self& put(char_type __c);
+ _Self& write(const char_type* __s, streamsize __n);
+
+public: // Formatted output.
+ // Formatted output from a streambuf.
+ _Self& operator<<(basic_streambuf<_CharT, _Traits>* __buf);
+# ifndef _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+ // this is needed for compiling with option char = unsigned
+ _Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; }
+# endif
+ _Self& operator<<(short __x);
+ _Self& operator<<(unsigned short __x);
+ _Self& operator<<(int __x);
+#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+ _Self& operator<<(unsigned int __x);
+#else
+/* We define this operator with size_t rather than unsigned int to avoid
+ * 64 bits warning.
+ */
+ _Self& operator<<(size_t __x);
+#endif
+ _Self& operator<<(long __x);
+ _Self& operator<<(unsigned long __x);
+#ifdef _STLP_LONG_LONG
+ _Self& operator<< (_STLP_LONG_LONG __x);
+ _Self& operator<< (unsigned _STLP_LONG_LONG __x);
+#endif
+ _Self& operator<<(float __x);
+ _Self& operator<<(double __x);
+# ifndef _STLP_NO_LONG_DOUBLE
+ _Self& operator<<(long double __x);
+# endif
+ _Self& operator<<(const void* __x);
+# ifndef _STLP_NO_BOOL
+ _Self& operator<<(bool __x);
+# endif
+
+public: // Buffer positioning and manipulation.
+ _Self& flush() {
+ if (this->rdbuf())
+ if (this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ return *this;
+ }
+
+ pos_type tellp() {
+ return this->rdbuf() && !this->fail()
+ ? this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out)
+ : pos_type(-1);
+ }
+
+ _Self& seekp(pos_type __pos) {
+ if (this->rdbuf() && !this->fail()) {
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) {
+ this->setstate(ios_base::failbit);
+ }
+ }
+ return *this;
+ }
+
+ _Self& seekp(off_type __off, ios_base::seekdir __dir) {
+ if (this->rdbuf() && !this->fail())
+ this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
+ return *this;
+ }
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+ // If we are using DLL specs, we have not to use inner classes
+ // end class declaration here
+ typedef _Osentry<_CharT, _Traits> sentry;
+};
+# define sentry _Osentry
+ template <class _CharT, class _Traits>
+ class _Osentry {
+ typedef _Osentry<_CharT, _Traits> _Self;
+#else
+ class sentry {
+ typedef sentry _Self;
+#endif
+ private:
+ basic_ostream<_CharT, _Traits>& _M_str;
+ // basic_streambuf<_CharT, _Traits>* _M_buf;
+ bool _M_ok;
+ public:
+ explicit sentry(basic_ostream<_CharT, _Traits>& __str)
+ : _M_str(__str), /* _M_buf(__str.rdbuf()), */ _M_ok(_STLP_PRIV __init_bostr(__str))
+ {}
+
+ ~sentry() {
+ if (_M_str.flags() & ios_base::unitbuf)
+#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+ if (!uncaught_exception())
+#endif
+ _M_str.flush();
+ }
+
+ operator bool() const { return _M_ok; }
+ private: // Disable assignment and copy constructor.
+ //Implementation is here only to avoid warning with some compilers.
+ sentry(const _Self& __s) : _M_str(__s._M_str) {}
+ _Self& operator=(const _Self&) { return *this; }
+ };
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+# undef sentry
+#else
+ // close basic_ostream class definition here
+};
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Osentry<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Osentry<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for istream<>::sentry constructor.
+template <class _CharT, class _Traits>
+bool __init_bostr(basic_ostream<_CharT, _Traits>& __str) {
+ if (__str.good()) {
+ // boris : check if this is needed !
+ if (!__str.rdbuf())
+ __str.setstate(ios_base::badbit);
+ if (__str.tie())
+ __str.tie()->flush();
+ return __str.good();
+ }
+ else
+ return false;
+}
+
+template <class _CharT, class _Traits>
+inline basic_streambuf<_CharT, _Traits>* _STLP_CALL
+__get_ostreambuf(basic_ostream<_CharT, _Traits>& __St)
+{ return __St.rdbuf(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Non-member functions.
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c){
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+#if defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+// some specializations
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, signed char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, unsigned char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, const char* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, const signed char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >&
+operator<<(basic_ostream<char, char_traits<char> >& __os, const unsigned char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+#else
+
+// also for compilers who might use that
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) {
+ __os._M_put_char(__os.widen(__c));
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __s) {
+ __os._M_put_widen(__s);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, const char* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+#endif /* _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER */
+
+//----------------------------------------------------------------------
+// basic_ostream manipulators.
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+endl(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(__os.widen('\n'));
+ __os.flush();
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+ends(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(_STLP_DEFAULT_CONSTRUCTED(_CharT));
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+flush(basic_ostream<_CharT, _Traits>& __os) {
+ __os.flush();
+ return __os;
+}
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_ostream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_OSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_ostreambuf_iterator.h b/build/stlport/stlport/stl/_ostreambuf_iterator.h
new file mode 100644
index 000000000..d8865493c
--- /dev/null
+++ b/build/stlport/stlport/stl/_ostreambuf_iterator.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+#define _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template<class _CharT, class _Traits>
+extern basic_streambuf<_CharT, _Traits>* _STLP_CALL __get_ostreambuf(basic_ostream<_CharT, _Traits>&);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// The default template argument is declared in iosfwd
+template <class _CharT, class _Traits>
+class ostreambuf_iterator :
+ public iterator<output_iterator_tag, void, void, void, void> {
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+public:
+ ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {}
+ // ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(__get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
+ inline ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW;
+
+ ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) {
+ _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c),
+ traits_type::eof());
+ return *this;
+ }
+
+ ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; }
+ ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; }
+ ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; }
+
+ bool failed() const { return !_M_ok; }
+
+private:
+ streambuf_type* _M_buf;
+ bool _M_ok;
+};
+
+template <class _CharT, class _Traits>
+inline ostreambuf_iterator<_CharT, _Traits>::ostreambuf_iterator(basic_ostream<_CharT, _Traits>& __o) _STLP_NOTHROW
+ : _M_buf(_STLP_PRIV __get_ostreambuf(__o)), _M_ok(_M_buf != 0) {}
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator<char, char_traits<char> >;
+# if defined (INSTANTIATE_WIDE_STREAMS)
+_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _CharT, class _Traits>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostreambuf_iterator<_CharT, _Traits>&) { return output_iterator_tag(); }
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_pair.h b/build/stlport/stlport/stl/_pair.h
new file mode 100644
index 000000000..7da76a98b
--- /dev/null
+++ b/build/stlport/stlport/stl/_pair.h
@@ -0,0 +1,186 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_PAIR_H
+#define _STLP_INTERNAL_PAIR_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+# if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# include <stl/_move_construct_fwk.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (__ANDROID__)
+/* Android has stl_pair.h, prevent using it by defining the header guard. */
+# define __SGI_STL_INTERNAL_PAIR_H
+#endif
+template <class _T1, class _T2>
+struct pair {
+ typedef _T1 first_type;
+ typedef _T2 second_type;
+
+ _T1 first;
+ _T2 second;
+#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
+ pair() {}
+#else
+ pair() : first(_T1()), second(_T2()) {}
+#endif
+ pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _U1, class _U2>
+ pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
+
+ pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ pair(__move_source<pair<_T1, _T2> > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)),
+ second(_STLP_PRIV _AsMoveSource(src.get().second))
+ {}
+#endif
+
+ __TRIVIAL_DESTRUCTOR(pair)
+};
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return __x.first == __y.first && __x.second == __y.second; }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return __x.first < __y.first ||
+ (!(__y.first < __x.first) && __x.second < __y.second);
+}
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__x == __y); }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return __y < __x; }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__y < __x); }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__x < __y); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
+template <class _T1, class _T2, int _Sz>
+inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
+ _T2 const (&__y)[_Sz])
+{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
+
+template <class _T1, class _T2, int _Sz>
+inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
+ _T2 const& __y)
+{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
+
+template <class _T1, class _T2, int _Sz1, int _Sz2>
+inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
+ _T2 const (&__y)[_Sz2]) {
+ return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
+ static_cast<_T2 const*>(__y));
+}
+#endif
+
+template <class _T1, class _T2>
+inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
+{ return pair<_T1, _T2>(__x, __y); }
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+_STLP_BEGIN_RELOPS_NAMESPACE
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
+{ return !(__x == __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
+{ return !(__y < __x); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y)
+{ return !(__x < __y); }
+
+_STLP_END_RELOPS_NAMESPACE
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_BEGIN_NAMESPACE
+
+template <class _T1, class _T2>
+struct __type_traits<pair<_T1, _T2> > {
+ typedef __type_traits<_T1> _T1Traits;
+ typedef __type_traits<_T2> _T2Traits;
+ typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
+ typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
+ typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
+ typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
+ typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
+ typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
+ typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
+ typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _T1, class _T2>
+struct __move_traits<pair<_T1, _T2> >
+ : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
+# endif
+
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_PAIR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_prolog.h b/build/stlport/stlport/stl/_prolog.h
new file mode 100644
index 000000000..9705c2c67
--- /dev/null
+++ b/build/stlport/stlport/stl/_prolog.h
@@ -0,0 +1,18 @@
+/* NOTE : this header has no guards and is MEANT for multiple inclusion!
+ * If you are using "header protection" option with your compiler,
+ * please also find #pragma which disables it and put it here, to
+ * allow reentrancy of this header.
+ */
+
+#include <stl/_cprolog.h>
+
+/* Get all debug things, potentially only empty macros if none of
+ * the debug features available in user config file is activated. */
+ /* Thanks to _STLP_OUTERMOST_HEADER_ID we hide _debug.h when C standard
+ * headers are included as some platforms (Win32) include C standard headers
+ * in an 'extern "C"' scope which do not accept the templates exposed
+ * in _debug.h. */
+#if defined (__cplusplus) && !defined (_STLP_DEBUG_H) && \
+ !((_STLP_OUTERMOST_HEADER_ID >= 0x200) && (_STLP_OUTERMOST_HEADER_ID <= 0x300))
+# include <stl/debug/_debug.h>
+#endif
diff --git a/build/stlport/stlport/stl/_pthread_alloc.h b/build/stlport/stlport/stl/_pthread_alloc.h
new file mode 100644
index 000000000..f45d9497b
--- /dev/null
+++ b/build/stlport/stlport/stl/_pthread_alloc.h
@@ -0,0 +1,461 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_PTHREAD_ALLOC_H
+#define _STLP_PTHREAD_ALLOC_H
+
+/*
+ * Pthread-specific node allocator.
+ * This is similar to the default allocator, except that free-list
+ * information is kept separately for each thread, avoiding locking.
+ * This should be reasonably fast even in the presence of threads.
+ * The down side is that storage may not be well-utilized.
+ * It is not an error to allocate memory in thread A and deallocate
+ * it in thread B. But this effectively transfers ownership of the memory,
+ * so that it can only be reallocated by thread B. Thus this can effectively
+ * result in a storage leak if it's done on a regular basis.
+ * It can also result in frequent sharing of
+ * cache lines among processors, with potentially serious performance
+ * consequences.
+ */
+
+#if !defined (_STLP_PTHREADS)
+# error POSIX specific allocator implementation. Your system do not seems to \
+have this interface so please comment the _STLP_USE_PERTHREAD_ALLOC macro \
+or report to the STLport forum.
+#endif
+
+#if defined (_STLP_USE_NO_IOSTREAMS)
+# error You cannot use per thread allocator implementation without building \
+STLport libraries.
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Pthread_alloc_per_thread_state;
+
+// Pthread-specific allocator.
+class _STLP_CLASS_DECLSPEC _Pthread_alloc {
+public: // but only for internal use:
+ typedef _Pthread_alloc_per_thread_state __state_type;
+ typedef char value_type;
+
+public:
+ // Return a recycled or new per thread state.
+ static __state_type * _STLP_CALL _S_get_per_thread_state();
+
+ /* n must be > 0 */
+ static void * _STLP_CALL allocate(size_t& __n);
+
+ /* p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n);
+
+ // boris : versions for per_thread_allocator
+ /* n must be > 0 */
+ static void * _STLP_CALL allocate(size_t& __n, __state_type* __a);
+
+ /* p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n, __state_type* __a);
+
+ static void * _STLP_CALL reallocate(void *__p, size_t __old_sz, size_t& __new_sz);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+typedef _STLP_PRIV _Pthread_alloc __pthread_alloc;
+typedef __pthread_alloc pthread_alloc;
+
+template <class _Tp>
+class pthread_allocator : public __stlport_class<pthread_allocator<_Tp> > {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+#endif
+
+ pthread_allocator() _STLP_NOTHROW {}
+ pthread_allocator(const pthread_allocator<_Tp>& a) _STLP_NOTHROW {}
+
+#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
+ template <class _OtherType> pthread_allocator(const pthread_allocator<_OtherType>&)
+ _STLP_NOTHROW {}
+#endif
+
+ ~pthread_allocator() _STLP_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ _S_Alloc::deallocate(__p, __n * sizeof(value_type));
+ }
+ }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(pthread_allocator<_Tp>& __x) {}
+#endif
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC pthread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool operator==(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>& a2)
+{ return true; }
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template <class _T1, class _T2>
+inline bool operator!=(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>&)
+{ return false; }
+#endif
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
+{ typedef pthread_allocator<_Tp> allocator_type; };
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+template <class _Tp1, class _Tp2>
+inline pthread_allocator<_Tp2>&
+__stl_alloc_rebind(pthread_allocator<_Tp1>& __x, const _Tp2*)
+{ return (pthread_allocator<_Tp2>&)__x; }
+
+template <class _Tp1, class _Tp2>
+inline pthread_allocator<_Tp2>
+__stl_alloc_create(pthread_allocator<_Tp1>&, const _Tp2*)
+{ return pthread_allocator<_Tp2>(); }
+
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __pthread_alloc_type_traits {
+ typedef typename _IsSTLportClass<pthread_allocator<_Tp> >::_Ret _STLportAlloc;
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef _STLportAlloc has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef _STLportAlloc is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<pthread_allocator<_Tp> > : _STLP_PRIV __pthread_alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<char> > : _STLP_PRIV __pthread_alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<wchar_t> > : _STLP_PRIV __pthread_alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<void*> > : _STLP_PRIV __pthread_alloc_type_traits<void*> {};
+# endif
+#endif
+
+//
+// per_thread_allocator<> : this allocator always return memory to the same thread
+// it was allocated from.
+//
+
+template <class _Tp>
+class per_thread_allocator {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+ typedef pthread_alloc::__state_type __state_type;
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef per_thread_allocator<_NewType> other;
+ };
+#endif
+
+ per_thread_allocator() _STLP_NOTHROW {
+ _M_state = _S_Alloc::_S_get_per_thread_state();
+ }
+ per_thread_allocator(const per_thread_allocator<_Tp>& __a) _STLP_NOTHROW : _M_state(__a._M_state){}
+
+#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
+ template <class _OtherType> per_thread_allocator(const per_thread_allocator<_OtherType>& __a)
+ _STLP_NOTHROW : _M_state(__a._M_state) {}
+#endif
+
+ ~per_thread_allocator() _STLP_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, _S_Alloc::allocate(__buf_size, _M_state));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ _S_Alloc::deallocate(__p, __n * sizeof(value_type), _M_state);
+ }
+ }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+
+ // state is being kept here
+ __state_type* _M_state;
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size, _M_state));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC per_thread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef per_thread_allocator<_NewType> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool operator==(const per_thread_allocator<_T1>& __a1,
+ const per_thread_allocator<_T2>& __a2)
+{ return __a1._M_state == __a2._M_state; }
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template <class _T1, class _T2>
+inline bool operator!=(const per_thread_allocator<_T1>& __a1,
+ const per_thread_allocator<_T2>& __a2)
+{ return __a1._M_state != __a2._M_state; }
+#endif
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, per_thread_allocator<_Atype> >
+{ typedef per_thread_allocator<_Tp> allocator_type; };
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+template <class _Tp1, class _Tp2>
+inline per_thread_allocator<_Tp2>&
+__stl_alloc_rebind(per_thread_allocator<_Tp1>& __x, const _Tp2*)
+{ return (per_thread_allocator<_Tp2>&)__x; }
+
+template <class _Tp1, class _Tp2>
+inline per_thread_allocator<_Tp2>
+__stl_alloc_create(per_thread_allocator<_Tp1>&, const _Tp2*)
+{ return per_thread_allocator<_Tp2>(); }
+
+#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __perthread_alloc_type_traits {
+ typedef typename _IsSTLportClass<per_thread_allocator<_Tp> >::_Ret _STLportAlloc;
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef __false_type has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<per_thread_allocator<_Tp> > : _STLP_PRIV __perthread_alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<char> > : _STLP_PRIV __perthread_alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<wchar_t> > : _STLP_PRIV __perthread_alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<void*> > : _STLP_PRIV __perthread_alloc_type_traits<void*> {};
+# endif
+#endif
+
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTHREAD_ALLOC */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_ptrs_specialize.h b/build/stlport/stlport/stl/_ptrs_specialize.h
new file mode 100644
index 000000000..b9cb5d886
--- /dev/null
+++ b/build/stlport/stlport/stl/_ptrs_specialize.h
@@ -0,0 +1,83 @@
+#ifndef _STLP_PTRS_SPECIALIZE_H
+#define _STLP_PTRS_SPECIALIZE_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \
+ (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && !defined (_STLP_NO_ARROW_OPERATOR))
+# define _STLP_POINTERS_SPECIALIZE( _TpP )
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
+#else
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+// the following is a workaround for arrow operator problems
+# if defined ( _STLP_NO_ARROW_OPERATOR )
+// User wants to disable proxy -> operators
+# define _STLP_DEFINE_ARROW_OPERATOR
+# else
+// Compiler can handle generic -> operator.
+# if defined (__BORLANDC__)
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); }
+# elif defined(__WATCOMC__)
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; }
+# else
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
+# endif
+# endif /* _STLP_NO_ARROW_OPERATOR */
+
+// Important pointers specializations
+
+# ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type)
+# else
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<__true_type> {};
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***)
+# endif
+
+# define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
+
+_STLP_BEGIN_NAMESPACE
+
+# if !defined ( _STLP_NO_BOOL )
+_STLP_POINTERS_SPECIALIZE( bool )
+# endif
+_STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void)
+# ifndef _STLP_NO_SIGNED_BUILTINS
+ _STLP_POINTERS_SPECIALIZE( signed char )
+# endif
+ _STLP_POINTERS_SPECIALIZE( char )
+ _STLP_POINTERS_SPECIALIZE( unsigned char )
+ _STLP_POINTERS_SPECIALIZE( short )
+ _STLP_POINTERS_SPECIALIZE( unsigned short )
+ _STLP_POINTERS_SPECIALIZE( int )
+ _STLP_POINTERS_SPECIALIZE( unsigned int )
+ _STLP_POINTERS_SPECIALIZE( long )
+ _STLP_POINTERS_SPECIALIZE( unsigned long )
+ _STLP_POINTERS_SPECIALIZE( float )
+ _STLP_POINTERS_SPECIALIZE( double )
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ _STLP_POINTERS_SPECIALIZE( long double )
+# endif
+# if defined ( _STLP_LONG_LONG)
+ _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG )
+ _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG )
+# endif
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+ _STLP_POINTERS_SPECIALIZE( wchar_t )
+# endif
+
+_STLP_END_NAMESPACE
+
+# undef _STLP_ARROW_SPECIALIZE
+# undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V
+
+#endif
+#endif
diff --git a/build/stlport/stlport/stl/_queue.h b/build/stlport/stlport/stl/_queue.h
new file mode 100644
index 000000000..5f3763c02
--- /dev/null
+++ b/build/stlport/stlport/stl/_queue.h
@@ -0,0 +1,268 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_QUEUE_H
+#define _STLP_INTERNAL_QUEUE_H
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if ! defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
+template <class _Tp, class _Sequence = deque<_Tp> >
+# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+# define _STLP_QUEUE_ARGS _Tp
+template <class _Tp>
+# else
+template <class _Tp, class _Sequence>
+# endif
+class queue
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_QUEUE_ARGS)
+ : public __stlport_class<queue<_Tp> >
+# else
+ : public __stlport_class<queue<_Tp, _Sequence> >
+# endif
+#endif
+{
+# if defined ( _STLP_QUEUE_ARGS )
+ typedef deque<_Tp> _Sequence;
+ typedef queue<_Tp> _Self;
+# else
+ typedef queue<_Tp, _Sequence> _Self;
+# endif
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+
+protected:
+ //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant.
+ _Sequence c;
+public:
+ queue() : c() {}
+ explicit queue(const _Sequence& __c) : c(__c) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+#endif
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference front() { return c.front(); }
+ const_reference front() const { return c.front(); }
+ reference back() { return c.back(); }
+ const_reference back() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_front(); }
+ const _Sequence& _Get_s() const { return c; }
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#ifndef _STLP_QUEUE_ARGS
+# define _STLP_QUEUE_ARGS _Tp, _Sequence
+# define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence
+#else
+# define _STLP_QUEUE_HEADER_ARGS class _Tp
+#endif
+
+template < _STLP_QUEUE_HEADER_ARGS >
+inline bool _STLP_CALL
+operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
+ return __x._Get_s() == __y._Get_s();
+}
+
+template < _STLP_QUEUE_HEADER_ARGS >
+inline bool _STLP_CALL
+operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
+ return __x._Get_s() < __y._Get_s();
+}
+
+_STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > )
+
+# if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG ))
+template <class _Tp, class _Sequence = vector<_Tp>,
+ class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> >
+# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+template <class _Tp>
+# else
+template <class _Tp, class _Sequence, class _Compare>
+# endif
+class priority_queue
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
+ : public __stlport_class<priority_queue<_Tp> >
+# else
+ : public __stlport_class<priority_queue<_Tp, _Sequence> >
+# endif
+#endif
+{
+# ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS
+ typedef vector<_Tp> _Sequence;
+ typedef less< typename vector<_Tp>::value_type> _Compare;
+ typedef priority_queue<_Tp> _Self;
+# else
+ typedef priority_queue<_Tp, _Sequence, _Compare> _Self;
+# endif
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+protected:
+ //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant.
+ _Sequence c;
+ _Compare comp;
+public:
+ priority_queue() : c() {}
+ explicit priority_queue(const _Compare& __x) : c(), comp(__x) {}
+ priority_queue(const _Compare& __x, const _Sequence& __s)
+ : c(__s), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ priority_queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)),
+ comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {}
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last)
+ : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
+
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first,
+ _InputIterator __last, const _Compare& __x)
+ : c(__first, __last), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last,
+ const _Compare& __x, const _Sequence& __s)
+ : c(__s), comp(__x)
+ {
+ c.insert(c.end(), __first, __last);
+ make_heap(c.begin(), c.end(), comp);
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ priority_queue(const value_type* __first, const value_type* __last)
+ : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
+
+ priority_queue(const value_type* __first, const value_type* __last,
+ const _Compare& __x)
+ : c(__first, __last), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+ priority_queue(const value_type* __first, const value_type* __last,
+ const _Compare& __x, const _Sequence& __c)
+ : c(__c), comp(__x)
+ {
+ c.insert(c.end(), __first, __last);
+ make_heap(c.begin(), c.end(), comp);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ const_reference top() const { return c.front(); }
+ void push(const value_type& __x) {
+ _STLP_TRY {
+ c.push_back(__x);
+ push_heap(c.begin(), c.end(), comp);
+ }
+ _STLP_UNWIND(c.clear())
+ }
+ void pop() {
+ _STLP_TRY {
+ pop_heap(c.begin(), c.end(), comp);
+ c.pop_back();
+ }
+ _STLP_UNWIND(c.clear())
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Sequence>
+struct __move_traits<queue<_Tp, _Sequence> > :
+ _STLP_PRIV __move_traits_aux<_Sequence>
+{};
+
+template <class _Tp, class _Sequence, class _Compare>
+struct __move_traits<priority_queue<_Tp, _Sequence, _Compare> > :
+ _STLP_PRIV __move_traits_aux2<_Sequence, _Compare>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_QUEUE_ARGS
+#undef _STLP_QUEUE_HEADER_ARGS
+#undef comp
+
+#endif /* _STLP_INTERNAL_QUEUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_range_errors.c b/build/stlport/stlport/stl/_range_errors.c
new file mode 100644
index 000000000..87293be7f
--- /dev/null
+++ b/build/stlport/stlport/stl/_range_errors.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#if defined(_STLP_THROW_RANGE_ERRORS)
+# if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_DONT_REDEFINE_STD)
+// In this mode we are going to throw native exception so that catch of
+// exception like std::runtime_error for instance will also catch exception
+// thrown by STLport containers like stlport::vector or stlport::string.
+# include <stdexcept>
+# include <string>
+# define _STLP_THROW_MSG(ex,msg) throw std::ex(msg)
+# else
+# if defined (__BUILDING_STLPORT)
+# include <stdexcept>
+# include <string>
+# else
+# ifndef _STLP_INTERNAL_STDEXCEPT
+# include <stl/_stdexcept.h>
+# endif
+# ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+# endif
+# endif
+# define _STLP_THROW_MSG(ex,msg) throw ex(msg)
+# endif
+#else
+# if defined (__BUILDING_STLPORT)
+# include <cstdlib>
+# include <cstdio>
+# else
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# endif
+# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
+#endif
+
+// For mode without library and throwing range errors, include the
+// stdexcept header and throw the appropriate exceptions directly.
+
+#if defined (_STLP_EXTERN_RANGE_ERRORS)
+# define _STLP_THROW_FUNCT_SPEC void _STLP_DECLSPEC
+#else
+# define _STLP_THROW_FUNCT_SPEC inline void
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
+{ _STLP_THROW_MSG(runtime_error, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
+{ _STLP_THROW_MSG(range_error, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
+{ _STLP_THROW_MSG(out_of_range, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
+{ _STLP_THROW_MSG(length_error, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
+{ _STLP_THROW_MSG(invalid_argument, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
+{ _STLP_THROW_MSG(overflow_error, __msg); }
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_THROW_FUNCT_SPEC
+#undef _STLP_THROW_MSG
diff --git a/build/stlport/stlport/stl/_range_errors.h b/build/stlport/stlport/stl/_range_errors.h
new file mode 100644
index 000000000..80df26a46
--- /dev/null
+++ b/build/stlport/stlport/stl/_range_errors.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+#ifndef _STLP_RANGE_ERRORS_H
+#define _STLP_RANGE_ERRORS_H
+
+// A few places in the STL throw range errors, using standard exception
+// classes defined in <stdexcept>. This header file provides functions
+// to throw those exception objects.
+
+// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
+// this exception throwing.
+#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
+ !defined (_STLP_DONT_THROW_RANGE_ERRORS)
+# define _STLP_THROW_RANGE_ERRORS
+#endif
+
+// For the STLport iostreams, only declaration here, definition is in the lib
+#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS)
+# define _STLP_EXTERN_RANGE_ERRORS
+#endif
+
+_STLP_BEGIN_NAMESPACE
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
+
+#if defined (__DMC__) && !defined (_STLP_NO_EXCEPTIONS)
+# pragma noreturn(__stl_throw_runtime_error)
+# pragma noreturn(__stl_throw_range_error)
+# pragma noreturn(__stl_throw_out_of_range)
+# pragma noreturn(__stl_throw_length_error)
+# pragma noreturn(__stl_throw_invalid_argument)
+# pragma noreturn(__stl_throw_overflow_error)
+#endif
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_EXTERN_RANGE_ERRORS)
+# include <stl/_range_errors.c>
+#endif
+
+#endif /* _STLP_RANGE_ERRORS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_raw_storage_iter.h b/build/stlport/stlport/stl/_raw_storage_iter.h
new file mode 100644
index 000000000..6e4bc2e9d
--- /dev/null
+++ b/build/stlport/stlport/stl/_raw_storage_iter.h
@@ -0,0 +1,80 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H
+#define _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _ForwardIterator, class _Tp>
+class raw_storage_iterator
+ : public iterator<output_iterator_tag,void,void,void,void>
+{
+protected:
+ _ForwardIterator _M_iter;
+public:
+ typedef output_iterator_tag iterator_category;
+# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+# endif
+ explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
+ raw_storage_iterator<_ForwardIterator, _Tp>& operator*() { return *this; }
+ raw_storage_iterator<_ForwardIterator, _Tp>& operator=(const _Tp& __element) {
+ _Param_Construct(&*_M_iter, __element);
+ return *this;
+ }
+ raw_storage_iterator<_ForwardIterator, _Tp>& operator++() {
+ ++_M_iter;
+ return *this;
+ }
+ raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) {
+ raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;
+ ++_M_iter;
+ return __tmp;
+ }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _ForwardIterator, class _Tp>
+inline output_iterator_tag iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) { return output_iterator_tag(); }
+#endif
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_relops_cont.h b/build/stlport/stlport/stl/_relops_cont.h
new file mode 100644
index 000000000..cd8ec0504
--- /dev/null
+++ b/build/stlport/stlport/stl/_relops_cont.h
@@ -0,0 +1,29 @@
+// This is an implementation file which
+// is intended to be included multiple times with different _STLP_ASSOCIATIVE_CONTAINER
+// setting
+
+#if !defined (_STLP_EQUAL_OPERATOR_SPECIALIZED)
+_STLP_TEMPLATE_HEADER
+inline bool _STLP_CALL operator==(const _STLP_TEMPLATE_CONTAINER& __x,
+ const _STLP_TEMPLATE_CONTAINER& __y) {
+ return __x.size() == __y.size() &&
+ equal(__x.begin(), __x.end(), __y.begin());
+}
+#endif /* _STLP_EQUAL_OPERATOR_SPECIALIZED */
+
+_STLP_TEMPLATE_HEADER
+inline bool _STLP_CALL operator<(const _STLP_TEMPLATE_CONTAINER& __x,
+ const _STLP_TEMPLATE_CONTAINER& __y) {
+ return lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end());
+}
+
+_STLP_RELOPS_OPERATORS( _STLP_TEMPLATE_HEADER , _STLP_TEMPLATE_CONTAINER )
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+_STLP_TEMPLATE_HEADER
+inline void _STLP_CALL swap(_STLP_TEMPLATE_CONTAINER& __x,
+ _STLP_TEMPLATE_CONTAINER& __y) {
+ __x.swap(__y);
+}
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
diff --git a/build/stlport/stlport/stl/_relops_hash_cont.h b/build/stlport/stlport/stl/_relops_hash_cont.h
new file mode 100644
index 000000000..421c8050b
--- /dev/null
+++ b/build/stlport/stlport/stl/_relops_hash_cont.h
@@ -0,0 +1,13 @@
+/* This is an implementation file which is intended to be included
+ * multiple times with different _STLP_TEMPLATE_CONTAINER settings.
+ */
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+_STLP_TEMPLATE_HEADER
+inline void _STLP_CALL
+swap(_STLP_TEMPLATE_CONTAINER& __hm1, _STLP_TEMPLATE_CONTAINER& __hm2) {
+ __hm1.swap(__hm2);
+}
+
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
diff --git a/build/stlport/stlport/stl/_rope.c b/build/stlport/stlport/stl/_rope.c
new file mode 100644
index 000000000..196ee220b
--- /dev/null
+++ b/build/stlport/stlport/stl/_rope.c
@@ -0,0 +1,1407 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+// if necessary. Assumes path_end[leaf_index] and leaf_pos are correct.
+// Results in a valid buf_ptr if the iterator can be legitimately
+// dereferenced.
+#ifndef _STLP_ROPEIMPL_H
+#define _STLP_ROPEIMPL_H
+
+#ifndef _STLP_INTERNAL_ROPE_H
+# include <stl/_rope.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+#endif
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __allocator__ _Alloc
+#else
+# define __allocator__ allocator_type
+#endif
+
+template<class _CharT, class _Alloc>
+_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos)
+ : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr._M_data, __pos),
+ _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); }
+
+template<class _CharT, class _Alloc>
+_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos):
+ _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos),
+ _M_root_rope(&__r) {
+#if !defined (__DMC__)
+ _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*this);
+#else
+ _Rope_iterator_base<_CharT, _Alloc>* __x = this;
+ _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*__x);
+#endif
+}
+
+template<class _CharT, class _Alloc>
+void _Rope_RopeRep<_CharT, _Alloc>::_M_free_c_string() {
+ _CharT* __cstr = _M_c_string;
+ if (0 != __cstr) {
+ size_t _p_size = _M_size._M_data + 1;
+ _STLP_STD::_Destroy_Range(__cstr, __cstr + _p_size);
+ _M_size.deallocate(__cstr, _p_size);
+ }
+}
+
+// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
+// Results in a valid buf_ptr if the iterator can be legitimately
+// dereferenced.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
+ _Rope_iterator_base<_CharT,_Alloc>& __x) {
+ const _RopeRep* __leaf = __x._M_path_end._M_data[__x._M_leaf_index];
+ size_t __leaf_pos = __x._M_leaf_pos;
+ size_t __pos = __x._M_current_pos;
+
+ switch(__leaf->_M_tag) {
+ case _RopeRep::_S_leaf:
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ __x._M_buf_start = __STATIC_CAST(const _RopeLeaf*, __leaf)->_M_data;
+ __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
+ __x._M_buf_end = __x._M_buf_start + __leaf->_M_size._M_data;
+ break;
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ size_t __len = _S_iterator_buf_len;
+ size_t __buf_start_pos = __leaf_pos;
+ size_t __leaf_end = __leaf_pos + __leaf->_M_size._M_data;
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ char_producer<_CharT>* __fn = __STATIC_CAST(const _RopeFunction*, __leaf)->_M_fn;
+
+ if (__buf_start_pos + __len <= __pos) {
+ __buf_start_pos = __pos - __len/4;
+ if (__buf_start_pos + __len > __leaf_end) {
+ __buf_start_pos = __leaf_end - __len;
+ }
+ }
+ if (__buf_start_pos + __len > __leaf_end) {
+ __len = __leaf_end - __buf_start_pos;
+ }
+ (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf._M_data);
+ __x._M_buf_ptr = __x._M_tmp_buf._M_data + (__pos - __buf_start_pos);
+ __x._M_buf_start = __x._M_tmp_buf._M_data;
+ __x._M_buf_end = __x._M_tmp_buf._M_data + __len;
+ }
+ break;
+ default:
+ _STLP_ASSERT(0)
+ ;
+ }
+}
+
+// Set path and buffer inside a rope iterator. We assume that
+// pos and root are already set.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache(
+ _Rope_iterator_base<_CharT,_Alloc>& __x) {
+ const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1];
+ const _RopeRep* __curr_rope;
+ int __curr_depth = -1; /* index into path */
+ size_t __curr_start_pos = 0;
+ size_t __pos = __x._M_current_pos;
+ unsigned char __dirns = 0; // Bit vector marking right turns in the path
+
+ _STLP_ASSERT(__pos <= __x._M_root->_M_size._M_data)
+ if (__pos >= __x._M_root->_M_size._M_data) {
+ __x._M_buf_ptr = 0;
+ return;
+ }
+ __curr_rope = __x._M_root;
+ if (0 != __curr_rope->_M_c_string) {
+ /* Treat the root as a leaf. */
+ __x._M_buf_start = __curr_rope->_M_c_string;
+ __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size._M_data;
+ __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
+ __x._M_path_end._M_data[0] = __curr_rope;
+ __x._M_leaf_index = 0;
+ __x._M_leaf_pos = 0;
+ return;
+ }
+ for(;;) {
+ ++__curr_depth;
+ _STLP_ASSERT(__curr_depth <= _RopeRep::_S_max_rope_depth)
+ __path[__curr_depth] = __curr_rope;
+ switch(__curr_rope->_M_tag) {
+ case _RopeRep::_S_leaf:
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ __x._M_leaf_pos = __curr_start_pos;
+ goto done;
+ case _RopeRep::_S_concat:
+ {
+ const _RopeConcat* __c = __STATIC_CAST(const _RopeConcat*, __curr_rope);
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ __dirns <<= 1;
+ if (__pos >= __curr_start_pos + __left_len) {
+ __dirns |= 1;
+ __curr_rope = __c->_M_right;
+ __curr_start_pos += __left_len;
+ } else {
+ __curr_rope = __left;
+ }
+ }
+ break;
+ }
+ }
+done:
+ // Copy last section of path into _M_path_end.
+ {
+ int __i = -1;
+ int __j = __curr_depth + 1 - _S_path_cache_len;
+
+ if (__j < 0) __j = 0;
+ while (__j <= __curr_depth) {
+ __x._M_path_end._M_data[++__i] = __path[__j++];
+ }
+ __x._M_leaf_index = __i;
+ }
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+}
+
+// Specialized version of the above. Assumes that
+// the path cache is valid for the previous position.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr(
+_Rope_iterator_base<_CharT,_Alloc>& __x) {
+ int __current_index = __x._M_leaf_index;
+ const _RopeRep* __current_node = __x._M_path_end._M_data[__current_index];
+ size_t __len = __current_node->_M_size._M_data;
+ size_t __node_start_pos = __x._M_leaf_pos;
+ unsigned char __dirns = __x._M_path_directions;
+ const _RopeConcat* __c;
+
+ _STLP_ASSERT(__x._M_current_pos <= __x._M_root->_M_size._M_data)
+ if (__x._M_current_pos - __node_start_pos < __len) {
+ /* More stuff in this leaf, we just didn't cache it. */
+ _S_setbuf(__x);
+ return;
+ }
+ _STLP_ASSERT(__node_start_pos + __len == __x._M_current_pos)
+ // node_start_pos is starting position of last_node.
+ while (--__current_index >= 0) {
+ if (!(__dirns & 1) /* Path turned left */)
+ break;
+ __current_node = __x._M_path_end._M_data[__current_index];
+ __c = __STATIC_CAST(const _RopeConcat*, __current_node);
+ // Otherwise we were in the right child. Thus we should pop
+ // the concatenation node.
+ __node_start_pos -= __c->_M_left->_M_size._M_data;
+ __dirns >>= 1;
+ }
+ if (__current_index < 0) {
+ // We underflowed the cache. Punt.
+ _S_setcache(__x);
+ return;
+ }
+ __current_node = __x._M_path_end._M_data[__current_index];
+ __c = __STATIC_CAST(const _RopeConcat*, __current_node);
+ // current_node is a concatenation node. We are positioned on the first
+ // character in its right child.
+ // node_start_pos is starting position of current_node.
+ __node_start_pos += __c->_M_left->_M_size._M_data;
+ __current_node = __c->_M_right;
+ __x._M_path_end._M_data[++__current_index] = __current_node;
+ __dirns |= 1;
+ while (_RopeRep::_S_concat == __current_node->_M_tag) {
+ ++__current_index;
+ if (_S_path_cache_len == __current_index) {
+ int __i;
+ for (__i = 0; __i < _S_path_cache_len-1; ++__i) {
+ __x._M_path_end._M_data[__i] = __x._M_path_end._M_data[__i+1];
+ }
+ --__current_index;
+ }
+ __current_node = __STATIC_CAST(const _RopeConcat*, __current_node)->_M_left;
+ __x._M_path_end._M_data[__current_index] = __current_node;
+ __dirns <<= 1;
+ // node_start_pos is unchanged.
+ }
+ __x._M_leaf_index = __current_index;
+ __x._M_leaf_pos = __node_start_pos;
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) {
+ _M_current_pos += __n;
+ if (0 != _M_buf_ptr) {
+ size_t __chars_left = _M_buf_end - _M_buf_ptr;
+ if (__chars_left > __n) {
+ _M_buf_ptr += __n;
+ } else if (__chars_left == __n) {
+ _M_buf_ptr += __n;
+ _S_setcache_for_incr(*this);
+ } else {
+ _M_buf_ptr = 0;
+ }
+ }
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
+ if (0 != _M_buf_ptr) {
+ size_t __chars_left = _M_buf_ptr - _M_buf_start;
+ if (__chars_left >= __n) {
+ _M_buf_ptr -= __n;
+ } else {
+ _M_buf_ptr = 0;
+ }
+ }
+ _M_current_pos -= __n;
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator<_CharT,_Alloc>::_M_check() {
+ if (_M_root_rope->_M_tree_ptr._M_data != this->_M_root) {
+ // _Rope was modified. Get things fixed up.
+ _RopeRep::_S_unref(this->_M_root);
+ this->_M_root = _M_root_rope->_M_tree_ptr._M_data;
+ _RopeRep::_S_ref(this->_M_root);
+ this->_M_buf_ptr = 0;
+ }
+}
+
+// There are several reasons for not doing this with virtual destructors
+// and a class specific delete operator:
+// - A class specific delete operator can't easily get access to
+// allocator instances if we need them.
+// - Any virtual function would need a 4 or byte vtable pointer;
+// this only requires a one byte tag per object.
+template <class _CharT, class _Alloc>
+void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() {
+ switch (_M_tag) {
+ case _S_leaf:
+ {
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, this);
+ _STLP_STD::_Destroy(__l); // ->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf();
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
+ _RopeLeaf).deallocate(__l, 1);
+ break;
+ }
+ case _S_concat:
+ {
+ typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, this);
+ _STLP_STD::_Destroy(__c);
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
+ _RopeConcatenation).deallocate(__c, 1);
+ break;
+ }
+ case _S_function:
+ {
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, this);
+ _STLP_STD::_Destroy(__f);
+ _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
+ _RopeFunction).deallocate(__f, 1);
+ break;
+ }
+ case _S_substringfn:
+ {
+ typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
+ _RopeSubstring* __rss = __STATIC_CAST(_RopeSubstring*, this);
+ _STLP_STD::_Destroy(__rss);
+ _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
+ _RopeSubstring).deallocate(__rss, 1);
+ break;
+ }
+ }
+}
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __RopeLeaf__ _Rope_RopeLeaf<_CharT,_Alloc>
+# define __RopeRep__ _Rope_RopeRep<_CharT,_Alloc>
+# define _RopeLeaf _Rope_RopeLeaf<_CharT,_Alloc>
+# define _RopeRep _Rope_RopeRep<_CharT,_Alloc>
+# define size_type size_t
+# else
+# define __RopeLeaf__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf
+# define __RopeRep__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep
+# endif
+
+template <class _CharT, class _Alloc>
+void rope<_CharT, _Alloc>::_M_throw_out_of_range() const {
+ __stl_throw_out_of_range("rope");
+}
+
+// Concatenate a C string onto a leaf rope by copying the rope data.
+// Used for short ropes.
+template <class _CharT, class _Alloc>
+__RopeLeaf__*
+rope<_CharT,_Alloc>::_S_leaf_concat_char_iter (
+ _RopeLeaf* __r, const _CharT* __iter, size_t __len) {
+ size_t __old_len = __r->_M_size._M_data;
+ _CharT* __new_data = __r->_M_size.allocate(_S_rounded_up_size(__old_len + __len));
+ _RopeLeaf* __result;
+
+ _STLP_PRIV __ucopy_n(__r->_M_data, __old_len, __new_data);
+ _STLP_PRIV __ucopy_n(__iter, __len, __new_data + __old_len);
+ _S_construct_null(__new_data + __old_len + __len);
+ _STLP_TRY {
+ __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->get_allocator());
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__new_data, __old_len + __len,
+ __r->get_allocator()))
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
+ size_t __size, const __true_type& /*basic char type*/) {
+ _S_construct_null(__r->_M_data + __size);
+ _STLP_ASSERT(__r->_M_c_string == __r->_M_data)
+}
+
+template <class _CharT, class _Alloc>
+void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
+ size_t, const __false_type& /*basic char type*/) {
+ if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+}
+
+// As above, but it's OK to clobber original if refcount is 1
+template <class _CharT, class _Alloc>
+__RopeLeaf__*
+rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter (_RopeLeaf* __r, const _CharT* __iter, size_t __len) {
+ //_STLP_ASSERT(__r->_M_ref_count >= 1)
+ if ( /* __r->_M_ref_count > 1 */ __r->_M_incr() > 2 ) { // - ptr
+ __r->_M_decr(); // - ptr
+ return _S_leaf_concat_char_iter(__r, __iter, __len);
+ }
+ __r->_M_decr(); // - ptr, __r->_M_ref_count == 1 or 0
+ size_t __old_len = __r->_M_size._M_data;
+ if (_S_rounded_up_size(__old_len) == _S_rounded_up_size(__old_len + __len)) {
+ // The space has been partially initialized for the standard
+ // character types. But that doesn't matter for those types.
+ _STLP_PRIV __ucopy_n(__iter, __len, __r->_M_data + __old_len);
+ _Terminate_RopeLeaf(__r, __old_len + __len, _IsBasicCharType());
+ __r->_M_size._M_data = __old_len + __len;
+ // _STLP_ASSERT(__r->_M_ref_count == 1)
+ // __r->_M_ref_count = 2;
+ __r->_M_incr(); // i.e. __r->_M_ref_count = 2
+ return __r;
+ } else {
+ _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
+ //_STLP_ASSERT(__result->_M_ref_count == 1)
+ return __result;
+ }
+}
+
+// Assumes left and right are not 0.
+// Does not increment (nor decrement on exception) child reference counts.
+// Result has ref count 1.
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) {
+ _RopeConcatenation* __result =
+ _S_new_RopeConcatenation(__left, __right, __left->get_allocator());
+ size_t __depth = __result->_M_depth;
+
+ _STLP_ASSERT(__left->get_allocator() == __right->get_allocator())
+ if (__depth > 20 && (__result->_M_size._M_data < 1000 ||
+ __depth > _RopeRep::_S_max_rope_depth)) {
+ _RopeRep* __balanced;
+
+ _STLP_TRY {
+ __balanced = _S_balance(__result);
+ // _STLP_ASSERT(__result == __balanced ||
+ // 1 == __result->_M_ref_count &&
+ // 1 == __balanced->_M_ref_count)
+ __result->_M_unref_nonnil();
+ }
+ _STLP_UNWIND((_STLP_CREATE_ALLOCATOR(allocator_type,(allocator_type&)__left->_M_size,
+ _RopeConcatenation).deallocate(__result,1)))
+ // In case of exception, we need to deallocate
+ // otherwise dangling result node. But caller
+ // still owns its children. Thus unref is
+ // inappropriate.
+ return __balanced;
+ } else {
+ return __result;
+ }
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_concat_char_iter (_RopeRep* __r,
+ const _CharT*__s, size_t __slen) {
+ _RopeRep* __result;
+ if (0 == __slen) {
+ _S_ref(__r);
+ return __r;
+ }
+ if (0 == __r)
+ return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ if (_RopeRep::_S_leaf == __r->_M_tag &&
+ __r->_M_size._M_data + __slen <= _S_copy_max) {
+ __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag &&
+ _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) {
+ _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
+ if (__right->_M_size._M_data + __slen <= _S_copy_max) {
+ _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
+ _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
+ __left->_M_ref_nonnil();
+ _STLP_TRY {
+ __result = _S_tree_concat(__left, __nright);
+ }
+ _STLP_UNWIND(_S_unref(__left); _S_unref(__nright))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ }
+ }
+ _RopeRep* __nright =
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ _STLP_TRY {
+ __r->_M_ref_nonnil();
+ __result = _S_tree_concat(__r, __nright);
+ }
+ _STLP_UNWIND(_S_unref(__r); _S_unref(__nright))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
+ _RopeRep* __r, const _CharT* __s, size_t __slen) {
+ _RopeRep* __result;
+ if (0 == __r)
+ return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen,
+ __r->get_allocator());
+ // size_t __count = __r->_M_ref_count;
+ size_t __orig_size = __r->_M_size._M_data;
+ // _STLP_ASSERT(__count >= 1)
+ if ( /* __count > 1 */ __r->_M_incr() > 2 ) {
+ __r->_M_decr();
+ return _S_concat_char_iter(__r, __s, __slen);
+ }
+ if (0 == __slen) {
+ return __r;
+ }
+ __r->_M_decr();
+ if (__orig_size + __slen <= _S_copy_max && _RopeRep::_S_leaf == __r->_M_tag) {
+ return _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag) {
+ _RopeLeaf* __right = __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __r)->_M_right);
+ if (_RopeRep::_S_leaf == __right->_M_tag &&
+ __right->_M_size._M_data + __slen <= _S_copy_max) {
+ _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen);
+ if (__right == __new_right) {
+ // _STLP_ASSERT(__new_right->_M_ref_count == 2)
+ // __new_right->_M_ref_count = 1;
+ __new_right->_M_decr();
+ } else {
+ // _STLP_ASSERT(__new_right->_M_ref_count >= 1)
+ __right->_M_unref_nonnil();
+ }
+ // _STLP_ASSERT(__r->_M_ref_count == 1)
+ // __r->_M_ref_count = 2; // One more than before.
+ __r->_M_incr();
+ __STATIC_CAST(_RopeConcatenation*, __r)->_M_right = __new_right;
+ // E.Musser : moved below
+ // __r->_M_size._M_data = __orig_size + __slen;
+ if (0 != __r->_M_c_string) {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+ __r->_M_size._M_data = __orig_size + __slen;
+ return __r;
+ }
+ }
+ _RopeRep* __right =
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ __r->_M_ref_nonnil();
+ _STLP_TRY {
+ __result = _S_tree_concat(__r, __right);
+ }
+ _STLP_UNWIND(_S_unref(__r); _S_unref(__right))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_concat_rep(_RopeRep* __left, _RopeRep* __right) {
+ if (0 == __left) {
+ _S_ref(__right);
+ return __right;
+ }
+ if (0 == __right) {
+ __left->_M_ref_nonnil();
+ return __left;
+ }
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ if (_RopeRep::_S_leaf == __left->_M_tag) {
+ if (__right->_M_size._M_data + __left->_M_size._M_data <= _S_copy_max) {
+ return _S_leaf_concat_char_iter(__STATIC_CAST(_RopeLeaf*, __left),
+ __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
+ __right->_M_size._M_data);
+ }
+ } else if (_RopeRep::_S_concat == __left->_M_tag &&
+ _RopeRep::_S_leaf == __STATIC_CAST(_RopeConcatenation*, __left)->_M_right->_M_tag) {
+ _RopeLeaf* __leftright =
+ __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __left)->_M_right);
+ if (__leftright->_M_size._M_data + __right->_M_size._M_data <= _S_copy_max) {
+ _RopeRep* __leftleft = __STATIC_CAST(_RopeConcatenation*, __left)->_M_left;
+ _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
+ __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
+ __right->_M_size._M_data);
+ __leftleft->_M_ref_nonnil();
+ _STLP_TRY {
+ return _S_tree_concat(__leftleft, __rest);
+ }
+ _STLP_UNWIND(_S_unref(__leftleft); _S_unref(__rest))
+ }
+ }
+ }
+ __left->_M_ref_nonnil();
+ __right->_M_ref_nonnil();
+ _STLP_TRY {
+ return _S_tree_concat(__left, __right);
+ }
+ _STLP_UNWIND(_S_unref(__left); _S_unref(__right))
+ _STLP_RET_AFTER_THROW(0)
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1) {
+ if (0 == __base) return 0;
+ size_t __len = __base->_M_size._M_data;
+ size_t __adj_endp1;
+ const size_t __lazy_threshold = 128;
+
+ if (__endp1 >= __len) {
+ if (0 == __start) {
+ __base->_M_ref_nonnil();
+ return __base;
+ } else {
+ __adj_endp1 = __len;
+ }
+ } else {
+ __adj_endp1 = __endp1;
+ }
+ switch(__base->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __base);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ size_t __left_len = __left->_M_size._M_data;
+ _RopeRep* __result;
+
+ if (__adj_endp1 <= __left_len) {
+ return _S_substring(__left, __start, __endp1);
+ } else if (__start >= __left_len) {
+ return _S_substring(__right, __start - __left_len,
+ __adj_endp1 - __left_len);
+ }
+ _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len));
+ _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len));
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 - mpw forgets to call dtor on __left_result and __right_result without this try block
+ __result = _S_concat_rep(__left_result, __right_result);
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
+ }
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __base);
+ _RopeLeaf* __result;
+ size_t __result_len;
+ if (__start >= __adj_endp1) return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold) goto lazy;
+ const _CharT* __section = __l->_M_data + __start;
+ // We should sometimes create substring node instead.
+ __result = _S_RopeLeaf_from_unowned_char_ptr(__section, __result_len,
+ __base->get_allocator());
+ return __result;
+ }
+ case _RopeRep::_S_substringfn:
+ // Avoid introducing multiple layers of substring nodes.
+ {
+ _RopeSubstring* __old = __STATIC_CAST(_RopeSubstring*, __base);
+ size_t __result_len;
+ if (__start >= __adj_endp1) return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold) {
+ _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base,
+ __start + __old->_M_start,
+ __adj_endp1 - __start,
+ __base->get_allocator());
+ return __result;
+ } // *** else fall through: ***
+ }
+ case _RopeRep::_S_function:
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __base);
+ if (__start >= __adj_endp1) return 0;
+ size_t __result_len = __adj_endp1 - __start;
+
+ if (__result_len > __lazy_threshold) goto lazy;
+ _CharT* __section = __base->_M_size.allocate(_S_rounded_up_size(__result_len));
+ _STLP_TRY {
+ (*(__f->_M_fn))(__start, __result_len, __section);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__section,
+ __result_len, __base->get_allocator()))
+ _S_construct_null(__section + __result_len);
+ return _S_new_RopeLeaf(__section, __result_len,
+ __base->get_allocator());
+ }
+ }
+ /*NOTREACHED*/
+ _STLP_ASSERT(false)
+ lazy:
+ {
+ // Create substring node.
+ return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
+ __base->get_allocator());
+ }
+}
+
+template<class _CharT>
+class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ _CharT* _M_buf_ptr;
+public:
+ _Rope_flatten_char_consumer(_CharT* __buffer) {
+ _M_buf_ptr = __buffer;
+ }
+ ~_Rope_flatten_char_consumer() {}
+ bool operator() (const _CharT* __leaf, size_t __n) {
+ _STLP_PRIV __ucopy_n(__leaf, __n, _M_buf_ptr);
+ _M_buf_ptr += __n;
+ return true;
+ }
+};
+
+template<class _CharT>
+class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ _CharT _M_pattern;
+public:
+ size_t _M_count; // Number of nonmatching characters
+ _Rope_find_char_char_consumer(_CharT __p)
+ : _M_pattern(__p), _M_count(0) {}
+ ~_Rope_find_char_char_consumer() {}
+ bool operator() (const _CharT* __leaf, size_t __n) {
+ size_t __i;
+ for (__i = 0; __i < __n; ++__i) {
+ if (__leaf[__i] == _M_pattern) {
+ _M_count += __i; return false;
+ }
+ }
+ _M_count += __n; return true;
+ }
+};
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits>
+// Here _CharT is both the stream and rope character type.
+class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
+ typedef _Rope_insert_char_consumer<_CharT,_Traits> _Self;
+ _Insert_ostream& _M_o;
+
+ //explicitely defined as private to avoid warnings:
+ _Self& operator = (_Self const&);
+public:
+ _Rope_insert_char_consumer(_Insert_ostream& __writer)
+ : _M_o(__writer) {}
+ ~_Rope_insert_char_consumer() {}
+ // Caller is presumed to own the ostream
+ bool operator() (const _CharT* __leaf, size_t __n);
+ // Returns true to continue traversal.
+};
+
+template<class _CharT, class _Traits>
+bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
+ (const _CharT* __leaf, size_t __n) {
+ size_t __i;
+ // We assume that formatting is set up correctly for each element.
+ for (__i = 0; __i < __n; ++__i) _M_o.put(__leaf[__i]);
+ return true;
+}
+#endif /* !_STLP_USE_NO_IOSTREAMS */
+
+template <class _CharT, class _Alloc, class _CharConsumer>
+bool _S_apply_to_pieces(_CharConsumer& __c,
+ _Rope_RopeRep<_CharT, _Alloc> * __r,
+ size_t __begin, size_t __end) {
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+
+ if (0 == __r) return true;
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __conc->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+ if (__begin < __left_len) {
+ size_t __left_end = (min) (__left_len, __end);
+ if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
+ return false;
+ }
+ if (__end > __left_len) {
+ _RopeRep* __right = __conc->_M_right;
+ size_t __right_start = (max)(__left_len, __begin);
+ if (!_S_apply_to_pieces(__c, __right,
+ __right_start - __left_len,
+ __end - __left_len)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
+ return __c(__l->_M_data + __begin, __end - __begin);
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
+ size_t __len = __end - __begin;
+ bool __result;
+ _CharT* __buffer = __r->get_allocator().allocate(__len);
+ _STLP_TRY {
+ (*(__f->_M_fn))(__begin, __len, __buffer);
+ __result = __c(__buffer, __len);
+ __r->get_allocator().deallocate(__buffer, __len);
+ }
+ _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len)))
+ return __result;
+ }
+ default:
+ _STLP_ASSERT(false)
+ /*NOTREACHED*/
+ return false;
+ }
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits>
+inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, streamsize __n) {
+ char __f = __o.fill();
+ for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f);
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r, const __true_type& /*_IsBasicCharType*/) {
+ streamsize __w = __o.width();
+ const bool __left = (__o.flags() & ios::left) != 0;
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+
+ const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w))));
+ streamsize __pad_len = __need_pad ? __w - __rope_len : 0;
+
+ if (!__left && __pad_len > 0) {
+ _Rope_fill(__o, __pad_len);
+ }
+ __r.apply_to_pieces(0, __rope_len, __c);
+ if (__left && __pad_len > 0) {
+ _Rope_fill(__o, __pad_len);
+ }
+ return __o;
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r, const __false_type& /*_IsBasicCharType*/) {
+ streamsize __w = __o.width();
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+
+ __o.width(__w /__rope_len);
+ _STLP_TRY {
+ __r.apply_to_pieces(0, __rope_len, __c);
+ __o.width(__w);
+ }
+ _STLP_UNWIND(__o.width(__w))
+ return __o;
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r) {
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ return _S_io_get(__o, __r, _Char_Is_Integral());
+}
+#endif /* NO_IOSTREAMS */
+
+template <class _CharT, class _Alloc>
+_CharT* rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer) {
+ _Rope_flatten_char_consumer<_CharT> __c(__buffer);
+ _S_apply_to_pieces(__c, __r, __start, __start + __len);
+ return(__buffer + __len);
+}
+
+template <class _CharT, class _Alloc>
+size_t rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const {
+ _Rope_find_char_char_consumer<_CharT> __c(__pattern);
+ _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __start, size());
+ size_type __result_pos = __start + __c._M_count;
+#ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+#endif
+ return __result_pos;
+}
+
+template <class _CharT, class _Alloc>
+_CharT*
+rope<_CharT,_Alloc>::_S_flatten(_Rope_RopeRep<_CharT, _Alloc>* __r, _CharT* __buffer) {
+ if (0 == __r) return __buffer;
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ _CharT* __rest = _S_flatten(__left, __buffer);
+ return _S_flatten(__right, __rest);
+ }
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
+ return _STLP_PRIV __ucopy_n(__l->_M_data, __l->_M_size._M_data, __buffer).second;
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ // We dont yet do anything with substring nodes.
+ // This needs to be fixed before ropefiles will work well.
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
+ (*(__f->_M_fn))(0, __f->_M_size._M_data, __buffer);
+ return __buffer + __f->_M_size._M_data;
+ }
+ default:
+ _STLP_ASSERT(false)
+ /*NOTREACHED*/
+ return 0;
+ }
+}
+
+#ifdef _STLP_DEBUG
+// This needs work for _CharT != char
+template <class _CharT, class _Alloc>
+void rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) {
+ for (int __i = 0; __i < __indent; ++__i) putchar(' ');
+ if (0 == __r) {
+ printf("NULL\n"); return;
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag) {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ printf("Concatenation %p (rc = %ld, depth = %d, len = %ld, %s balanced)\n",
+ __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data,
+ __r->_M_is_balanced? "" : "not");
+ _S_dump(__left, __indent + 2);
+ _S_dump(__right, __indent + 2);
+ return;
+ }
+ else {
+ const char* __kind;
+
+ switch (__r->_M_tag) {
+ case _RopeRep::_S_leaf:
+ __kind = "Leaf";
+ break;
+ case _RopeRep::_S_function:
+ __kind = "Function";
+ break;
+ case _RopeRep::_S_substringfn:
+ __kind = "Function representing substring";
+ break;
+ default:
+ __kind = "(corrupted kind field!)";
+ }
+ printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
+ __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data);
+ if (sizeof(_CharT) == 1) {
+ const int __max_len = 40;
+ _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
+ _CharT __buffer[__max_len + 1];
+ bool __too_big = __r->_M_size._M_data > __prefix->_M_size._M_data;
+
+ _S_flatten(__prefix, __buffer);
+ __buffer[__prefix->_M_size._M_data] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n");
+ } else {
+ printf("\n");
+ }
+ }
+}
+#endif /* _STLP_DEBUG */
+
+# define __ROPE_TABLE_BODY = { \
+/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \
+/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \
+/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \
+/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \
+/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \
+/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \
+/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \
+/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \
+/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \
+/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \
+/* 45 */2971215073ul }
+
+template <class _CharT, class _Alloc>
+const unsigned long
+rope<_CharT,_Alloc>::_S_min_len[__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY;
+# undef __ROPE_DEPTH_SIZE
+# undef __ROPE_MAX_DEPTH
+# undef __ROPE_TABLE_BODY
+
+// These are Fibonacci numbers < 2**32.
+
+template <class _CharT, class _Alloc>
+__RopeRep__* rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) {
+ _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0};
+ _RopeRep* __result = 0;
+ int __i;
+ // Invariant:
+ // The concatenation of forest in descending order is equal to __r.
+ // __forest[__i]._M_size._M_data >= _S_min_len[__i]
+ // __forest[__i]._M_depth = __i
+ // References from forest are included in refcount.
+
+ _STLP_TRY {
+ _S_add_to_forest(__r, __forest);
+ for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__result);
+ __result = _S_concat_rep(__forest[__i], __result);
+ __forest[__i]->_M_unref_nonnil();
+# ifdef _STLP_USE_EXCEPTIONS
+ __forest[__i] = 0;
+# endif
+ }
+ }
+ _STLP_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
+ _S_unref(__forest[__i]))
+ if (__result->_M_depth > _RopeRep::_S_max_rope_depth) {
+ __stl_throw_range_error("rope too long");
+ }
+ return(__result);
+}
+
+
+template <class _CharT, class _Alloc>
+void
+rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
+{
+ if (__r -> _M_is_balanced) {
+ _S_add_leaf_to_forest(__r, __forest);
+ return;
+ }
+ _STLP_ASSERT(__r->_M_tag == _RopeRep::_S_concat)
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+
+ _S_add_to_forest(__c->_M_left, __forest);
+ _S_add_to_forest(__c->_M_right, __forest);
+ }
+}
+
+
+template <class _CharT, class _Alloc>
+void
+rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
+{
+ _RopeRep* __insertee; // included in refcount
+ _RopeRep* __too_tiny = 0; // included in refcount
+ int __i; // forest[0..__i-1] is empty
+ size_t __s = __r->_M_size._M_data;
+
+ for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) {
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__too_tiny);
+ __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ }
+ }
+ {
+ _Self_destruct_ptr __old(__too_tiny);
+ __insertee = _S_concat_and_set_balanced(__too_tiny, __r);
+ }
+ // Too_tiny dead, and no longer included in refcount.
+ // Insertee is live and included.
+ _STLP_ASSERT(_S_is_almost_balanced(__insertee))
+ _STLP_ASSERT(__insertee->_M_depth <= __r->_M_depth + 1)
+ for (;; ++__i) {
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__insertee);
+ __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ _STLP_ASSERT(_S_is_almost_balanced(__insertee))
+ }
+ _STLP_ASSERT(_S_min_len[__i] <= __insertee->_M_size._M_data)
+ _STLP_ASSERT(__forest[__i] == 0)
+ if (__i == _RopeRep::_S_max_rope_depth ||
+ __insertee->_M_size._M_data < _S_min_len[__i+1]) {
+ __forest[__i] = __insertee;
+ // refcount is OK since __insertee is now dead.
+ return;
+ }
+ }
+}
+
+template <class _CharT, class _Alloc>
+_CharT
+rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i)
+{
+ _CharT* __cstr = __r->_M_c_string;
+
+ _STLP_ASSERT(__i < __r->_M_size._M_data)
+ if (0 != __cstr) return __cstr[__i];
+ for(;;) {
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ if (__i >= __left_len) {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ } else {
+ __r = __left;
+ }
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ return __l->_M_data[__i];
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ _RopeFunction* __f = (_RopeFunction*)__r;
+ _CharT __result;
+
+ (*(__f->_M_fn))(__i, 1, &__result);
+ return __result;
+ }
+ }
+ }
+#if defined(_STLP_NEED_UNREACHABLE_RETURN)
+ return 0;
+#endif
+}
+
+// Return a uniquely referenced character slot for the given
+// position, or 0 if that's not possible.
+template <class _CharT, class _Alloc>
+_CharT*
+rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i)
+{
+ _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth];
+ size_t __csptr = 0;
+
+ for(;;) {
+ // if (__r->_M_ref_count > 1) return 0;
+ if ( __r->_M_incr() > 2 ) {
+ __r->_M_decr();
+ return 0;
+ }
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c;
+ if (__i >= __left_len) {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ } else {
+ __r = __left;
+ }
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
+ __clrstack[__csptr++] = __l;
+ while (__csptr > 0) {
+ -- __csptr;
+ _RopeRep* __d = __clrstack[__csptr];
+ __d->_M_free_c_string();
+ __d->_M_c_string = 0;
+ }
+ return __l->_M_data + __i;
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ return 0;
+ }
+ }
+#if defined(_STLP_NEED_UNREACHABLE_RETURN)
+ return 0;
+#endif
+
+}
+
+// The following could be implemented trivially using
+// lexicographical_compare_3way.
+// We do a little more work to avoid dealing with rope iterators for
+// flat strings.
+template <class _CharT, class _Alloc>
+int
+rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
+ const _RopeRep* __right) {
+ size_t __left_len;
+ size_t __right_len;
+
+ if (0 == __right) return 0 != __left;
+ if (0 == __left) return -1;
+ __left_len = __left->_M_size._M_data;
+ __right_len = __right->_M_size._M_data;
+ if (_RopeRep::_S_leaf == __left->_M_tag) {
+ const _RopeLeaf* __l = __STATIC_CAST(const _RopeLeaf*, __left);
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
+ return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
+ __r->_M_data, __r->_M_data + __right_len);
+ }
+ else {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
+ __rstart, __rend);
+ }
+ }
+ else {
+ const_iterator __lstart(__left, 0);
+ const_iterator __lend(__left, __left_len);
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
+ return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend,
+ __r->_M_data, __r->_M_data + __right_len);
+ }
+ else {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, __rstart, __rend);
+ }
+ }
+}
+
+// Assignment to reference proxies.
+template <class _CharT, class _Alloc>
+_Rope_char_ref_proxy<_CharT, _Alloc>&
+_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) {
+ _RopeRep* __old = _M_root->_M_tree_ptr._M_data;
+ // First check for the case in which everything is uniquely
+ // referenced. In that case we can do this destructively.
+ _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
+ if (0 != __ptr) {
+ *__ptr = __c;
+ return *this;
+ }
+ _Self_destruct_ptr __left(
+ _My_rope::_S_substring(__old, 0, _M_pos));
+ _Self_destruct_ptr __right(
+ _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size._M_data));
+ _Self_destruct_ptr __result_left(
+ _My_rope::_S_destr_concat_char_iter(__left, &__c, 1));
+
+ // _STLP_ASSERT(__left == __result_left || 1 == __result_left->_M_ref_count)
+ _RopeRep* __result =
+ _My_rope::_S_concat_rep(__result_left, __right);
+ // _STLP_ASSERT(1 <= __result->_M_ref_count)
+ _RopeRep::_S_unref(__old);
+ _M_root->_M_tree_ptr._M_data = __result;
+ return *this;
+}
+
+template <class _CharT, class _Alloc>
+_Rope_char_ptr_proxy<_CharT, _Alloc>
+_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const {
+ return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this);
+}
+
+template<class _CharT, class _Alloc>
+_CharT rope<_CharT,_Alloc>::_S_empty_c_str[1] = { _CharT() };
+// # endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+template <class _CharT, class _Alloc>
+const size_t rope<_CharT, _Alloc>::npos;
+#endif
+
+template<class _CharT, class _Alloc>
+const _CharT* rope<_CharT,_Alloc>::c_str() const {
+ if (0 == _M_tree_ptr._M_data) {
+ // Possibly redundant, but probably fast.
+ _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return _S_empty_c_str;
+ }
+ _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
+ if (0 != __old_c_string) return __old_c_string;
+ size_t __s = size();
+ _CharT* __result = _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).allocate(__s + 1);
+ _S_flatten(_M_tree_ptr._M_data, __result);
+ _S_construct_null(__result + __s);
+ __old_c_string = __STATIC_CAST(_CharT*, _Atomic_swap_ptr(__REINTERPRET_CAST(void* _STLP_VOLATILE*, &(_M_tree_ptr._M_data->_M_c_string)),
+ __result));
+ if (0 != __old_c_string) {
+ // It must have been added in the interim. Hence it had to have been
+ // separately allocated. Deallocate the old copy, since we just
+ // replaced it.
+ _STLP_STD::_Destroy_Range(__old_c_string, __old_c_string + __s + 1);
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).deallocate(__old_c_string, __s + 1);
+ }
+ return __result;
+}
+
+template<class _CharT, class _Alloc>
+const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() {
+ if (0 == _M_tree_ptr._M_data) {
+ _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return _S_empty_c_str;
+ }
+ _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
+ if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && 0 != __old_c_string) {
+ return __old_c_string;
+ }
+ size_t __s = size();
+ _CharT* __result = _M_tree_ptr.allocate(_S_rounded_up_size(__s));
+ _S_flatten(_M_tree_ptr._M_data, __result);
+ _S_construct_null(__result + __s);
+ _M_tree_ptr._M_data->_M_unref_nonnil();
+ _M_tree_ptr._M_data = _S_new_RopeLeaf(__result, __s, _M_tree_ptr);
+ return __result;
+}
+
+// Algorithm specializations. More should be added.
+
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) && !defined (__DMC__)
+// I couldn't get this to work with VC++
+template<class _CharT,class _Alloc>
+void _Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first,
+ _Rope_iterator<_CharT,_Alloc> __middle,
+ _Rope_iterator<_CharT,_Alloc> __last) {
+ _STLP_ASSERT(__first.container() == __middle.container() &&
+ __middle.container() == __last.container())
+ rope<_CharT,_Alloc>& __r(__first.container());
+ rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
+ rope<_CharT,_Alloc> __suffix =
+ __r.substr(__last.index(), __r.size() - __last.index());
+ rope<_CharT,_Alloc> __part1 =
+ __r.substr(__middle.index(), __last.index() - __middle.index());
+ rope<_CharT,_Alloc> __part2 =
+ __r.substr(__first.index(), __middle.index() - __first.index());
+ __r = __prefix;
+ __r += __part1;
+ __r += __part2;
+ __r += __suffix;
+}
+
+
+# if 0
+// Probably not useful for several reasons:
+// - for SGIs 7.1 compiler and probably some others,
+// this forces lots of rope<wchar_t, ...> instantiations, creating a
+// code bloat and compile time problem. (Fixed in 7.2.)
+// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive
+// for unicode strings. Unsigned short may be a better character
+// type.
+inline void rotate(
+ _Rope_iterator<wchar_t, allocator<char> > __first,
+ _Rope_iterator<wchar_t, allocator<char> > __middle,
+ _Rope_iterator<wchar_t, allocator<char> > __last) {
+ _Rope_rotate(__first, __middle, __last);
+}
+# endif
+#endif /* _STLP_MSVC */
+
+# undef __RopeLeaf__
+# undef __RopeRep__
+# undef __RopeLeaf
+# undef __RopeRep
+# undef size_type
+
+_STLP_END_NAMESPACE
+
+# endif /* ROPEIMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_rope.h b/build/stlport/stlport/stl/_rope.h
new file mode 100644
index 000000000..cc391f75d
--- /dev/null
+++ b/build/stlport/stlport/stl/_rope.h
@@ -0,0 +1,2391 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// rope<_CharT,_Alloc> is a sequence of _CharT.
+// Ropes appear to be mutable, but update operations
+// really copy enough of the data structure to leave the original
+// valid. Thus ropes can be logically copied by just copying
+// a pointer value.
+
+#ifndef _STLP_INTERNAL_ROPE_H
+#define _STLP_INTERNAL_ROPE_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_INTERNAL_IOSFWD)
+# include <stl/_iosfwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+#ifndef _STLP_CHAR_TRAITS_H
+# include <stl/char_traits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#ifdef _STLP_SGI_THREADS
+# include <mutex.h>
+#endif
+
+#ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) (_Alloc_traits<_Tp,__atype>::create_allocator(__a))
+#else
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// First a lot of forward declarations. The standard seems to require
+// much stricter "declaration before use" than many of the implementations
+// that preceded it.
+template<class _CharT, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_CharT>) > class rope;
+template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
+template<class _CharT, class _Alloc> struct _Rope_RopeRep;
+template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
+template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
+template<class _CharT, class _Alloc> struct _Rope_RopeSubstring;
+template<class _CharT, class _Alloc> class _Rope_iterator;
+template<class _CharT, class _Alloc> class _Rope_const_iterator;
+template<class _CharT, class _Alloc> class _Rope_char_ref_proxy;
+template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT>
+struct _BasicCharType { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _BasicCharType<char> { typedef __true_type _Ret; };
+
+#ifdef _STLP_HAS_WCHAR_T
+_STLP_TEMPLATE_NULL
+struct _BasicCharType<wchar_t> { typedef __true_type _Ret; };
+#endif
+
+// Some helpers, so we can use the power algorithm on ropes.
+// See below for why this isn't local to the implementation.
+
+// This uses a nonstandard refcount convention.
+// The result has refcount 0.
+template<class _CharT, class _Alloc>
+struct _Rope_Concat_fn
+ : public binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>,
+ rope<_CharT,_Alloc> > {
+ rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x,
+ const rope<_CharT,_Alloc>& __y) {
+ return __x + __y;
+ }
+};
+
+template <class _CharT, class _Alloc>
+inline
+rope<_CharT,_Alloc>
+__identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
+{ return rope<_CharT,_Alloc>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Store an eos
+template <class _CharT>
+inline void _S_construct_null_aux(_CharT *__p, const __true_type&)
+{ *__p = 0; }
+
+template <class _CharT>
+inline void _S_construct_null_aux(_CharT *__p, const __false_type&)
+{ _STLP_STD::_Construct(__p); }
+
+template <class _CharT>
+inline void _S_construct_null(_CharT *__p) {
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ _S_construct_null_aux(__p, _Char_Is_Integral());
+}
+
+// char_producers are logically functions that generate a section of
+// a string. These can be converted to ropes. The resulting rope
+// invokes the char_producer on demand. This allows, for example,
+// files to be viewed as ropes without reading the entire file.
+template <class _CharT>
+class char_producer {
+public:
+ virtual ~char_producer() {}
+ virtual void operator()(size_t __start_pos, size_t __len,
+ _CharT* __buffer) = 0;
+ // Buffer should really be an arbitrary output iterator.
+ // That way we could flatten directly into an ostream, etc.
+ // This is thoroughly impossible, since iterator types don't
+ // have runtime descriptions.
+};
+
+// Sequence buffers:
+//
+// Sequence must provide an append operation that appends an
+// array to the sequence. Sequence buffers are useful only if
+// appending an entire array is cheaper than appending element by element.
+// This is true for many string representations.
+// This should perhaps inherit from ostream<sequence::value_type>
+// and be implemented correspondingly, so that they can be used
+// for formatted. For the sake of portability, we don't do this yet.
+//
+// For now, sequence buffers behave as output iterators. But they also
+// behave a little like basic_ostringstream<sequence::value_type> and a
+// little like containers.
+
+template<class _Sequence
+# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
+ defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
+ , size_t _Buf_sz = 100
+# if defined(__sgi) && !defined(__GNUC__)
+# define __TYPEDEF_WORKAROUND
+ ,class _V = typename _Sequence::value_type
+# endif /* __sgi */
+# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ >
+// The 3rd parameter works around a common compiler bug.
+class sequence_buffer : public iterator <output_iterator_tag, void, void, void, void> {
+public:
+# ifndef __TYPEDEF_WORKAROUND
+ typedef typename _Sequence::value_type value_type;
+ typedef sequence_buffer<_Sequence
+# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
+ defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
+ , _Buf_sz
+ > _Self;
+# else /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ > _Self;
+ enum { _Buf_sz = 100};
+# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ // # endif
+# else /* __TYPEDEF_WORKAROUND */
+ typedef _V value_type;
+ typedef sequence_buffer<_Sequence, _Buf_sz, _V> _Self;
+# endif /* __TYPEDEF_WORKAROUND */
+protected:
+ _Sequence* _M_prefix;
+ value_type _M_buffer[_Buf_sz];
+ size_t _M_buf_count;
+public:
+ void flush() {
+ _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
+ _M_buf_count = 0;
+ }
+ ~sequence_buffer() { flush(); }
+ sequence_buffer() : _M_prefix(0), _M_buf_count(0) {}
+ sequence_buffer(const _Self& __x) {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ _STLP_STD::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ }
+ sequence_buffer(_Self& __x) {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ }
+ sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {}
+ _Self& operator= (_Self& __x) {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ return *this;
+ }
+ _Self& operator= (const _Self& __x) {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ _STLP_STD::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ return *this;
+ }
+ void push_back(value_type __x) {
+ if (_M_buf_count < _Buf_sz) {
+ _M_buffer[_M_buf_count] = __x;
+ ++_M_buf_count;
+ } else {
+ flush();
+ _M_buffer[0] = __x;
+ _M_buf_count = 1;
+ }
+ }
+ void append(const value_type *__s, size_t __len) {
+ if (__len + _M_buf_count <= _Buf_sz) {
+ size_t __i = _M_buf_count;
+ size_t __j = 0;
+ for (; __j < __len; __i++, __j++) {
+ _M_buffer[__i] = __s[__j];
+ }
+ _M_buf_count += __len;
+ } else if (0 == _M_buf_count) {
+ _M_prefix->append(__s, __s + __len);
+ } else {
+ flush();
+ append(__s, __len);
+ }
+ }
+ _Self& write(const value_type *__s, size_t __len) {
+ append(__s, __len);
+ return *this;
+ }
+ _Self& put(value_type __x) {
+ push_back(__x);
+ return *this;
+ }
+ _Self& operator=(const value_type& __rhs) {
+ push_back(__rhs);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+};
+
+// The following should be treated as private, at least for now.
+template<class _CharT>
+class _Rope_char_consumer {
+#if !defined (_STLP_MEMBER_TEMPLATES)
+public:
+ //Without member templates we have to use run-time parameterization.
+ // The symmetry with char_producer is accidental and temporary.
+ virtual ~_Rope_char_consumer() {}
+ virtual bool operator()(const _CharT* __buffer, size_t __len) = 0;
+#endif
+};
+
+//
+// What follows should really be local to rope. Unfortunately,
+// that doesn't work, since it makes it impossible to define generic
+// equality on rope iterators. According to the draft standard, the
+// template parameters for such an equality operator cannot be inferred
+// from the occurence of a member class as a parameter.
+// (SGI compilers in fact allow this, but the __result wouldn't be
+// portable.)
+// Similarly, some of the static member functions are member functions
+// only to avoid polluting the global namespace, and to circumvent
+// restrictions on type inference for template functions.
+//
+
+//
+// The internal data structure for representing a rope. This is
+// private to the implementation. A rope is really just a pointer
+// to one of these.
+//
+// A few basic functions for manipulating this data structure
+// are members of _RopeRep. Most of the more complex algorithms
+// are implemented as rope members.
+//
+// Some of the static member functions of _RopeRep have identically
+// named functions in rope that simply invoke the _RopeRep versions.
+//
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeRep
+ : public _Refcount_Base
+{
+ typedef _Rope_RopeRep<_CharT, _Alloc> _Self;
+public:
+ //
+ // GAB: 11/09/05
+ //
+ // "__ROPE_DEPTH_SIZE" is set to one more then the "__ROPE_MAX_DEPTH".
+ // This was originally just an addition of "__ROPE_MAX_DEPTH + 1"
+ // but this addition causes the sunpro compiler to complain about
+ // multiple declarations during the initialization of "_S_min_len".
+ // Changed to be a fixed value and the sunpro compiler appears to
+ // be happy???
+ //
+# define __ROPE_MAX_DEPTH 45
+# define __ROPE_DEPTH_SIZE 46 // __ROPE_MAX_DEPTH + 1
+ enum { _S_max_rope_depth = __ROPE_MAX_DEPTH };
+ enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
+ // Apparently needed by VC++
+ // The data fields of leaves are allocated with some
+ // extra space, to accomodate future growth and for basic
+ // character types, to hold a trailing eos character.
+ enum { _S_alloc_granularity = 8 };
+
+ _Tag _M_tag:8;
+ bool _M_is_balanced:8;
+
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef _Alloc allocator_type;
+
+ allocator_type get_allocator() const { return allocator_type(_M_size); }
+
+ unsigned char _M_depth;
+ _CharT* _STLP_VOLATILE _M_c_string;
+ _STLP_PRIV _STLP_alloc_proxy<size_t, _CharT, allocator_type> _M_size;
+
+#ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeRep() : _Refcount_Base(1), _M_size(allocator_type(), 0) {
+# if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ _STLP_CHECK_RUNTIME_COMPATIBILITY();
+# endif
+ }
+#endif
+
+ /* Flattened version of string, if needed. */
+ /* typically 0. */
+ /* If it's not 0, then the memory is owned */
+ /* by this node. */
+ /* In the case of a leaf, this may point to */
+ /* the same memory as the data field. */
+ _Rope_RopeRep(_Tag __t, unsigned char __d, bool __b, size_t _p_size,
+ allocator_type __a) :
+ _Refcount_Base(1),
+ _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0), _M_size(__a, _p_size) {
+#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ _STLP_CHECK_RUNTIME_COMPATIBILITY();
+#endif
+ }
+
+ typedef _STLP_TYPENAME _STLP_PRIV _BasicCharType<_CharT>::_Ret _IsBasicCharType;
+
+#if 0
+ /* Please tell why this code is necessary if you uncomment it.
+ * Problem with it is that rope implementation expect that _S_rounded_up_size(n)
+ * returns a size > n in order to store the terminating null charater. When
+ * instanciation type is not a char or wchar_t this is not guaranty resulting in
+ * memory overrun.
+ */
+ static size_t _S_rounded_up_size_aux(size_t __n, __true_type const& /*_IsBasicCharType*/) {
+ // Allow slop for in-place expansion.
+ return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1);
+ }
+
+ static size_t _S_rounded_up_size_aux(size_t __n, __false_type const& /*_IsBasicCharType*/) {
+ // Allow slop for in-place expansion.
+ return (__n + _S_alloc_granularity - 1) & ~(_S_alloc_granularity - 1);
+ }
+#endif
+ // fbp : moved from RopeLeaf
+ static size_t _S_rounded_up_size(size_t __n)
+ //{ return _S_rounded_up_size_aux(__n, _IsBasicCharType()); }
+ { return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); }
+
+ static void _S_free_string( _CharT* __s, size_t __len,
+ allocator_type __a) {
+ _STLP_STD::_Destroy_Range(__s, __s + __len);
+ // This has to be a static member, so this gets a bit messy
+# ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+ __a.deallocate(__s, _S_rounded_up_size(__len)); //*ty 03/24/2001 - restored not to use __stl_alloc_rebind() since it is not defined under _STLP_MEMBER_TEMPLATE_CLASSES
+# else
+ __stl_alloc_rebind (__a, (_CharT*)0).deallocate(__s, _S_rounded_up_size(__len));
+# endif
+ }
+
+ // Deallocate data section of a leaf.
+ // This shouldn't be a member function.
+ // But its hard to do anything else at the
+ // moment, because it's templatized w.r.t.
+ // an allocator.
+ // Does nothing if __GC is defined.
+ void _M_free_c_string();
+ void _M_free_tree();
+ // Deallocate t. Assumes t is not 0.
+ void _M_unref_nonnil() {
+ if (_M_decr() == 0) _M_free_tree();
+ }
+ void _M_ref_nonnil() {
+ _M_incr();
+ }
+ static void _S_unref(_Self* __t) {
+ if (0 != __t) {
+ __t->_M_unref_nonnil();
+ }
+ }
+ static void _S_ref(_Self* __t) {
+ if (0 != __t) __t->_M_incr();
+ }
+ //static void _S_free_if_unref(_Self* __t) {
+ // if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree();
+ //}
+};
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
+public:
+ _CharT* _M_data; /* Not necessarily 0 terminated. */
+ /* The allocated size is */
+ /* _S_rounded_up_size(size), except */
+ /* in the GC case, in which it */
+ /* doesn't matter. */
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
+ void _M_init(__true_type const& /*_IsBasicCharType*/) {
+ this->_M_c_string = _M_data;
+ }
+ void _M_init(__false_type const& /*_IsBasicCharType*/) {}
+
+public:
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+
+ _Rope_RopeLeaf( _CharT* __d, size_t _p_size, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_leaf, 0, true, _p_size, __a),
+ _M_data(__d) {
+ _STLP_ASSERT(_p_size > 0)
+ _M_init(_IsBasicCharType());
+ }
+
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeLeaf() {}
+ _Rope_RopeLeaf(const _Rope_RopeLeaf<_CharT, _Alloc>& ) {}
+# endif
+
+// The constructor assumes that d has been allocated with
+ // the proper allocator and the properly padded size.
+ // In contrast, the destructor deallocates the data:
+ ~_Rope_RopeLeaf() {
+ if (_M_data != this->_M_c_string) {
+ this->_M_free_c_string();
+ }
+ _RopeRep::_S_free_string(_M_data, this->_M_size._M_data, this->get_allocator());
+ }
+};
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> {
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+public:
+ _RopeRep* _M_left;
+ _RopeRep* _M_right;
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+ _Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat,
+ (max)(__l->_M_depth, __r->_M_depth) + 1, false,
+ __l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r)
+ {}
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeConcatenation() {}
+ _Rope_RopeConcatenation(const _Rope_RopeConcatenation<_CharT, _Alloc>&) {}
+# endif
+
+ ~_Rope_RopeConcatenation() {
+ this->_M_free_c_string();
+ _M_left->_M_unref_nonnil();
+ _M_right->_M_unref_nonnil();
+ }
+};
+
+template <class _CharT, class _Alloc>
+struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> {
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+public:
+ char_producer<_CharT>* _M_fn;
+ /*
+ * Char_producer is owned by the
+ * rope and should be explicitly
+ * deleted when the rope becomes
+ * inaccessible.
+ */
+ bool _M_delete_when_done;
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _Rope_RopeRep<_CharT,_Alloc>::allocator_type allocator_type;
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeFunction() {}
+ _Rope_RopeFunction(const _Rope_RopeFunction<_CharT, _Alloc>& ) {}
+# endif
+
+ _Rope_RopeFunction(char_producer<_CharT>* __f, size_t _p_size,
+ bool __d, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_function, 0, true, _p_size, __a), _M_fn(__f)
+ , _M_delete_when_done(__d)
+ { _STLP_ASSERT(_p_size > 0) }
+
+ ~_Rope_RopeFunction() {
+ this->_M_free_c_string();
+ if (_M_delete_when_done) {
+ delete _M_fn;
+ }
+ }
+};
+
+/*
+ * Substring results are usually represented using just
+ * concatenation nodes. But in the case of very long flat ropes
+ * or ropes with a functional representation that isn't practical.
+ * In that case, we represent the __result as a special case of
+ * RopeFunction, whose char_producer points back to the rope itself.
+ * In all cases except repeated substring operations and
+ * deallocation, we treat the __result as a RopeFunction.
+ */
+template<class _CharT, class _Alloc>
+struct _Rope_RopeSubstring : public char_producer<_CharT>, public _Rope_RopeFunction<_CharT,_Alloc> {
+public:
+ // XXX this whole class should be rewritten.
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ _RopeRep *_M_base; // not 0
+ size_t _M_start;
+ /* virtual */ void operator()(size_t __start_pos, size_t __req_len,
+ _CharT* __buffer) {
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ switch (_M_base->_M_tag) {
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ char_producer<_CharT>* __fn =
+ __STATIC_CAST(_RopeFunction*, _M_base)->_M_fn;
+ _STLP_ASSERT(__start_pos + __req_len <= this->_M_size._M_data)
+ _STLP_ASSERT(_M_start + this->_M_size._M_data <= _M_base->_M_size._M_data)
+ (*__fn)(__start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _CharT* __s =
+ __STATIC_CAST(_RopeLeaf*, _M_base)->_M_data;
+ _STLP_PRIV __ucopy_n(__s + __start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ default:
+ _STLP_ASSERT(false)
+ ;
+ }
+ }
+
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+
+ _Rope_RopeSubstring(_RopeRep* __b, size_t __s, size_t __l, allocator_type __a)
+ : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a),
+ _M_base(__b), _M_start(__s) {
+ _STLP_ASSERT(__l > 0)
+ _STLP_ASSERT(__s + __l <= __b->_M_size._M_data)
+ _M_base->_M_ref_nonnil();
+ this->_M_tag = _RopeRep::_S_substringfn;
+ }
+ virtual ~_Rope_RopeSubstring()
+ { _M_base->_M_unref_nonnil(); }
+};
+
+/*
+ * Self-destructing pointers to Rope_rep.
+ * These are not conventional smart pointers. Their
+ * only purpose in life is to ensure that unref is called
+ * on the pointer either at normal exit or if an exception
+ * is raised. It is the caller's responsibility to
+ * adjust reference counts when these pointers are initialized
+ * or assigned to. (This convention significantly reduces
+ * the number of potentially expensive reference count
+ * updates.)
+ */
+template<class _CharT, class _Alloc>
+struct _Rope_self_destruct_ptr {
+ _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
+ ~_Rope_self_destruct_ptr()
+ { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
+# ifdef _STLP_USE_EXCEPTIONS
+ _Rope_self_destruct_ptr() : _M_ptr(0) {}
+# else
+ _Rope_self_destruct_ptr() {}
+# endif
+ _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
+ _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
+ _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
+ operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; }
+ _Rope_self_destruct_ptr<_CharT, _Alloc>&
+ operator= (_Rope_RopeRep<_CharT,_Alloc>* __x)
+ { _M_ptr = __x; return *this; }
+};
+
+/*
+ * Dereferencing a nonconst iterator has to return something
+ * that behaves almost like a reference. It's not possible to
+ * return an actual reference since assignment requires extra
+ * work. And we would get into the same problems as with the
+ * CD2 version of basic_string.
+ */
+template<class _CharT, class _Alloc>
+class _Rope_char_ref_proxy {
+ typedef _Rope_char_ref_proxy<_CharT, _Alloc> _Self;
+ friend class rope<_CharT,_Alloc>;
+ friend class _Rope_iterator<_CharT,_Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
+ typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ typedef rope<_CharT,_Alloc> _My_rope;
+ size_t _M_pos;
+ _CharT _M_current;
+ bool _M_current_valid;
+ _My_rope* _M_root; // The whole rope.
+public:
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p) :
+ _M_pos(__p), _M_current_valid(false), _M_root(__r) {}
+ _Rope_char_ref_proxy(const _Self& __x) :
+ _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {}
+ // Don't preserve cache if the reference can outlive the
+ // expression. We claim that's not possible without calling
+ // a copy constructor or generating reference to a proxy
+ // reference. We declare the latter to have undefined semantics.
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
+ : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
+ inline operator _CharT () const;
+ _Self& operator= (_CharT __c);
+ _Rope_char_ptr_proxy<_CharT, _Alloc> operator& () const;
+ _Self& operator= (const _Self& __c) {
+ return operator=((_CharT)__c);
+ }
+};
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template<class _CharT, class __Alloc>
+inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
+ _CharT __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
+#else
+// There is no really acceptable way to handle this. The default
+// definition of swap doesn't work for proxy references.
+// It can't really be made to work, even with ugly hacks, since
+// the only unusual operation it uses is the copy constructor, which
+// is needed for other purposes. We provide a macro for
+// full specializations, and instantiate the most common case.
+# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \
+ inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \
+ _CharT __tmp = __a; \
+ __a = __b; \
+ __b = __tmp; \
+ }
+
+_ROPE_SWAP_SPECIALIZATION(char, allocator<char>)
+
+# ifndef _STLP_NO_WCHAR_T
+_ROPE_SWAP_SPECIALIZATION(wchar_t, allocator<wchar_t>)
+# endif
+
+#endif /* !_STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template<class _CharT, class _Alloc>
+class _Rope_char_ptr_proxy {
+ // XXX this class should be rewritten.
+public:
+ typedef _Rope_char_ptr_proxy<_CharT, _Alloc> _Self;
+ friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
+ size_t _M_pos;
+ rope<_CharT,_Alloc>* _M_root; // The whole rope.
+
+ _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ _Rope_char_ptr_proxy(const _Self& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ _Rope_char_ptr_proxy() {}
+ _Rope_char_ptr_proxy(_CharT* __x) : _M_pos(0), _M_root(0) {
+ _STLP_ASSERT(0 == __x)
+ }
+ _Self& operator= (const _Self& __x) {
+ _M_pos = __x._M_pos;
+ _M_root = __x._M_root;
+ return *this;
+ }
+
+ _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
+ return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
+ }
+};
+
+
+/*
+ * Rope iterators:
+ * Unlike in the C version, we cache only part of the stack
+ * for rope iterators, since they must be efficiently copyable.
+ * When we run out of cache, we have to reconstruct the iterator
+ * value.
+ * Pointers from iterators are not included in reference counts.
+ * Iterators are assumed to be thread private. Ropes can
+ * be shared.
+ */
+template<class _CharT, class _Alloc>
+class _Rope_iterator_base
+/* : public random_access_iterator<_CharT, ptrdiff_t> */
+{
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_iterator_base<_CharT, _Alloc> _Self;
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcat;
+public:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+ enum { _S_path_cache_len = 4 }; // Must be <= 9 because of _M_path_direction.
+ enum { _S_iterator_buf_len = 15 };
+ size_t _M_current_pos;
+ // The whole rope.
+ _RopeRep* _M_root;
+ // Starting position for current leaf
+ size_t _M_leaf_pos;
+ // Buffer possibly containing current char.
+ _CharT* _M_buf_start;
+ // Pointer to current char in buffer, != 0 ==> buffer valid.
+ _CharT* _M_buf_ptr;
+ // One past __last valid char in buffer.
+ _CharT* _M_buf_end;
+
+ // What follows is the path cache. We go out of our
+ // way to make this compact.
+ // Path_end contains the bottom section of the path from
+ // the root to the current leaf.
+ struct {
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ _RopeRep const*_M_data[4];
+# else
+ _RopeRep const*_M_data[_S_path_cache_len];
+# endif
+ } _M_path_end;
+ // Last valid __pos in path_end;
+ // _M_path_end[0] ... _M_path_end[_M_leaf_index-1]
+ // point to concatenation nodes.
+ int _M_leaf_index;
+ // (_M_path_directions >> __i) & 1 is 1
+ // if we got from _M_path_end[leaf_index - __i - 1]
+ // to _M_path_end[leaf_index - __i] by going to the
+ // __right. Assumes path_cache_len <= 9.
+ unsigned char _M_path_directions;
+ // Short buffer for surrounding chars.
+ // This is useful primarily for
+ // RopeFunctions. We put the buffer
+ // here to avoid locking in the
+ // multithreaded case.
+ // The cached path is generally assumed to be valid
+ // only if the buffer is valid.
+ struct {
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ _CharT _M_data[15];
+# else
+ _CharT _M_data[_S_iterator_buf_len];
+# endif
+ } _M_tmp_buf;
+
+ // Set buffer contents given path cache.
+ static void _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ // Set buffer contents and path cache.
+ static void _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ // As above, but assumes path cache is valid for previous posn.
+ static void _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ _Rope_iterator_base() {}
+ _Rope_iterator_base(_RopeRep* __root, size_t __pos)
+ : _M_current_pos(__pos),_M_root(__root), _M_buf_ptr(0) {}
+ void _M_incr(size_t __n);
+ void _M_decr(size_t __n);
+public:
+ size_t index() const { return _M_current_pos; }
+private:
+ void _M_copy_buf(const _Self& __x) {
+ _M_tmp_buf = __x._M_tmp_buf;
+ if (__x._M_buf_start == __x._M_tmp_buf._M_data) {
+ _M_buf_start = _M_tmp_buf._M_data;
+ _M_buf_end = _M_buf_start + (__x._M_buf_end - __x._M_buf_start);
+ _M_buf_ptr = _M_buf_start + (__x._M_buf_ptr - __x._M_buf_start);
+ } else {
+ _M_buf_end = __x._M_buf_end;
+ }
+ }
+
+public:
+ _Rope_iterator_base(const _Self& __x) :
+ _M_current_pos(__x._M_current_pos),
+ _M_root(__x._M_root),
+ _M_leaf_pos( __x._M_leaf_pos ),
+ _M_buf_start(__x._M_buf_start),
+ _M_buf_ptr(__x._M_buf_ptr),
+ _M_path_end(__x._M_path_end),
+ _M_leaf_index(__x._M_leaf_index),
+ _M_path_directions(__x._M_path_directions)
+ {
+ if (0 != __x._M_buf_ptr) {
+ _M_copy_buf(__x);
+ }
+ }
+ _Self& operator = (const _Self& __x)
+ {
+ _M_current_pos = __x._M_current_pos;
+ _M_root = __x._M_root;
+ _M_buf_start = __x._M_buf_start;
+ _M_buf_ptr = __x._M_buf_ptr;
+ _M_path_end = __x._M_path_end;
+ _M_leaf_index = __x._M_leaf_index;
+ _M_path_directions = __x._M_path_directions;
+ _M_leaf_pos = __x._M_leaf_pos;
+ if (0 != __x._M_buf_ptr) {
+ _M_copy_buf(__x);
+ }
+ return *this;
+ }
+};
+
+template<class _CharT, class _Alloc> class _Rope_iterator;
+
+template<class _CharT, class _Alloc>
+class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_const_iterator<_CharT, _Alloc> _Self;
+ typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
+ // protected:
+public:
+# ifndef _STLP_HAS_NO_NAMESPACES
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ // The one from the base class may not be directly visible.
+# endif
+ _Rope_const_iterator(const _RopeRep* __root, size_t __pos):
+ _Rope_iterator_base<_CharT,_Alloc>(__CONST_CAST(_RopeRep*,__root), __pos)
+ // Only nonconst iterators modify root ref count
+ {}
+public:
+ typedef _CharT reference; // Really a value. Returning a reference
+ // Would be a mess, since it would have
+ // to be included in refcount.
+ typedef const _CharT* pointer;
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag iterator_category;
+
+public:
+ _Rope_const_iterator() {}
+ _Rope_const_iterator(const _Self& __x) :
+ _Rope_iterator_base<_CharT,_Alloc>(__x) { }
+ _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x):
+ _Rope_iterator_base<_CharT,_Alloc>(__x) {}
+ _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) :
+ _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos) {}
+ _Self& operator= (const _Self& __x) {
+ _Base::operator=(__x);
+ return *this;
+ }
+ reference operator*() {
+ if (0 == this->_M_buf_ptr)
+#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 7))
+ this->_S_setcache(*this);
+#elif !defined (__DMC__)
+ _S_setcache(*this);
+#else
+ { _Rope_iterator_base<_CharT, _Alloc>* __x = this; _S_setcache(*__x); }
+#endif
+ return *(this->_M_buf_ptr);
+ }
+ _Self& operator++()
+ {
+ if ( this->_M_buf_ptr != 0 ) {
+ _CharT *__next = this->_M_buf_ptr + 1;
+ if ( __next < this->_M_buf_end ) {
+ this->_M_buf_ptr = __next;
+ ++this->_M_current_pos;
+ return *this;
+ }
+ }
+ this->_M_incr(1);
+ return *this;
+ }
+ _Self& operator+=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_incr(__n);
+ } else {
+ this->_M_decr(-__n);
+ }
+ return *this;
+ }
+ _Self& operator--() {
+ this->_M_decr(1);
+ return *this;
+ }
+ _Self& operator-=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_decr(__n);
+ } else {
+ this->_M_incr(-__n);
+ }
+ return *this;
+ }
+ _Self operator++(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ // This makes a subsequent dereference expensive.
+ // Perhaps we should instead copy the iterator
+ // if it has a valid cache?
+ }
+ _Self operator--(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ }
+ inline reference operator[](size_t __n);
+};
+
+template<class _CharT, class _Alloc>
+class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_iterator<_CharT, _Alloc> _Self;
+ typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+public:
+ rope<_CharT,_Alloc>* _M_root_rope;
+ // root is treated as a cached version of this,
+ // and is used to detect changes to the underlying
+ // rope.
+ // Root is included in the reference count.
+ // This is necessary so that we can detect changes reliably.
+ // Unfortunately, it requires careful bookkeeping for the
+ // nonGC case.
+ _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos);
+
+ void _M_check();
+public:
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer;
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag iterator_category;
+public:
+ ~_Rope_iterator() { //*TY 5/6/00 - added dtor to balance reference count
+ _RopeRep::_S_unref(this->_M_root);
+ }
+
+ rope<_CharT,_Alloc>& container() { return *_M_root_rope; }
+ _Rope_iterator() {
+ this->_M_root = 0; // Needed for reference counting.
+ }
+ _Rope_iterator(const _Self& __x) :
+ _Rope_iterator_base<_CharT,_Alloc>(__x) {
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_ref(this->_M_root);
+ }
+ _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos);
+ _Self& operator= (const _Self& __x) {
+ _RopeRep* __old = this->_M_root;
+ _RopeRep::_S_ref(__x._M_root);
+ _Base::operator=(__x);
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_unref(__old);
+ return *this;
+ }
+ reference operator*() {
+ _M_check();
+ if (0 == this->_M_buf_ptr) {
+ return reference(_M_root_rope, this->_M_current_pos);
+ } else {
+ return reference(_M_root_rope, this->_M_current_pos, *(this->_M_buf_ptr));
+ }
+ }
+ _Self& operator++() {
+ this->_M_incr(1);
+ return *this;
+ }
+ _Self& operator+=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_incr(__n);
+ } else {
+ this->_M_decr(-__n);
+ }
+ return *this;
+ }
+ _Self& operator--() {
+ this->_M_decr(1);
+ return *this;
+ }
+ _Self& operator-=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_decr(__n);
+ } else {
+ this->_M_incr(-__n);
+ }
+ return *this;
+ }
+ _Self operator++(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Self(_M_root_rope, __old_pos);
+ }
+ _Self operator--(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Self(_M_root_rope, __old_pos);
+ }
+ reference operator[](ptrdiff_t __n) {
+ return reference(_M_root_rope, this->_M_current_pos + __n);
+ }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _CharT, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _Rope_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag();}
+template <class _CharT, class _Alloc>
+inline _CharT* value_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline ptrdiff_t* distance_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _Rope_const_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag(); }
+template <class _CharT, class _Alloc>
+inline _CharT* value_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline ptrdiff_t* distance_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+template <class _CharT, class _Alloc, class _CharConsumer>
+bool _S_apply_to_pieces(_CharConsumer& __c,
+ _Rope_RopeRep<_CharT, _Alloc> *__r,
+ size_t __begin, size_t __end);
+ // begin and end are assumed to be in range.
+
+template <class _CharT, class _Alloc>
+class rope
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<rope<_CharT, _Alloc> >
+#endif
+{
+ typedef rope<_CharT,_Alloc> _Self;
+public:
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef _CharT const_reference;
+ typedef const _CharT* const_pointer;
+ typedef _Rope_iterator<_CharT,_Alloc> iterator;
+ typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator;
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
+ typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer;
+
+ friend class _Rope_iterator<_CharT,_Alloc>;
+ friend class _Rope_const_iterator<_CharT,_Alloc>;
+ friend struct _Rope_RopeRep<_CharT,_Alloc>;
+ friend class _Rope_iterator_base<_CharT,_Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
+ friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
+ friend struct _Rope_RopeSubstring<_CharT,_Alloc>;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected:
+ typedef _CharT* _Cstrptr;
+
+ static _CharT _S_empty_c_str[1];
+
+ enum { _S_copy_max = 23 };
+ // For strings shorter than _S_copy_max, we copy to
+ // concatenate.
+
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
+
+public:
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef _Alloc allocator_type;
+
+public:
+ // The only data member of a rope:
+ _STLP_PRIV _STLP_alloc_proxy<_RopeRep*, _CharT, allocator_type> _M_tree_ptr;
+
+public:
+ allocator_type get_allocator() const { return allocator_type(_M_tree_ptr); }
+
+public:
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+ typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring;
+
+ // Retrieve a character at the indicated position.
+ static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
+
+ // Obtain a pointer to the character at the indicated position.
+ // The pointer can be used to change the character.
+ // If such a pointer cannot be produced, as is frequently the
+ // case, 0 is returned instead.
+ // (Returns nonzero only if all nodes in the path have a refcount
+ // of 1.)
+ static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
+
+ static void _S_unref(_RopeRep* __t) {
+ _RopeRep::_S_unref(__t);
+ }
+ static void _S_ref(_RopeRep* __t) {
+ _RopeRep::_S_ref(__t);
+ }
+
+ typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
+
+ // _Result is counted in refcount.
+ static _RopeRep* _S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1);
+
+ static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate rope and char ptr, copying __s.
+ // Should really take an arbitrary iterator.
+ // Result is counted in refcount.
+ static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // As above, but one reference to __r is about to be
+ // destroyed. Thus the pieces may be recycled if all
+ // relevent reference counts are 1.
+
+ // General concatenation on _RopeRep. _Result
+ // has refcount of 1. Adjusts argument refcounts.
+ static _RopeRep* _S_concat_rep(_RopeRep* __left, _RopeRep* __right);
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _CharConsumer>
+#else
+ typedef _Rope_char_consumer<_CharT> _CharConsumer;
+#endif
+ void apply_to_pieces(size_t __begin, size_t __end,
+ _CharConsumer& __c) const
+ { _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __begin, __end); }
+
+protected:
+
+ static size_t _S_rounded_up_size(size_t __n)
+ { return _RopeRep::_S_rounded_up_size(__n); }
+
+ // Allocate and construct a RopeLeaf using the supplied allocator
+ // Takes ownership of s instead of copying.
+ static _RopeLeaf* _S_new_RopeLeaf(_CharT *__s,
+ size_t _p_size, allocator_type __a) {
+ _RopeLeaf* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeLeaf).allocate(1);
+ _STLP_TRY {
+ new(__space) _RopeLeaf(__s, _p_size, __a);
+ }
+ _STLP_UNWIND(_STLP_CREATE_ALLOCATOR(allocator_type,__a,
+ _RopeLeaf).deallocate(__space, 1))
+ return __space;
+ }
+
+ static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
+ allocator_type __a) {
+ _RopeConcatenation* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeConcatenation).allocate(1);
+ return new(__space) _RopeConcatenation(__left, __right, __a);
+ }
+
+ static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
+ size_t _p_size, bool __d, allocator_type __a) {
+ _RopeFunction* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeFunction).allocate(1);
+ return new(__space) _RopeFunction(__f, _p_size, __d, __a);
+ }
+
+ static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
+ size_t __l, allocator_type __a) {
+ _RopeSubstring* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeSubstring).allocate(1);
+ return new(__space) _RopeSubstring(__b, __s, __l, __a);
+ }
+
+ static
+ _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
+ size_t _p_size, allocator_type __a) {
+ if (0 == _p_size) return 0;
+
+ _CharT* __buf = _STLP_CREATE_ALLOCATOR(allocator_type,__a, _CharT).allocate(_S_rounded_up_size(_p_size));
+
+ _STLP_PRIV __ucopy_n(__s, _p_size, __buf);
+ _S_construct_null(__buf + _p_size);
+
+ _STLP_TRY {
+ return _S_new_RopeLeaf(__buf, _p_size, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__buf, _p_size, __a))
+ _STLP_RET_AFTER_THROW(0)
+ }
+
+
+ // Concatenation of nonempty strings.
+ // Always builds a concatenation node.
+ // Rebalances if the result is too deep.
+ // Result has refcount 1.
+ // Does not increment left and right ref counts even though
+ // they are referenced.
+ static _RopeRep*
+ _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
+
+ // Concatenation helper functions
+ static _RopeLeaf*
+ _S_leaf_concat_char_iter(_RopeLeaf* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate by copying leaf.
+ // should take an arbitrary iterator
+ // result has refcount 1.
+ static _RopeLeaf* _S_destr_leaf_concat_char_iter
+ (_RopeLeaf* __r, const _CharT* __iter, size_t __slen);
+ // A version that potentially clobbers __r if __r->_M_ref_count == 1.
+
+
+ // A helper function for exponentiating strings.
+ // This uses a nonstandard refcount convention.
+ // The result has refcount 0.
+ typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
+#if !defined (__GNUC__) || (__GNUC__ < 3)
+ friend _Concat_fn;
+#else
+ friend struct _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc>;
+#endif
+
+public:
+ static size_t _S_char_ptr_len(const _CharT* __s) {
+ return char_traits<_CharT>::length(__s);
+ }
+
+public: /* for operators */
+ rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, __t) { }
+private:
+ // Copy __r to the _CharT buffer.
+ // Returns __buffer + __r->_M_size._M_data.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
+
+ // Again, with explicit starting position and length.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer);
+
+ // fbp : HP aCC prohibits access to protected min_len from within static methods ( ?? )
+public:
+ static const unsigned long _S_min_len[__ROPE_DEPTH_SIZE];
+protected:
+ static bool _S_is_balanced(_RopeRep* __r)
+ { return (__r->_M_size._M_data >= _S_min_len[__r->_M_depth]); }
+
+ static bool _S_is_almost_balanced(_RopeRep* __r) {
+ return (__r->_M_depth == 0 ||
+ __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 1]);
+ }
+
+ static bool _S_is_roughly_balanced(_RopeRep* __r) {
+ return (__r->_M_depth <= 1 ||
+ __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 2]);
+ }
+
+ // Assumes the result is not empty.
+ static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left,
+ _RopeRep* __right) {
+ _RopeRep* __result = _S_concat_rep(__left, __right);
+ if (_S_is_balanced(__result)) __result->_M_is_balanced = true;
+ return __result;
+ }
+
+ // The basic rebalancing operation. Logically copies the
+ // rope. The result has refcount of 1. The client will
+ // usually decrement the reference count of __r.
+ // The result is within height 2 of balanced by the above
+ // definition.
+ static _RopeRep* _S_balance(_RopeRep* __r);
+
+ // Add all unbalanced subtrees to the forest of balanceed trees.
+ // Used only by balance.
+ static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
+
+ // Add __r to forest, assuming __r is already balanced.
+ static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
+
+#ifdef _STLP_DEBUG
+ // Print to stdout, exposing structure
+ static void _S_dump(_RopeRep* __r, int __indent = 0);
+#endif
+
+ // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
+ static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
+
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+
+ void _M_reset(_RopeRep* __r) {
+ //if (__r != _M_tree_ptr._M_data) {
+ _S_unref(_M_tree_ptr._M_data);
+ _M_tree_ptr._M_data = __r;
+ //}
+ }
+
+public:
+ bool empty() const { return 0 == _M_tree_ptr._M_data; }
+
+ // Comparison member function. This is public only for those
+ // clients that need a ternary comparison. Others
+ // should use the comparison operators below.
+ int compare(const _Self& __y) const {
+ return _S_compare(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data);
+ }
+
+ rope(const _CharT* __s, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, _S_char_ptr_len(__s),__a))
+ {}
+
+ rope(const _CharT* __s, size_t __len,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_S_RopeLeaf_from_unowned_char_ptr(__s, __len, __a)))
+ {}
+
+ // Should perhaps be templatized with respect to the iterator type
+ // and use Sequence_buffer. (It should perhaps use sequence_buffer
+ // even now.)
+ rope(const _CharT *__s, const _CharT *__e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, __e - __s, __a))
+ {}
+
+ rope(const const_iterator& __s, const const_iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos))
+ {}
+
+ rope(const iterator& __s, const iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos))
+ {}
+
+ rope(_CharT __c, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {
+ _CharT* __buf = _M_tree_ptr.allocate(_S_rounded_up_size(1));
+
+ _Copy_Construct(__buf, __c);
+ _S_construct_null(__buf + 1);
+
+ _STLP_TRY {
+ _M_tree_ptr._M_data = _S_new_RopeLeaf(__buf, 1, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__buf, 1, __a))
+ }
+
+ rope(size_t __n, _CharT __c,
+ const allocator_type& __a = allocator_type()):
+ _M_tree_ptr(__a, (_RopeRep*)0) {
+ if (0 == __n)
+ return;
+
+ rope<_CharT,_Alloc> __result;
+# define __exponentiate_threshold size_t(32)
+ _RopeRep* __remainder;
+ rope<_CharT,_Alloc> __remainder_rope;
+
+ // gcc-2.7.2 bugs
+ typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
+
+ size_t __exponent = __n / __exponentiate_threshold;
+ size_t __rest = __n % __exponentiate_threshold;
+ if (0 == __rest) {
+ __remainder = 0;
+ } else {
+ _CharT* __rest_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__rest));
+ uninitialized_fill_n(__rest_buffer, __rest, __c);
+ _S_construct_null(__rest_buffer + __rest);
+ _STLP_TRY {
+ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__rest_buffer, __rest, __a))
+ }
+ __remainder_rope._M_tree_ptr._M_data = __remainder;
+ if (__exponent != 0) {
+ _CharT* __base_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__exponentiate_threshold));
+ _RopeLeaf* __base_leaf;
+ rope<_CharT,_Alloc> __base_rope;
+ uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
+ _S_construct_null(__base_buffer + __exponentiate_threshold);
+ _STLP_TRY {
+ __base_leaf = _S_new_RopeLeaf(__base_buffer,
+ __exponentiate_threshold, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__base_buffer,
+ __exponentiate_threshold, __a))
+ __base_rope._M_tree_ptr._M_data = __base_leaf;
+ if (1 == __exponent) {
+ __result = __base_rope;
+ // One each for base_rope and __result
+ //_STLP_ASSERT(2 == __result._M_tree_ptr._M_data->_M_ref_count)
+ } else {
+ __result = _STLP_PRIV __power(__base_rope, __exponent, _Concat_fn());
+ }
+ if (0 != __remainder) {
+ __result += __remainder_rope;
+ }
+ } else {
+ __result = __remainder_rope;
+ }
+ _M_tree_ptr._M_data = __result._M_tree_ptr._M_data;
+ _M_tree_ptr._M_data->_M_ref_nonnil();
+# undef __exponentiate_threshold
+ }
+
+ rope(const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {}
+
+ // Construct a rope from a function that can compute its members
+ rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {
+ _M_tree_ptr._M_data = (0 == __len) ?
+ 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+ }
+
+ rope(const _Self& __x)
+ : _M_tree_ptr(__x._M_tree_ptr, __x._M_tree_ptr._M_data) {
+ _S_ref(_M_tree_ptr._M_data);
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ rope(__move_source<_Self> __src)
+ : _M_tree_ptr(__src.get()._M_tree_ptr, __src.get()._M_tree_ptr._M_data) {
+ __src.get()._M_tree_ptr._M_data = 0;
+ }
+#endif
+
+ ~rope() {
+ _S_unref(_M_tree_ptr._M_data);
+ }
+
+ _Self& operator=(const _Self& __x) {
+ _STLP_ASSERT(get_allocator() == __x.get_allocator())
+ _S_ref(__x._M_tree_ptr._M_data);
+ _M_reset(__x._M_tree_ptr._M_data);
+ return *this;
+ }
+
+ void clear() {
+ _S_unref(_M_tree_ptr._M_data);
+ _M_tree_ptr._M_data = 0;
+ }
+ void push_back(_CharT __x) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__x, 1));
+ }
+
+ void pop_back() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data =
+ _S_substring(_M_tree_ptr._M_data, 0, _M_tree_ptr._M_data->_M_size._M_data - 1);
+ _S_unref(__old);
+ }
+
+ _CharT back() const {
+ return _S_fetch(_M_tree_ptr._M_data, _M_tree_ptr._M_data->_M_size._M_data - 1);
+ }
+
+ void push_front(_CharT __x) {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _RopeRep* __left =
+ _S_RopeLeaf_from_unowned_char_ptr(&__x, 1, _M_tree_ptr);
+ _STLP_TRY {
+ _M_tree_ptr._M_data = _S_concat_rep(__left, _M_tree_ptr._M_data);
+ _S_unref(__old);
+ _S_unref(__left);
+ }
+ _STLP_UNWIND(_S_unref(__left))
+ }
+
+ void pop_front() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data = _S_substring(_M_tree_ptr._M_data, 1, _M_tree_ptr._M_data->_M_size._M_data);
+ _S_unref(__old);
+ }
+
+ _CharT front() const {
+ return _S_fetch(_M_tree_ptr._M_data, 0);
+ }
+
+ void balance() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data = _S_balance(_M_tree_ptr._M_data);
+ _S_unref(__old);
+ }
+
+ void copy(_CharT* __buffer) const {
+ _STLP_STD::_Destroy_Range(__buffer, __buffer + size());
+ _S_flatten(_M_tree_ptr._M_data, __buffer);
+ }
+
+ /*
+ * This is the copy function from the standard, but
+ * with the arguments reordered to make it consistent with the
+ * rest of the interface.
+ * Note that this guaranteed not to compile if the draft standard
+ * order is assumed.
+ */
+ size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const {
+ size_t _p_size = size();
+ size_t __len = (__pos + __n > _p_size? _p_size - __pos : __n);
+
+ _STLP_STD::_Destroy_Range(__buffer, __buffer + __len);
+ _S_flatten(_M_tree_ptr._M_data, __pos, __len, __buffer);
+ return __len;
+ }
+
+# ifdef _STLP_DEBUG
+ // Print to stdout, exposing structure. May be useful for
+ // performance debugging.
+ void dump() {
+ _S_dump(_M_tree_ptr._M_data);
+ }
+# endif
+
+ // Convert to 0 terminated string in new allocated memory.
+ // Embedded 0s in the input do not terminate the copy.
+ const _CharT* c_str() const;
+
+ // As above, but also use the flattened representation as the
+ // the new rope representation.
+ const _CharT* replace_with_c_str();
+
+ // Reclaim memory for the c_str generated flattened string.
+ // Intentionally undocumented, since it's hard to say when this
+ // is safe for multiple threads.
+ void delete_c_str () {
+ if (0 == _M_tree_ptr._M_data) return;
+ if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag &&
+ ((_RopeLeaf*)_M_tree_ptr._M_data)->_M_data ==
+ _M_tree_ptr._M_data->_M_c_string) {
+ // Representation shared
+ return;
+ }
+ _M_tree_ptr._M_data->_M_free_c_string();
+ _M_tree_ptr._M_data->_M_c_string = 0;
+ }
+
+ _CharT operator[] (size_type __pos) const {
+ return _S_fetch(_M_tree_ptr._M_data, __pos);
+ }
+
+ _CharT at(size_type __pos) const {
+ if (__pos >= size()) _M_throw_out_of_range();
+ return (*this)[__pos];
+ }
+
+ const_iterator begin() const {
+ return(const_iterator(_M_tree_ptr._M_data, 0));
+ }
+
+ // An easy way to get a const iterator from a non-const container.
+ const_iterator const_begin() const {
+ return(const_iterator(_M_tree_ptr._M_data, 0));
+ }
+
+ const_iterator end() const {
+ return(const_iterator(_M_tree_ptr._M_data, size()));
+ }
+
+ const_iterator const_end() const {
+ return(const_iterator(_M_tree_ptr._M_data, size()));
+ }
+
+ size_type size() const {
+ return(0 == _M_tree_ptr._M_data? 0 : _M_tree_ptr._M_data->_M_size._M_data);
+ }
+
+ size_type length() const {
+ return size();
+ }
+
+ size_type max_size() const {
+ return _S_min_len[__ROPE_MAX_DEPTH-1] - 1;
+ // Guarantees that the result can be sufficiently
+ // balanced. Longer ropes will probably still work,
+ // but it's harder to make guarantees.
+ }
+
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+
+ const_reverse_iterator const_rbegin() const {
+ return const_reverse_iterator(end());
+ }
+
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ const_reverse_iterator const_rend() const {
+ return const_reverse_iterator(begin());
+ }
+ // The symmetric cases are intentionally omitted, since they're presumed
+ // to be less common, and we don't handle them as well.
+
+ // The following should really be templatized.
+ // The first argument should be an input iterator or
+ // forward iterator with value_type _CharT.
+ _Self& append(const _CharT* __iter, size_t __n) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __iter, __n));
+ return *this;
+ }
+
+ _Self& append(const _CharT* __c_string) {
+ size_t __len = _S_char_ptr_len(__c_string);
+ append(__c_string, __len);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, const _CharT* __e) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __s, __e - __s));
+ return *this;
+ }
+
+ _Self& append(const_iterator __s, const_iterator __e) {
+ _STLP_ASSERT(__s._M_root == __e._M_root)
+ _STLP_ASSERT(get_allocator() == __s._M_root->get_allocator())
+ _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos));
+ _M_reset(_S_concat_rep(_M_tree_ptr._M_data, (_RopeRep*)__appendee));
+ return *this;
+ }
+
+ _Self& append(_CharT __c) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__c, 1));
+ return *this;
+ }
+
+ _Self& append() { return append(_CharT()); } // XXX why?
+
+ _Self& append(const _Self& __y) {
+ _STLP_ASSERT(__y.get_allocator() == get_allocator())
+ _M_reset(_S_concat_rep(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data));
+ return *this;
+ }
+
+ _Self& append(size_t __n, _CharT __c) {
+ rope<_CharT,_Alloc> __last(__n, __c);
+ return append(__last);
+ }
+
+ void swap(_Self& __b) {
+ _M_tree_ptr.swap(__b._M_tree_ptr);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+protected:
+ // Result is included in refcount.
+ static _RopeRep* replace(_RopeRep* __old, size_t __pos1,
+ size_t __pos2, _RopeRep* __r) {
+ if (0 == __old) { _S_ref(__r); return __r; }
+ _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
+ _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size._M_data));
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 -
+ _RopeRep* __result;
+
+ if (0 == __r) {
+ __result = _S_concat_rep(__left, __right);
+ } else {
+ _STLP_ASSERT(__old->get_allocator() == __r->get_allocator())
+ _Self_destruct_ptr __left_result(_S_concat_rep(__left, __r));
+ __result = _S_concat_rep(__left_result, __right);
+ }
+ return __result;
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
+ }
+
+public:
+ void insert(size_t __p, const _Self& __r) {
+ if (__p > size()) _M_throw_out_of_range();
+ _STLP_ASSERT(get_allocator() == __r.get_allocator())
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p, __r._M_tree_ptr._M_data));
+ }
+
+ void insert(size_t __p, size_t __n, _CharT __c) {
+ rope<_CharT,_Alloc> __r(__n,__c);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const _CharT* __i, size_t __n) {
+ if (__p > size()) _M_throw_out_of_range();
+ _Self_destruct_ptr __left(_S_substring(_M_tree_ptr._M_data, 0, __p));
+ _Self_destruct_ptr __right(_S_substring(_M_tree_ptr._M_data, __p, size()));
+ _Self_destruct_ptr __left_result(
+ _S_concat_char_iter(__left, __i, __n));
+ // _S_ destr_concat_char_iter should be safe here.
+ // But as it stands it's probably not a win, since __left
+ // is likely to have additional references.
+ _M_reset(_S_concat_rep(__left_result, __right));
+ }
+
+ void insert(size_t __p, const _CharT* __c_string) {
+ insert(__p, __c_string, _S_char_ptr_len(__c_string));
+ }
+
+ void insert(size_t __p, _CharT __c) {
+ insert(__p, &__c, 1);
+ }
+
+ void insert(size_t __p) {
+ _CharT __c = _CharT();
+ insert(__p, &__c, 1);
+ }
+
+ void insert(size_t __p, const _CharT* __i, const _CharT* __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const const_iterator& __i,
+ const const_iterator& __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const iterator& __i,
+ const iterator& __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ // (position, length) versions of replace operations:
+ void replace(size_t __p, size_t __n, const _Self& __r) {
+ if (__p > size()) _M_throw_out_of_range();
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, __r._M_tree_ptr._M_data));
+ }
+
+ void replace(size_t __p, size_t __n,
+ const _CharT* __i, size_t __i_len) {
+ _Self __r(__i, __i_len);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n, _CharT __c) {
+ _Self __r(__c);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n, const _CharT* __c_string) {
+ _Self __r(__c_string);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const _CharT* __i, const _CharT* __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const const_iterator& __i, const const_iterator& __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const iterator& __i, const iterator& __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ // Single character variants:
+ void replace(size_t __p, _CharT __c) {
+ if (__p > size()) _M_throw_out_of_range();
+ iterator __i(this, __p);
+ *__i = __c;
+ }
+
+ void replace(size_t __p, const _Self& __r) {
+ replace(__p, 1, __r);
+ }
+
+ void replace(size_t __p, const _CharT* __i, size_t __i_len) {
+ replace(__p, 1, __i, __i_len);
+ }
+
+ void replace(size_t __p, const _CharT* __c_string) {
+ replace(__p, 1, __c_string);
+ }
+
+ void replace(size_t __p, const _CharT* __i, const _CharT* __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ void replace(size_t __p, const const_iterator& __i,
+ const const_iterator& __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ void replace(size_t __p, const iterator& __i,
+ const iterator& __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ // Erase, (position, size) variant.
+ void erase(size_t __p, size_t __n) {
+ if (__p > size()) _M_throw_out_of_range();
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, 0));
+ }
+
+ // Erase, single character
+ void erase(size_t __p) {
+ erase(__p, __p + 1);
+ }
+
+ // Insert, iterator variants.
+ iterator insert(const iterator& __p, const _Self& __r)
+ { insert(__p.index(), __r); return __p; }
+ iterator insert(const iterator& __p, size_t __n, _CharT __c)
+ { insert(__p.index(), __n, __c); return __p; }
+ iterator insert(const iterator& __p, _CharT __c)
+ { insert(__p.index(), __c); return __p; }
+ iterator insert(const iterator& __p )
+ { insert(__p.index()); return __p; }
+ iterator insert(const iterator& __p, const _CharT* c_string)
+ { insert(__p.index(), c_string); return __p; }
+ iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
+ { insert(__p.index(), __i, __n); return __p; }
+ iterator insert(const iterator& __p, const _CharT* __i,
+ const _CharT* __j)
+ { insert(__p.index(), __i, __j); return __p; }
+ iterator insert(const iterator& __p,
+ const const_iterator& __i, const const_iterator& __j)
+ { insert(__p.index(), __i, __j); return __p; }
+ iterator insert(const iterator& __p,
+ const iterator& __i, const iterator& __j)
+ { insert(__p.index(), __i, __j); return __p; }
+
+ // Replace, range variants.
+ void replace(const iterator& __p, const iterator& __q,
+ const _Self& __r)
+ { replace(__p.index(), __q.index() - __p.index(), __r); }
+ void replace(const iterator& __p, const iterator& __q, _CharT __c)
+ { replace(__p.index(), __q.index() - __p.index(), __c); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __c_string)
+ { replace(__p.index(), __q.index() - __p.index(), __c_string); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, size_t __n)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+ void replace(const iterator& __p, const iterator& __q,
+ const const_iterator& __i, const const_iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+ void replace(const iterator& __p, const iterator& __q,
+ const iterator& __i, const iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+
+ // Replace, iterator variants.
+ void replace(const iterator& __p, const _Self& __r)
+ { replace(__p.index(), __r); }
+ void replace(const iterator& __p, _CharT __c)
+ { replace(__p.index(), __c); }
+ void replace(const iterator& __p, const _CharT* __c_string)
+ { replace(__p.index(), __c_string); }
+ void replace(const iterator& __p, const _CharT* __i, size_t __n)
+ { replace(__p.index(), __i, __n); }
+ void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __i, __j); }
+ void replace(const iterator& __p, const_iterator __i,
+ const_iterator __j)
+ { replace(__p.index(), __i, __j); }
+ void replace(const iterator& __p, iterator __i, iterator __j)
+ { replace(__p.index(), __i, __j); }
+
+ // Iterator and range variants of erase
+ iterator erase(const iterator& __p, const iterator& __q) {
+ size_t __p_index = __p.index();
+ erase(__p_index, __q.index() - __p_index);
+ return iterator(this, __p_index);
+ }
+ iterator erase(const iterator& __p) {
+ size_t __p_index = __p.index();
+ erase(__p_index, 1);
+ return iterator(this, __p_index);
+ }
+
+ _Self substr(size_t __start, size_t __len = 1) const {
+ if (__start > size()) _M_throw_out_of_range();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start, __start + __len));
+ }
+
+ _Self substr(iterator __start, iterator __end) const {
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
+ }
+
+ _Self substr(iterator __start) const {
+ size_t __pos = __start.index();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
+ }
+
+ _Self substr(const_iterator __start, const_iterator __end) const {
+ // This might eventually take advantage of the cache in the
+ // iterator.
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
+ }
+
+ rope<_CharT,_Alloc> substr(const_iterator __start) {
+ size_t __pos = __start.index();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
+ }
+
+#include <stl/_string_npos.h>
+
+ size_type find(const _Self& __s, size_type __pos = 0) const {
+ if (__pos >= size())
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ return npos;
+# else
+ return size();
+# endif
+
+ size_type __result_pos;
+ const_iterator __result = _STLP_STD::search(const_begin() + (ptrdiff_t)__pos, const_end(), __s.begin(), __s.end() );
+ __result_pos = __result.index();
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+# endif
+ return __result_pos;
+ }
+ size_type find(_CharT __c, size_type __pos = 0) const;
+ size_type find(const _CharT* __s, size_type __pos = 0) const {
+ size_type __result_pos;
+ const_iterator __result = _STLP_STD::search(const_begin() + (ptrdiff_t)__pos, const_end(),
+ __s, __s + _S_char_ptr_len(__s));
+ __result_pos = __result.index();
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+# endif
+ return __result_pos;
+ }
+
+ iterator mutable_begin() {
+ return(iterator(this, 0));
+ }
+
+ iterator mutable_end() {
+ return(iterator(this, size()));
+ }
+
+ reverse_iterator mutable_rbegin() {
+ return reverse_iterator(mutable_end());
+ }
+
+ reverse_iterator mutable_rend() {
+ return reverse_iterator(mutable_begin());
+ }
+
+ reference mutable_reference_at(size_type __pos) {
+ return reference(this, __pos);
+ }
+
+# ifdef __STD_STUFF
+ reference operator[] (size_type __pos) {
+ return reference(this, __pos);
+ }
+
+ reference at(size_type __pos) {
+ if (__pos >= size()) _M_throw_out_of_range();
+ return (*this)[__pos];
+ }
+
+ void resize(size_type, _CharT) {}
+ void resize(size_type) {}
+ void reserve(size_type = 0) {}
+ size_type capacity() const {
+ return max_size();
+ }
+
+ // Stuff below this line is dangerous because it's error prone.
+ // I would really like to get rid of it.
+ // copy function with funny arg ordering.
+ size_type copy(_CharT* __buffer, size_type __n,
+ size_type __pos = 0) const {
+ return copy(__pos, __n, __buffer);
+ }
+
+ iterator end() { return mutable_end(); }
+
+ iterator begin() { return mutable_begin(); }
+
+ reverse_iterator rend() { return mutable_rend(); }
+
+ reverse_iterator rbegin() { return mutable_rbegin(); }
+
+# else
+
+ const_iterator end() { return const_end(); }
+
+ const_iterator begin() { return const_begin(); }
+
+ const_reverse_iterator rend() { return const_rend(); }
+
+ const_reverse_iterator rbegin() { return const_rbegin(); }
+
+# endif
+}; //class rope
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Alloc>
+const size_t rope<_CharT, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+template <class _CharT, class _Alloc>
+inline _CharT
+_Rope_const_iterator< _CharT, _Alloc>::operator[](size_t __n)
+{ return rope<_CharT,_Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y) {
+ return (__x._M_current_pos == __y._M_current_pos &&
+ __x._M_root == __y._M_root);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return (__x._M_current_pos < __y._M_current_pos); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Alloc>
+inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Alloc>
+inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Alloc>
+inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__x < __y); }
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos - __n); }
+# endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y) {
+ return (__x._M_current_pos == __y._M_current_pos &&
+ __x._M_root_rope == __y._M_root_rope);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return (__x._M_current_pos < __y._M_current_pos); }
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Alloc>
+inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Alloc>
+inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Alloc>
+inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__x < __y); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
+ ptrdiff_t __n) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos - __n);
+}
+# endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator+(const _Rope_iterator<_CharT,_Alloc>& __x,
+ ptrdiff_t __n) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
+}
+
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ _STLP_ASSERT(__left.get_allocator() == __right.get_allocator())
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_rep(__left._M_tree_ptr._M_data, __right._M_tree_ptr._M_data));
+ // Inlining this should make it possible to keep __left and __right in registers.
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left,
+ const _CharT* __right) {
+ size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, __right, __rlen));
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left,
+ const _CharT* __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) {
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, &__right, 1));
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator< (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ return __left.compare(__right) < 0;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator== (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ return __left.compare(__right) == 0;
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Alloc>
+inline bool
+operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__x < __y);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
+ return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r);
+#endif
+
+typedef rope<char, allocator<char> > crope;
+#if defined (_STLP_HAS_WCHAR_T)
+typedef rope<wchar_t, allocator<wchar_t> > wrope;
+#endif
+
+inline crope::reference __mutable_reference_at(crope& __c, size_t __i)
+{ return __c.mutable_reference_at(__i); }
+
+#if defined (_STLP_HAS_WCHAR_T)
+inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i)
+{ return __c.mutable_reference_at(__i); }
+#endif
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _CharT, class _Alloc>
+inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y)
+{ __x.swap(__y); }
+#else
+
+inline void swap(crope& __x, crope& __y) { __x.swap(__y); }
+# ifdef _STLP_HAS_WCHAR_T // dwa 8/21/97
+inline void swap(wrope& __x, wrope& __y) { __x.swap(__y); }
+# endif
+
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+
+// Hash functions should probably be revisited later:
+_STLP_TEMPLATE_NULL struct hash<crope> {
+ size_t operator()(const crope& __str) const {
+ size_t _p_size = __str.size();
+
+ if (0 == _p_size) return 0;
+ return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
+ }
+};
+
+#if defined (_STLP_HAS_WCHAR_T) // dwa 8/21/97
+_STLP_TEMPLATE_NULL struct hash<wrope> {
+ size_t operator()(const wrope& __str) const {
+ size_t _p_size = __str.size();
+
+ if (0 == _p_size) return 0;
+ return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
+ }
+};
+#endif
+
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310))
+// I couldn't get this to work with VC++
+template<class _CharT,class _Alloc>
+# if defined (__DMC__)
+extern
+# endif
+void _Rope_rotate(_Rope_iterator<_CharT, _Alloc> __first,
+ _Rope_iterator<_CharT, _Alloc> __middle,
+ _Rope_iterator<_CharT, _Alloc> __last);
+
+inline void rotate(_Rope_iterator<char, allocator<char> > __first,
+ _Rope_iterator<char, allocator<char> > __middle,
+ _Rope_iterator<char, allocator<char> > __last)
+{ _Rope_rotate(__first, __middle, __last); }
+#endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const {
+ if (_M_current_valid) {
+ return _M_current;
+ } else {
+ return _My_rope::_S_fetch(_M_root->_M_tree_ptr._M_data, _M_pos);
+ }
+}
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _CharT, class _Alloc>
+struct __move_traits<rope<_CharT, _Alloc> > {
+ typedef __true_type implemented;
+ //Completness depends on the allocator:
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_rope.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ROPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_set.h b/build/stlport/stlport/stl/_set.h
new file mode 100644
index 000000000..a8f68620e
--- /dev/null
+++ b/build/stlport/stlport/stl/_set.h
@@ -0,0 +1,412 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SET_H
+#define _STLP_INTERNAL_SET_H
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+#if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<set<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef set<_Key, _Compare, _Alloc> _Self;
+public:
+// typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _SetTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing set
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+
+ // allocation/deallocation
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit set(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+#else
+ set()
+ : _M_t(_Compare(), allocator_type()) {}
+ explicit set(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ set(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
+# endif
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#else
+ set(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ set(const value_type* __first,
+ const value_type* __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+ set(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ set(const_iterator __first, const_iterator __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ set(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ set(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x)
+ { return _M_t.insert_unique(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_unique( __pos , __x); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#else
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(__first, __last); }
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase( __pos ); }
+ size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); }
+ void clear() { _M_t.clear(); }
+
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range_unique(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range_unique(__x); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef multiset<_Key, _Compare, _Alloc> _Self;
+public:
+ // typedefs:
+
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _MultisetTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multiset
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit multiset(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+#else
+ multiset()
+ : _M_t(_Compare(), allocator_type()) {}
+ explicit multiset(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ multiset(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
+# endif
+#else
+ multiset(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ multiset(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+
+ multiset(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ multiset(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multiset(const _Self& __x) : _M_t(__x._M_t) {}
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ multiset(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ iterator insert(const value_type& __x)
+ { return _M_t.insert_equal(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_equal(__pos, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_equal(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase( __pos ); }
+ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); }
+ void clear() { _M_t.clear(); }
+
+ // multiset operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.count(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) { return _M_t.equal_range(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const { return _M_t.equal_range(__x); }
+};
+
+#else
+# include <stl/pointers/_set.h>
+_STLP_BEGIN_NAMESPACE
+#endif /* _STLP_USE_PTR_SPECIALIZATIONS */
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Compare, class _Alloc>
+struct __move_traits<set<_Key,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename set<_Key,_Compare,_Alloc>::_Rep_type>
+{};
+
+template <class _Key, class _Compare, class _Alloc>
+struct __move_traits<multiset<_Key,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename multiset<_Key,_Compare,_Alloc>::_Rep_type>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_slist.c b/build/stlport/stlport/stl/_slist.c
new file mode 100644
index 000000000..107b600b4
--- /dev/null
+++ b/build/stlport/stlport/stl/_slist.c
@@ -0,0 +1,230 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_SLIST_C
+#define _STLP_SLIST_C
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#ifndef _STLP_CARRAY_H
+# include <stl/_carray.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define size_type size_t
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+_Slist_node_base*
+_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
+ _Slist_node_base* __last_node) {
+ _Slist_node_base* __cur = __before_first->_M_next;
+ while (__cur != __last_node) {
+ _Node* __tmp = __STATIC_CAST(_Node*, __cur);
+ __cur = __cur->_M_next;
+ _STLP_STD::_Destroy(&__tmp->_M_data);
+ _M_head.deallocate(__tmp,1);
+ }
+ __before_first->_M_next = __last_node;
+ return __last_node;
+}
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define slist _STLP_PTR_IMPL_NAME(slist)
+#elif defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+/* When building STLport lib Digital Mars Compiler complains on the _M_data assignment
+ * problem which would be perfertly right if we were using it. Hiding it during build
+ * fix this issue.
+ */
+template <class _Tp, class _Alloc>
+slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x) {
+ if (&__x != this) {
+ _Node_base* __p1 = &this->_M_head._M_data;
+ _Node_base* __n1 = this->_M_head._M_data._M_next;
+ const _Node_base* __n2 = __x._M_head._M_data._M_next;
+ while (__n1 && __n2) {
+ __STATIC_CAST(_Node*, __n1)->_M_data = __STATIC_CAST(const _Node*, __n2)->_M_data;
+ __p1 = __n1;
+ __n1 = __n1->_M_next;
+ __n2 = __n2->_M_next;
+ }
+ if (__n2 == 0)
+ this->_M_erase_after(__p1, 0);
+ else
+ _M_insert_after_range(__p1, const_iterator(__CONST_CAST(_Node_base*, __n2)),
+ const_iterator(0));
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) {
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ for ( ; __node != 0 && __n > 0 ; --__n) {
+ __STATIC_CAST(_Node*, __node)->_M_data = __val;
+ __prev = __node;
+ __node = __node->_M_next;
+ }
+ if (__n > 0)
+ _M_insert_after_fill(__prev, __n, __val);
+ else
+ this->_M_erase_after(__prev, 0);
+}
+
+template <class _Tp, class _Alloc>
+void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur->_M_next != 0 && __len > 0) {
+ --__len;
+ __cur = __cur->_M_next;
+ }
+ if (__cur->_M_next)
+ this->_M_erase_after(__cur, 0);
+ else
+ _M_insert_after_fill(__cur, __len, __x);
+}
+
+template <class _Tp, class _Alloc>
+void slist<_Tp,_Alloc>::remove(const _Tp& __val) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur && __cur->_M_next) {
+ if (__STATIC_CAST(_Node*, __cur->_M_next)->_M_data == __val)
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+}
+
+#if !defined (slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __pred) {
+ typedef _Slist_node<_Tp> _Node;
+ typename slist<_Tp, _Alloc>::iterator __ite(__that.begin());
+ if (__ite != __that.end()) {
+ while (__ite._M_node->_M_next) {
+ if (__pred(*__ite, __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data))
+ __that.erase_after(__ite);
+ else
+ ++__ite;
+ }
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp) {
+ typedef _Slist_node<_Tp> _Node;
+ if (__that.get_allocator() == __x.get_allocator()) {
+ typename slist<_Tp, _Alloc>::iterator __ite(__that.before_begin());
+ while (__ite._M_node->_M_next && !__x.empty()) {
+ if (__comp(__x.front(), __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data, __x.front()),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __that.splice_after(__ite, __x, __x.before_begin());
+ }
+ ++__ite;
+ }
+ if (!__x.empty()) {
+ __that.splice_after(__ite, __x);
+ }
+ }
+ else {
+ typename slist<_Tp, _Alloc>::iterator __i1(__that.before_begin()), __i2(__x.begin());
+ while (__i1._M_node->_M_next && __i2._M_node) {
+ if (__comp(__STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data, *__i2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__i2, __STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__i1;
+ }
+ else {
+ __i1 = __that.insert_after(__i1, *(__i2++));
+ }
+ }
+ __that.insert_after(__i1, __i2, __x.end());
+ __x.clear();
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) {
+ if (!__that.begin()._M_node || !__that.begin()._M_node->_M_next)
+ return;
+
+ slist<_Tp, _Alloc> __carry(__that.get_allocator());
+ const int NB = 64;
+ _STLP_PRIV _CArray<slist<_Tp, _Alloc>, NB> __counter(__carry);
+ int __fill = 0;
+ while (!__that.empty()) {
+ __carry.splice_after(__carry.before_begin(), __that, __that.before_begin());
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty()) {
+ _STLP_PRIV _Slist_merge(__counter[__i], __carry, __comp);
+ __carry.swap(__counter[__i]);
+ ++__i;
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill) {
+ ++__fill;
+ if (__fill >= NB) {
+ //Looks like the slist has too many elements to be sorted with this algorithm:
+ __stl_throw_overflow_error("slist::sort");
+ }
+ }
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ _STLP_PRIV _Slist_merge(__counter[__i], __counter[__i - 1], __comp);
+ __that.swap(__counter[__fill-1]);
+}
+
+#if defined (slist)
+# undef slist
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# undef size_type
+#endif
+
+#endif /* _STLP_SLIST_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_slist.h b/build/stlport/stlport/stl/_slist.h
new file mode 100644
index 000000000..924daa496
--- /dev/null
+++ b/build/stlport/stlport/stl/_slist.h
@@ -0,0 +1,914 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SLIST_H
+#define _STLP_INTERNAL_SLIST_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+# include <stl/_slist_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+class _Slist_node : public _Slist_node_base {
+public:
+ _Tp _M_data;
+ __TRIVIAL_STUFF(_Slist_node)
+};
+
+struct _Slist_iterator_base {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag iterator_category;
+
+ _Slist_node_base *_M_node;
+
+ _Slist_iterator_base(_Slist_node_base *__x) : _M_node(__x) {}
+
+ void _M_incr() {
+ _M_node = _M_node->_M_next;
+ }
+};
+
+template <class _Tp, class _Traits>
+class _Slist_iterator : public _Slist_iterator_base {
+public:
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Slist_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Slist_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Slist_iterator<_Tp, _ConstTraits> const_iterator;
+
+ typedef _Slist_node<value_type> _Node;
+
+ explicit _Slist_iterator(_Slist_node_base *__x) : _Slist_iterator_base(__x) {}
+ _Slist_iterator() : _Slist_iterator_base(0) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
+
+ reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_incr();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_incr();
+ return __tmp;
+ }
+
+ bool operator==(const_iterator __y ) const {
+ return this->_M_node == __y._M_node;
+ }
+ bool operator!=(const_iterator __y ) const {
+ return this->_M_node != __y._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _Slist_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+inline _Tp* _STLP_CALL value_type(const _STLP_PRIV _Slist_iterator<_Tp, _Traits>&) { return __STATIC_CAST(_Tp*, 0); }
+inline ptrdiff_t* _STLP_CALL distance_type(const _STLP_PRIV _Slist_iterator_base&) { return 0; }
+inline forward_iterator_tag _STLP_CALL iterator_category(const _STLP_PRIV _Slist_iterator_base&) { return forward_iterator_tag(); }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* OLD_QUERIES */
+
+// Base class that encapsulates details of allocators and simplifies EH
+template <class _Tp, class _Alloc>
+class _Slist_base {
+protected:
+ typedef _Slist_node<_Tp> _Node;
+ typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type;
+ typedef _Slist_base<_Tp, _Alloc> _Self;
+
+public:
+ typedef _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _AllocProxy;
+
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+
+ _Slist_base(const allocator_type& __a) :
+ _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() )
+ { _M_head._M_data._M_next = 0; }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Slist_base(__move_source<_Self> src) :
+ _M_head(__move_source<_AllocProxy>(src.get()._M_head))
+ { src.get()._M_head._M_data._M_next = 0; }
+#endif
+
+ ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); }
+
+protected:
+ _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) {
+ _Node* __next = __STATIC_CAST(_Node*, __pos->_M_next);
+ _Slist_node_base* __next_next = __next->_M_next;
+ __pos->_M_next = __next_next;
+ _STLP_STD::_Destroy(&__next->_M_data);
+ _M_head.deallocate(__next,1);
+ return __next_next;
+ }
+ _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
+
+public:
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp); }
+ _AllocProxy _M_head;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define slist _STLP_PTR_IMPL_NAME(slist)
+#elif defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist;
+
+#if !defined (slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// helper functions to reduce code duplication
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
+
+#if !defined (slist)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+class slist : protected _STLP_PRIV _Slist_base<_Tp,_Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
+ , public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_PRIV _Slist_base<_Tp,_Alloc> _Base;
+ typedef slist<_Tp,_Alloc> _Self;
+public:
+ typedef _Tp value_type;
+
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _STLP_PRIV _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+private:
+ typedef _STLP_PRIV _Slist_node<_Tp> _Node;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_create_node(const value_type& __x = _Tp()) {
+#else
+ _Node* _M_create_node(const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _Node* __node = this->_M_head.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__node->_M_data, __x);
+ __node->_M_next = 0;
+ }
+ _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
+ return __node;
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_create_node() {
+ _Node* __node = this->_M_head.allocate(1);
+ _STLP_TRY {
+ _STLP_STD::_Construct(&__node->_M_data);
+ __node->_M_next = 0;
+ }
+ _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
+ return __node;
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+public:
+
+ allocator_type get_allocator() const { return _Base::get_allocator(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(const allocator_type& __a = allocator_type())
+#else
+ slist()
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) {}
+ slist(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp),
+ const allocator_type& __a = allocator_type())
+#else
+ explicit slist(size_type __n)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ slist(size_type __n, const value_type& __x)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
+ slist(size_type __n, const value_type& __x, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // VC++ needs this crazyness
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ slist(const _Self& __x)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__x.get_allocator())
+ { _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end()); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ _Self& operator= (const _Self& __x);
+
+ ~slist() {}
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
+
+private:
+ void _M_fill_assign(size_type __n, const _Tp& __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+public:
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_assign((size_type) __n, (_Tp) __val);
+ }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else
+public:
+ void assign(const_pointer __first, const_pointer __last) {
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ while (__node != 0 && __first != __last) {
+ __STATIC_CAST(_Node*, __node)->_M_data = *__first;
+ __prev = __node;
+ __node = __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ while (__node != 0 && __first != __last) {
+ __STATIC_CAST(_Node*, __node)->_M_data = *__first;
+ __prev = __node;
+ __node = __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+
+public:
+
+ // Experimental new feature: before_begin() returns a
+ // non-dereferenceable iterator that, when incremented, yields
+ // begin(). This iterator may be used as the argument to
+ // insert_after, erase_after, etc. Note that even for an empty
+ // slist, before_begin() is not the same iterator as end(). It
+ // is always necessary to increment before_begin() at least once to
+ // obtain end().
+ iterator before_begin() { return iterator(&this->_M_head._M_data); }
+ const_iterator before_begin() const
+ { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_head._M_data)); }
+
+ iterator begin() { return iterator(this->_M_head._M_data._M_next); }
+ const_iterator begin() const
+ { return const_iterator(this->_M_head._M_data._M_next);}
+
+ iterator end() { return iterator(); }
+ const_iterator end() const { return const_iterator(); }
+
+ size_type size() const
+ { return _STLP_PRIV _Sl_global_inst::size(this->_M_head._M_data._M_next); }
+
+ size_type max_size() const { return size_type(-1); }
+
+ bool empty() const { return this->_M_head._M_data._M_next == 0; }
+
+ void swap(_Self& __x)
+ { this->_M_head.swap(__x._M_head); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __x = _Tp()) {
+#else
+ void push_front(const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node(__x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front() { _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node());}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_front() {
+ _Node* __node = __STATIC_CAST(_Node*, this->_M_head._M_data._M_next);
+ this->_M_head._M_data._M_next = __node->_M_next;
+ _STLP_STD::_Destroy(&__node->_M_data);
+ this->_M_head.deallocate(__node, 1);
+ }
+
+ iterator previous(const_iterator __pos) {
+ return iterator(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node));
+ }
+ const_iterator previous(const_iterator __pos) const {
+ return const_iterator(__CONST_CAST(_Node_base*,
+ _STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data,
+ __pos._M_node)));
+ }
+
+private:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_insert_after(_Node_base* __pos, const value_type& __x = _Tp()) {
+#else
+ _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x)));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_insert_after(_Node_base* __pos) {
+ return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node()));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void _M_insert_after_fill(_Node_base* __pos,
+ size_type __n, const value_type& __x) {
+ for (size_type __i = 0; __i < __n; ++__i)
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_insert_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_insert_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(__pos, __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_insert_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert_after_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_insert_after_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_splice_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_splice_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_splice_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(__pos, __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_splice_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_splice_after_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_splice_after_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary slist to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice_after(iterator(__pos), __tmp);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_splice_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_splice_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_splice_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos),
+ __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_splice_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_splice_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_splice_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary slist to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(iterator(__pos), __tmp);
+ }
+
+public:
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert_after(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return iterator(_M_insert_after(__pos._M_node, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos) {
+ return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x) {
+ _M_insert_after_fill(__pos._M_node, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InIter>
+ void insert_after(iterator __pos, _InIter __first, _InIter __last) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _M_insert_after_range(__pos._M_node, __first, __last);
+ }
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _M_splice_after_range(__pos._M_node, __first, __last);
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos) {
+ return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_DEFAULT_CONSTRUCTED(_Tp)));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InIter>
+ void insert(iterator __pos, _InIter __first, _InIter __last) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type* __first,
+ const value_type* __last) {
+ _M_insert_after_range(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ __first, __last);
+ }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _M_splice_range(__pos._M_node, __first, __last);
+ }
+
+public:
+ iterator erase_after(iterator __pos)
+ { return iterator(this->_M_erase_after(__pos._M_node)); }
+ iterator erase_after(iterator __before_first, iterator __last)
+ { return iterator(this->_M_erase_after(__before_first._M_node, __last._M_node)); }
+
+ iterator erase(iterator __pos)
+ { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node))); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node)); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size, const value_type& __x = _Tp());
+#else
+ void resize(size_type new_size, const value_type& __x);
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear()
+ { this->_M_erase_after(&this->_M_head._M_data, 0); }
+
+public:
+ // Moves the range [__before_first + 1, __before_last + 1) to *this,
+ // inserting it immediately after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last) {
+ if (__before_first != __before_last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
+ __before_first._M_node, __before_last._M_node);
+ }
+ else {
+ this->insert_after(__pos, iterator(__before_first._M_node->_M_next), iterator(__before_last._M_node->_M_next));
+ __x.erase_after(__before_first, ++__before_last);
+ }
+ }
+ }
+
+ // Moves the element that follows __prev to *this, inserting it immediately
+ // after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x, iterator __prev) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
+ __prev._M_node, __prev._M_node->_M_next);
+ }
+ else {
+ this->insert_after(__pos, __STATIC_CAST(_Node*, __prev._M_node->_M_next)->_M_data);
+ __x.erase_after(__prev);
+ }
+ }
+
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void splice_after(iterator __pos, _Self& __x) {
+ if (this->get_allocator() == __x.get_allocator())
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data);
+ else {
+ this->insert_after(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and linear in __x.size().
+ void splice(iterator __pos, _Self& __x) {
+ if (__x._M_head._M_data._M_next) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ &__x._M_head._M_data,
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, 0));
+ }
+ else {
+ insert(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node),
+ __i._M_node);
+ }
+ else {
+ insert(__pos, *__i);
+ __x.erase(__i);
+ }
+ }
+
+ // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
+ // and in distance(__first, __last).
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ if (__first != __last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(__first._M_node, __last._M_node));
+ }
+ else {
+ insert(__pos, __first, __last);
+ __x.erase(__first, __last);
+ }
+ }
+ }
+
+public:
+ void reverse() {
+ if (this->_M_head._M_data._M_next)
+ this->_M_head._M_data._M_next = _STLP_PRIV _Sl_global_inst::__reverse(this->_M_head._M_data._M_next);
+ }
+
+ void remove(const _Tp& __val);
+
+ void unique() { _STLP_PRIV _Slist_unique(*this, equal_to<value_type>()); }
+ void merge(_Self& __x) { _STLP_PRIV _Slist_merge(*this, __x, less<value_type>()); }
+ void sort() { _STLP_PRIV _Slist_sort(*this, less<value_type>()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur->_M_next) {
+ if (__pred(__STATIC_CAST(_Node*, __cur->_M_next)->_M_data))
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred)
+ { _STLP_PRIV _Slist_unique(*this, __pred); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp)
+ { _STLP_PRIV _Slist_merge(*this, __x, __comp); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _STLP_PRIV _Slist_sort(*this, __comp); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (slist)
+# undef slist
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_slist.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_slist.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_slist.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp, class _Alloc>
+inline bool _STLP_CALL
+operator == (const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
+ typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = _SL1.end();
+ const_iterator __end2 = _SL2.end();
+
+ const_iterator __i1 = _SL1.begin();
+ const_iterator __i2 = _SL2.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+}
+
+#define _STLP_EQUAL_OPERATOR_SPECIALIZED
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<slist<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+# endif
+
+// Specialization of insert_iterator so that insertions will be constant
+// time rather than linear time.
+template <class _Tp, class _Alloc>
+class insert_iterator<slist<_Tp, _Alloc> > {
+protected:
+ typedef slist<_Tp, _Alloc> _Container;
+ _Container* _M_container;
+ typename _Container::iterator _M_iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : _M_container(&__x) {
+ if (__i == __x.begin())
+ _M_iter = __x.before_begin();
+ else
+ _M_iter = __x.previous(__i);
+ }
+
+ insert_iterator<_Container>&
+ operator = (const typename _Container::value_type& __val) {
+ _M_iter = _M_container->insert_after(_M_iter, __val);
+ return *this;
+ }
+
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_slist_base.c b/build/stlport/stlport/stl/_slist_base.c
new file mode 100644
index 000000000..e0e68c9b2
--- /dev/null
+++ b/build/stlport/stlport/stl/_slist_base.c
@@ -0,0 +1,104 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_SLIST_BASE_C
+#define _STLP_SLIST_BASE_C
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+# include <stl/_slist_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+_Slist_node_base* _STLP_CALL
+_Sl_global<_Dummy>::__previous(_Slist_node_base* __head,
+ const _Slist_node_base* __node) {
+ while (__head && __head->_M_next != __node)
+ __head = __head->_M_next;
+ return __head;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos, _Slist_node_base* __head) {
+ _Slist_node_base* __before_last = __previous(__head, 0);
+ if (__before_last != __head) {
+ _Slist_node_base* __after = __pos->_M_next;
+ __pos->_M_next = __head->_M_next;
+ __head->_M_next = 0;
+ __before_last->_M_next = __after;
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos,
+ _Slist_node_base* __before_first,
+ _Slist_node_base* __before_last) {
+ if (__pos != __before_first && __pos != __before_last) {
+ _Slist_node_base* __first = __before_first->_M_next;
+ _Slist_node_base* __after = __pos->_M_next;
+ __before_first->_M_next = __before_last->_M_next;
+ __pos->_M_next = __first;
+ __before_last->_M_next = __after;
+ }
+}
+
+template <class _Dummy>
+_Slist_node_base* _STLP_CALL
+_Sl_global<_Dummy>::__reverse(_Slist_node_base* __node) {
+ _Slist_node_base* __result = __node;
+ __node = __node->_M_next;
+ __result->_M_next = 0;
+ while(__node) {
+ _Slist_node_base* __next = __node->_M_next;
+ __node->_M_next = __result;
+ __result = __node;
+ __node = __next;
+ }
+ return __result;
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Sl_global<_Dummy>::size(_Slist_node_base* __node) {
+ size_t __result = 0;
+ for ( ; __node != 0; __node = __node->_M_next)
+ ++__result;
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SLIST_BASE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_slist_base.h b/build/stlport/stlport/stl/_slist_base.h
new file mode 100644
index 000000000..3afa18a15
--- /dev/null
+++ b/build/stlport/stlport/stl/_slist_base.h
@@ -0,0 +1,90 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+#define _STLP_INTERNAL_SLIST_BASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Slist_node_base {
+ _Slist_node_base* _M_next;
+};
+
+inline _Slist_node_base*
+__slist_make_link(_Slist_node_base* __prev_node,
+ _Slist_node_base* __new_node) {
+ __new_node->_M_next = __prev_node->_M_next;
+ __prev_node->_M_next = __new_node;
+ return __new_node;
+}
+
+
+template <class _Dummy>
+class _Sl_global {
+public:
+ // those used to be global functions
+ // moved here to reduce code bloat without templatizing _Slist_iterator_base
+ static size_t _STLP_CALL size(_Slist_node_base* __node);
+ static _Slist_node_base* _STLP_CALL __reverse(_Slist_node_base* __node);
+ static void _STLP_CALL __splice_after(_Slist_node_base* __pos,
+ _Slist_node_base* __before_first,
+ _Slist_node_base* __before_last);
+
+ static void _STLP_CALL __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head);
+
+ static _Slist_node_base* _STLP_CALL __previous(_Slist_node_base* __head,
+ const _Slist_node_base* __node);
+ static const _Slist_node_base* _STLP_CALL __previous(const _Slist_node_base* __head,
+ const _Slist_node_base* __node) {
+ return _Sl_global<_Dummy>::__previous(__CONST_CAST(_Slist_node_base*, __head), __node);
+ }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Sl_global<bool>;
+#endif
+
+typedef _Sl_global<bool> _Sl_global_inst;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION) && defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+# include <stl/_slist_base.c>
+#endif
+
+#endif /* _STLP_INTERNAL_SLIST_BASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_sparc_atomic.h b/build/stlport/stlport/stl/_sparc_atomic.h
new file mode 100644
index 000000000..21cc0ad03
--- /dev/null
+++ b/build/stlport/stlport/stl/_sparc_atomic.h
@@ -0,0 +1,61 @@
+
+// Currently, SUN CC requires object file
+
+#if defined (__GNUC__)
+
+/*
+** int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value)
+*/
+
+# if defined(__sparc_v9__) || defined (__sparcv9)
+
+# ifdef __arch64__
+
+# define _STLP_EXCH_ASM asm volatile ("casx [%3], %4, %0 ; membar #LoadLoad | #LoadStore " : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
+
+# else /* __arch64__ */
+
+# define _STLP_EXCH_ASM asm volatile ("cas [%3], %4, %0" : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
+# endif
+
+# else /* __sparc_v9__ */
+
+# define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "0" (_L_value2) )
+# endif
+
+
+# define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2 = __value2 ; \
+ do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ _L_value1; })
+
+# define _STLP_ATOMIC_INCREMENT(__pvalue1) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2; \
+ do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ (_L_value2 + 1); })
+
+# define _STLP_ATOMIC_DECREMENT(__pvalue1) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2; \
+ do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ (_L_value2 - 1); })
+
+# elif ! defined (_STLP_NO_EXTERN_INLINE)
+
+extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v);
+extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i);
+extern "C" void _STLP_atomic_increment(__stl_atomic_t* i);
+
+# define _STLP_ATOMIC_INCREMENT(__x) _STLP_atomic_increment((__stl_atomic_t*)__x)
+# define _STLP_ATOMIC_DECREMENT(__x) _STLP_atomic_decrement((__stl_atomic_t*)__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y)
+
+#endif
diff --git a/build/stlport/stlport/stl/_sstream.c b/build/stlport/stlport/stl/_sstream.c
new file mode 100644
index 000000000..9f585351e
--- /dev/null
+++ b/build/stlport/stlport/stl/_sstream.c
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_SSTREAM_C
+#define _STLP_SSTREAM_C
+
+#ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+#endif
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wint_t is supported for this mode
+# define __BSB_int_type__ int
+# define __BSB_pos_type__ streampos
+#else
+# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Non-inline stringbuf member functions.
+
+// Constructors. Note that the base class constructor sets all of the
+// get and area pointers to null.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::basic_stringbuf(ios_base::openmode __mode)
+ : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str()
+{}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode)
+ : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s)
+{
+ _M_set_ptrs();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf()
+{}
+
+// Set the underlying string to a new value.
+template <class _CharT, class _Traits, class _Alloc>
+void
+basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s)
+{
+ _M_str = __s;
+ _M_set_ptrs();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void
+basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs()
+{
+ _CharT* __data_ptr = _S_start(_M_str);
+ _CharT* __data_end = _S_finish(_M_str);
+ // The initial read position is the beginning of the string.
+ if (_M_mode & ios_base::in) {
+ this->setg(__data_ptr, (_M_mode & ios_base::ate) ? __data_end : __data_ptr, __data_end);
+ }
+
+ // The initial write position is the beginning of the string.
+ if (_M_mode & ios_base::out) {
+ if ( _M_mode & (ios_base::app | ios_base::ate) ) {
+ this->setp( __data_end, __data_end );
+ } else {
+ this->setp( __data_ptr, __data_end );
+ this->pbump((int)_M_str.size()); // initial write position, if we initialized with string
+ }
+ // this->setp((_M_mode & (ios_base::app | ios_base::ate))? __data_end : __data_ptr, __data_end);
+ }
+}
+
+// Precondition: gptr() >= egptr(). Returns a character, if one is available.
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::underflow() {
+ return this->gptr() != this->egptr()
+ ? _Traits::to_int_type(*this->gptr())
+ : _Traits::eof();
+}
+
+// Precondition: gptr() >= egptr().
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::uflow() {
+ if (this->gptr() != this->egptr()) {
+ int_type __c = _Traits::to_int_type(*this->gptr());
+ this->gbump(1);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c) {
+ if (this->gptr() != this->eback()) {
+ if (!_Traits::eq_int_type(__c, _Traits::eof())) {
+ if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ return __c;
+ }
+ else if (_M_mode & ios_base::out) {
+ this->gbump(-1);
+ *this->gptr() = _Traits::to_char_type(__c);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+ }
+ else {
+ this->gbump(-1);
+ return _Traits::not_eof(__c);
+ }
+ }
+ else
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__ basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c)
+{
+ if (!_Traits::eq_int_type(__c, _Traits::eof())) {
+ if (_M_mode & ios_base::out) {
+ if ( this->pptr() < this->epptr() ) { // just put back in any case
+ _M_str.push_back( _Traits::to_char_type(__c) );
+ this->pbump(1);
+ } else if ( _M_mode & ios_base::in ) {
+ ptrdiff_t __offset = this->gptr() - this->eback();
+ _M_str.push_back(_Traits::to_char_type(__c));
+ _CharT* __data_ptr = _S_start(_M_str);
+ this->setg(__data_ptr, __data_ptr + __offset, _S_finish(_M_str));
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ } else {
+ _M_str.push_back( _Traits::to_char_type(__c) );
+ this->setp(_S_start(_M_str), _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ }
+ return __c;
+ }
+ return _Traits::eof(); // Overflow always fails if it's read-only
+ }
+ return _Traits::not_eof(__c); // __c is EOF, so we don't have to do anything
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+streamsize
+basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s,
+ streamsize __n) {
+ streamsize __nwritten = 0;
+
+ if ((_M_mode & ios_base::out) && __n > 0) {
+ // If the put pointer is somewhere in the middle of the string,
+ // then overwrite instead of append.
+ if ( !_M_str.empty() && this->pbase() == _S_start(_M_str)) {
+ ptrdiff_t __avail = _S_finish(_M_str) - this->pptr();
+ if (__avail > __n) {
+ _Traits::copy(this->pptr(), __s, __STATIC_CAST(size_t, __n));
+ this->pbump((int)__n);
+ return __n;
+ } else {
+ _Traits::copy(this->pptr(), __s, __avail);
+ __nwritten += __avail;
+ __n -= __avail;
+ __s += __avail;
+ }
+ }
+
+ // At this point we know we're appending.
+ _CharT* __data_ptr;
+ if (_M_mode & ios_base::in) {
+ ptrdiff_t __get_offset = this->gptr() - this->eback();
+ _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
+ __data_ptr = _S_start(_M_str);
+ this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str));
+ } else {
+ _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
+ __data_ptr = _S_start(_M_str);
+ }
+
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ __nwritten += __n;
+ }
+
+ return __nwritten;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+streamsize
+basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c,
+ streamsize __n) {
+ streamsize __nwritten = 0;
+
+ if ((_M_mode & ios_base::out) && __n > 0) {
+ // If the put pointer is somewhere in the middle of the string,
+ // then overwrite instead of append.
+ if (this->pbase() == _S_start(_M_str)) {
+ ptrdiff_t __avail = _S_finish(_M_str) - this->pptr();
+ if (__avail > __n) {
+ _Traits::assign(this->pptr(), __STATIC_CAST(size_t, __n), __c);
+ this->pbump(__STATIC_CAST(int, __n));
+ return __n;
+ }
+ else {
+ _Traits::assign(this->pptr(), __avail, __c);
+ __nwritten += __avail;
+ __n -= __avail;
+ }
+ }
+
+ // At this point we know we're appending.
+ size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
+ : __STATIC_CAST(size_t, __n);
+ _CharT* __data_ptr;
+ if (this->_M_mode & ios_base::in) {
+ ptrdiff_t __get_offset = this->gptr() - this->eback();
+ _M_str.append(__app_size, __c);
+ __data_ptr = _S_start(_M_str);
+ this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str));
+ } else {
+ _M_str.append(__app_size, __c);
+ __data_ptr = _S_start(_M_str);
+ }
+
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ __nwritten += __app_size;
+ }
+
+ return __nwritten;
+}
+
+// According to the C++ standard the effects of setbuf are implementation
+// defined, except that setbuf(0, 0) has no effect. In this implementation,
+// setbuf(<anything>, n), for n > 0, calls reserve(n) on the underlying
+// string.
+template <class _CharT, class _Traits, class _Alloc>
+basic_streambuf<_CharT, _Traits>*
+basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) {
+ if (__n > 0) {
+ bool __do_get_area = false;
+ bool __do_put_area = false;
+ ptrdiff_t __offg = 0;
+ ptrdiff_t __offp = 0;
+
+ if (this->pbase() == _S_start(_M_str)) {
+ __do_put_area = true;
+ __offp = this->pptr() - this->pbase();
+ }
+
+ if (this->eback() == _S_start(_M_str)) {
+ __do_get_area = true;
+ __offg = this->gptr() - this->eback();
+ }
+
+ _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
+ : __STATIC_CAST(size_t, __n));
+
+ _CharT* __data_ptr = _S_start(_M_str);
+
+ if (__do_get_area) {
+ this->setg(__data_ptr, __data_ptr + __offg, _S_finish(_M_str));
+ }
+
+ if (__do_put_area) {
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)__offp);
+ }
+ }
+
+ return this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_pos_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::seekoff(off_type __off,
+ ios_base::seekdir __dir,
+ ios_base::openmode __mode) {
+ __mode &= _M_mode;
+
+ bool __imode = (__mode & ios_base::in) != 0;
+ bool __omode = (__mode & ios_base::out) != 0;
+
+ if ( !(__imode || __omode) )
+ return pos_type(off_type(-1));
+
+ if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
+ return pos_type(off_type(-1));
+
+ streamoff __newoff;
+ switch(__dir) {
+ case ios_base::beg:
+ __newoff = 0;
+ break;
+ case ios_base::end:
+ __newoff = _M_str.size();
+ break;
+ case ios_base::cur:
+ __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase();
+ if ( __off == 0 ) {
+ return pos_type(__newoff);
+ }
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ __off += __newoff;
+
+ if (__imode) {
+ ptrdiff_t __n = this->egptr() - this->eback();
+
+ if (__off < 0 || __off > __n)
+ return pos_type(off_type(-1));
+ this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off),
+ this->eback() + __STATIC_CAST(ptrdiff_t, __n));
+ }
+
+ if (__omode) {
+ ptrdiff_t __n = this->epptr() - this->pbase();
+
+ if (__off < 0 || __off > __n)
+ return pos_type(off_type(-1));
+ this->setp(this->pbase(), this->pbase() + __n);
+ this->pbump((int)__off);
+ }
+
+ return pos_type(__off);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_pos_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::seekpos(pos_type __pos, ios_base::openmode __mode) {
+ __mode &= _M_mode;
+
+ bool __imode = (__mode & ios_base::in) != 0;
+ bool __omode = (__mode & ios_base::out) != 0;
+
+ if ( !(__imode || __omode) )
+ return pos_type(off_type(-1));
+
+ if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
+ return pos_type(off_type(-1));
+
+ const off_type __n = __pos - pos_type(off_type(0));
+
+ if (__imode) {
+ if (__n < 0 || __n > this->egptr() - this->eback())
+ return pos_type(off_type(-1));
+ this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr());
+ }
+
+ if (__omode) {
+ if (__n < 0 || size_t(__n) > _M_str.size())
+ return pos_type(off_type(-1));
+
+ this->setp(_S_start(_M_str), _S_finish(_M_str));
+ this->pbump((int)__n);
+ }
+
+ return __pos;
+}
+
+//----------------------------------------------------------------------
+// Non-inline istringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>
+ ::basic_istringstream(ios_base::openmode __mode)
+ : basic_istream<_CharT, _Traits>(0),
+ _M_buf(__mode | ios_base::in) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>
+ ::basic_istringstream(const _String& __str,ios_base::openmode __mode)
+ : basic_istream<_CharT, _Traits>(0),
+ _M_buf(__str, __mode | ios_base::in) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream()
+{}
+
+//----------------------------------------------------------------------
+// Non-inline ostringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>
+ ::basic_ostringstream(ios_base::openmode __mode)
+ : basic_ostream<_CharT, _Traits>(0),
+ _M_buf(__mode | ios_base::out) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>
+ ::basic_ostringstream(const _String& __str, ios_base::openmode __mode)
+ : basic_ostream<_CharT, _Traits>(0),
+ _M_buf(__str, __mode | ios_base::out) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream()
+{}
+
+//----------------------------------------------------------------------
+// Non-inline stringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>
+ ::basic_stringstream(ios_base::openmode __mode)
+ : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>
+ ::basic_stringstream(const _String& __str, ios_base::openmode __mode)
+ : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream()
+{}
+
+_STLP_END_NAMESPACE
+
+# undef __BSB_int_type__
+# undef __BSB_pos_type__
+
+#endif /* _STLP_SSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_sstream.h b/build/stlport/stlport/stl/_sstream.h
new file mode 100644
index 000000000..9e8d02a64
--- /dev/null
+++ b/build/stlport/stlport/stl/_sstream.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+// This header defines classes basic_stringbuf, basic_istringstream,
+// basic_ostringstream, and basic_stringstream. These classes
+// represent streamsbufs and streams whose sources or destinations are
+// C++ strings.
+
+#ifndef _STLP_INTERNAL_SSTREAM
+#define _STLP_INTERNAL_SSTREAM
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// This version of basic_stringbuf relies on the internal details of
+// basic_string. It relies on the fact that, in this implementation,
+// basic_string's iterators are pointers. It also assumes (as allowed
+// by the standard) that _CharT is a POD type.
+
+// We have a very small buffer for the put area, just so that we don't
+// have to use append() for every sputc. Conceptually, the buffer
+// immediately follows the end of the underlying string. We use this
+// buffer when appending to write-only streambufs, but we don't use it
+// for read-write streambufs.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
+public: // Typedefs.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_streambuf<_CharT, _Traits> _Base;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Self;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+
+public: // Constructors, destructor.
+ explicit basic_stringbuf(ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual ~basic_stringbuf();
+
+public: // Get or set the string.
+ _String str() const { return _M_str; }
+ void str(const _String& __s);
+
+protected: // Overridden virtual member functions.
+ virtual int_type underflow();
+ virtual int_type uflow();
+ virtual int_type pbackfail(int_type __c);
+ virtual int_type overflow(int_type __c);
+ int_type pbackfail() {return pbackfail(_Traits::eof());}
+ int_type overflow() {return overflow(_Traits::eof());}
+
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+ virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
+
+ virtual _Base* setbuf(_CharT* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+private: // Helper functions.
+ void _M_set_ptrs();
+ static _CharT* _S_start(const _String& __str) { return __CONST_CAST(_CharT*, __str.data()); }
+ static _CharT* _S_finish(const _String& __str) { return __CONST_CAST(_CharT*, __str.data()) + __str.size(); }
+
+private:
+ ios_base::openmode _M_mode;
+ _String _M_str;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<char, char_traits<char>, allocator<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+//----------------------------------------------------------------------
+// Class basic_istringstream, an input stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_istringstream : public basic_istream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_istream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+public: // Constructors, destructor.
+ basic_istringstream(ios_base::openmode __mode = ios_base::in);
+ basic_istringstream(const _String& __str,
+ ios_base::openmode __mode = ios_base::in);
+ ~basic_istringstream();
+
+public: // Member functions
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); }
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_istringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_istringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_ostringstream, an output stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_ostringstream : public basic_ostream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_ostream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+public: // Constructors, destructor.
+ basic_ostringstream(ios_base::openmode __mode = ios_base::out);
+ basic_ostringstream(const _String& __str,
+ ios_base::openmode __mode = ios_base::out);
+ ~basic_ostringstream();
+
+public: // Member functions.
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE
+
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_ostringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_ostringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_stringstream, a bidirectional stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_stringstream : public basic_iostream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_iostream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+ typedef ios_base::openmode openmode;
+
+public: // Constructors, destructor.
+ basic_stringstream(openmode __mod = ios_base::in | ios_base::out);
+ basic_stringstream(const _String& __str,
+ openmode __mod = ios_base::in | ios_base::out);
+ ~basic_stringstream();
+
+public: // Member functions.
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); }
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_stringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_stringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<char, char_traits<char>, allocator<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<char, char_traits<char>, allocator<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<char, char_traits<char>, allocator<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_sstream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_SSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_stack.h b/build/stlport/stlport/stl/_stack.h
new file mode 100644
index 000000000..7ea9d59af
--- /dev/null
+++ b/build/stlport/stlport/stl/_stack.h
@@ -0,0 +1,133 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_STACK_H
+#define _STLP_INTERNAL_STACK_H
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
+template <class _Tp, class _Sequence = deque<_Tp> >
+#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+# define _STLP_STACK_ARGS _Tp
+template <class _Tp>
+#else
+template <class _Tp, class _Sequence>
+#endif
+class stack
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_STACK_ARGS)
+ : public __stlport_class<stack<_Tp> >
+# else
+ : public __stlport_class<stack<_Tp, _Sequence> >
+# endif
+#endif
+{
+#ifdef _STLP_STACK_ARGS
+ typedef deque<_Tp> _Sequence;
+ typedef stack<_Tp> _Self;
+#else
+ typedef stack<_Tp, _Sequence> _Self;
+#endif
+
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+protected:
+ //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant.
+ _Sequence c;
+public:
+ stack() : c() {}
+ explicit stack(const _Sequence& __s) : c(__s) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ stack(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+#endif
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference top() { return c.back(); }
+ const_reference top() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_back(); }
+ const _Sequence& _Get_s() const { return c; }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#ifndef _STLP_STACK_ARGS
+# define _STLP_STACK_ARGS _Tp, _Sequence
+# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
+#else
+# define _STLP_STACK_HEADER_ARGS class _Tp
+#endif
+
+template < _STLP_STACK_HEADER_ARGS >
+inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x,
+ const stack< _STLP_STACK_ARGS >& __y)
+{ return __x._Get_s() == __y._Get_s(); }
+
+template < _STLP_STACK_HEADER_ARGS >
+inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x,
+ const stack< _STLP_STACK_ARGS >& __y)
+{ return __x._Get_s() < __y._Get_s(); }
+
+_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
+
+#undef _STLP_STACK_ARGS
+#undef _STLP_STACK_HEADER_ARGS
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Sequence>
+struct __move_traits<stack<_Tp, _Sequence> > :
+ _STLP_PRIV __move_traits_aux<_Sequence>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_STACK_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_stdexcept.h b/build/stlport/stlport/stl/_stdexcept.h
new file mode 100644
index 000000000..ac241601e
--- /dev/null
+++ b/build/stlport/stlport/stl/_stdexcept.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_STDEXCEPT
+#define _STLP_INTERNAL_STDEXCEPT
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+# include <stl/_stdexcept_base.h>
+#endif
+
+#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
+
+# if defined(_STLP_USE_EXCEPTIONS)
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC logic_error : public __Named_exception {
+public:
+ logic_error(const string& __s) : __Named_exception(__s) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~logic_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC runtime_error : public __Named_exception {
+public:
+ runtime_error(const string& __s) : __Named_exception(__s) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~runtime_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC domain_error : public logic_error {
+public:
+ domain_error(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~domain_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC invalid_argument : public logic_error {
+public:
+ invalid_argument(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~invalid_argument() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC length_error : public logic_error {
+public:
+ length_error(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~length_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC out_of_range : public logic_error {
+public:
+ out_of_range(const string& __arg) : logic_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~out_of_range() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC range_error : public runtime_error {
+public:
+ range_error(const string& __arg) : runtime_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~range_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC overflow_error : public runtime_error {
+public:
+ overflow_error(const string& __arg) : runtime_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~overflow_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+class _STLP_CLASS_DECLSPEC underflow_error : public runtime_error {
+public:
+ underflow_error(const string& __arg) : runtime_error(__arg) {}
+# ifndef _STLP_USE_NO_IOSTREAMS
+ ~underflow_error() _STLP_NOTHROW_INHERENTLY;
+# endif
+};
+
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_USE_EXCEPTIONS */
+#endif
+
+#endif /* _STLP_INTERNAL_STDEXCEPT */
diff --git a/build/stlport/stlport/stl/_stdexcept_base.c b/build/stlport/stlport/stl/_stdexcept_base.c
new file mode 100644
index 000000000..3ff3c66b4
--- /dev/null
+++ b/build/stlport/stlport/stl/_stdexcept_base.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+__Named_exception::__Named_exception(const string& __str) {
+ size_t __size = strlen(_STLP_PRIV __get_c_string(__str)) + 1;
+ if (__size > _S_bufsize) {
+ _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
+ if (!_M_name) {
+ __size = _S_bufsize;
+ _M_name = _M_static_name;
+ }
+ else {
+ *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
+ }
+ }
+ else {
+ _M_name = _M_static_name;
+ }
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, _STLP_PRIV __get_c_string(__str), __size - 1);
+ _M_name[__size - 1] = '\0';
+#else
+ strncpy_s(_M_name, __size, _STLP_PRIV __get_c_string(__str), __size - 1);
+#endif
+}
+
+__Named_exception::__Named_exception(const __Named_exception& __x) {
+ size_t __size = strlen(__x._M_name) + 1;
+ if (__size > _S_bufsize) {
+ _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
+ if (!_M_name) {
+ __size = _S_bufsize;
+ _M_name = _M_static_name;
+ }
+ else {
+ *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
+ }
+ }
+ else {
+ _M_name = _M_static_name;
+ }
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, __x._M_name, __size - 1);
+ _M_name[__size - 1] = '\0';
+#else
+ strncpy_s(_M_name, __size, __x._M_name, __size - 1);
+#endif
+}
+
+__Named_exception& __Named_exception::operator = (const __Named_exception& __x) {
+ size_t __size = strlen(__x._M_name) + 1;
+ size_t __buf_size = _M_name != _M_static_name ? *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) : static_cast<size_t>(_S_bufsize);
+ if (__size > __buf_size) {
+ // Being here necessarily mean that we need to allocate a buffer:
+ if (_M_name != _M_static_name) free(_M_name);
+ _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
+ if (!_M_name) {
+ __size = _S_bufsize;
+ _M_name = _M_static_name;
+ }
+ else {
+ *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
+ }
+ }
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, __x._M_name, __size - 1);
+ _M_name[__size - 1] = '\0';
+#else
+ strncpy_s(_M_name, __size, __x._M_name, __size - 1);
+#endif
+ return *this;
+}
+
+__Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {
+ if (_M_name != _M_static_name)
+ free(_M_name);
+}
+
+const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY
+{ return _M_name; }
diff --git a/build/stlport/stlport/stl/_stdexcept_base.h b/build/stlport/stlport/stl/_stdexcept_base.h
new file mode 100644
index 000000000..bac2c178e
--- /dev/null
+++ b/build/stlport/stlport/stl/_stdexcept_base.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+#define _STLP_INTERNAL_STDEXCEPT_BASE
+
+#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+# if defined(_STLP_USE_EXCEPTIONS)
+
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# endif
+
+# ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+# endif
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_OWN_STDEXCEPT 1
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+/* We disable the 4275 warning for
+ * - WinCE where there are only static version of the native C++ runtime.
+ * - The MSVC compilers when the STLport user wants to make an STLport dll linked to
+ * the static C++ native runtime. In this case the std::exception base class is no more
+ * exported from native dll but is used as a base class for the exported __Named_exception
+ * class.
+ */
+# if defined (_STLP_WCE_NET) || \
+ defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_DO_WARNING_POP
+# pragma warning (push)
+# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
+ // for dll-interface class '__Named_exception'
+# endif
+
+# if !defined (_STLP_NO_EXCEPTION_HEADER)
+# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
+ defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
+using _STLP_VENDOR_EXCEPT_STD::exception;
+# endif
+# endif
+# define _STLP_EXCEPTION_BASE exception
+
+class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
+public:
+ __Named_exception(const string& __str);
+ __Named_exception(const __Named_exception&);
+ __Named_exception& operator = (const __Named_exception&);
+
+ const char* what() const _STLP_NOTHROW_INHERENTLY;
+ ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
+
+private:
+ enum { _S_bufsize = 256 };
+ char _M_static_name[_S_bufsize];
+ char *_M_name;
+};
+
+# if defined (_STLP_USE_NO_IOSTREAMS) && !defined (__BUILDING_STLPORT)
+ // if not linking to the lib, expose implementation of members here
+# include <stl/_stdexcept_base.c>
+# endif
+
+# if defined (_STLP_DO_WARNING_POP)
+# pragma warning (pop)
+# undef _STLP_DO_WARNING_POP
+# endif
+
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_USE_EXCEPTIONS */
+#endif
+
+#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */
diff --git a/build/stlport/stlport/stl/_stlport_version.h b/build/stlport/stlport/stl/_stlport_version.h
new file mode 100644
index 000000000..587651de4
--- /dev/null
+++ b/build/stlport/stlport/stl/_stlport_version.h
@@ -0,0 +1,30 @@
+ /*
+ *
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STLPORT_VERSION_H
+#define _STLP_STLPORT_VERSION_H
+
+/* The last SGI STL release we merged with */
+#define __SGI_STL 0x330
+
+/* STLport version */
+#define _STLPORT_MAJOR 5
+#define _STLPORT_MINOR 2
+#define _STLPORT_PATCHLEVEL 1
+
+#define _STLPORT_VERSION 0x521
+
+#endif /* _STLP_STLPORT_VERSION_H */
diff --git a/build/stlport/stlport/stl/_stream_iterator.h b/build/stlport/stlport/stl/_stream_iterator.h
new file mode 100644
index 000000000..aa26ae351
--- /dev/null
+++ b/build/stlport/stlport/stl/_stream_iterator.h
@@ -0,0 +1,253 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#if !defined (_STLP_INTERNAL_STREAM_ITERATOR_H) && !defined (_STLP_USE_NO_IOSTREAMS)
+#define _STLP_INTERNAL_STREAM_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+// streambuf_iterators predeclarations must appear first
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+// istream_iterator and ostream_iterator look very different if we're
+// using new, templatized iostreams than if we're using the old cfront
+// version.
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _CharT, class _Traits, class _Dist
+# define __ISI_TMPL_ARGUMENTS _Tp, _CharT, _Traits, _Dist
+template <class _Tp,
+ class _CharT = char, class _Traits = char_traits<_CharT>,
+ class _Dist = ptrdiff_t>
+class istream_iterator : public iterator<input_iterator_tag, _Tp , _Dist,
+ const _Tp*, const _Tp& > {
+#else
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp
+# define __ISI_TMPL_ARGUMENTS _Tp
+template <class _Tp>
+class istream_iterator : public iterator<input_iterator_tag, _Tp , ptrdiff_t,
+ const _Tp*, const _Tp& > {
+# else
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _Dist
+# define __ISI_TMPL_ARGUMENTS _Tp, _Dist
+template <class _Tp, _STLP_DFL_TYPE_PARAM(_Dist, ptrdiff_t)>
+class istream_iterator : public iterator<input_iterator_tag, _Tp, _Dist ,
+ const _Tp*, const _Tp& > {
+# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+ typedef char _CharT;
+ typedef char_traits<char> _Traits;
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+ typedef ptrdiff_t _Dist;
+# endif
+#endif
+
+ typedef istream_iterator< __ISI_TMPL_ARGUMENTS > _Self;
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Dist difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+
+ istream_iterator() : _M_stream(0), _M_ok(false), _M_read_done(true) {}
+ istream_iterator(istream_type& __s) : _M_stream(&__s), _M_ok(false), _M_read_done(false) {}
+
+ reference operator*() const {
+ if (!_M_read_done) {
+ _M_read();
+ }
+ return _M_value;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_read();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_read();
+ return __tmp;
+ }
+
+ bool _M_equal(const _Self& __x) const {
+ if (!_M_read_done) {
+ _M_read();
+ }
+ if (!__x._M_read_done) {
+ __x._M_read();
+ }
+ return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);
+ }
+
+private:
+ istream_type* _M_stream;
+ mutable _Tp _M_value;
+ mutable bool _M_ok;
+ mutable bool _M_read_done;
+
+ void _M_read() const {
+ _STLP_MUTABLE(_Self, _M_ok) = ((_M_stream != 0) && !_M_stream->fail());
+ if (_M_ok) {
+ *_M_stream >> _STLP_MUTABLE(_Self, _M_value);
+ _STLP_MUTABLE(_Self, _M_ok) = !_M_stream->fail();
+ }
+ _STLP_MUTABLE(_Self, _M_read_done) = true;
+ }
+};
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _TpP,
+ class _CharT = char, class _Traits = char_traits<_CharT> >
+#else
+template <class _TpP>
+#endif
+class ostream_iterator: public iterator<output_iterator_tag, void, void, void, void> {
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+ typedef char _CharT;
+ typedef char_traits<char> _Traits;
+ typedef ostream_iterator<_TpP> _Self;
+#else
+ typedef ostream_iterator<_TpP, _CharT, _Traits> _Self;
+#endif
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+
+ ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
+ ostream_iterator(ostream_type& __s, const _CharT* __c)
+ : _M_stream(&__s), _M_string(__c) {}
+ _Self& operator=(const _TpP& __val) {
+ *_M_stream << __val;
+ if (_M_string) *_M_stream << _M_string;
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+private:
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _TpP>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostream_iterator<_TpP>&) { return output_iterator_tag(); }
+# else
+template <class _TpP, class _CharT, class _Traits>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostream_iterator<_TpP, _CharT, _Traits>&) { return output_iterator_tag(); }
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// form-independent definiotion of stream iterators
+_STLP_BEGIN_NAMESPACE
+
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline bool _STLP_CALL
+operator==(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
+ const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
+{ return __x._M_equal(__y); }
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline bool _STLP_CALL
+operator!=(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
+ const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
+{ return !__x._M_equal(__y); }
+#endif
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline input_iterator_tag _STLP_CALL
+iterator_category(const istream_iterator< __ISI_TMPL_ARGUMENTS >&)
+{ return input_iterator_tag(); }
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline _Tp* _STLP_CALL
+value_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Tp*) 0; }
+
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline ptrdiff_t* _STLP_CALL
+distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (ptrdiff_t*)0; }
+# else
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline _Dist* _STLP_CALL
+distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Dist*)0; }
+# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __ISI_TMPL_HEADER_ARGUMENTS
+#undef __ISI_TMPL_ARGUMENTS
+
+#endif /* _STLP_INTERNAL_STREAM_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_streambuf.c b/build/stlport/stlport/stl/_streambuf.c
new file mode 100644
index 000000000..bd61a204f
--- /dev/null
+++ b/build/stlport/stlport/stl/_streambuf.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_STREAMBUF_C
+#define _STLP_STREAMBUF_C
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+//----------------------------------------------------------------------
+// Non-inline basic_streambuf<> member functions.
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) || !defined (_STLP_USE_STATIC_LIB)
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::basic_streambuf()
+ : _M_gbegin(0), _M_gnext(0), _M_gend(0),
+ _M_pbegin(0), _M_pnext(0), _M_pend(0),
+ _M_locale() {
+ // _M_lock._M_initialize();
+}
+#endif
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>::~basic_streambuf()
+{}
+
+template <class _CharT, class _Traits>
+locale
+basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc) {
+ this->imbue(__loc);
+ locale __tmp = _M_locale;
+ _M_locale = __loc;
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::xsgetn(_CharT* __s, streamsize __n) {
+ streamsize __result = 0;
+ const int_type __eof = _Traits::eof();
+
+ while (__result < __n) {
+ if (_M_gnext < _M_gend) {
+ size_t __chunk = (min) (__STATIC_CAST(size_t,_M_gend - _M_gnext),
+ __STATIC_CAST(size_t,__n - __result));
+ _Traits::copy(__s, _M_gnext, __chunk);
+ __result += __chunk;
+ __s += __chunk;
+ _M_gnext += __chunk;
+ }
+ else {
+ int_type __c = this->sbumpc();
+ if (!_Traits::eq_int_type(__c, __eof)) {
+ *__s = _Traits::to_char_type(__c);
+ ++__result;
+ ++__s;
+ }
+ else
+ break;
+ }
+ }
+
+ return __result;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::xsputn(const _CharT* __s, streamsize __n)
+{
+ streamsize __result = 0;
+ const int_type __eof = _Traits::eof();
+
+ while (__result < __n) {
+ if (_M_pnext < _M_pend) {
+ size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
+ __STATIC_CAST(size_t,__n - __result));
+ _Traits::copy(_M_pnext, __s, __chunk);
+ __result += __chunk;
+ __s += __chunk;
+ _M_pnext += __chunk;
+ }
+
+ else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(*__s)),
+ __eof)) {
+ ++__result;
+ ++__s;
+ }
+ else
+ break;
+ }
+ return __result;
+}
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::_M_xsputnc(_CharT __c, streamsize __n)
+{
+ streamsize __result = 0;
+ const int_type __eof = _Traits::eof();
+
+ while (__result < __n) {
+ if (_M_pnext < _M_pend) {
+ size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext),
+ __STATIC_CAST(size_t,__n - __result));
+ _Traits::assign(_M_pnext, __chunk, __c);
+ __result += __chunk;
+ _M_pnext += __chunk;
+ }
+
+ else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(__c)),
+ __eof))
+ ++__result;
+ else
+ break;
+ }
+ return __result;
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::_M_snextc_aux()
+{
+ int_type __eof = _Traits::eof();
+ if (_M_gend == _M_gnext)
+ return _Traits::eq_int_type(this->uflow(), __eof) ? __eof : this->sgetc();
+ else {
+ _M_gnext = _M_gend;
+ return this->underflow();
+ }
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::pbackfail(int_type) {
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::overflow(int_type) {
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::uflow() {
+ return ( _Traits::eq_int_type(this->underflow(),_Traits::eof()) ?
+ _Traits::eof() :
+ _Traits::to_int_type(*_M_gnext++));
+}
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type
+basic_streambuf<_CharT, _Traits>::underflow()
+{ return _Traits::eof(); }
+
+template <class _CharT, class _Traits>
+streamsize
+basic_streambuf<_CharT, _Traits>::showmanyc()
+{ return 0; }
+
+template <class _CharT, class _Traits>
+void
+basic_streambuf<_CharT, _Traits>::imbue(const locale&) {}
+
+template <class _CharT, class _Traits>
+int
+basic_streambuf<_CharT, _Traits>::sync() { return 0; }
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
+{ return pos_type(-1); }
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type
+basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode)
+{ return pos_type(-1); }
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_streambuf<_CharT, _Traits>:: setbuf(char_type*, streamsize)
+{ return this; }
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_streambuf.h b/build/stlport/stlport/stl/_streambuf.h
new file mode 100644
index 000000000..e336b0f53
--- /dev/null
+++ b/build/stlport/stlport/stl/_streambuf.h
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_STREAMBUF
+#define _STLP_INTERNAL_STREAMBUF
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h> // Needed for ios_base bitfield members.
+#endif // <ios_base> includes <iosfwd>.
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class basic_streambuf<>, the base class of the streambuf hierarchy.
+
+// A basic_streambuf<> manages an input (get) area and an output (put)
+// area. Each is described by three pointers: a beginning, an end, and a
+// current position. basic_streambuf<> contains some very simple member
+// functions that manipulate those six pointers, but almost all of the real
+// functionality gets delegated to protected virtual member functions.
+// All of the public member functions are inline, and most of the protected
+// member functions are virtual.
+
+// Although basic_streambuf<> is not abstract, it is useful only as a base
+// class. Its virtual member functions have default definitions such that
+// reading from a basic_streambuf<> will always yield EOF, and writing to a
+// basic_streambuf<> will always fail.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_streambuf {
+ friend class basic_istream<_CharT, _Traits>;
+ friend class basic_ostream<_CharT, _Traits>;
+
+public: // Typedefs.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+private: // Data members.
+
+ char_type* _M_gbegin; // Beginning of get area
+ char_type* _M_gnext; // Current position within the get area
+ char_type* _M_gend; // End of get area
+
+ char_type* _M_pbegin; // Beginning of put area
+ char_type* _M_pnext; // Current position within the put area
+ char_type* _M_pend; // End of put area
+
+ locale _M_locale; // The streambuf's locale object
+
+public: // Destructor.
+ virtual ~basic_streambuf();
+
+protected: // The default constructor.
+ basic_streambuf()
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && defined (_STLP_USE_STATIC_LIB)
+ //We make it inline to avoid unresolved symbol.
+ : _M_gbegin(0), _M_gnext(0), _M_gend(0),
+ _M_pbegin(0), _M_pnext(0), _M_pend(0),
+ _M_locale()
+ {}
+#else
+ ;
+#endif
+
+protected: // Protected interface to the get area.
+ char_type* eback() const { return _M_gbegin; } // Beginning
+ char_type* gptr() const { return _M_gnext; } // Current position
+ char_type* egptr() const { return _M_gend; } // End
+
+ void gbump(int __n) { _M_gnext += __n; }
+ void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) {
+ _M_gbegin = __gbegin;
+ _M_gnext = __gnext;
+ _M_gend = __gend;
+ }
+
+public:
+ // An alternate public interface to the above functions
+ // which allows us to avoid using templated friends which
+ // are not supported on some compilers.
+ char_type* _M_eback() const { return eback(); }
+ char_type* _M_gptr() const { return gptr(); }
+ char_type* _M_egptr() const { return egptr(); }
+ void _M_gbump(int __n) { gbump(__n); }
+ void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
+ { this->setg(__gbegin, __gnext, __gend); }
+
+protected: // Protected interface to the put area
+
+ char_type* pbase() const { return _M_pbegin; } // Beginning
+ char_type* pptr() const { return _M_pnext; } // Current position
+ char_type* epptr() const { return _M_pend; } // End
+
+ void pbump(int __n) { _M_pnext += __n; }
+ void setp(char_type* __pbegin, char_type* __pend) {
+ _M_pbegin = __pbegin;
+ _M_pnext = __pbegin;
+ _M_pend = __pend;
+ }
+
+protected: // Virtual buffer management functions.
+
+ virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
+
+ // Alters the stream position, using an integer offset. In this
+ // class seekoff does nothing; subclasses are expected to override it.
+ virtual pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode = ios_base::in | ios_base::out);
+
+ // Alters the stream position, using a previously obtained streampos. In
+ // this class seekpos does nothing; subclasses are expected to override it.
+ virtual pos_type
+ seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
+
+ // Synchronizes (i.e. flushes) the buffer. All subclasses are expected to
+ // override this virtual member function.
+ virtual int sync();
+
+
+public: // Buffer management.
+ basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n)
+ { return this->setbuf(__s, __n); }
+
+ pos_type pubseekoff(off_type __offset, ios_base::seekdir __way,
+ ios_base::openmode __mod = ios_base::in | ios_base::out)
+ { return this->seekoff(__offset, __way, __mod); }
+
+ pos_type pubseekpos(pos_type __sp,
+ ios_base::openmode __mod = ios_base::in | ios_base::out)
+ { return this->seekpos(__sp, __mod); }
+
+ int pubsync() { return this->sync(); }
+
+protected: // Virtual get area functions, as defined in
+ // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
+ // Returns a lower bound on the number of characters that we can read,
+ // with underflow, before reaching end of file. (-1 is a special value:
+ // it means that underflow will fail.) Most subclasses should probably
+ // override this virtual member function.
+ virtual streamsize showmanyc();
+
+ // Reads up to __n characters. Return value is the number of
+ // characters read.
+ virtual streamsize xsgetn(char_type* __s, streamsize __n);
+
+ // Called when there is no read position, i.e. when gptr() is null
+ // or when gptr() >= egptr(). Subclasses are expected to override
+ // this virtual member function.
+ virtual int_type underflow();
+
+ // Similar to underflow(), but used for unbuffered input. Most
+ // subclasses should probably override this virtual member function.
+ virtual int_type uflow();
+
+ // Called when there is no putback position, i.e. when gptr() is null
+ // or when gptr() == eback(). All subclasses are expected to override
+ // this virtual member function.
+ virtual int_type pbackfail(int_type = traits_type::eof());
+
+protected: // Virtual put area functions, as defined in
+ // 27.5.2.4.5 of the standard.
+
+ // Writes up to __n characters. Return value is the number of characters
+ // written.
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+
+ // Extension: writes up to __n copies of __c. Return value is the number
+ // of characters written.
+ virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
+
+ // Called when there is no write position. All subclasses are expected to
+ // override this virtual member function.
+ virtual int_type overflow(int_type = traits_type::eof());
+
+public: // Public members for writing characters.
+ // Write a single character.
+ int_type sputc(char_type __c) {
+ return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
+ : this->overflow(_Traits::to_int_type(__c)));
+ }
+
+ // Write __n characters.
+ streamsize sputn(const char_type* __s, streamsize __n)
+ { return this->xsputn(__s, __n); }
+
+ // Extension: write __n copies of __c.
+ streamsize _M_sputnc(char_type __c, streamsize __n)
+ { return this->_M_xsputnc(__c, __n); }
+
+private: // Helper functions.
+ int_type _M_snextc_aux();
+
+public: // Public members for reading characters.
+ streamsize in_avail() {
+ return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
+ }
+
+ // Advance to the next character and return it.
+ int_type snextc() {
+ return ( _M_gend - _M_gnext > 1 ?
+ _Traits::to_int_type(*++_M_gnext) :
+ this->_M_snextc_aux());
+ }
+
+ // Return the current character and advance to the next.
+ int_type sbumpc() {
+ return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++)
+ : this->uflow();
+ }
+
+ // Return the current character without advancing to the next.
+ int_type sgetc() {
+ return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext)
+ : this->underflow();
+ }
+
+ streamsize sgetn(char_type* __s, streamsize __n)
+ { return this->xsgetn(__s, __n); }
+
+ int_type sputbackc(char_type __c) {
+ return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1)))
+ ? _Traits::to_int_type(*--_M_gnext)
+ : this->pbackfail(_Traits::to_int_type(__c));
+ }
+
+ int_type sungetc() {
+ return (_M_gbegin < _M_gnext)
+ ? _Traits::to_int_type(*--_M_gnext)
+ : this->pbackfail();
+ }
+
+protected: // Virtual locale functions.
+
+ // This is a hook, called by pubimbue() just before pubimbue()
+ // sets the streambuf's locale to __loc. Note that imbue should
+ // not (and cannot, since it has no access to streambuf's private
+ // members) set the streambuf's locale itself.
+ virtual void imbue(const locale&);
+
+public: // Locale-related functions.
+ locale pubimbue(const locale&);
+ locale getloc() const { return _M_locale; }
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+ void stossc() { this->sbumpc(); }
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<wchar_t, char_traits<wchar_t> >;
+# endif // _STLP_NO_WCHAR_T
+#endif // _STLP_USE_TEMPLATE_EXPORT
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_streambuf.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_string.c b/build/stlport/stlport/stl/_string.c
new file mode 100644
index 000000000..ae5509263
--- /dev/null
+++ b/build/stlport/stlport/stl/_string.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_STRING_C
+#define _STLP_STRING_C
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+# include <stl/_ctraits_fns.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_H
+# include <stl/_function.h>
+#endif
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+#elif defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __size_type__ size_t
+# define size_type size_t
+# define iterator _CharT*
+#else
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// A helper class to use a char_traits as a function object.
+template <class _Traits>
+struct _Not_within_traits : public unary_function<typename _Traits::char_type, bool> {
+ typedef typename _Traits::char_type _CharT;
+ const _CharT* _M_first;
+ const _CharT* _M_last;
+
+ _Not_within_traits(const _CharT* __f, const _CharT* __l)
+ : _M_first(__f), _M_last(__l) {}
+
+ bool operator()(const _CharT& __x) const {
+ return find_if(_M_first, _M_last,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__x)) == _M_last;
+ }
+};
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __true_type& /* _STLportTraits */)
+{ return __find_first_of(__first1, __last1, __first2, __last2); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __false_type& /* _STLportTraits */)
+{ return __find_first_of(__first1, __last1, __first2, __last2, _STLP_PRIV _Eq_traits<_Traits>()); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
+#else
+ enum { _Is = _IsSTLportClass<_Traits>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportTraits;
+#endif
+ return __str_find_first_of_aux(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
+}
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* /* __traits */, const __true_type& __useStrcspnLikeAlgo)
+{ return __find_first_of_aux2(__first1, __last1, __first2, __last2, __first2, not1(_Identity<bool>()), __useStrcspnLikeAlgo); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* /* __traits */, const __false_type& /* _UseStrcspnLikeAlgo */)
+{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
+
+template <class _InputIter, class _CharT, class _Tp, class _Traits>
+inline _InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Tp* __pt, _Traits* __traits) {
+ typedef typename _IsIntegral<_Tp>::_Ret _IsIntegral;
+ typedef typename _IsCharLikeType<_CharT>::_Ret _IsCharLike;
+ typedef typename _Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
+ return __str_find_first_not_of_aux3(__first1, __last1, __first2, __last2, __traits, _UseStrcspnLikeAlgo());
+}
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits, const __true_type& /* _STLportTraits */)
+{ return __str_find_first_not_of_aux2(__first1, __last1, __first2, __last2,
+ _STLP_VALUE_TYPE(__first1, _InputIter), __traits); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __false_type& /* _STLportTraits */)
+{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
+#else
+ enum { _Is = _IsSTLportClass<_Traits>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportTraits;
+#endif
+ return __str_find_first_not_of_aux1(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
+}
+
+// ------------------------------------------------------------
+// Non-inline declarations.
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+// Change the string's capacity so that it is large enough to hold
+// at least __res_arg elements, plus the terminating _CharT(). Note that,
+// if __res_arg < capacity(), this member function may actually decrease
+// the string's capacity.
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) {
+ if (__res_arg > max_size())
+ this->_M_throw_length_error();
+
+ size_type __n = (max)(__res_arg, size()) + 1;
+ if (__n < this->_M_capacity())
+ return;
+
+ _M_reserve(__n);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::_M_reserve(size_type __n) {
+ pointer __new_start = this->_M_start_of_storage.allocate(__n, __n);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __n);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) {
+ if (__n > 0) {
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ if (__n >= this->_M_rest())
+ _M_reserve(_M_compute_next_size(__n));
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
+ _M_construct_null(this->_M_finish + __n);
+ _Traits::assign(*end(), __c);
+ this->_M_finish += __n;
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>&
+basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, __last - __first);
+ if (__n >= this->_M_rest()) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ const _CharT* __f1 = __first;
+ ++__f1;
+ _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1);
+ _M_construct_null(this->_M_finish + __n);
+ _Traits::assign(*end(), *__first);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) {
+ if (__n <= size()) {
+ _Traits::assign(this->_M_Start(), __n, __c);
+ erase(begin() + __n, end());
+ }
+ else {
+ if (__n < capacity()) {
+ _Traits::assign(this->_M_Start(), size(), __c);
+ append(__n - size(), __c);
+ }
+ else {
+ _Self __str(__n, __c);
+ this->swap(__str);
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) {
+ ptrdiff_t __n = __l - __f;
+ if (__STATIC_CAST(size_type, __n) <= size()) {
+ _Traits::move(this->_M_Start(), __f, __n);
+ erase(begin() + __n, end());
+ }
+ else {
+ _Traits::move(this->_M_Start(), __f, size());
+ _M_append(__f + size(), __l);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+_CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p,
+ _CharT __c) {
+ pointer __new_pos = __p;
+ if (this->_M_rest() > 1 ) {
+ _M_construct_null(this->_M_finish + 1);
+ _Traits::move(__p + 1, __p, this->_M_finish - __p);
+ _Traits::assign(*__p, __c);
+ ++this->_M_finish;
+ }
+ else {
+ size_type __len = _M_compute_next_size(1);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start);
+ _Traits::assign(*__new_pos, __c);
+ pointer __new_finish = __new_pos + 1;
+ __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ return __new_pos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos,
+ size_t __n, _CharT __c) {
+ if (__n != 0) {
+ if (this->_M_rest() > __n) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+ _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _Traits::assign(__pos, __n, __c);
+ }
+ else {
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ _Traits::assign(__pos, __elems_after + 1, __c);
+ }
+ }
+ else {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
+ __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c);
+ __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos,
+ const _CharT* __first, const _CharT* __last,
+ bool __self_ref) {
+ //this version has to take care about the auto referencing
+ if (__first != __last) {
+ const size_t __n = __last - __first;
+ if (this->_M_rest() > __n) {
+ const size_t __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+ _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ if (!__self_ref || __last < __pos) {
+ _M_copy(__first, __last, __pos);
+ }
+ else {
+ //We have to check that the source buffer hasn't move
+ if (__first >= __pos) {
+ //The source buffer has move
+ __first += __n;
+ __last += __n;
+ _M_copy(__first, __last, __pos);
+ }
+ else {
+ //The source buffer hasn't move, it has been duplicated
+ _M_move(__first, __last, __pos);
+ }
+ }
+ }
+ else {
+ const_iterator __mid = __first;
+ __mid += __elems_after + 1;
+ _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ if (!__self_ref)
+ _M_copy(__first, __mid, __pos);
+ else
+ _M_move(__first, __mid, __pos);
+ }
+ }
+ else {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
+ __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
+ __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc> ::replace(iterator __first, iterator __last,
+ size_type __n, _CharT __c) {
+ size_type __len = (size_type)(__last - __first);
+
+ if (__len >= __n) {
+ _Traits::assign(__first, __n, __c);
+ erase(__first + __n, __last);
+ }
+ else {
+ _Traits::assign(__first, __len, __c);
+ insert(__last, __n - __len, __c);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc> ::_M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l,
+ bool __self_ref) {
+ const ptrdiff_t __n = __l - __f;
+ const difference_type __len = __last - __first;
+ if (__len >= __n) {
+ if (!__self_ref || __l < __first || __f >= __last)
+ _M_copy(__f, __l, __first);
+ else
+ _M_move(__f, __l, __first);
+ erase(__first + __n, __last);
+ } else if (!__self_ref || (__f >= __last) || (__l <= __first)) { // no overlap
+ const_iterator __m = __f + __len;
+ _M_copy(__f, __m, __first);
+ _M_insert(__last, __m, __l, __self_ref );
+ } else if (__f < __first) { // we have to take care of overlaping
+ const_iterator __m = __f + __len;
+ // We have to deal with possible reallocation because we do insert first.
+ const difference_type __off_dest = __first - this->begin();
+ const difference_type __off_src = __f - this->begin();
+ _M_insert(__last, __m, __l, true);
+ _Traits::move(begin() + __off_dest, begin() + __off_src, __len);
+ } else {
+ const_iterator __m = __f + __len;
+ _Traits::move(__first, __f, __len);
+ _M_insert(__last, __m, __l, true);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::find( const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_t __len = size();
+ if (__pos >= __len || __pos + __n > __len) {
+ if ( __n == 0 && __pos <= __len ) { // marginal case
+ return __pos;
+ }
+ return npos;
+ }
+
+ const_pointer __result =
+ _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(),
+ __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
+ return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::find(_CharT __c, size_type __pos) const
+{
+ if (__pos >= size()) { /*__pos + 1 > size()*/
+ return npos;
+ }
+
+ const_pointer __result =
+ _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__c));
+ return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_type __len = size();
+ if ( __len < __n ) {
+ return npos;
+ }
+ const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n;
+ if ( __n == 0 ) { // marginal case
+ return __last - this->_M_Start();
+ }
+ const_pointer __result = _STLP_STD::find_end(this->_M_Start(), __last,
+ __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
+ return __result != __last ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rresult =
+ _STLP_STD::find_if(const_reverse_iterator(__last), rend(),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__c));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_of(const _CharT* __s, size_type __pos,
+ size_type __n) const {
+ if (__pos >= size()) /*__pos + 1 > size()*/
+ return npos;
+ else {
+ const_iterator __result = _STLP_PRIV __str_find_first_of(begin() + __pos, end(),
+ __s, __s + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __result != end() ? __result - begin() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+ __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const const_reverse_iterator __rresult =
+ _STLP_PRIV __str_find_first_of(const_reverse_iterator(__last), rend(),
+ __s, __s + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const {
+ typedef typename _Traits::char_type _CharType;
+ if (__pos >= size()) /*__pos + 1 >= size()*/
+ return npos;
+ else {
+ const_pointer __result = _STLP_PRIV __str_find_first_not_of(this->_M_Start() + __pos, this->_M_Finish(),
+ __STATIC_CAST(const _CharType*, __s),
+ __STATIC_CAST(const _CharType*, __s) + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __result != this->_M_finish ? __result - this->_M_Start() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(_CharT __c, size_type __pos) const {
+ if (1 > size())
+ return npos;
+ else {
+ const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Neq_char_bound<_Traits>(__c));
+ return __result != this->_M_finish ? __result - this->_M_Start() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__
+basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+{
+ typedef typename _Traits::char_type _CharType;
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rlast = const_reverse_iterator(__last);
+ const_reverse_iterator __rresult =
+ _STLP_PRIV __str_find_first_not_of(__rlast, rend(),
+ __STATIC_CAST(const _CharType*, __s),
+ __STATIC_CAST(const _CharType*, __s) + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__
+basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __pos) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rlast = const_reverse_iterator(__last);
+ const_reverse_iterator __rresult =
+ _STLP_STD::find_if(__rlast, rend(),
+ _STLP_PRIV _Neq_char_bound<_Traits>(__c));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT* __buf, size_t __n) {
+ if (__n > 0) {
+ __n = (min) (__n - 1, __s.size());
+ _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf);
+ __buf[__n] = _CharT();
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// _String_base methods
+template <class _Tp, class _Alloc>
+void _String_base<_Tp,_Alloc>::_M_throw_length_error() const
+{ __stl_throw_length_error("basic_string"); }
+
+template <class _Tp, class _Alloc>
+void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const
+{ __stl_throw_out_of_range("basic_string"); }
+
+template <class _Tp, class _Alloc>
+void _String_base<_Tp, _Alloc>::_M_allocate_block(size_t __n) {
+ if ((__n <= (max_size() + 1)) && (__n > 0)) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (__n > _DEFAULT_SIZE) {
+ this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start_of_storage._M_data;
+ this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data + __n;
+ }
+#else
+ this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start_of_storage._M_data;
+ this->_M_end_of_storage = this->_M_start_of_storage._M_data + __n;
+#endif
+ } else {
+ this->_M_throw_length_error();
+ }
+}
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + traits_type::length(__s));
+}
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s,
+ const allocator_type& __a)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const basic_string<_CharT, _Traits, _Alloc> & __s)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator())
+{ _M_range_initialize(__s._M_Start(), __s._M_Finish()); }
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __size_type__
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# undef size_type
+# undef iterator
+#endif
+
+#endif /* _STLP_STRING_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_string.h b/build/stlport/stlport/stl/_string.h
new file mode 100644
index 000000000..540822b3c
--- /dev/null
+++ b/build/stlport/stlport/stl/_string.h
@@ -0,0 +1,1182 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_STRING_H
+#define _STLP_INTERNAL_STRING_H
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+# include <stl/_string_sum.h>
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+#if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE)
+
+// MSL implementation classes expect to see the definition of streampos
+// when this header is included. We expect this to be fixed in later MSL
+// implementations
+# if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105
+# include <stl/msl_string.h>
+# endif
+#endif // __MWERKS__
+
+/*
+ * Standard C++ string class. This class has performance
+ * characteristics very much like vector<>, meaning, for example, that
+ * it does not perform reference-count or copy-on-write, and that
+ * concatenation of two strings is an O(N) operation.
+
+ * There are three reasons why basic_string is not identical to
+ * vector.
+ * First, basic_string always stores a null character at the end;
+ * this makes it possible for c_str to be a fast operation.
+ * Second, the C++ standard requires basic_string to copy elements
+ * using char_traits<>::assign, char_traits<>::copy, and
+ * char_traits<>::move. This means that all of vector<>'s low-level
+ * operations must be rewritten. Third, basic_string<> has a lot of
+ * extra functions in its interface that are convenient but, strictly
+ * speaking, redundant.
+ */
+
+#include <stl/_string_base.h>
+
+_STLP_BEGIN_NAMESPACE
+
+// ------------------------------------------------------------
+// Class basic_string.
+
+// Class invariants:
+// (1) [start, finish) is a valid range.
+// (2) Each iterator in [start, finish) points to a valid object
+// of type value_type.
+// (3) *finish is a valid object of type value_type; when
+// value_type is not a POD it is value_type().
+// (4) [finish + 1, end_of_storage) is a valid range.
+// (5) Each iterator in [finish + 1, end_of_storage) points to
+// unininitialized memory.
+
+// Note one important consequence: a string of length n must manage
+// a block of memory whose size is at least n + 1.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+struct _String_reserve_t {};
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+#elif defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+#endif
+
+#if defined (basic_string)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#if defined (__DMC__)
+# define _STLP_PRIVATE public
+#elif defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_PRIVATE protected
+#else
+# define _STLP_PRIVATE private
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : _STLP_PRIVATE _STLP_PRIV _String_base<_CharT,_Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+_STLP_PRIVATE: // Private members inherited from base.
+ typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+
+public:
+ typedef _CharT value_type;
+ typedef _Traits traits_type;
+
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename _Base::size_type size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ typedef const value_type* const_iterator;
+ typedef value_type* iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+#include <stl/_string_npos.h>
+
+ typedef _STLP_PRIV _String_reserve_t _Reserve_t;
+
+public: // Constructor, destructor, assignment.
+ typedef typename _Base::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_start_of_storage, _CharT); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit basic_string(const allocator_type& __a = allocator_type())
+#else
+ basic_string()
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), _Base::_DEFAULT_SIZE)
+ { _M_terminate_string(); }
+ explicit basic_string(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, _Base::_DEFAULT_SIZE)
+ { _M_terminate_string(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(_Reserve_t, size_t __n,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(_Reserve_t, size_t __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1)
+ { _M_terminate_string(); }
+ basic_string(_Reserve_t, size_t __n, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1)
+ { _M_terminate_string(); }
+
+ basic_string(const _Self&);
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(const _Self& __s, size_type __pos)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos, __s._M_Finish());
+ }
+ basic_string(const _Self& __s, size_type __pos, size_type __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+ basic_string(const _Self& __s, size_type __pos, size_type __n,
+ const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(const _CharT* __s, size_type __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + __n);
+ }
+ basic_string(const _CharT* __s, size_type __n, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + __n);
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type());
+#else
+ basic_string(const _CharT* __s);
+ basic_string(const _CharT* __s, const allocator_type& __a);
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(size_type __n, _CharT __c)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+ basic_string(size_type __n, _CharT __c, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# endif
+#else
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ basic_string(const _CharT* __f, const _CharT* __l,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_range_initialize(__f, __l);
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ basic_string(const _CharT* __f, const _CharT* __l)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_range_initialize(__f, __l);
+ }
+# endif
+# endif
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ /* We need an additionnal constructor to build an empty string without
+ * any allocation or termination char*/
+protected:
+ struct _CalledFromWorkaround_t {};
+ basic_string(_CalledFromWorkaround_t, const allocator_type &__a)
+ : _String_base<_CharT,_Alloc>(__a) {}
+# endif
+#endif
+
+_STLP_PRIVATE:
+ size_type _M_compute_next_size(size_type __n) {
+ const size_type __size = size();
+ if (__n > max_size() - __size)
+ this->_M_throw_length_error();
+ size_type __len = __size + (max)(__n, __size) + 1;
+ if (__len > max_size() || __len < __size)
+ __len = max_size(); // overflow
+ return __len;
+ }
+
+ template <class _InputIter>
+ void _M_range_initialize(_InputIter __f, _InputIter __l,
+ const input_iterator_tag &__tag) {
+ this->_M_allocate_block();
+ _M_construct_null(this->_M_Finish());
+ _M_appendT(__f, __l, __tag);
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = _STLP_STD::distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_range_initializeT(_InputIter __f, _InputIter __l) {
+ _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __x);
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ _M_range_initializeT(__f, __l);
+ }
+
+public:
+ _Self& operator=(const _Self& __s) {
+ if (&__s != this)
+ _M_assign(__s._M_Start(), __s._M_Finish());
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_assign(__s, __s + traits_type::length(__s));
+ }
+
+ _Self& operator=(_CharT __c)
+ { return assign(__STATIC_CAST(size_type,1), __c); }
+
+private:
+ static _CharT _STLP_CALL _M_null()
+ { return _STLP_DEFAULT_CONSTRUCTED(_CharT); }
+
+_STLP_PRIVATE: // Helper functions used by constructors
+ // and elsewhere.
+ void _M_construct_null(_CharT* __p) const
+ { _STLP_STD::_Construct(__p); }
+ void _M_terminate_string()
+ { _M_construct_null(this->_M_Finish()); }
+ bool _M_inside(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return (__s >= this->_M_Start()) && (__s < this->_M_Finish());
+ }
+
+ void _M_range_initialize(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ ptrdiff_t __n = __l - __f;
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ _M_terminate_string();
+ }
+
+public: // Iterators.
+ iterator begin() { return this->_M_Start(); }
+ iterator end() { return this->_M_Finish(); }
+ const_iterator begin() const { return this->_M_Start(); }
+ const_iterator end() const { return this->_M_Finish(); }
+
+ reverse_iterator rbegin()
+ { return reverse_iterator(this->_M_Finish()); }
+ reverse_iterator rend()
+ { return reverse_iterator(this->_M_Start()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(this->_M_Finish()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(this->_M_Start()); }
+
+public: // Size, capacity, etc.
+ size_type size() const { return this->_M_Finish() - this->_M_Start(); }
+ size_type length() const { return size(); }
+ size_type max_size() const { return _Base::max_size(); }
+
+ void resize(size_type __n, _CharT __c) {
+ if (__n <= size())
+ erase(begin() + __n, end());
+ else
+ append(__n - size(), __c);
+ }
+
+ void resize(size_type __n) { resize(__n, _M_null()); }
+
+private:
+ void _M_reserve(size_type);
+public:
+ void reserve(size_type = 0);
+
+ size_type capacity() const
+ { return this->_M_capacity() - 1; }
+
+ void clear() {
+ if (!empty()) {
+ _Traits::assign(*(this->_M_Start()), _M_null());
+ this->_M_finish = this->_M_Start();
+ }
+ }
+
+ bool empty() const { return this->_M_Start() == this->_M_Finish(); }
+
+public: // Element access.
+
+ const_reference operator[](size_type __n) const
+ { return *(this->_M_Start() + __n); }
+ reference operator[](size_type __n)
+ { return *(this->_M_Start() + __n); }
+
+ const_reference at(size_type __n) const {
+ if (__n >= size())
+ this->_M_throw_out_of_range();
+ return *(this->_M_Start() + __n);
+ }
+
+ reference at(size_type __n) {
+ if (__n >= size())
+ this->_M_throw_out_of_range();
+ return *(this->_M_Start() + __n);
+ }
+
+public: // Append, operator+=, push_back.
+
+ _Self& operator+=(const _Self& __s) { return append(__s); }
+ _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); }
+ _Self& operator+=(_CharT __c) { push_back(__c); return *this; }
+
+private:
+ _Self& _M_append(const _CharT* __first, const _CharT* __last);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _InputIter>
+ _Self& _M_appendT(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last ; ++__first)
+ push_back(*__first);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n >= this->_M_rest()) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _Traits::assign(*this->_M_finish, *__first++);
+ uninitialized_copy(__first, __last, this->_M_Finish() + 1);
+ _M_construct_null(this->_M_Finish() + __n);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
+ { return append((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
+ { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_append_dispatch(__first, __last, _Integral());
+ }
+#else
+public:
+ _Self& append(const _CharT* __first, const _CharT* __last) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_append(__first, __last);
+ }
+#endif
+
+public:
+ _Self& append(const _Self& __s)
+ { return _M_append(__s._M_Start(), __s._M_Finish()); }
+
+ _Self& append(const _Self& __s,
+ size_type __pos, size_type __n) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_append(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+ _Self& append(const _CharT* __s, size_type __n)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s+__n); }
+ _Self& append(const _CharT* __s)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s + traits_type::length(__s)); }
+ _Self& append(size_type __n, _CharT __c);
+
+public:
+ void push_back(_CharT __c) {
+ if (this->_M_rest() == 1 )
+ _M_reserve(_M_compute_next_size(1));
+ _M_construct_null(this->_M_Finish() + 1);
+ _Traits::assign(*(this->_M_Finish()), __c);
+ ++this->_M_finish;
+ }
+
+ void pop_back() {
+ _Traits::assign(*(this->_M_Finish() - 1), _M_null());
+ --this->_M_finish;
+ }
+
+public: // Assign
+ _Self& assign(const _Self& __s)
+ { return _M_assign(__s._M_Start(), __s._M_Finish()); }
+
+ _Self& assign(const _Self& __s,
+ size_type __pos, size_type __n) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_assign(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + __n); }
+
+ _Self& assign(const _CharT* __s)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + _Traits::length(__s)); }
+
+ _Self& assign(size_type __n, _CharT __c);
+
+private:
+ _Self& _M_assign(const _CharT* __f, const _CharT* __l);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ // Helper functions for assign.
+ template <class _Integer>
+ _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
+ { return assign((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ pointer __cur = this->_M_Start();
+ while (__f != __l && __cur != this->_M_Finish()) {
+ _Traits::assign(*__cur, *__f);
+ ++__f;
+ ++__cur;
+ }
+ if (__f == __l)
+ erase(__cur, this->end());
+ else
+ _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ return *this;
+ }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& assign(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_assign_dispatch(__first, __last, _Integral());
+ }
+#else
+public:
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_assign(__f, __l);
+ }
+#endif
+
+public: // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__s.size() > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s == this);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ if (__pos > size() || __beg > __s.size())
+ this->_M_throw_out_of_range();
+ size_type __len = (min) (__n, __s.size() - __beg);
+ if (__len > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos,
+ __s._M_Start() + __beg, __s._M_Start() + __beg + __len, &__s == this);
+ return *this;
+ }
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos, __s, __s + __n, _M_inside(__s));
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ size_type __len = _Traits::length(__s);
+ if (__len > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(this->_M_Start() + __pos, __s, __s + __len, _M_inside(__s));
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ insert(begin() + __pos, __n, __c);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ if (__p == end()) {
+ push_back(__c);
+ return this->_M_Finish() - 1;
+ }
+ else
+ return _M_insert_aux(__p, __c);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c);
+
+_STLP_PRIVATE: // Helper functions for insert.
+ void _M_insert(iterator __p, const _CharT* __first, const _CharT* __last, bool __self_ref);
+
+ pointer _M_insert_aux(pointer, _CharT);
+
+ void _M_copy(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_FIX_LITERAL_BUG(__res)
+ _Traits::copy(__res, __f, __l - __f);
+ }
+
+ void _M_move(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _Traits::move(__res, __f, __l - __f);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _ForwardIter>
+ void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ size_type __n) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+
+ template <class _InputIter>
+ void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __p = insert(__p, *__first);
+ ++__p;
+ }
+ }
+
+ template <class _ForwardIter>
+ void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (__n < this->_M_rest()) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ if (__elems_after >= __n) {
+ uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _M_copyT(__first, __last, __pos);
+ }
+ else {
+ pointer __old_finish = this->_M_Finish();
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after + 1);
+ _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ _M_copyT(__first, __mid, __pos);
+ }
+ }
+ else {
+ _M_insert_overflow(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
+ const __true_type& /*Integral*/)
+ { insert(__p, (size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*Integral*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__first, __last, get_allocator());
+ _M_insertT(__p, __self.begin(), __self.end(), forward_iterator_tag());
+ }
+
+ template <class _InputIterator>
+ void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
+ _STLP_FIX_LITERAL_BUG(__result)
+ for ( ; __first != __last; ++__first, ++__result)
+ _Traits::assign(*__result, *__first);
+ }
+
+# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_FIX_LITERAL_BUG(__res)
+ _Traits::copy(__res, __f, __l - __f);
+ }
+# endif
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_insert_dispatch(__p, __first, __last, _Integral());
+ }
+# endif
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_insert(__p, __f, __l, _M_inside(__f));
+ }
+#endif
+
+public: // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos));
+ return *this;
+ }
+
+ iterator erase(iterator __pos) {
+ // The move includes the terminating _CharT().
+ _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos);
+ --this->_M_finish;
+ return __pos;
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ if (__first != __last) {
+ // The move includes the terminating _CharT().
+ traits_type::move(__first, __last, (this->_M_Finish() - __last) + 1);
+ this->_M_finish = this->_M_Finish() - (__last - __first);
+ }
+ return __first;
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, __size - __pos);
+ if (__s.size() > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s._M_Start(), __s._M_Finish(), &__s == this);
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ const size_type __size1 = size();
+ const size_type __size2 = __s.size();
+ if (__pos1 > __size1 || __pos2 > __size2)
+ this->_M_throw_out_of_range();
+ const size_type __len1 = (min) (__n1, __size1 - __pos1);
+ const size_type __len2 = (min) (__n2, __size2 - __pos2);
+ if (__len2 > max_size() - (__size1 - __len1))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos1, begin() + __pos1 + __len1,
+ __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s == this);
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, __size - __pos);
+ if (__n2 > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s, __s + __n2, _M_inside(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return replace(__pos, __n1, __s, _Traits::length(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, __size - __pos);
+ if (__n2 > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return replace(begin() + __pos, begin() + __pos + __len, __n2, __c);
+ }
+
+ _Self& replace(iterator __first, iterator __last, const _Self& __s) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_replace(__first, __last, __s._M_Start(), __s._M_Finish(), &__s == this);
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_replace(__first, __last, __s, __s + __n, _M_inside(__s));
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_replace(__first, __last, __s, __s + _Traits::length(__s), _M_inside(__s));
+ }
+
+ _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c);
+
+_STLP_PRIVATE: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Integer>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return replace(__first, __last, (size_type) __n, (_CharT) __x);
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__f, __l, get_allocator());
+ return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false);
+ }
+
+public:
+ // Check to see if _InputIter is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_replace(__first, __last, __f, __l, _M_inside(__f));
+ }
+#endif
+
+public: // Other modifier member functions.
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, size() - __pos);
+ _Traits::copy(__s, this->_M_Start() + __pos, __len);
+ return __len;
+ }
+
+ void swap(_Self& __s) { this->_M_swap(__s); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public: // Conversion to C string.
+
+ const _CharT* c_str() const { return this->_M_Start(); }
+ const _CharT* data() const { return this->_M_Start(); }
+
+public: // find.
+ size_type find(const _Self& __s, size_type __pos = 0) const
+ { return find(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find(__s, __pos, _Traits::length(__s)); }
+
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ // WIE: Versant schema compiler 5.2.2 ICE workaround
+ size_type find(_CharT __c) const { return find(__c, 0); }
+ size_type find(_CharT __c, size_type __pos /* = 0 */) const;
+
+public: // rfind.
+ size_type rfind(const _Self& __s, size_type __pos = npos) const
+ { return rfind(__s._M_Start(), __pos, __s.size()); }
+
+ size_type rfind(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return rfind(__s, __pos, _Traits::length(__s)); }
+
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const;
+ size_type rfind(_CharT __c, size_type __pos = npos) const;
+
+public: // find_first_of
+ size_type find_first_of(const _Self& __s, size_type __pos = 0) const
+ { return find_first_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_first_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return find(__c, __pos); }
+
+public: // find_last_of
+ size_type find_last_of(const _Self& __s, size_type __pos = npos) const
+ { return find_last_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_last_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_last_of(_CharT __c, size_type __pos = npos) const
+ { return rfind(__c, __pos); }
+
+public: // find_first_not_of
+ size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
+ { return find_first_not_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const;
+
+public: // find_last_not_of
+ size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
+ { return find_last_not_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const;
+
+public: // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _Self(*this, __pos, __n, get_allocator()); }
+
+public: // Compare
+ int compare(const _Self& __s) const
+ { return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); }
+
+ int compare(size_type __pos1, size_type __n1, const _Self& __s) const {
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s._M_Start(), __s._M_Finish());
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) const {
+ if (__pos1 > size() || __pos2 > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s._M_Start() + __pos2,
+ __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2));
+ }
+
+ int compare(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_compare(this->_M_Start(), this->_M_Finish(), __s, __s + _Traits::length(__s));
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s, __s + _Traits::length(__s));
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s, __s + __n2);
+ }
+
+public: // Helper functions for compare.
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const _CharT* __f2, const _CharT* __l2) {
+ const ptrdiff_t __n1 = __l1 - __f1;
+ const ptrdiff_t __n2 = __l2 - __f2;
+ const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2));
+ return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));
+ }
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1)
+# include <stl/_string_sum_methods.h>
+# undef _STLP_STRING_SUM_BASE
+#endif
+};
+
+#undef _STLP_PRIVATE
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# include <stl/_string_workaround.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ------------------------------------------------------------
+// Non-member functions.
+// Swap.
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _CharT, class _Traits, class _Alloc>
+inline void _STLP_CALL
+swap(basic_string<_CharT,_Traits,_Alloc>& __x,
+ basic_string<_CharT,_Traits,_Alloc>& __y)
+{ __x.swap(__y); }
+#else
+inline void _STLP_CALL swap(string& __x, string& __y)
+{ __x.swap(__y); }
+# if defined (_STLP_HAS_WCHAR_T)
+inline void _STLP_CALL swap(wstring& __x, wstring& __y)
+{ __x.swap(__y); }
+# endif
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _CharT, class _Traits, class _Alloc>
+struct __move_traits<basic_string<_CharT, _Traits, _Alloc> > {
+ typedef __true_type implemented;
+ //Completness depends on the allocator:
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+/*#else
+ * There is no need to specialize for string and wstring in this case
+ * as the default __move_traits will already tell that string is movable
+ * but not complete. We cannot define it as complete as nothing guaranty
+ * that the STLport user hasn't specialized std::allocator for char or
+ * wchar_t.
+ */
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT* __buf, size_t __n);
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+// A couple of functions to transfer between ASCII/Unicode
+wstring __ASCIIToWide(const char *ascii);
+string __WideToASCII(const wchar_t *wide);
+#endif
+
+inline const char* _STLP_CALL
+__get_c_string(const string& __str) { return __str.c_str(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#include <stl/_string_operators.h>
+
+#if defined(_STLP_USE_NO_IOSTREAMS) || \
+ (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION))
+# include <stl/_string.c>
+#endif
+
+#endif /* _STLP_INTERNAL_STRING_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/build/stlport/stlport/stl/_string_base.h b/build/stlport/stlport/stl/_string_base.h
new file mode 100644
index 000000000..7c6d7fe69
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_base.h
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_BASE_H
+#define _STLP_STRING_BASE_H
+
+// ------------------------------------------------------------
+// Class _String_base.
+
+// _String_base is a helper class that makes it it easier to write an
+// exception-safe version of basic_string. The constructor allocates,
+// but does not initialize, a block of memory. The destructor
+// deallocates, but does not destroy elements within, a block of
+// memory. The destructor assumes that _M_start either is null, or else
+// points to a block of memory that was allocated using _String_base's
+// allocator and whose size is _M_end_of_storage - _M_start_of_storage._M_data.
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+class _String_base {
+ typedef _String_base<_Tp, _Alloc> _Self;
+protected:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+public:
+ //dums: Some compiler(MSVC6) require it to be public not simply protected!
+ enum {_DEFAULT_SIZE = 4 * sizeof( void * )};
+ //This is needed by the full move framework
+ typedef _Alloc allocator_type;
+ typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _AllocProxy;
+ typedef size_t size_type;
+private:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ union _Buffers {
+ _Tp* _M_end_of_storage;
+ _Tp _M_static_buf[_DEFAULT_SIZE];
+ } _M_buffers;
+#else
+ _Tp* _M_end_of_storage;
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+protected:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ bool _M_using_static_buf() const
+ { return (_M_start_of_storage._M_data == _M_buffers._M_static_buf); }
+ _Tp const* _M_Start() const { return _M_start_of_storage._M_data; }
+ _Tp* _M_Start() { return _M_start_of_storage._M_data; }
+ _Tp const* _M_End() const
+ { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; }
+ _Tp* _M_End()
+ { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; }
+ size_type _M_capacity() const
+ { return _M_using_static_buf() ? _DEFAULT_SIZE : _M_buffers._M_end_of_storage - _M_start_of_storage._M_data; }
+ size_type _M_rest() const
+ { return _M_using_static_buf() ? _DEFAULT_SIZE - (_M_finish - _M_buffers._M_static_buf) : _M_buffers._M_end_of_storage - _M_finish; }
+#else
+ _Tp const* _M_Start() const { return _M_start_of_storage._M_data; }
+ _Tp* _M_Start() { return _M_start_of_storage._M_data; }
+ _Tp const* _M_End() const { return _M_end_of_storage; }
+ _Tp* _M_End() { return _M_end_of_storage; }
+ size_type _M_capacity() const
+ { return _M_end_of_storage - _M_start_of_storage._M_data; }
+ size_type _M_rest() const
+ { return _M_end_of_storage - _M_finish; }
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+
+ _Tp* _M_finish;
+ _AllocProxy _M_start_of_storage;
+
+ _Tp const* _M_Finish() const {return _M_finish;}
+ _Tp* _M_Finish() {return _M_finish;}
+
+ // Precondition: 0 < __n <= max_size().
+ void _M_allocate_block(size_t __n = _DEFAULT_SIZE);
+ void _M_deallocate_block() {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (!_M_using_static_buf() && (_M_start_of_storage._M_data != 0))
+ _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_buffers._M_end_of_storage - _M_start_of_storage._M_data);
+#else
+ if (_M_start_of_storage._M_data != 0)
+ _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_end_of_storage - _M_start_of_storage._M_data);
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ }
+
+ size_t max_size() const {
+ const size_type __string_max_size = size_type(-1) / sizeof(_Tp);
+ typename allocator_type::size_type __alloc_max_size = _M_start_of_storage.max_size();
+ return (min)(__alloc_max_size, __string_max_size) - 1;
+ }
+
+ _String_base(const allocator_type& __a)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf)
+#else
+ : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0)
+#endif
+ {}
+
+ _String_base(const allocator_type& __a, size_t __n)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf) {
+#else
+ : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0) {
+#endif
+ _M_allocate_block(__n);
+ }
+
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ void _M_move_src (_Self &src) {
+ if (src._M_using_static_buf()) {
+ _M_buffers = src._M_buffers;
+ _M_finish = _M_buffers._M_static_buf + (src._M_finish - src._M_start_of_storage._M_data);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ }
+ else {
+ _M_start_of_storage._M_data = src._M_start_of_storage._M_data;
+ _M_finish = src._M_finish;
+ _M_buffers._M_end_of_storage = src._M_buffers._M_end_of_storage;
+ src._M_start_of_storage._M_data = 0;
+ }
+ }
+#endif
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _String_base(__move_source<_Self> src)
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
+ _M_move_src(src.get());
+# else
+ : _M_end_of_storage(src.get()._M_end_of_storage), _M_finish(src.get()._M_finish),
+ _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
+ src.get()._M_start_of_storage._M_data = 0;
+# endif
+ }
+#endif
+
+ ~_String_base() { _M_deallocate_block(); }
+
+ void _M_reset(_Tp *__start, _Tp *__finish, _Tp *__end_of_storage) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ _M_buffers._M_end_of_storage = __end_of_storage;
+#else
+ _M_end_of_storage = __end_of_storage;
+#endif
+ _M_finish = __finish;
+ _M_start_of_storage._M_data = __start;
+ }
+
+ void _M_swap(_Self &__s) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (_M_using_static_buf()) {
+ if (__s._M_using_static_buf()) {
+ _STLP_STD::swap(_M_buffers, __s._M_buffers);
+ _Tp *__tmp = _M_finish;
+ _M_finish = _M_start_of_storage._M_data + (__s._M_finish - __s._M_start_of_storage._M_data);
+ __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_start_of_storage._M_data);
+ //We need to swap _M_start_of_storage for allocators with state:
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ __s._M_start_of_storage._M_data = __s._M_buffers._M_static_buf;
+ } else {
+ __s._M_swap(*this);
+ return;
+ }
+ }
+ else if (__s._M_using_static_buf()) {
+ _Tp *__tmp = _M_start_of_storage._M_data;
+ _Tp *__tmp_finish = _M_finish;
+ _Tp *__tmp_end_data = _M_buffers._M_end_of_storage;
+ _M_buffers = __s._M_buffers;
+ //We need to swap _M_start_of_storage for allocators with state:
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
+ __s._M_buffers._M_end_of_storage = __tmp_end_data;
+ __s._M_start_of_storage._M_data = __tmp;
+ __s._M_finish = __tmp_finish;
+ }
+ else {
+ _STLP_STD::swap(_M_buffers._M_end_of_storage, __s._M_buffers._M_end_of_storage);
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+ }
+#else
+ _STLP_STD::swap(_M_end_of_storage, __s._M_end_of_storage);
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+#endif
+ }
+
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _String_base<char, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _String_base<wchar_t, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_BASE_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/build/stlport/stlport/stl/_string_fwd.h b/build/stlport/stlport/stl/_string_fwd.h
new file mode 100644
index 000000000..fe65385e6
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_fwd.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_FWD_H
+#define _STLP_STRING_FWD_H
+
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT,
+ class _Traits = char_traits<_CharT>,
+ class _Alloc = allocator<_CharT> >
+class basic_string;
+#else
+template <class _CharT,
+ class _Traits,
+ class _Alloc>
+class basic_string;
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+typedef basic_string<char, char_traits<char>, allocator<char> > string;
+
+#if defined (_STLP_HAS_WCHAR_T)
+typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//This function limits header dependency between exception and string
+//implementation. It is implemented in _string.h
+const char* _STLP_CALL __get_c_string(const string& __str);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_FWD_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_string_hash.h b/build/stlport/stlport/stl/_string_hash.h
new file mode 100644
index 000000000..87f2d9fbe
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_hash.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_HASH_H
+#define _STLP_STRING_HASH_H
+
+#ifndef _STLP_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+_STLP_INLINE_LOOP size_t
+__stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) {
+ unsigned long __h = 0;
+ size_t __len = __s.size();
+ const _CharT* __data = __s.data();
+ for ( size_t __i = 0; __i < __len; ++__i)
+ __h = /* 5 *__h */(__h << 2) + __h + __data[__i];
+ return size_t(__h);
+}
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
+ (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x560))
+template <class _CharT, class _Traits, class _Alloc>
+struct hash<basic_string<_CharT,_Traits,_Alloc> > {
+ size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const
+ { return __stl_string_hash(__s); }
+};
+
+#else
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC hash<string> {
+ size_t operator()(const string& __s) const
+ { return __stl_string_hash(__s); }
+};
+
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC hash<wstring> {
+ size_t operator()(const wstring& __s) const
+ { return __stl_string_hash(__s); }
+};
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/build/stlport/stlport/stl/_string_io.c b/build/stlport/stlport/stl/_string_io.c
new file mode 100644
index 000000000..84b18736b
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_io.c
@@ -0,0 +1,172 @@
+#ifndef _STLP_STRING_IO_C
+#define _STLP_STRING_IO_C
+
+#ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits>
+bool _STLP_CALL
+__stlp_string_fill(basic_ostream<_CharT, _Traits>& __os,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize __n) {
+ _CharT __f = __os.fill();
+ for (streamsize __i = 0; __i < __n; ++__i) {
+ if (_Traits::eq_int_type(__buf->sputc(__f), _Traits::eof()))
+ return false;
+ }
+ return true;
+}
+
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator << (basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT,_Traits,_Alloc>& __s) {
+ typedef basic_ostream<_CharT, _Traits> __ostream;
+ typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type;
+
+ // The hypothesis of this implementation is that size_type is unsigned:
+ _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0)
+
+ typename __ostream::sentry __sentry(__os);
+ bool __ok = false;
+
+ if (__sentry) {
+ __ok = true;
+ size_type __n = __s.size();
+ const bool __left = (__os.flags() & __ostream::left) != 0;
+ const streamsize __w = __os.width(0);
+ basic_streambuf<_CharT, _Traits>* __buf = __os.rdbuf();
+
+ const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __n) < __w)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__n < __STATIC_CAST(size_t, __w))));
+ streamsize __pad_len = __need_pad ? __w - __n : 0;
+
+ if (!__left)
+ __ok = __stlp_string_fill(__os, __buf, __pad_len);
+
+ __ok = __ok && (__buf->sputn(__s.data(), streamsize(__n)) == streamsize(__n));
+
+ if (__left)
+ __ok = __ok && __stlp_string_fill(__os, __buf, __pad_len);
+ }
+
+ if (!__ok)
+ __os.setstate(__ostream::failbit);
+
+ return __os;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator >> (basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits, _Alloc>& __s) {
+ typedef basic_istream<_CharT, _Traits> __istream;
+ typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type;
+
+ // The hypothesis of this implementation is that size_type is unsigned:
+ _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0)
+
+ typename __istream::sentry __sentry(__is);
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ typedef ctype<_CharT> _C_type;
+
+ const locale& __loc = __is.getloc();
+ const _C_type& _Ctype = use_facet<_C_type>(__loc);
+ __s.clear();
+ streamsize __width = __is.width(0);
+ size_type __n;
+ if (__width <= 0)
+ __n = __s.max_size();
+ /* __width can only overflow size_type if sizeof(streamsize) > sizeof(size_type)
+ * because here we know that __width is positive and the stattic assertion check
+ * that size_type is unsigned.
+ */
+ else if (sizeof(streamsize) > sizeof(size_type) &&
+ (__width > __STATIC_CAST(streamsize, __s.max_size())))
+ __n = 0;
+ else {
+ __n = __STATIC_CAST(size_type, __width);
+ __s.reserve(__n);
+ }
+
+ while (__n-- > 0) {
+ typename _Traits::int_type __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, _Traits::eof())) {
+ __is.setstate(__istream::eofbit);
+ break;
+ }
+ else {
+ _CharT __c = _Traits::to_char_type(__c1);
+
+ if (_Ctype.is(_C_type::space, __c)) {
+ if (_Traits::eq_int_type(__buf->sputbackc(__c), _Traits::eof()))
+ __is.setstate(__istream::failbit);
+ break;
+ }
+ else
+ __s.push_back(__c);
+ }
+ }
+
+ // If we have read no characters, then set failbit.
+ if (__s.empty())
+ __is.setstate(__istream::failbit);
+ }
+ else
+ __is.setstate(__istream::failbit);
+
+ return __is;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT __delim) {
+ typedef basic_istream<_CharT, _Traits> __istream;
+ typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type;
+ size_type __nread = 0;
+ typename basic_istream<_CharT, _Traits>::sentry __sentry(__is, true);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
+ __s.clear();
+
+ while (__nread < __s.max_size()) {
+ int __c1 = __buf->sbumpc();
+ if (_Traits::eq_int_type(__c1, _Traits::eof())) {
+ __is.setstate(__istream::eofbit);
+ break;
+ }
+ else {
+ ++__nread;
+ _CharT __c = _Traits::to_char_type(__c1);
+ if (!_Traits::eq(__c, __delim))
+ __s.push_back(__c);
+ else
+ break; // Character is extracted but not appended.
+ }
+ }
+ }
+ if (__nread == 0 || __nread >= __s.max_size())
+ __is.setstate(__istream::failbit);
+
+ return __is;
+}
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_string_io.h b/build/stlport/stlport/stl/_string_io.h
new file mode 100644
index 000000000..fe549fef6
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_io.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_IO_H
+#define _STLP_STRING_IO_H
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+// I/O.
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT,_Traits,_Alloc>& __s);
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __sum) {
+ basic_string<_CharT, _Traits, _Alloc> __tmp(__sum);
+ return __os << __tmp;
+}
+
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s);
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT __delim);
+
+#if !(defined (__BORLANDC__) && !defined (_STLP_USE_OWN_NAMESPACE))
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT,_Traits,_Alloc>& __s) {
+ return getline(__is, __s, __is.widen('\n'));
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_string_io.c>
+#endif
+
+#endif /* _STLP_STRING_IO_H */
diff --git a/build/stlport/stlport/stl/_string_npos.h b/build/stlport/stlport/stl/_string_npos.h
new file mode 100644
index 000000000..faa9c6272
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_npos.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* This header contains npos definition used in basic_string and rope
+ * implementation. It do not have to be guarded as files including it
+ * are already guarded and it has sometimes to be included several times.
+ */
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+ enum { npos = -1 };
+#elif defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+ // inline initializer conflicts with 'extern template'
+ static const size_t npos;
+#else
+ static const size_t npos = ~(size_t)0;
+#endif
diff --git a/build/stlport/stlport/stl/_string_operators.h b/build/stlport/stlport/stl/_string_operators.h
new file mode 100644
index 000000000..cff13af01
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_operators.h
@@ -0,0 +1,602 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_OPERATORS_H
+#define _STLP_STRING_OPERATORS_H
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_USE_TEMPLATE_EXPRESSION)
+
+# if defined (__GNUC__) || defined (__MLCCPP__)
+# define _STLP_INIT_AMBIGUITY 1
+# endif
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+# if defined (_STLP_INIT_AMBIGUITY)
+ // gcc counts this as a function
+ _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator());
+# endif
+ __result.append(__s);
+ __result.append(__y);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+ const size_t __n = _Traits::length(__s);
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator());
+# endif
+ __result.append(__s, __s + __n);
+ __result.append(__y);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(_CharT __c,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
+# else
+ _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator());
+# endif
+ __result.push_back(__c);
+ __result.append(__y);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+ const size_t __n = _Traits::length(__s);
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator());
+# endif
+ __result.append(__x);
+ __result.append(__s, __s + __n);
+ return __result;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT __c) {
+ typedef basic_string<_CharT,_Traits,_Alloc> _Str;
+ typedef typename _Str::_Reserve_t _Reserve_t;
+# if defined (_STLP_INIT_AMBIGUITY)
+ _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator());
+# else
+ _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator());
+# endif
+ __result.append(__x);
+ __result.push_back(__c);
+ return __result;
+}
+
+# undef _STLP_INIT_AMBIGUITY
+
+#else /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+// addition with basic_string
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ __root_type,
+ _STLP_PRIV __on_right>(__lhs, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs,
+ const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right>(__lhs, __rhs);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __on_left> _STLP_CALL
+operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __on_left>(__lhs, __rhs);
+}
+
+// addition with C string
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ const size_t __n = _Traits::length(__s);
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ __root_type, _STLP_PRIV __on_right>(__x, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ const size_t __n = _Traits::length(__s);
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
+ __root_type,
+ _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __on_left> _STLP_CALL
+operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x,
+ const _CharT* __s) {
+ const size_t __n = _Traits::length(__s);
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n));
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) {
+ const size_t __n = _Traits::length(__s);
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y);
+}
+
+// addition with char
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) {
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ __root_type, _STLP_PRIV __on_right>(__x, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) {
+ typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>,
+ _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>,
+ _STLP_PRIV __on_right> __root_type;
+ __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator()));
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ __root_type, _STLP_PRIV __on_right>(__c, __root);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __on_left> _STLP_CALL
+operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Left, class _Right, class _StorageDir>
+inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right> _STLP_CALL
+operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) {
+ return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>,
+ _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>,
+ _STLP_PRIV __on_right>(__c, __x);
+}
+
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+// Operator== and operator!=
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator==(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator==(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+// Operator< (and also >, <=, and >=).
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()) < 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()) < 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()) < 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
+ __y.begin(), __y.end()) < 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __s, __s + __n) < 0;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n,
+ __y.begin(), __y.end()) < 0;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ size_t __n = _Traits::length(__s);
+ return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),
+ __s, __s + __n) < 0;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+
+/* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise
+ * it might introduce ambiguity with pure template relational operators
+ * from rel_ops namespace.
+ */
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__x < __y); }
+
+# if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const basic_string<_CharT,_Traits,_Alloc>& __y)
+{ return !(__x==__y); }
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y)
+{ return !(__x==__y); }
+# endif
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator!=(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s == __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x == __s);
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s == __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x == __s);
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __y < __s;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __s < __x;
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __y < __s;
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return __s < __x;
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<=(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__y < __s);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __x);
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<=(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__y < __s);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __x);
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>=(const _CharT* __s,
+ const basic_string<_CharT,_Traits,_Alloc>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+inline bool _STLP_CALL
+operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x < __s);
+}
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>=(const _CharT* __s,
+ const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__s < __y);
+}
+
+template <class _CharT, class _Traits, class _Alloc, class _Lhs, class _Rhs, class _StoreDir>
+inline bool _STLP_CALL
+operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return !(__x < __s);
+}
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_OPERATORS_H */
+
diff --git a/build/stlport/stlport/stl/_string_sum.h b/build/stlport/stlport/stl/_string_sum.h
new file mode 100644
index 000000000..739d2884f
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_sum.h
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_SUM_H
+#define _STLP_STRING_SUM_H
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*char wrapper to simulate basic_string*/
+template <class _CharT>
+struct __char_wrapper {
+ typedef const _CharT& const_reference;
+
+ __char_wrapper(_CharT __val) : _Val(__val) {}
+
+ _CharT getValue() const { return _Val; }
+ size_t size() const { return 1; }
+
+ const_reference operator[] (size_t __n) const {
+ //To avoid a check on __n we use this strange implementation
+ return (&_Val)[__n];
+ }
+
+private:
+ _CharT _Val;
+};
+
+/*C string wrapper to simulate basic_string*/
+template <class _CharT>
+struct __cstr_wrapper {
+ typedef const _CharT& const_reference;
+
+ __cstr_wrapper(const _CharT *__cstr, size_t __size) :
+ _CStr(__cstr), _Size(__size) {}
+
+ const _CharT* c_str() const { return _CStr; }
+
+ size_t size() const { return _Size; }
+
+ const_reference operator[] (size_t __n) const { return _CStr[__n]; }
+
+private:
+ const _CharT *_CStr;
+ size_t _Size;
+};
+
+/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/
+template <class _CharT, class _Traits, class _Alloc>
+struct __bstr_wrapper {
+ typedef const _CharT& const_reference;
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+
+ __bstr_wrapper (_BString const& __s) :
+ _BStr(__s) {}
+
+ size_t size() const { return _BStr.size(); }
+
+ const_reference operator[] (size_t __n) const { return _BStr[__n]; }
+
+ _BString const& b_str() const { return _BStr; }
+
+private:
+ _BString const& _BStr;
+};
+
+struct __on_left {};
+struct __on_right {};
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Left, class _Right,
+ class _StorageDirection>
+class __bstr_sum {
+public:
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+ typedef typename _BString::const_reference const_reference;
+ typedef typename _BString::const_iterator const_iterator;
+ typedef typename _BString::const_reverse_iterator const_reverse_iterator;
+ typedef typename _BString::size_type size_type;
+ typedef typename _BString::allocator_type allocator_type;
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self;
+
+ __bstr_sum (_Left const& lhs, _Right const& rhs) :
+ _lhs(lhs), _rhs(rhs) {}
+
+ _Left const& getLhs() const { return _lhs; }
+ _Right const& getRhs() const { return _rhs; }
+
+ allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); }
+
+ const_iterator begin() const { return _M_get_storage().begin(); }
+ const_iterator end() const { return _M_get_storage().end(); }
+ const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); }
+ const_reverse_iterator rend() const { return _M_get_storage().rend(); }
+
+ size_type size() const { return _lhs.size() + _rhs.size(); }
+ size_type length() const { return size(); }
+
+ size_t max_size() const { return _M_get_storage().max_size(); }
+ size_type capacity() const { return size(); }
+ bool empty() const { return size() == 0; }
+
+ const_reference operator[](size_t __n) const
+ { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; }
+
+ const_reference at(size_type __n) const
+ { return _M_get_storage().at(__n); }
+
+ //operator +=
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft;
+ _BStrOnLeft operator += (const _BString& __s) { return append(__s); }
+
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft;
+ _CStrOnLeft operator += (const _CharT* __s) { return append(__s); }
+
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft;
+ _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); }
+
+ //append
+ _BStrOnLeft append (const _BString& __s)
+ { return _BStrOnLeft(*this, __s); }
+ _BString& append(const _BString& __s, size_type __pos, size_type __n)
+ { return _M_get_storage().append(__s, __pos, __n); }
+ _CStrOnLeft append(const _CharT* __s) {
+ const size_type __n = _Traits::length(__s);
+ return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n));
+ }
+ _CStrOnLeft append(const _CharT* __s, size_type __n)
+ { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); }
+ _BString& append(size_type __n, _CharT __c)
+ {return _M_get_storage().append(__n, __c);}
+ template <class _InputIter>
+ _BString& append(_InputIter __first, _InputIter __last)
+ {return _M_get_storage().append(__first, __last);}
+
+ //assign
+ _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);}
+ _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);}
+ _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);}
+ _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); }
+ _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);}
+
+ //insert
+ _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);}
+ _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n)
+ {return _M_get_storage().insert(__pos, __s, __beg, __n);}
+ _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);}
+ _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);}
+ _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);}
+
+ //erase
+ _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);}
+
+ //replace
+ _BString& replace(size_type __pos, size_type __n, const _BString& __s)
+ {return _M_get_storage().replace(__pos, __n, __s);}
+ _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2)
+ {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);}
+ _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)
+ {return _M_get_storage().replace(__pos, __n1, __s, __n2);}
+ _BString& replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {return _M_get_storage().replace(__pos, __n1, __s);}
+ _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ {return _M_get_storage().replace(__pos, __n1, __n2, __c);}
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ {return _M_get_storage().copy(__s, __n, __pos);}
+
+ void swap(_BString& __s)
+ {_M_get_storage().swap(__s);}
+
+ const _CharT* c_str() const { return _M_get_storage().c_str(); }
+ const _CharT* data() const { return _M_get_storage().data(); }
+
+ //find family
+ size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
+ size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); }
+ size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); }
+
+ size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); }
+ size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); }
+
+ size_type find_first_of(const _BString& __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_of(__s, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_of(__s, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_first_of(__s, __pos, __n); }
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _M_get_storage().find(__c, __pos); }
+
+ size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_of(__s, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_of(__s, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_last_of(__s, __pos, __n); }
+ size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const
+ { return _M_get_storage().rfind(__c, __pos); }
+
+ size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__s, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__s, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_first_not_of(__s, __pos, __n); }
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__c, __pos); }
+
+ size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_not_of(__s, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const
+ { return _M_get_storage().find_last_not_of(__s, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_last_not_of(__s, __pos, __n); }
+ size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_not_of(__c, __pos); }
+
+ _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const
+ { return _M_get_storage().substr(__pos, __n); }
+
+ //compare
+ int compare(const _BString& __s) const
+ { return _M_get_storage().compare(__s); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s) const
+ { return _M_get_storage().compare(__pos1, __n1, __s); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const
+ { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); }
+ int compare(const _CharT* __s) const
+ { return _M_get_storage().compare(__s); }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
+ { return _M_get_storage().compare(__pos1, __n1, __s); }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
+ { return _M_get_storage().compare(__pos1, __n1, __s, __n2); }
+
+ //Returns the underlying basic_string representation of the template expression
+ //The non const method will always initialise it.
+ _BString& _M_get_storage()
+ { return _rhs._M_get_storage(*this, _StorageDirection()); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ __on_left const& /*StorageDir*/)
+ { return _lhs._M_get_storage(__ref); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ __on_right const& /*StorageDir*/)
+ { return _rhs._M_get_storage(__ref); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref)
+ { return _M_get_storage(__ref, _StorageDirection()); }
+
+ //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation.
+ _BString const& _M_get_storage(bool __do_init = true) const
+ { return _M_get_storage(*this, __do_init, _StorageDirection()); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init, __on_left const& /*StorageDir*/) const
+ { return _lhs._M_get_storage(__ref, __do_init); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init, __on_right const& /*StorageDir*/) const
+ { return _rhs._M_get_storage(__ref, __do_init); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init) const
+ { return _M_get_storage(__ref, __do_init, _StorageDirection()); }
+
+private:
+ _Left _lhs;
+ _Right _rhs;
+};
+
+/*
+ * For this operator we choose to use the right part as the storage part
+ */
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline __bstr_sum<_CharT, _Traits, _Alloc,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
+ __on_right> _STLP_CALL
+operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) {
+ return __bstr_sum<_CharT, _Traits, _Alloc,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
+ __on_right>(__lhs, __rhs);
+}
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return __lhs._M_get_storage() < __rhs._M_get_storage(); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__lhs == __rhs); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return __rhs < __lhs; }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__rhs < __lhs); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__lhs < __rhs); }
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+
+/*
+ * This class will be used to simulate a temporary string that is required for
+ * a call to the c_str method on the __bstr_sum class.
+ */
+
+template <class _CharT, class _Traits, class _Alloc>
+struct __sum_storage_elem {
+ typedef __sum_storage_elem<_CharT, _Traits, _Alloc> _Self;
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+
+ __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc)
+ {}
+
+ template <class _Left, class _Right, class _StorageDir>
+ void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) const {
+ if (!_M_init) {
+ _STLP_MUTABLE(_Self, _M_storage) = __ref;
+ _STLP_MUTABLE(_Self, _M_init) = true;
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref,
+ bool __do_init) const {
+ if (__do_init) {
+ _M_Init(__ref);
+ }
+ return _M_storage;
+ }
+ template <class _Left, class _Right, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) {
+ _M_Init(__ref);
+ return _M_storage;
+ }
+
+ size_t size() const { return 0; }
+ _CharT const& operator[](size_t __n) const
+ { return __STATIC_CAST(_CharT*, 0)[__n]; }
+
+private:
+ mutable bool _M_init;
+ mutable basic_string<_CharT, _Traits, _Alloc> _M_storage;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /*_STLP_STRING_SUM_H*/
diff --git a/build/stlport/stlport/stl/_string_sum_methods.h b/build/stlport/stlport/stl/_string_sum_methods.h
new file mode 100644
index 000000000..305608e50
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_sum_methods.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * All the necessary methods used for template expressions with basic_string
+ * This file do not have to be macro guarded as it is only used in the _string.h
+ * file and it is a part of the basic_string definition.
+ */
+
+public:
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s)
+ : _STLP_STRING_SUM_BASE(_Reserve_t(), __s.size(), __s.get_allocator())
+ { _M_append_sum(__s); }
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) {
+ size_type __size = __s.size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ else
+ _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos));
+ }
+
+private:
+ _CharT* _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf) {
+ _STLP_STD::_Copy_Construct(__buf, __c.getValue());
+ return __buf + 1;
+ }
+ _CharT* _M_append_fast(_CharT const* __s, size_type __s_size, _CharT *__buf)
+ { return uninitialized_copy(__s, __s + __s_size, __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.c_str(), __s.size(), __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf)
+ { return _M_append_fast(__s.b_str(), __buf); }
+ _CharT* _M_append_fast(_Self const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.data(), __s.size(), __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf)
+ { return __buf; }
+ template <class _Left, class _Right, class _StorageDir>
+ _CharT* _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __buf)); }
+
+ _CharT* _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf, size_type /*__pos*/, size_type __n) {
+ if (__n == 0)
+ return __buf;
+ _STLP_STD::_Copy_Construct(__buf, __c.getValue());
+ return __buf + 1;
+ }
+ _CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.b_str(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_Self const& __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.data(), __s.size(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf,
+ size_type, size_type)
+ { return __buf; }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _CharT *__buf, size_type __pos, size_type __n) {
+ if (__n == 0) {
+ return __buf;
+ }
+ size_type __lhs_size = __s.getLhs().size();
+ if (__pos < __lhs_size) {
+ if (__n < (__lhs_size - __pos)) {
+ return _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n);
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n),
+ 0, __n - (__lhs_size - __pos));
+ }
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), __buf, __pos - __lhs_size, __n);
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) {
+ size_type __s_size = __s.size();
+ if (__s_size == 0)
+ return *this;
+ const size_type __old_size = this->size();
+ if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
+ this->_M_throw_length_error();
+ if (__old_size + __s_size > this->capacity()) {
+ const size_type __len = __old_size + (max)(__old_size, __s_size) + 1;
+ pointer __new_start = this->_M_start_of_storage.allocate(__len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = this->_M_append_fast(__s, __new_finish);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _M_append_sum_no_overflow(__s, 0, __s_size);
+ }
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n) {
+ size_type __s_size = (min)(__s.size() - __pos, __n);
+ if (__s_size == 0)
+ return *this;
+ const size_type __old_size = this->size();
+ if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
+ this->_M_throw_length_error();
+ if (__old_size + __s_size > this->capacity()) {
+ const size_type __len = __old_size + (max)(__old_size, __s_size) + 1;
+ pointer __new_start = this->_M_start_of_storage.allocate(__len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = _M_append_fast_pos(__s, __new_finish, __pos, __s_size);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _M_append_sum_no_overflow(__s, __pos, __s_size);
+ }
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ void _M_append_sum_no_overflow(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n) {
+ pointer __finish = this->_M_Finish();
+ _M_append_fast_pos(__s, __finish + 1, __pos + 1, __n - 1);
+ this->_M_construct_null(__finish + __n);
+ _Traits::assign(*this->_M_finish, __s[__pos]);
+ this->_M_finish += __n;
+ }
diff --git a/build/stlport/stlport/stl/_string_workaround.h b/build/stlport/stlport/stl/_string_workaround.h
new file mode 100644
index 000000000..d77e32015
--- /dev/null
+++ b/build/stlport/stlport/stl/_string_workaround.h
@@ -0,0 +1,599 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+//Included from _string.h, no need for macro guarding.
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc>
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : public _STLP_NO_MEM_T_STRING_BASE
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+private: // Protected members inherited from base.
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ typedef _STLP_NO_MEM_T_STRING_BASE _Base;
+ typedef typename _Base::_CalledFromWorkaround_t _CalledFromWorkaround_t;
+public:
+
+ __IMPORT_WITH_REVERSE_ITERATORS(_Base)
+
+ typedef typename _Base::_Iterator_category _Iterator_category;
+ typedef typename _Base::traits_type traits_type;
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+#include <stl/_string_npos.h>
+
+public: // Constructor, destructor, assignment.
+ explicit basic_string(const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__a) {}
+
+ basic_string(_Reserve_t __r, size_t __n,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {}
+
+ basic_string(const _Self& __s)
+ : _STLP_NO_MEM_T_STRING_BASE(__s) {}
+
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {}
+
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {}
+
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {}
+
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {}
+#endif
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), __a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# endif
+
+ _Self& operator=(const _Self& __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+
+ _Self& operator=(_CharT __c) {
+ _Base::operator=(__c);
+ return *this;
+ }
+
+private:
+ template <class _InputIter>
+ void _M_range_initialize(_InputIter __f, _InputIter __l,
+ const input_iterator_tag &__tag) {
+ this->_M_allocate_block();
+ this->_M_construct_null(this->_M_Finish());
+ _M_appendT(__f, __l, __tag);
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = _STLP_STD::distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_range_initializeT(_InputIter __f, _InputIter __l) {
+ _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_fill_n(this->_M_Start(), __n, __x);
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ _M_range_initializeT(__f, __l);
+ }
+
+public: // Append, operator+=, push_back.
+ _Self& operator+=(const _Self& __s) {
+ _Base::operator+=(__s);
+ return *this;
+ }
+ _Self& operator+=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::operator+=(__s);
+ return *this;
+ }
+ _Self& operator+=(_CharT __c) {
+ _Base::operator+=(__c);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s) {
+ _Base::append(__s);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s,
+ size_type __pos, size_type __n) {
+ _Base::append(__s, __pos, __n);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::append(__s, __n);
+ return *this;
+ }
+ _Self& append(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::append(__s);
+ return *this;
+ }
+ _Self& append(size_type __n, _CharT __c) {
+ _Base::append(__n, __c);
+ return *this;
+ }
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_append_dispatch(__first, __last, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ //See equivalent assign method remark.
+ _Self& append(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::append(__f, __l);
+ return *this;
+ }
+#endif
+
+private: // Helper functions for append.
+
+ template <class _InputIter>
+ _Self& _M_appendT(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last ; ++__first)
+ _Base::push_back(*__first);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ const size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n >= this->_M_rest()) {
+ size_type __len = this->_M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _Traits::assign(*this->_M_finish, *__first++);
+ uninitialized_copy(__first, __last, this->_M_Finish() + 1);
+ this->_M_construct_null(this->_M_Finish() + __n);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
+ { return append((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
+ { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
+
+public: // Assign
+ _Self& assign(const _Self& __s) {
+ _Base::assign(__s);
+ return *this;
+ }
+
+ _Self& assign(const _Self& __s,
+ size_type __pos, size_type __n) {
+ _Base::assign(__s, __pos, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::assign(__s, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::assign(__s);
+ return *this;
+ }
+
+ _Self& assign(size_type __n, _CharT __c) {
+ _Base::assign(__n, __c);
+ return *this;
+ }
+
+private: // Helper functions for assign.
+
+ template <class _Integer>
+ _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
+ { return assign((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ pointer __cur = this->_M_Start();
+ while (__f != __l && __cur != this->_M_Finish()) {
+ _Traits::assign(*__cur, *__f);
+ ++__f;
+ ++__cur;
+ }
+ if (__f == __l)
+ _Base::erase(__cur, this->_M_Finish());
+ else
+ _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ return *this;
+ }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& assign(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ /* This method is not part of the standard and is a specialization of the
+ * template method assign. It is only granted for convenience to call assign
+ * with mixed parameters iterator and const_iterator.
+ */
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::assign(__f, __l);
+ return *this;
+ }
+#endif
+
+public: // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ _Base::insert(__pos, __s);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ _Base::insert(__pos, __s, __beg, __n);
+ return *this;
+ }
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::insert(__pos, __s, __n);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::insert(__pos, __s);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ _Base::insert(__pos, __n, __c);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c)
+ { return _Base::insert(__p, __c); }
+
+ void insert(iterator __p, size_t __n, _CharT __c)
+ { _Base::insert(__p, __n, __c); }
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_insert_dispatch(__p, __first, __last, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_insert(__p, __f, __l, this->_M_inside(__f));
+ }
+#endif
+
+private: // Helper functions for insert.
+ void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::_M_insert(__p, __f, __l, __self_ref);
+ }
+
+ template <class _ForwardIter>
+ void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ size_type __n) {
+ size_type __len = this->_M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+
+ template <class _InputIter>
+ void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __p = insert(__p, *__first);
+ ++__p;
+ }
+ }
+
+ template <class _ForwardIter>
+ void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n < this->_M_rest()) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ if (__elems_after >= __n) {
+ uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _M_copyT(__first, __last, __pos);
+ }
+ else {
+ pointer __old_finish = this->_M_Finish();
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after + 1);
+ _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ _M_copyT(__first, __mid, __pos);
+ }
+ }
+ else {
+ _M_insert_overflow(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
+ const __true_type& /*Integral*/)
+ { insert(__p, (size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*Integral*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__first, __last, this->get_allocator());
+ _M_insertT(__p, __self.begin(), __self.end(), _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+ template <class _InputIterator>
+ void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ for ( ; __first != __last; ++__first, ++__result)
+ _Traits::assign(*__result, *__first);
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) _STLP_FIX_LITERAL_BUG(__res)
+ _Base::_M_copy(__f, __l, __res);
+ }
+#endif
+
+public: // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ _Base::erase(__pos, __n);
+ return *this;
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_FIX_LITERAL_BUG(__pos)
+ return _Base::erase(__pos);
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _Base::erase(__first, __last);
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ _Base::replace(__pos, __n, __s);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ _Base::replace(__pos1, __n1, __s, __pos2, __n2);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__pos, __n1, __s, __n2);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__pos, __n1, __s);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ _Base::replace(__pos, __n1, __n2, __c);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last, const _Self& __s) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _Base::replace(__first, __last, __s);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__first, __last, __s, __n);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__first, __last, __s);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ size_type __n, _CharT __c) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _Base::replace(__first, __last, __n, __c);
+ return *this;
+ }
+
+ // Check to see if _InputIter is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_replace(__first, __last, __f, __l, this->_M_inside(__f));
+ }
+#endif
+
+private: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _Base::_M_replace(__first, __last, __f, __l, __self_ref);
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return replace(__first, __last, (size_type) __n, (_CharT) __x);
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__f, __l, this->get_allocator());
+ return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false);
+ }
+
+public: // Other modifier member functions.
+ void swap(_Self& __s) { _Base::swap(__s); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public: // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _Self(*this, __pos, __n, this->get_allocator()); }
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG)
+# define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE
+# include <stl/_string_sum_methods.h>
+# undef _STLP_STRING_SUM_BASE
+#endif
+};
+
+#undef _STLP_NO_MEM_T_STRING_BASE
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/build/stlport/stlport/stl/_strstream.h b/build/stlport/stlport/stl/_strstream.h
new file mode 100644
index 000000000..5e3d4c37d
--- /dev/null
+++ b/build/stlport/stlport/stl/_strstream.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_STRSTREAM
+#define _STLP_INTERNAL_STRSTREAM
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#ifndef _STLP_USE_NAMESPACES
+# define strstream _STLP_strstream
+# define ostrstream _STLP_ostrstream
+# define istrstream _STLP_istrstream
+# define strstreambuf _STLP_strstreambuf
+#endif
+
+//----------------------------------------------------------------------
+// Class strstreambuf, a streambuf class that manages an array of char.
+// Note that this class is not a template.
+
+class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf<char, char_traits<char> > {
+public: // Types.
+ typedef char_traits<char> _Traits;
+ typedef basic_streambuf<char, char_traits<char> > _Base;
+ typedef void* (*__alloc_fn)(size_t);
+ typedef void (*__free_fn)(void*);
+public: // Constructor, destructor
+
+ explicit strstreambuf(streamsize _Initial_capacity = 0);
+
+ strstreambuf(__alloc_fn, __free_fn);
+
+ strstreambuf(char* __get, streamsize __n, char* __put = 0);
+ strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
+ strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
+
+ strstreambuf(const char* __get, streamsize __n);
+ strstreambuf(const signed char* __get, streamsize __n);
+ strstreambuf(const unsigned char* __get, streamsize __n);
+
+ virtual ~strstreambuf();
+
+public: // strstreambuf operations.
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+protected: // Overridden virtual member functions.
+ virtual int_type overflow(int_type __c = _Traits::eof());
+ virtual int_type pbackfail(int_type __c = _Traits::eof());
+ virtual int_type underflow();
+ virtual _Base* setbuf(char* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+private: // Helper functions.
+ // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
+ char* _M_alloc(size_t);
+ void _M_free(char*);
+
+ // Helper function used in constructors.
+ void _M_setup(char* __get, char* __put, streamsize __n);
+private: // Data members.
+ __alloc_fn _M_alloc_fun;
+ __free_fn _M_free_fun;
+ bool _M_dynamic : 1;
+ bool _M_frozen : 1;
+ bool _M_constant : 1;
+};
+
+//----------------------------------------------------------------------
+// Class istrstream, an istream that manages a strstreambuf.
+
+class _STLP_CLASS_DECLSPEC istrstream : public basic_istream<char, char_traits<char> > {
+public:
+ explicit istrstream(char*);
+ explicit istrstream(const char*);
+ istrstream(char* , streamsize);
+ istrstream(const char*, streamsize);
+ virtual ~istrstream();
+
+ strstreambuf* rdbuf() const;
+ char* str();
+
+private:
+ strstreambuf _M_buf;
+};
+
+//----------------------------------------------------------------------
+// Class ostrstream
+
+class _STLP_CLASS_DECLSPEC ostrstream : public basic_ostream<char, char_traits<char> >
+{
+public:
+ ostrstream();
+ ostrstream(char*, int, ios_base::openmode = ios_base::out);
+ virtual ~ostrstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+private:
+ strstreambuf _M_buf;
+};
+
+//----------------------------------------------------------------------
+// Class strstream
+
+class _STLP_CLASS_DECLSPEC strstream : public basic_iostream<char, char_traits<char> > {
+public:
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
+
+ strstream();
+ strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
+ virtual ~strstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ int pcount() const;
+ char* str();
+
+private:
+ strstreambuf _M_buf;
+
+ //explicitely defined as private to avoid warnings:
+ strstream(strstream const&);
+ strstream& operator = (strstream const&);
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_STRSTREAM */
diff --git a/build/stlport/stlport/stl/_tempbuf.c b/build/stlport/stlport/stl/_tempbuf.c
new file mode 100644
index 000000000..179b4725c
--- /dev/null
+++ b/build/stlport/stlport/stl/_tempbuf.c
@@ -0,0 +1,57 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_TEMPBUF_C
+#define _STLP_TEMPBUF_C
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+pair<_Tp*, ptrdiff_t> _STLP_CALL
+__get_temporary_buffer(ptrdiff_t __len, _Tp*)
+{
+ if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
+ __len = INT_MAX / sizeof(_Tp);
+
+ while (__len > 0) {
+ _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp));
+ if (__tmp != 0)
+ return pair<_Tp*, ptrdiff_t>(__tmp, __len);
+ __len /= 2;
+ }
+
+ return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
+}
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TEMPBUF_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_tempbuf.h b/build/stlport/stlport/stl/_tempbuf.h
new file mode 100644
index 000000000..0e0a74785
--- /dev/null
+++ b/build/stlport/stlport/stl/_tempbuf.h
@@ -0,0 +1,167 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+#define _STLP_INTERNAL_TEMPBUF_H
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+pair<_Tp*, ptrdiff_t> _STLP_CALL
+__get_temporary_buffer(ptrdiff_t __len, _Tp*);
+
+#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+template <class _Tp>
+inline pair<_Tp*, ptrdiff_t> _STLP_CALL get_temporary_buffer(ptrdiff_t __len) {
+ return __get_temporary_buffer(__len, (_Tp*) 0);
+}
+
+# if ! defined(_STLP_NO_EXTENSIONS)
+// This overload is not required by the standard; it is an extension.
+// It is supported for backward compatibility with the HP STL, and
+// because not all compilers support the language feature (explicit
+// function template arguments) that is required for the standard
+// version of get_temporary_buffer.
+template <class _Tp>
+inline pair<_Tp*, ptrdiff_t> _STLP_CALL
+get_temporary_buffer(ptrdiff_t __len, _Tp*) {
+ return __get_temporary_buffer(__len, (_Tp*) 0);
+}
+# endif
+#endif
+
+template <class _Tp>
+inline void _STLP_CALL return_temporary_buffer(_Tp* __p) {
+// SunPro brain damage
+ free((char*)__p);
+}
+
+template <class _ForwardIterator, class _Tp>
+class _Temporary_buffer {
+private:
+ ptrdiff_t _M_original_len;
+ ptrdiff_t _M_len;
+ _Tp* _M_buffer;
+
+ void _M_allocate_buffer() {
+ _M_original_len = _M_len;
+ _M_buffer = 0;
+
+ if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
+ _M_len = INT_MAX / sizeof(_Tp);
+
+ while (_M_len > 0) {
+ _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
+ if (_M_buffer)
+ break;
+ _M_len /= 2;
+ }
+ }
+
+ void _M_initialize_buffer(const _Tp&, const __true_type&) {}
+ void _M_initialize_buffer(const _Tp& val, const __false_type&) {
+ uninitialized_fill_n(_M_buffer, _M_len, val);
+ }
+
+public:
+ ptrdiff_t size() const { return _M_len; }
+ ptrdiff_t requested_size() const { return _M_original_len; }
+ _Tp* begin() { return _M_buffer; }
+ _Tp* end() { return _M_buffer + _M_len; }
+
+ _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
+ // Workaround for a __type_traits bug in the pre-7.3 compiler.
+# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
+ typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
+# else
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial;
+# endif
+ _STLP_TRY {
+ _M_len = _STLP_STD::distance(__first, __last);
+ _M_allocate_buffer();
+ if (_M_len > 0)
+ _M_initialize_buffer(*__first, _Trivial());
+ }
+ _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0)
+ }
+
+ ~_Temporary_buffer() {
+ _STLP_STD::_Destroy_Range(_M_buffer, _M_buffer + _M_len);
+ free(_M_buffer);
+ }
+
+private:
+ // Disable copy constructor and assignment operator.
+ _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
+ void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
+};
+
+# ifndef _STLP_NO_EXTENSIONS
+
+// Class temporary_buffer is not part of the standard. It is an extension.
+
+template <class _ForwardIterator,
+ class _Tp
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ = typename iterator_traits<_ForwardIterator>::value_type
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+ >
+struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
+{
+ temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
+ : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
+ ~temporary_buffer() {}
+};
+
+# endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+# ifndef _STLP_LINK_TIME_INSTANTIATION
+# include <stl/_tempbuf.c>
+# endif
+
+#endif /* _STLP_INTERNAL_TEMPBUF_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_threads.c b/build/stlport/stlport/stl/_threads.c
new file mode 100644
index 000000000..ea3c0b9c6
--- /dev/null
+++ b/build/stlport/stlport/stl/_threads.c
@@ -0,0 +1,167 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_THREADS_C
+#define _STLP_THREADS_C
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+#if defined (_STLP_SGI_THREADS)
+# include <time.h>
+#elif defined (_STLP_UNIX)
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+# include <sys/time.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+template<int __32bits>
+_STLP_STATIC_MUTEX
+_Atomic_swap_struct<__32bits>::_S_swap_lock _STLP_MUTEX_INITIALIZER;
+# undef _STLP_USE_ATOMIC_SWAP_MUTEX
+#endif
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+template <int __inst>
+unsigned _STLP_mutex_spin<__inst>::__max = _STLP_mutex_spin<__inst>::__low_max;
+
+template <int __inst>
+unsigned _STLP_mutex_spin<__inst>::__last = 0;
+#endif // _STLP_USE_PTHREAD_SPINLOCK
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+
+# if defined (_STLP_SPARC_SOLARIS_THREADS)
+// underground function in libc.so; we do not want dependance on librt
+extern "C" int __nanosleep(const struct timespec*, struct timespec*);
+# define _STLP_NANOSLEEP __nanosleep
+# else
+# define _STLP_NANOSLEEP nanosleep
+# endif
+
+template <int __inst>
+void _STLP_CALL
+_STLP_mutex_spin<__inst>::_S_nsec_sleep(int __log_nsec, unsigned int& __iteration) {
+# if defined (_STLP_WIN32THREADS)
+# if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
+ if (__iteration <= 4000) {
+ // Use SwitchToThread because
+ // 1) Sleep(1) often takes ~15 ms
+ // 2) SwitchToThread yields to lower-priority threads
+ // 4000 is enough to avoid Sleep and is used just to prevent infinite looping
+ // This number is advised spin count for Heap management by Microsoft
+ SwitchToThread();
+ } else {
+# endif
+ if (__log_nsec <= 21) {
+ /* Note from boost (www.boost.org):
+ * Changed from Sleep(0) to Sleep(1).
+ * According to MSDN, Sleep(0) will never yield to a lower-priority thread,
+ * whereas Sleep(1) will. Performance seems not to be affected. */
+ Sleep(1);
+ } else {
+ Sleep(1 << (__log_nsec - 20));
+ }
+# if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
+ __iteration = 0; //reset to avoid sleeps sequence
+ }
+# endif
+# elif defined(_STLP_OS2THREADS)
+ if (__log_nsec <= 20) {
+ DosSleep(0);
+ } else {
+ DosSleep(1 << (__log_nsec - 20));
+ }
+# elif defined (_STLP_UNIX)
+ timespec __ts;
+ /* Max sleep is 2**27nsec ~ 60msec */
+ __ts.tv_sec = 0;
+ __ts.tv_nsec = 1 << __log_nsec;
+ _STLP_NANOSLEEP(&__ts, 0);
+# endif
+}
+
+template <int __inst>
+void _STLP_CALL
+_STLP_mutex_spin<__inst>::_M_do_lock(volatile __stl_atomic_t* __lock) {
+# if defined(_STLP_ATOMIC_EXCHANGE)
+ if (_Atomic_swap(__lock, 1)) {
+ unsigned __my_spin_max = _STLP_mutex_spin<0>::__max;
+ unsigned __my_last_spins = _STLP_mutex_spin<0>::__last;
+ volatile unsigned __junk = 17; // Value doesn't matter.
+ unsigned __i;
+
+ for (__i = 0; __i < __my_spin_max; ++__i) {
+ if (__i < __my_last_spins/2 || *__lock) {
+ __junk *= __junk; __junk *= __junk;
+ __junk *= __junk; __junk *= __junk;
+ } else {
+ if (!_Atomic_swap(__lock, 1)) {
+ // got it!
+ // Spinning worked. Thus we're probably not being scheduled
+ // against the other process with which we were contending.
+ // Thus it makes sense to spin longer the next time.
+ _STLP_mutex_spin<0>::__last = __i;
+ _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__high_max;
+ return;
+ }
+ }
+ }
+
+ // We are probably being scheduled against the other process. Sleep.
+ _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__low_max;
+
+ for (__i = 0 ;; ++__i) {
+ int __log_nsec = __i + 6;
+
+ if (__log_nsec > 27) __log_nsec = 27;
+ if (!_Atomic_swap(__lock, 1)) {
+ break;
+ }
+ _S_nsec_sleep(__log_nsec, __i);
+ }
+ } /* first _Atomic_swap */
+# endif
+}
+#endif // _STLP_USE_PTHREAD_SPINLOCK
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+#endif /* _STLP_THREADS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_threads.h b/build/stlport/stlport/stl/_threads.h
new file mode 100644
index 000000000..fe381d838
--- /dev/null
+++ b/build/stlport/stlport/stl/_threads.h
@@ -0,0 +1,687 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_THREADS_H
+#define _STLP_INTERNAL_THREADS_H
+
+// Supported threading models are native SGI, pthreads, uithreads
+// (similar to pthreads, but based on an earlier draft of the Posix
+// threads standard), and Win32 threads. Uithread support by Jochen
+// Schlick, 1999, and Solaris threads generalized to them.
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+// On SUN and Mac OS X gcc, zero-initialization works just fine...
+#if defined (__sun) || (defined (__GNUC__) && defined(__APPLE__))
+# define _STLP_MUTEX_INITIALIZER
+#endif
+
+/* This header defines the following atomic operation that platform should
+ * try to support as much as possible. Atomic operation are exposed as macro
+ * in order to easily test for their existance. They are:
+ * __stl_atomic_t _STLP_ATOMIC_INCREMENT(volatile __stl_atomic_t* __ptr) :
+ * increment *__ptr by 1 and returns the new value
+ * __stl_atomic_t _STLP_ATOMIC_DECREMENT(volatile __stl_atomic_t* __ptr) :
+ * decrement *__ptr by 1 and returns the new value
+ * __stl_atomic_t _STLP_ATOMIC_EXCHANGE(volatile __stl_atomic_t* __target, __stl_atomic_t __val) :
+ * assign __val to *__target and returns former *__target value
+ * void* _STLP_ATOMIC_EXCHANGE_PTR(void* volatile* __target, void* __ptr) :
+ * assign __ptr to *__target and returns former *__target value
+ */
+
+#if defined (_STLP_THREADS)
+
+# if defined (_STLP_SGI_THREADS)
+
+# include <mutex.h>
+// Hack for SGI o32 compilers.
+# if !defined(__add_and_fetch) && \
+ (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64)))
+# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v)
+# define __test_and_set(__l,__v) test_and_set(__l,__v)
+# endif /* o32 */
+
+# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
+# define _STLP_ATOMIC_EXCHANGE(__p, __q) test_and_set(__p, __q)
+# else
+# define _STLP_ATOMIC_EXCHANGE(__p, __q) __test_and_set((unsigned long*)__p, (unsigned long)__q)
+# endif
+
+# define _STLP_ATOMIC_INCREMENT(__x) __add_and_fetch(__x, 1)
+# define _STLP_ATOMIC_DECREMENT(__x) __add_and_fetch(__x, (size_t) -1)
+typedef long __stl_atomic_t;
+
+# elif defined (_STLP_PTHREADS)
+
+# include <pthread.h>
+# if !defined (_STLP_USE_PTHREAD_SPINLOCK)
+# if defined (PTHREAD_MUTEX_INITIALIZER) && !defined (_STLP_MUTEX_INITIALIZER) && defined (_REENTRANT)
+# define _STLP_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER }
+# endif
+//HPUX variants have (on some platforms optional) non-standard "DCE" pthreads impl
+# if defined (_DECTHREADS_) && (defined (_PTHREAD_USE_D4) || defined (__hpux)) && !defined (_CMA_SUPPRESS_EXTERNALS_)
+# define _STLP_PTHREAD_ATTR_DEFAULT pthread_mutexattr_default
+# else
+# define _STLP_PTHREAD_ATTR_DEFAULT 0
+# endif
+# else
+# if defined (__OpenBSD__)
+# include <spinlock.h>
+# endif
+# endif
+
+# if defined (__GNUC__) && defined (__i386__)
+# if !defined (_STLP_ATOMIC_INCREMENT)
+inline long _STLP_atomic_increment_gcc_x86(long volatile* p) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (1)
+ :"cc");
+ return result + 1;
+}
+# define _STLP_ATOMIC_INCREMENT(__x) (_STLP_atomic_increment_gcc_x86((long volatile*)__x))
+# endif
+
+# if !defined (_STLP_ATOMIC_DECREMENT)
+inline long _STLP_atomic_decrement_gcc_x86(long volatile* p) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (-1)
+ :"cc");
+ return result - 1;
+}
+# define _STLP_ATOMIC_DECREMENT(__x) (_STLP_atomic_decrement_gcc_x86((long volatile*)__x))
+# endif
+typedef long __stl_atomic_t;
+# else
+typedef size_t __stl_atomic_t;
+# endif /* if defined(__GNUC__) && defined(__i386__) */
+
+# elif defined (_STLP_WIN32THREADS)
+
+# if !defined (_STLP_ATOMIC_INCREMENT)
+# if !defined (_STLP_NEW_PLATFORM_SDK)
+# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__CONST_CAST(long*, __x))
+# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__CONST_CAST(long*, __x))
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__CONST_CAST(long*, __x), __y)
+# else
+# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__x)
+# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__x, __y)
+# endif
+# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) STLPInterlockedExchangePointer(__x, __y)
+# endif
+typedef long __stl_atomic_t;
+
+# elif defined (__DECC) || defined (__DECCXX)
+
+# include <machine/builtins.h>
+# define _STLP_ATOMIC_EXCHANGE __ATOMIC_EXCH_LONG
+# define _STLP_ATOMIC_INCREMENT(__x) __ATOMIC_ADD_LONG(__x, 1)
+# define _STLP_ATOMIC_DECREMENT(__x) __ATOMIC_ADD_LONG(__x, -1)
+typedef long __stl_atomic_t;
+
+# elif defined (_STLP_SPARC_SOLARIS_THREADS)
+
+typedef long __stl_atomic_t;
+# include <stl/_sparc_atomic.h>
+
+# elif defined (_STLP_UITHREADS)
+
+// this inclusion is potential hazard to bring up all sorts
+// of old-style headers. Let's assume vendor already know how
+// to deal with that.
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+# include <synch.h>
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+# endif
+typedef size_t __stl_atomic_t;
+
+# elif defined (_STLP_BETHREADS)
+
+# include <OS.h>
+# include <cassert>
+# include <stdio.h>
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+typedef size_t __stl_atomic_t;
+
+# elif defined (_STLP_NWTHREADS)
+
+# include <nwthread.h>
+# include <nwsemaph.h>
+typedef size_t __stl_atomic_t;
+
+# elif defined(_STLP_OS2THREADS)
+
+# if defined (__GNUC__)
+# define INCL_DOSSEMAPHORES
+# include <os2.h>
+# else
+// This section serves to replace os2.h for VisualAge C++
+ typedef unsigned long ULONG;
+# if !defined (__HEV__) /* INCL_SEMAPHORE may also define HEV */
+# define __HEV__
+ typedef ULONG HEV;
+ typedef HEV* PHEV;
+# endif
+ typedef ULONG APIRET;
+ typedef ULONG HMTX;
+ typedef HMTX* PHMTX;
+ typedef const char* PCSZ;
+ typedef ULONG BOOL32;
+ APIRET _System DosCreateMutexSem(PCSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
+ APIRET _System DosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
+ APIRET _System DosReleaseMutexSem(HMTX hmtx);
+ APIRET _System DosCloseMutexSem(HMTX hmtx);
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+# endif /* GNUC */
+typedef size_t __stl_atomic_t;
+
+# else
+
+typedef size_t __stl_atomic_t;
+
+# endif
+
+#else
+/* no threads */
+# define _STLP_ATOMIC_INCREMENT(__x) ++(*__x)
+# define _STLP_ATOMIC_DECREMENT(__x) --(*__x)
+/* We do not grant other atomic operations as they are useless if STLport do not have
+ * to be thread safe
+ */
+typedef size_t __stl_atomic_t;
+#endif
+
+#if !defined (_STLP_MUTEX_INITIALIZER)
+# if defined(_STLP_ATOMIC_EXCHANGE)
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+# elif defined(_STLP_UITHREADS)
+# define _STLP_MUTEX_INITIALIZER = { DEFAULTMUTEX }
+# else
+# define _STLP_MUTEX_INITIALIZER
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+// Helper struct. This is a workaround for various compilers that don't
+// handle static variables in inline functions properly.
+template <int __inst>
+struct _STLP_mutex_spin {
+ enum { __low_max = 30, __high_max = 1000 };
+ // Low if we suspect uniprocessor, high for multiprocessor.
+ static unsigned __max;
+ static unsigned __last;
+ static void _STLP_CALL _M_do_lock(volatile __stl_atomic_t* __lock);
+ static void _STLP_CALL _S_nsec_sleep(int __log_nsec, unsigned int& __iteration);
+};
+#endif // !_STLP_USE_PTHREAD_SPINLOCK
+
+// Locking class. Note that this class *does not have a constructor*.
+// It must be initialized either statically, with _STLP_MUTEX_INITIALIZER,
+// or dynamically, by explicitly calling the _M_initialize member function.
+// (This is similar to the ways that a pthreads mutex can be initialized.)
+// There are explicit member functions for acquiring and releasing the lock.
+
+// There is no constructor because static initialization is essential for
+// some uses, and only a class aggregate (see section 8.5.1 of the C++
+// standard) can be initialized that way. That means we must have no
+// constructors, no base classes, no virtual functions, and no private or
+// protected members.
+
+// For non-static cases, clients should use _STLP_mutex.
+
+struct _STLP_CLASS_DECLSPEC _STLP_mutex_base {
+#if defined (_STLP_ATOMIC_EXCHANGE) || defined (_STLP_SGI_THREADS)
+ // It should be relatively easy to get this to work on any modern Unix.
+ volatile __stl_atomic_t _M_lock;
+#endif
+
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ inline void _M_initialize() { _M_lock = 0; }
+ inline void _M_destroy() {}
+
+ void _M_acquire_lock() {
+ _STLP_mutex_spin<0>::_M_do_lock(&_M_lock);
+ }
+
+ inline void _M_release_lock() {
+ volatile __stl_atomic_t* __lock = &_M_lock;
+# if defined(_STLP_SGI_THREADS) && defined(__GNUC__) && __mips >= 3
+ asm("sync");
+ *__lock = 0;
+# elif defined(_STLP_SGI_THREADS) && __mips >= 3 && \
+ (defined (_ABIN32) || defined(_ABI64))
+ __lock_release(__lock);
+# elif defined (_STLP_SPARC_SOLARIS_THREADS)
+# if defined (__WORD64) || defined (__arch64__) || defined (__sparcv9) || defined (__sparcv8plus)
+ asm("membar #StoreStore ; membar #LoadStore");
+# else
+ asm(" stbar ");
+# endif
+ *__lock = 0;
+# else
+ *__lock = 0;
+ // This is not sufficient on many multiprocessors, since
+ // writes to protected variables and the lock may be reordered.
+# endif
+ }
+# elif defined (_STLP_PTHREADS)
+# if defined (_STLP_USE_PTHREAD_SPINLOCK)
+# if !defined (__OpenBSD__)
+ pthread_spinlock_t _M_lock;
+ inline void _M_initialize() { pthread_spin_init( &_M_lock, 0 ); }
+ inline void _M_destroy() { pthread_spin_destroy( &_M_lock ); }
+
+ // sorry, but no static initializer for pthread_spinlock_t;
+ // this will not work for compilers that has problems with call
+ // constructor of static object...
+
+ // _STLP_mutex_base()
+ // { pthread_spin_init( &_M_lock, 0 ); }
+
+ // ~_STLP_mutex_base()
+ // { pthread_spin_destroy( &_M_lock ); }
+
+ inline void _M_acquire_lock() { pthread_spin_lock( &_M_lock ); }
+ inline void _M_release_lock() { pthread_spin_unlock( &_M_lock ); }
+# else // __OpenBSD__
+ spinlock_t _M_lock;
+ inline void _M_initialize() { _SPINLOCK_INIT( &_M_lock ); }
+ inline void _M_destroy() { }
+ inline void _M_acquire_lock() { _SPINLOCK( &_M_lock ); }
+ inline void _M_release_lock() { _SPINUNLOCK( &_M_lock ); }
+# endif // __OpenBSD__
+# else // !_STLP_USE_PTHREAD_SPINLOCK
+ pthread_mutex_t _M_lock;
+ inline void _M_initialize()
+ { pthread_mutex_init(&_M_lock,_STLP_PTHREAD_ATTR_DEFAULT); }
+ inline void _M_destroy()
+ { pthread_mutex_destroy(&_M_lock); }
+ inline void _M_acquire_lock() {
+# if defined ( __hpux ) && ! defined (PTHREAD_MUTEX_INITIALIZER)
+ if (!_M_lock.field1) _M_initialize();
+# endif
+ pthread_mutex_lock(&_M_lock);
+ }
+ inline void _M_release_lock() { pthread_mutex_unlock(&_M_lock); }
+# endif // !_STLP_USE_PTHREAD_SPINLOCK
+
+# elif defined (_STLP_UITHREADS)
+ mutex_t _M_lock;
+ inline void _M_initialize()
+ { mutex_init(&_M_lock, 0, NULL); }
+ inline void _M_destroy()
+ { mutex_destroy(&_M_lock); }
+ inline void _M_acquire_lock() { mutex_lock(&_M_lock); }
+ inline void _M_release_lock() { mutex_unlock(&_M_lock); }
+
+# elif defined (_STLP_OS2THREADS)
+ HMTX _M_lock;
+ inline void _M_initialize() { DosCreateMutexSem(NULL, &_M_lock, 0, false); }
+ inline void _M_destroy() { DosCloseMutexSem(_M_lock); }
+ inline void _M_acquire_lock() {
+ if (!_M_lock) _M_initialize();
+ DosRequestMutexSem(_M_lock, SEM_INDEFINITE_WAIT);
+ }
+ inline void _M_release_lock() { DosReleaseMutexSem(_M_lock); }
+# elif defined (_STLP_BETHREADS)
+ sem_id sem;
+ inline void _M_initialize() {
+ sem = create_sem(1, "STLPort");
+ assert(sem > 0);
+ }
+ inline void _M_destroy() {
+ int t = delete_sem(sem);
+ assert(t == B_NO_ERROR);
+ }
+ inline void _M_acquire_lock();
+ inline void _M_release_lock() {
+ status_t t = release_sem(sem);
+ assert(t == B_NO_ERROR);
+ }
+# elif defined (_STLP_NWTHREADS)
+ LONG _M_lock;
+ inline void _M_initialize()
+ { _M_lock = OpenLocalSemaphore(1); }
+ inline void _M_destroy()
+ { CloseLocalSemaphore(_M_lock); }
+ inline void _M_acquire_lock()
+ { WaitOnLocalSemaphore(_M_lock); }
+ inline void _M_release_lock() { SignalLocalSemaphore(_M_lock); }
+# else //*ty 11/24/2001 - added configuration check
+# error "Unknown thread facility configuration"
+# endif
+#else /* No threads */
+ inline void _M_initialize() {}
+ inline void _M_destroy() {}
+ inline void _M_acquire_lock() {}
+ inline void _M_release_lock() {}
+#endif // _STLP_PTHREADS
+};
+
+// Locking class. The constructor initializes the lock, the destructor destroys it.
+// Well - behaving class, does not need static initializer
+
+class _STLP_CLASS_DECLSPEC _STLP_mutex : public _STLP_mutex_base {
+ public:
+ inline _STLP_mutex () { _M_initialize(); }
+ inline ~_STLP_mutex () { _M_destroy(); }
+ private:
+ _STLP_mutex(const _STLP_mutex&);
+ void operator=(const _STLP_mutex&);
+};
+
+// A locking class that uses _STLP_STATIC_MUTEX. The constructor takes
+// a reference to an _STLP_STATIC_MUTEX, and acquires a lock. The destructor
+// releases the lock.
+// It's not clear that this is exactly the right functionality.
+// It will probably change in the future.
+
+struct _STLP_CLASS_DECLSPEC _STLP_auto_lock {
+ _STLP_auto_lock(_STLP_STATIC_MUTEX& __lock) : _M_lock(__lock)
+ { _M_lock._M_acquire_lock(); }
+ ~_STLP_auto_lock()
+ { _M_lock._M_release_lock(); }
+
+private:
+ _STLP_STATIC_MUTEX& _M_lock;
+ void operator=(const _STLP_auto_lock&);
+ _STLP_auto_lock(const _STLP_auto_lock&);
+};
+
+/*
+ * Class _Refcount_Base provides a type, __stl_atomic_t, a data member,
+ * _M_ref_count, and member functions _M_incr and _M_decr, which perform
+ * atomic preincrement/predecrement. The constructor initializes
+ * _M_ref_count.
+ */
+class _STLP_CLASS_DECLSPEC _Refcount_Base {
+ // The data member _M_ref_count
+#if defined (__DMC__)
+public:
+#endif
+ _STLP_VOLATILE __stl_atomic_t _M_ref_count;
+
+#if defined (_STLP_THREADS) && \
+ (!defined (_STLP_ATOMIC_INCREMENT) || !defined (_STLP_ATOMIC_DECREMENT) || \
+ defined (_STLP_WIN95_LIKE))
+# define _STLP_USE_MUTEX
+ _STLP_mutex _M_mutex;
+#endif
+
+ public:
+ // Constructor
+ _Refcount_Base(__stl_atomic_t __n) : _M_ref_count(__n) {}
+#if defined (__BORLANDC__)
+ ~_Refcount_Base(){};
+#endif
+
+ // _M_incr and _M_decr
+#if defined (_STLP_THREADS)
+# if !defined (_STLP_USE_MUTEX)
+ __stl_atomic_t _M_incr() { return _STLP_ATOMIC_INCREMENT(&_M_ref_count); }
+ __stl_atomic_t _M_decr() { return _STLP_ATOMIC_DECREMENT(&_M_ref_count); }
+# else
+# undef _STLP_USE_MUTEX
+ __stl_atomic_t _M_incr() {
+ _STLP_auto_lock l(_M_mutex);
+ return ++_M_ref_count;
+ }
+ __stl_atomic_t _M_decr() {
+ _STLP_auto_lock l(_M_mutex);
+ return --_M_ref_count;
+ }
+# endif
+#else /* No threads */
+ __stl_atomic_t _M_incr() { return ++_M_ref_count; }
+ __stl_atomic_t _M_decr() { return --_M_ref_count; }
+#endif
+};
+
+/* Atomic swap on __stl_atomic_t
+ * This is guaranteed to behave as though it were atomic only if all
+ * possibly concurrent updates use _Atomic_swap.
+ * In some cases the operation is emulated with a lock.
+ * Idem for _Atomic_swap_ptr
+ */
+/* Helper struct to handle following cases:
+ * - on platforms where sizeof(__stl_atomic_t) == sizeof(void*) atomic
+ * exchange can be done on pointers
+ * - on platform without atomic operation swap is done in a critical section,
+ * portable but inefficient.
+ */
+template <int __use_ptr_atomic_swap>
+class _Atomic_swap_struct {
+public:
+#if defined (_STLP_THREADS) && \
+ !defined (_STLP_ATOMIC_EXCHANGE) && \
+ (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
+ defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
+# define _STLP_USE_ATOMIC_SWAP_MUTEX
+ static _STLP_STATIC_MUTEX _S_swap_lock;
+#endif
+
+ static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ return _STLP_ATOMIC_EXCHANGE(__p, __q);
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing atomic swap implementation
+# endif
+#else
+ /* no threads */
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ return __result;
+#endif // _STLP_THREADS
+ }
+
+ static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
+ return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
+# elif defined (_STLP_ATOMIC_EXCHANGE)
+ _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
+ return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
+ __REINTERPRET_CAST(__stl_atomic_t, __q))
+ );
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ void *__result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing pointer atomic swap implementation
+# endif
+#else
+ /* no thread */
+ void *__result = *__p;
+ *__p = __q;
+ return __result;
+#endif
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _Atomic_swap_struct<0> {
+public:
+#if defined (_STLP_THREADS) && \
+ (!defined (_STLP_ATOMIC_EXCHANGE) || !defined (_STLP_ATOMIC_EXCHANGE_PTR)) && \
+ (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
+ defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
+# define _STLP_USE_ATOMIC_SWAP_MUTEX
+ static _STLP_STATIC_MUTEX _S_swap_lock;
+#endif
+
+ static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ return _STLP_ATOMIC_EXCHANGE(__p, __q);
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ /* This should be portable, but performance is expected
+ * to be quite awful. This really needs platform specific
+ * code.
+ */
+ _S_swap_lock._M_acquire_lock();
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing atomic swap implementation
+# endif
+#else
+ /* no threads */
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ return __result;
+#endif // _STLP_THREADS
+ }
+
+ static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
+ return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
+# elif defined (_STLP_ATOMIC_EXCHANGE)
+ _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
+ return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
+ __REINTERPRET_CAST(__stl_atomic_t, __q))
+ );
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ void *__result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing pointer atomic swap implementation
+# endif
+#else
+ /* no thread */
+ void *__result = *__p;
+ *__p = __q;
+ return __result;
+#endif
+ }
+};
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
+# pragma warning (push)
+# pragma warning (disable : 4189) //__use_ptr_atomic_swap initialized but not used
+#endif
+
+inline __stl_atomic_t _STLP_CALL _Atomic_swap(_STLP_VOLATILE __stl_atomic_t * __p, __stl_atomic_t __q) {
+ const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
+ return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap(__p, __q);
+}
+
+inline void* _STLP_CALL _Atomic_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+ const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
+ return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap_ptr(__p, __q);
+}
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
+# pragma warning (pop)
+#endif
+
+#if defined (_STLP_BETHREADS)
+template <int __inst>
+struct _STLP_beos_static_lock_data {
+ static bool is_init;
+ struct mutex_t : public _STLP_mutex {
+ mutex_t()
+ { _STLP_beos_static_lock_data<0>::is_init = true; }
+ ~mutex_t()
+ { _STLP_beos_static_lock_data<0>::is_init = false; }
+ };
+ static mutex_t mut;
+};
+
+template <int __inst>
+bool _STLP_beos_static_lock_data<__inst>::is_init = false;
+template <int __inst>
+typename _STLP_beos_static_lock_data<__inst>::mutex_t _STLP_beos_static_lock_data<__inst>::mut;
+
+inline void _STLP_mutex_base::_M_acquire_lock() {
+ if (sem == 0) {
+ // we need to initialise on demand here
+ // to prevent race conditions use our global
+ // mutex if it's available:
+ if (_STLP_beos_static_lock_data<0>::is_init) {
+ _STLP_auto_lock al(_STLP_beos_static_lock_data<0>::mut);
+ if (sem == 0) _M_initialize();
+ }
+ else {
+ // no lock available, we must still be
+ // in startup code, THERE MUST BE ONE THREAD
+ // ONLY active at this point.
+ _M_initialize();
+ }
+ }
+ status_t t;
+ t = acquire_sem(sem);
+ assert(t == B_NO_ERROR);
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_threads.c>
+#endif
+
+#endif /* _STLP_INTERNAL_THREADS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_time_facets.c b/build/stlport/stlport/stl/_time_facets.c
new file mode 100644
index 000000000..a907ad53d
--- /dev/null
+++ b/build/stlport/stlport/stl/_time_facets.c
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_TIME_FACETS_C
+#define _STLP_TIME_FACETS_C
+
+#ifndef _STLP_INTERNAL_TIME_FACETS_H
+# include <stl/_time_facets.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Declarations of static template members.
+
+template <class _CharT, class _InputIterator>
+locale::id time_get<_CharT, _InputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+locale::id time_put<_CharT, _OutputIterator>::id;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/* Matching input against a list of names
+
+ * Alphabetic input of the names of months and the names
+ * of weekdays requires matching input against a list of names.
+ * We use a simple generic algorithm to accomplish this. This
+ * algorithm is not very efficient, especially for longer lists
+ * of names, but it probably does not matter for the initial
+ * implementation and it may never matter, since we do not expect
+ * this kind of input to be used very often. The algorithm
+ * could be improved fairly simply by creating a new list of
+ * names still in the running at each iteration. A more sophisticated
+ * approach would be to build a tree to do the matching.
+ *
+ * We compare each character of the input to the corresponding
+ * character of each name on the list that has not been eliminated,
+ * either because every character in the name has already been
+ * matched, or because some character has not been matched. We
+ * continue only as long as there are some names that have not been
+ * eliminated.
+
+ * We do not really need a random access iterator (a forward iterator
+ * would do), but the extra generality makes the notation clumsier,
+ * and we don't really need it.
+
+ * We can recognize a failed match by the fact that the return value
+ * will be __name_end.
+ */
+
+#define _MAXNAMES 24
+
+template <class _InIt, class _NameIt>
+size_t _STLP_CALL
+__match(_InIt& __first, _InIt& __last, _NameIt __name, _NameIt __name_end) {
+ typedef ptrdiff_t difference_type;
+ difference_type __n = __name_end - __name;
+ difference_type __i, __start = 0;
+ size_t __pos = 0;
+ difference_type __check_count = __n;
+ bool __do_not_check[_MAXNAMES];
+ size_t __matching_name_index = __n;
+
+ memset(__do_not_check, 0, sizeof(__do_not_check));
+
+ while (__first != __last) {
+ difference_type __new_n = __n;
+ for (__i = __start; __i < __n; ++__i) {
+ if (!__do_not_check[__i]) {
+ if (*__first == __name[__i][__pos]) {
+ if (__pos == (__name[__i].size() - 1)) {
+ __matching_name_index = __i;
+ __do_not_check[__i] = true;
+ if (__i == __start) ++__start;
+ --__check_count;
+ if (__check_count == 0) {
+ ++__first;
+ return __matching_name_index;
+ }
+ }
+ __new_n = __i + 1;
+ }
+ else {
+ __do_not_check[__i] = true;
+ if (__i == __start) ++__start;
+ --__check_count;
+ if (__check_count == 0)
+ return __matching_name_index;
+ }
+ }
+ else {
+ if (__i == __start) ++ __start;
+ }
+ }
+
+ __n = __new_n;
+ ++__first; ++__pos;
+ }
+
+ return __matching_name_index;
+}
+
+// __get_formatted_time reads input that is assumed to be formatted
+// according to the rules for the C strftime function (C standard,
+// 7.12.3.5). This function is used to implement the do_get_time
+// and do_get_date virtual functions, which depend on the locale
+// specifications for the time and day formats respectively.
+// Note the catchall default case, intended mainly for the '%Z'
+// format designator, which does not make sense here since the
+// representation of timezones is not part of the locale.
+//
+// The case branches are implemented either by doing a match using
+// the appopriate name table or by doing a __get_integer_nogroup.
+//
+// 'y' format is assumed to mean that the input represents years
+// since 1900. That is, 2002 should be represented as 102. There
+// is no century-guessing.
+//
+// The match is successful if and only if the second component of the
+// return value is format_end.
+
+// Note that the antepenultimate parameter is being used only to determine
+// the correct overloading for the calls to __get_integer_nogroup.
+template <class _InIt1, class _Ch, class _TimeInfo>
+string::const_iterator _STLP_CALL
+__get_formatted_time _STLP_WEAK (_InIt1 __first, _InIt1 __last,
+ string::const_iterator __format, string::const_iterator __format_end,
+ _Ch*, const _TimeInfo& __table,
+ const ios_base& __s, ios_base::iostate& __err, tm* __t) {
+ const ctype<_Ch>& __ct = use_facet<ctype<_Ch> >(__s.getloc());
+ size_t offset;
+
+ while (__first != __last && __format != __format_end) {
+ offset = 0;
+ if (*__format == '%') {
+ ++__format;
+ char __c = *__format;
+ if (__c == '#') { //MS extension
+ ++__format;
+ __c = *__format;
+ }
+
+ switch (__c) {
+ case 'A':
+ offset = 7;
+ case 'a': {
+ size_t __index = __match(__first, __last,
+ __table._M_dayname + offset, __table._M_dayname + offset + 7);
+ if (__index == 7)
+ return __format;
+ __t->tm_wday = __STATIC_CAST(int, __index);
+ break;
+ }
+
+ case 'B':
+ offset = 12;
+ case 'b': {
+ size_t __index = __match(__first, __last,
+ __table._M_monthname + offset, __table._M_monthname + offset + 12);
+ if (__index == 12)
+ return __format;
+ __t->tm_mon = __STATIC_CAST(int, __index);
+ break;
+ }
+
+ case 'd': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0));
+ if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) {
+ __err |= ios_base::failbit;
+ return __format;
+ }
+ break;
+ }
+
+ case 'H': case 'I': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'j': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'm': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0));
+ --__t->tm_mon;
+ if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) {
+ __err |= ios_base::failbit;
+ return __format;
+ }
+ break;
+ }
+
+ case 'M': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'p': {
+ size_t __index = __match(__first, __last,
+ __table._M_am_pm + 0, __table._M_am_pm + 2);
+ if (__index == 2)
+ return __format;
+ // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00
+ if (__index == 1 && __t->tm_hour != 12 )
+ __t->tm_hour += 12;
+ if (__index == 0 && __t->tm_hour == 12 )
+ __t->tm_hour = 0;
+ break;
+ }
+
+ case 'S': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'y': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'Y': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ __t->tm_year -= 1900;
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ else {
+ if (*__first++ != __ct.widen(*__format)) break;
+ }
+
+ ++__format;
+ }
+
+ return __format;
+}
+
+template <class _InIt, class _TimeInfo>
+bool _STLP_CALL
+__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const _TimeInfo& __table, tm* __t) {
+ size_t __index = __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14);
+ if (__index != 14) {
+ __t->tm_wday = __STATIC_CAST(int, __index % 7);
+ return true;
+ }
+ return false;
+}
+
+template <class _InIt, class _TimeInfo>
+bool _STLP_CALL
+__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const _TimeInfo& __table, tm* __t) {
+ size_t __index = __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24);
+ if (__index != 24) {
+ __t->tm_mon = __STATIC_CAST(int, __index % 12);
+ return true;
+ }
+ return false;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt __end,
+ ios_base& __str, ios_base::iostate& __err,
+ tm* __t) const {
+ typedef string::const_iterator string_iterator;
+
+ string_iterator __format = this->_M_timeinfo._M_date_format.begin();
+ string_iterator __format_end = this->_M_timeinfo._M_date_format.end();
+
+ string_iterator __result
+ = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
+ __STATIC_CAST(_Ch*, 0), this->_M_timeinfo,
+ __str, __err, __t);
+ if (__result == __format_end)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt __end,
+ ios_base& __str, ios_base::iostate& __err,
+ tm* __t) const {
+ typedef string::const_iterator string_iterator;
+ string_iterator __format = this->_M_timeinfo._M_time_format.begin();
+ string_iterator __format_end = this->_M_timeinfo._M_time_format.end();
+
+ string_iterator __result
+ = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
+ __STATIC_CAST(_Ch*, 0), this->_M_timeinfo,
+ __str, __err, __t);
+ __err = __result == __format_end ? ios_base::goodbit
+ : ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const {
+ if (__s == __end) {
+ __err = ios_base::failbit | ios_base::eofbit;
+ return __s;
+ }
+
+ bool __pr = _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ __t->tm_year -= 1900;
+ __err = __pr ? ios_base::goodbit : ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt __end,
+ ios_base &__str, ios_base::iostate &__err,
+ tm *__t) const {
+ bool __result =
+ _STLP_PRIV __get_short_or_long_dayname(__s, __end, this->_M_timeinfo, __t);
+ if (__result)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt __end,
+ ios_base &__str, ios_base::iostate &__err,
+ tm *__t) const {
+ bool __result =
+ _STLP_PRIV __get_short_or_long_monthname(__s, __end, this->_M_timeinfo, __t);
+ if (__result)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template<class _Ch, class _OutputIter>
+_OutputIter
+time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb, const _Ch* __pat,
+ const _Ch* __pat_end) const {
+ const ctype<_Ch>& _Ct = use_facet<ctype<_Ch> >(__f.getloc());
+ while (__pat != __pat_end) {
+ char __c = _Ct.narrow(*__pat, 0);
+ if (__c == '%') {
+ char __mod = 0;
+ ++__pat;
+ __c = _Ct.narrow(*__pat++, 0);
+ if (__c == '#') { // MS extension
+ __mod = __c;
+ __c = _Ct.narrow(*__pat++, 0);
+ }
+ __s = do_put(__s, __f, __fill, __tmb, __c, __mod);
+ }
+ else
+ *__s++ = *__pat++;
+ }
+ return __s;
+}
+
+template<class _Ch, class _OutputIter>
+_OutputIter
+time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */,
+ const tm* __tmb, char __format,
+ char __modifier ) const {
+ const ctype<_Ch>& __ct = use_facet<ctype<_Ch> >(__f.getloc());
+ _STLP_BASIC_IOSTRING(_Ch) __buf;
+ _STLP_PRIV __write_formatted_time(__buf, __ct, __format, __modifier, this->_M_timeinfo, __tmb);
+ return copy(__buf.begin(), __buf.end(), __s);
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TIME_FACETS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_time_facets.h b/build/stlport/stlport/stl/_time_facets.h
new file mode 100644
index 000000000..e67c2f47a
--- /dev/null
+++ b/build/stlport/stlport/stl/_time_facets.h
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_TIME_FACETS_H
+#define _STLP_INTERNAL_TIME_FACETS_H
+
+#ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h> // Needed (for struct tm) by time facets
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Template functions used by time_get
+
+/* Both time_get and time_put need a structure of type _Time_Info
+ * to provide names and abbreviated names for months and days,
+ * as well as the am/pm designator. The month and weekday tables
+ * have the all the abbreviated names before all the full names.
+ * The _Time_Info tables are initialized using the non-template
+ * time_base class, which has a default constructor and two protected.
+ * The default one initialize _Time_Info with "C" time info. The
+ * protected initialize _time_Info using a _Locale_time instance
+ * or using a name( in fact the name is used to build a _Locale_time
+ * instance that is then used for initialization). */
+
+class _STLP_CLASS_DECLSPEC _Time_Info_Base {
+public:
+ string _M_time_format;
+ string _M_date_format;
+ string _M_date_time_format;
+ string _M_long_date_format;
+ string _M_long_date_time_format;
+};
+
+class _STLP_CLASS_DECLSPEC _Time_Info : public _Time_Info_Base {
+public:
+ string _M_dayname[14];
+ string _M_monthname[24];
+ string _M_am_pm[2];
+};
+
+#ifndef _STLP_NO_WCHAR_T
+class _STLP_CLASS_DECLSPEC _WTime_Info : public _Time_Info_Base {
+public:
+ wstring _M_dayname[14];
+ wstring _M_monthname[24];
+ wstring _M_am_pm[2];
+};
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC time_base {
+public:
+ enum dateorder {no_order, dmy, mdy, ymd, ydm};
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Ch>
+class time_init;
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC time_init<char> {
+protected:
+ time_init();
+ time_init(const char *name);
+ time_init(_Locale_time*);
+#if defined (__BORLANDC__)
+ static
+#endif
+ _Time_Info _M_timeinfo;
+ time_base::dateorder _M_dateorder;
+};
+
+#ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC time_init<wchar_t> {
+protected:
+ time_init();
+ time_init(const char *name);
+ time_init(_Locale_time*);
+#if defined (__BORLANDC__)
+ static
+#endif
+ _WTime_Info _M_timeinfo;
+ time_base::dateorder _M_dateorder;
+};
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _InIt>
+class time_get : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> {
+public:
+ typedef _Ch char_type;
+ typedef _InIt iter_type;
+
+ explicit time_get(size_t __refs = 0) : locale::facet(__refs)
+ {}
+
+ dateorder date_order() const { return do_date_order(); }
+ iter_type get_time(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_time(__s, __end, __str, __err, __t); }
+ iter_type get_date(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_date(__s, __end, __str, __err, __t); }
+ iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_weekday(__s, __end, __str, __err, __t); }
+ iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_monthname(__s, __end, __str, __err, __t); }
+ iter_type get_year(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_year(__s, __end, __str, __err, __t); }
+
+ static locale::id id;
+
+protected:
+ time_get(const char* __name, size_t __refs)
+ : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name)
+ {}
+ time_get(_Locale_time *__time)
+ : _STLP_PRIV time_init<_Ch>(__time)
+ {}
+
+ ~time_get() {}
+
+ virtual dateorder do_date_order() const { return this->_M_dateorder; }
+
+ virtual iter_type do_get_time(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_date(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_weekday(iter_type __s, iter_type __end,
+ ios_base&,
+ ios_base::iostate& __err,
+ tm* __t) const;
+ virtual iter_type do_get_monthname(iter_type __s, iter_type __end,
+ ios_base&,
+ ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_year(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+};
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _InIt>
+#else
+template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_get_byname : public time_get<_Ch, _InIt> {
+ friend class _Locale_impl;
+public:
+ typedef time_base::dateorder dateorder;
+ typedef _InIt iter_type;
+
+ explicit time_get_byname(const char* __name, size_t __refs = 0)
+ : time_get<_Ch, _InIt>(__name, __refs) {}
+
+protected:
+ ~time_get_byname() {}
+ dateorder do_date_order() const { return this->_M_dateorder; }
+
+private:
+ time_get_byname(_Locale_time *__time)
+ : time_get<_Ch, _InIt>(__time)
+ {}
+
+ typedef time_get_byname<_Ch, _InIt> _Self;
+ //explicitely defined as private to avoid warnings:
+ time_get_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+// time_put facet
+
+// For the formats 'x, 'X', and 'c', do_put calls the first form of
+// put with the pattern obtained from _M_timeinfo._M_date_format or
+// _M_timeinfo._M_time_format.
+
+// Helper function: __ takes a single-character
+// format. As indicated by the foregoing remark, this will never be
+// 'x', 'X', or 'c'.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC void _STLP_CALL
+__write_formatted_time(__iostring&, const ctype<char>& __ct,
+ char __format, char __modifier,
+ const _Time_Info& __table, const tm* __t);
+
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC void _STLP_CALL
+__write_formatted_time(__iowstring&, const ctype<wchar_t>& __ct,
+ char __format, char __modifier,
+ const _WTime_Info& __table, const tm* __t);
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _OutIt>
+class time_put : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> {
+public:
+ typedef _Ch char_type;
+ typedef _OutIt iter_type;
+
+ explicit time_put(size_t __refs = 0) : locale::facet(__refs)
+ {}
+
+ _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb,
+ const _Ch* __pat, const _Ch* __pat_end) const;
+
+ _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb, char __format, char __modifier = 0) const
+ { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }
+
+ static locale::id id;
+
+protected:
+ time_put(const char* __name, size_t __refs)
+ : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name)
+ {}
+ time_put(_Locale_time *__time)
+ : _STLP_PRIV time_init<_Ch>(__time)
+ {}
+ ~time_put() {}
+ virtual iter_type do_put(iter_type __s, ios_base& __f,
+ char_type /* __fill */, const tm* __tmb,
+ char __format, char /* __modifier */) const;
+};
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _OutIt>
+#else
+template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_put_byname : public time_put<_Ch, _OutIt> {
+ friend class _Locale_impl;
+public:
+ typedef time_base::dateorder dateorder;
+ typedef _OutIt iter_type;
+ typedef _Ch char_type;
+
+ explicit time_put_byname(const char * __name, size_t __refs = 0)
+ : time_put<_Ch, _OutIt>(__name, __refs)
+ {}
+
+protected:
+ ~time_put_byname() {}
+
+private:
+ time_put_byname(_Locale_time *__time)
+ : time_put<_Ch, _OutIt>(__time)
+ {}
+
+ typedef time_put_byname<_Ch, _OutIt> _Self;
+ //explicitely defined as private to avoid warnings:
+ time_put_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS time_get<char, istreambuf_iterator<char, char_traits<char> > >;
+_STLP_EXPORT_TEMPLATE_CLASS time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+_STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_time_facets.c>
+#endif
+
+#endif /* _STLP_INTERNAL_TIME_FACETS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_tree.c b/build/stlport/stlport/stl/_tree.c
new file mode 100644
index 000000000..818fcc4ac
--- /dev/null
+++ b/build/stlport/stlport/stl/_tree.c
@@ -0,0 +1,730 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ * Modified CRP 7/10/00 for improved conformance / efficiency on insert_unique /
+ * insert_equal with valid hint -- efficiency is improved all around, and it is
+ * should now be standard conforming for complexity on insert point immediately
+ * after hint (amortized constant time).
+ *
+ */
+#ifndef _STLP_TREE_C
+#define _STLP_TREE_C
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+#endif
+
+// fbp: these defines are for outline methods definitions.
+// needed for definitions to be portable. Should not be used in method bodies.
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __iterator__ _Rb_tree_iterator<_Value, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits>
+# define __size_type__ size_t
+# define iterator __iterator__
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::iterator
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::size_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+template <class _Dummy> void _STLP_CALL
+_Rb_global<_Dummy>::_Rotate_left(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base*& __root) {
+ _Rb_tree_node_base* __y = __x->_M_right;
+ __x->_M_right = __y->_M_left;
+ if (__y->_M_left != 0)
+ __y->_M_left->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_left)
+ __x->_M_parent->_M_left = __y;
+ else
+ __x->_M_parent->_M_right = __y;
+ __y->_M_left = __x;
+ __x->_M_parent = __y;
+}
+
+template <class _Dummy> void _STLP_CALL
+_Rb_global<_Dummy>::_Rotate_right(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base*& __root) {
+ _Rb_tree_node_base* __y = __x->_M_left;
+ __x->_M_left = __y->_M_right;
+ if (__y->_M_right != 0)
+ __y->_M_right->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_right)
+ __x->_M_parent->_M_right = __y;
+ else
+ __x->_M_parent->_M_left = __y;
+ __y->_M_right = __x;
+ __x->_M_parent = __y;
+}
+
+template <class _Dummy> void _STLP_CALL
+_Rb_global<_Dummy>::_Rebalance(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base*& __root) {
+ __x->_M_color = _S_rb_tree_red;
+ while (__x != __root && __x->_M_parent->_M_color == _S_rb_tree_red) {
+ if (__x->_M_parent == __x->_M_parent->_M_parent->_M_left) {
+ _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_right;
+ if (__y && __y->_M_color == _S_rb_tree_red) {
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __y->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ __x = __x->_M_parent->_M_parent;
+ }
+ else {
+ if (__x == __x->_M_parent->_M_right) {
+ __x = __x->_M_parent;
+ _Rotate_left(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ _Rotate_right(__x->_M_parent->_M_parent, __root);
+ }
+ }
+ else {
+ _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_left;
+ if (__y && __y->_M_color == _S_rb_tree_red) {
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __y->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ __x = __x->_M_parent->_M_parent;
+ }
+ else {
+ if (__x == __x->_M_parent->_M_left) {
+ __x = __x->_M_parent;
+ _Rotate_right(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_rb_tree_black;
+ __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
+ _Rotate_left(__x->_M_parent->_M_parent, __root);
+ }
+ }
+ }
+ __root->_M_color = _S_rb_tree_black;
+}
+
+template <class _Dummy> _Rb_tree_node_base* _STLP_CALL
+_Rb_global<_Dummy>::_Rebalance_for_erase(_Rb_tree_node_base* __z,
+ _Rb_tree_node_base*& __root,
+ _Rb_tree_node_base*& __leftmost,
+ _Rb_tree_node_base*& __rightmost) {
+ _Rb_tree_node_base* __y = __z;
+ _Rb_tree_node_base* __x;
+ _Rb_tree_node_base* __x_parent;
+
+ if (__y->_M_left == 0) // __z has at most one non-null child. y == z.
+ __x = __y->_M_right; // __x might be null.
+ else {
+ if (__y->_M_right == 0) // __z has exactly one non-null child. y == z.
+ __x = __y->_M_left; // __x is not null.
+ else { // __z has two non-null children. Set __y to
+ __y = _Rb_tree_node_base::_S_minimum(__y->_M_right); // __z's successor. __x might be null.
+ __x = __y->_M_right;
+ }
+ }
+
+ if (__y != __z) { // relink y in place of z. y is z's successor
+ __z->_M_left->_M_parent = __y;
+ __y->_M_left = __z->_M_left;
+ if (__y != __z->_M_right) {
+ __x_parent = __y->_M_parent;
+ if (__x) __x->_M_parent = __y->_M_parent;
+ __y->_M_parent->_M_left = __x; // __y must be a child of _M_left
+ __y->_M_right = __z->_M_right;
+ __z->_M_right->_M_parent = __y;
+ }
+ else
+ __x_parent = __y;
+ if (__root == __z)
+ __root = __y;
+ else if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __y;
+ else
+ __z->_M_parent->_M_right = __y;
+ __y->_M_parent = __z->_M_parent;
+ _STLP_STD::swap(__y->_M_color, __z->_M_color);
+ __y = __z;
+ // __y now points to node to be actually deleted
+ }
+ else { // __y == __z
+ __x_parent = __y->_M_parent;
+ if (__x) __x->_M_parent = __y->_M_parent;
+ if (__root == __z)
+ __root = __x;
+ else {
+ if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __x;
+ else
+ __z->_M_parent->_M_right = __x;
+ }
+
+ if (__leftmost == __z) {
+ if (__z->_M_right == 0) // __z->_M_left must be null also
+ __leftmost = __z->_M_parent;
+ // makes __leftmost == _M_header if __z == __root
+ else
+ __leftmost = _Rb_tree_node_base::_S_minimum(__x);
+ }
+ if (__rightmost == __z) {
+ if (__z->_M_left == 0) // __z->_M_right must be null also
+ __rightmost = __z->_M_parent;
+ // makes __rightmost == _M_header if __z == __root
+ else // __x == __z->_M_left
+ __rightmost = _Rb_tree_node_base::_S_maximum(__x);
+ }
+ }
+
+ if (__y->_M_color != _S_rb_tree_red) {
+ while (__x != __root && (__x == 0 || __x->_M_color == _S_rb_tree_black))
+ if (__x == __x_parent->_M_left) {
+ _Rb_tree_node_base* __w = __x_parent->_M_right;
+ if (__w->_M_color == _S_rb_tree_red) {
+ __w->_M_color = _S_rb_tree_black;
+ __x_parent->_M_color = _S_rb_tree_red;
+ _Rotate_left(__x_parent, __root);
+ __w = __x_parent->_M_right;
+ }
+ if ((__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_rb_tree_black) && (__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_rb_tree_black)) {
+ __w->_M_color = _S_rb_tree_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ } else {
+ if (__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_rb_tree_black) {
+ if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black;
+ __w->_M_color = _S_rb_tree_red;
+ _Rotate_right(__w, __root);
+ __w = __x_parent->_M_right;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_rb_tree_black;
+ if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black;
+ _Rotate_left(__x_parent, __root);
+ break;
+ }
+ } else { // same as above, with _M_right <-> _M_left.
+ _Rb_tree_node_base* __w = __x_parent->_M_left;
+ if (__w->_M_color == _S_rb_tree_red) {
+ __w->_M_color = _S_rb_tree_black;
+ __x_parent->_M_color = _S_rb_tree_red;
+ _Rotate_right(__x_parent, __root);
+ __w = __x_parent->_M_left;
+ }
+ if ((__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_rb_tree_black) && (__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_rb_tree_black)) {
+ __w->_M_color = _S_rb_tree_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ } else {
+ if (__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_rb_tree_black) {
+ if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black;
+ __w->_M_color = _S_rb_tree_red;
+ _Rotate_left(__w, __root);
+ __w = __x_parent->_M_left;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_rb_tree_black;
+ if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black;
+ _Rotate_right(__x_parent, __root);
+ break;
+ }
+ }
+ if (__x) __x->_M_color = _S_rb_tree_black;
+ }
+ return __y;
+}
+
+template <class _Dummy> _Rb_tree_node_base* _STLP_CALL
+_Rb_global<_Dummy>::_M_decrement(_Rb_tree_node_base* _M_node) {
+ if (_M_node->_M_color == _S_rb_tree_red && _M_node->_M_parent->_M_parent == _M_node)
+ _M_node = _M_node->_M_right;
+ else if (_M_node->_M_left != 0) {
+ _M_node = _Rb_tree_node_base::_S_maximum(_M_node->_M_left);
+ }
+ else {
+ _Base_ptr __y = _M_node->_M_parent;
+ while (_M_node == __y->_M_left) {
+ _M_node = __y;
+ __y = __y->_M_parent;
+ }
+ _M_node = __y;
+ }
+ return _M_node;
+}
+
+template <class _Dummy> _Rb_tree_node_base* _STLP_CALL
+_Rb_global<_Dummy>::_M_increment(_Rb_tree_node_base* _M_node) {
+ if (_M_node->_M_right != 0) {
+ _M_node = _Rb_tree_node_base::_S_minimum(_M_node->_M_right);
+ }
+ else {
+ _Base_ptr __y = _M_node->_M_parent;
+ while (_M_node == __y->_M_right) {
+ _M_node = __y;
+ __y = __y->_M_parent;
+ }
+ // check special case: This is necessary if _M_node is the
+ // _M_head and the tree contains only a single node __y. In
+ // that case parent, left and right all point to __y!
+ if (_M_node->_M_right != __y)
+ _M_node = __y;
+ }
+ return _M_node;
+}
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>&
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::operator=(
+ const _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>& __x) {
+ if (this != &__x) {
+ // Note that _Key may be a constant type.
+ clear();
+ _M_node_count = 0;
+ _M_key_compare = __x._M_key_compare;
+ if (__x._M_root() == 0) {
+ _M_root() = 0;
+ _M_leftmost() = &this->_M_header._M_data;
+ _M_rightmost() = &this->_M_header._M_data;
+ }
+ else {
+ _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data);
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ _M_node_count = __x._M_node_count;
+ }
+ }
+ return *this;
+}
+
+// CRP 7/10/00 inserted argument __on_right, which is another hint (meant to
+// act like __on_left and ignore a portion of the if conditions -- specify
+// __on_right != 0 to bypass comparison as false or __on_left != 0 to bypass
+// comparison as true)
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_insert(_Rb_tree_node_base * __parent,
+ const _Value& __val,
+ _Rb_tree_node_base * __on_left,
+ _Rb_tree_node_base * __on_right) {
+ // We do not create the node here as, depending on tests, we might call
+ // _M_key_compare that can throw an exception.
+ _Base_ptr __new_node;
+
+ if ( __parent == &this->_M_header._M_data ) {
+ __new_node = _M_create_node(__val);
+ _S_left(__parent) = __new_node; // also makes _M_leftmost() = __new_node
+ _M_root() = __new_node;
+ _M_rightmost() = __new_node;
+ }
+ else if ( __on_right == 0 && // If __on_right != 0, the remainder fails to false
+ ( __on_left != 0 || // If __on_left != 0, the remainder succeeds to true
+ _M_key_compare( _KeyOfValue()(__val), _S_key(__parent) ) ) ) {
+ __new_node = _M_create_node(__val);
+ _S_left(__parent) = __new_node;
+ if (__parent == _M_leftmost())
+ _M_leftmost() = __new_node; // maintain _M_leftmost() pointing to min node
+ }
+ else {
+ __new_node = _M_create_node(__val);
+ _S_right(__parent) = __new_node;
+ if (__parent == _M_rightmost())
+ _M_rightmost() = __new_node; // maintain _M_rightmost() pointing to max node
+ }
+ _S_parent(__new_node) = __parent;
+ _Rb_global_inst::_Rebalance(__new_node, this->_M_header._M_data._M_parent);
+ ++_M_node_count;
+ return iterator(__new_node);
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(const _Value& __val) {
+ _Base_ptr __y = &this->_M_header._M_data;
+ _Base_ptr __x = _M_root();
+ while (__x != 0) {
+ __y = __x;
+ if (_M_key_compare(_KeyOfValue()(__val), _S_key(__x))) {
+ __x = _S_left(__x);
+ }
+ else
+ __x = _S_right(__x);
+ }
+ return _M_insert(__y, __val, __x);
+}
+
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+pair<__iterator__, bool>
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(const _Value& __val) {
+ _Base_ptr __y = &this->_M_header._M_data;
+ _Base_ptr __x = _M_root();
+ bool __comp = true;
+ while (__x != 0) {
+ __y = __x;
+ __comp = _M_key_compare(_KeyOfValue()(__val), _S_key(__x));
+ __x = __comp ? _S_left(__x) : _S_right(__x);
+ }
+ iterator __j = iterator(__y);
+ if (__comp) {
+ if (__j == begin())
+ return pair<iterator,bool>(_M_insert(__y, __val, /* __x*/ __y), true);
+ else
+ --__j;
+ }
+ if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__val))) {
+ return pair<iterator,bool>(_M_insert(__y, __val, __x), true);
+ }
+ return pair<iterator,bool>(__j, false);
+}
+
+// Modifications CRP 7/10/00 as noted to improve conformance and
+// efficiency.
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(iterator __position,
+ const _Value& __val) {
+ if (__position._M_node == this->_M_header._M_data._M_left) { // begin()
+
+ // if the container is empty, fall back on insert_unique.
+ if (empty())
+ return insert_unique(__val).first;
+
+ if (_M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node))) {
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ }
+ // first argument just needs to be non-null
+ else {
+ bool __comp_pos_v = _M_key_compare( _S_key(__position._M_node), _KeyOfValue()(__val) );
+
+ if (__comp_pos_v == false) // compare > and compare < both false so compare equal
+ return __position;
+ //Below __comp_pos_v == true
+
+ // Standard-conformance - does the insertion point fall immediately AFTER
+ // the hint?
+ iterator __after = __position;
+ ++__after;
+
+ // Check for only one member -- in that case, __position points to itself,
+ // and attempting to increment will cause an infinite loop.
+ if (__after._M_node == &this->_M_header._M_data)
+ // Check guarantees exactly one member, so comparison was already
+ // performed and we know the result; skip repeating it in _M_insert
+ // by specifying a non-zero fourth argument.
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+
+ // All other cases:
+
+ // Optimization to catch insert-equivalent -- save comparison results,
+ // and we get this for free.
+ if (_M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) )) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ }
+ else {
+ return insert_unique(__val).first;
+ }
+ }
+ }
+ else if (__position._M_node == &this->_M_header._M_data) { // end()
+ if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__val))) {
+ // pass along to _M_insert that it can skip comparing
+ // v, Key ; since compare Key, v was true, compare v, Key must be false.
+ return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null
+ }
+ else
+ return insert_unique(__val).first;
+ }
+ else {
+ iterator __before = __position;
+ --__before;
+
+ bool __comp_v_pos = _M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node));
+
+ if (__comp_v_pos
+ && _M_key_compare( _S_key(__before._M_node), _KeyOfValue()(__val) )) {
+
+ if (_S_right(__before._M_node) == 0)
+ return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null
+ else
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ // first argument just needs to be non-null
+ }
+ else {
+ // Does the insertion point fall immediately AFTER the hint?
+ iterator __after = __position;
+ ++__after;
+ // Optimization to catch equivalent cases and avoid unnecessary comparisons
+ bool __comp_pos_v = !__comp_v_pos; // Stored this result earlier
+ // If the earlier comparison was true, this comparison doesn't need to be
+ // performed because it must be false. However, if the earlier comparison
+ // was false, we need to perform this one because in the equal case, both will
+ // be false.
+ if (!__comp_v_pos) {
+ __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val));
+ }
+
+ if ( (!__comp_v_pos) // comp_v_pos true implies comp_v_pos false
+ && __comp_pos_v
+ && (__after._M_node == &this->_M_header._M_data ||
+ _M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) ))) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ } else {
+ // Test for equivalent case
+ if (__comp_v_pos == __comp_pos_v)
+ return __position;
+ else
+ return insert_unique(__val).first;
+ }
+ }
+ }
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+__iterator__
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(iterator __position,
+ const _Value& __val) {
+ if (__position._M_node == this->_M_header._M_data._M_left) { // begin()
+
+ // Check for zero members
+ if (size() <= 0)
+ return insert_equal(__val);
+
+ if (!_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val)))
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ else {
+ // Check for only one member
+ if (__position._M_node->_M_left == __position._M_node)
+ // Unlike insert_unique, can't avoid doing a comparison here.
+ return _M_insert(__position._M_node, __val);
+
+ // All other cases:
+ // Standard-conformance - does the insertion point fall immediately AFTER
+ // the hint?
+ iterator __after = __position;
+ ++__after;
+
+ // Already know that compare(pos, v) must be true!
+ // Therefore, we want to know if compare(after, v) is false.
+ // (i.e., we now pos < v, now we want to know if v <= after)
+ // If not, invalid hint.
+ if ( __after._M_node == &this->_M_header._M_data ||
+ !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ }
+ else { // Invalid hint
+ return insert_equal(__val);
+ }
+ }
+ }
+ else if (__position._M_node == &this->_M_header._M_data) { // end()
+ if (!_M_key_compare(_KeyOfValue()(__val), _S_key(_M_rightmost())))
+ return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null
+ else {
+ return insert_equal(__val);
+ }
+ }
+ else {
+ iterator __before = __position;
+ --__before;
+ // store the result of the comparison between pos and v so
+ // that we don't have to do it again later. Note that this reverses the shortcut
+ // on the if, possibly harming efficiency in comparisons; I think the harm will
+ // be negligible, and to do what I want to do (save the result of a comparison so
+ // that it can be re-used) there is no alternative. Test here is for before <= v <= pos.
+ bool __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val));
+ if (!__comp_pos_v &&
+ !_M_key_compare(_KeyOfValue()(__val), _S_key(__before._M_node))) {
+ if (_S_right(__before._M_node) == 0)
+ return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null
+ else
+ return _M_insert(__position._M_node, __val, __position._M_node);
+ }
+ else {
+ // Does the insertion point fall immediately AFTER the hint?
+ // Test for pos < v <= after
+ iterator __after = __position;
+ ++__after;
+
+ if (__comp_pos_v &&
+ ( __after._M_node == &this->_M_header._M_data ||
+ !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) ) {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert(__position._M_node, __val, 0, __position._M_node);
+ else
+ return _M_insert(__after._M_node, __val, __after._M_node);
+ }
+ else { // Invalid hint
+ return insert_equal(__val);
+ }
+ }
+ }
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+_Rb_tree_node_base*
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_copy(_Rb_tree_node_base* __x,
+ _Rb_tree_node_base* __p) {
+ // structural copy. __x and __p must be non-null.
+ _Base_ptr __top = _M_clone_node(__x);
+ _S_parent(__top) = __p;
+
+ _STLP_TRY {
+ if (_S_right(__x))
+ _S_right(__top) = _M_copy(_S_right(__x), __top);
+ __p = __top;
+ __x = _S_left(__x);
+
+ while (__x != 0) {
+ _Base_ptr __y = _M_clone_node(__x);
+ _S_left(__p) = __y;
+ _S_parent(__y) = __p;
+ if (_S_right(__x))
+ _S_right(__y) = _M_copy(_S_right(__x), __y);
+ __p = __y;
+ __x = _S_left(__x);
+ }
+ }
+ _STLP_UNWIND(_M_erase(__top))
+
+ return __top;
+}
+
+// this has to stay out-of-line : it's recursive
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+void
+_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::_M_erase(_Rb_tree_node_base *__x) {
+ // erase without rebalancing
+ while (__x != 0) {
+ _M_erase(_S_right(__x));
+ _Base_ptr __y = _S_left(__x);
+ _STLP_STD::_Destroy(&_S_value(__x));
+ this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x),1);
+ __x = __y;
+ }
+}
+
+#if defined (_STLP_DEBUG)
+inline int
+__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root) {
+ if (__node == 0)
+ return 0;
+ else {
+ int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0;
+ if (__node == __root)
+ return __bc;
+ else
+ return __bc + __black_count(__node->_M_parent, __root);
+ }
+}
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+bool _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::__rb_verify() const {
+ if (_M_node_count == 0 || begin() == end())
+ return ((_M_node_count == 0) &&
+ (begin() == end()) &&
+ (this->_M_header._M_data._M_left == &this->_M_header._M_data) &&
+ (this->_M_header._M_data._M_right == &this->_M_header._M_data));
+
+ int __len = __black_count(_M_leftmost(), _M_root());
+ for (const_iterator __it = begin(); __it != end(); ++__it) {
+ _Base_ptr __x = __it._M_node;
+ _Base_ptr __L = _S_left(__x);
+ _Base_ptr __R = _S_right(__x);
+
+ if (__x->_M_color == _S_rb_tree_red)
+ if ((__L && __L->_M_color == _S_rb_tree_red) ||
+ (__R && __R->_M_color == _S_rb_tree_red))
+ return false;
+
+ if (__L && _M_key_compare(_S_key(__x), _S_key(__L)))
+ return false;
+ if (__R && _M_key_compare(_S_key(__R), _S_key(__x)))
+ return false;
+
+ if (!__L && !__R && __black_count(__x, _M_root()) != __len)
+ return false;
+ }
+
+ if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
+ return false;
+ if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
+ return false;
+
+ return true;
+}
+#endif /* _STLP_DEBUG */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#undef _Rb_tree
+#undef __iterator__
+#undef iterator
+#undef __size_type__
+
+#endif /* _STLP_TREE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_tree.h b/build/stlport/stlport/stl/_tree.h
new file mode 100644
index 000000000..bf059015e
--- /dev/null
+++ b/build/stlport/stlport/stl/_tree.h
@@ -0,0 +1,684 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_TREE_H
+#define _STLP_INTERNAL_TREE_H
+
+/*
+
+Red-black tree class, designed for use in implementing STL
+associative containers (set, multiset, map, and multimap). The
+insertion and deletion algorithms are based on those in Cormen,
+Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990),
+except that
+
+(1) the header cell is maintained with links not only to the root
+but also to the leftmost node of the tree, to enable constant time
+begin(), and to the rightmost node of the tree, to enable linear time
+performance when used with the generic set algorithms (set_union,
+etc.);
+
+(2) when a node being deleted has two children its successor node is
+relinked into its place, rather than copied, so that the only
+iterators invalidated are those referring to the deleted node.
+
+*/
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef bool _Rb_tree_Color_type;
+//const _Rb_tree_Color_type _S_rb_tree_red = false;
+//const _Rb_tree_Color_type _S_rb_tree_black = true;
+
+#define _S_rb_tree_red false
+#define _S_rb_tree_black true
+
+struct _Rb_tree_node_base {
+ typedef _Rb_tree_Color_type _Color_type;
+ typedef _Rb_tree_node_base* _Base_ptr;
+
+ _Color_type _M_color;
+ _Base_ptr _M_parent;
+ _Base_ptr _M_left;
+ _Base_ptr _M_right;
+
+ static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+};
+
+template <class _Value>
+struct _Rb_tree_node : public _Rb_tree_node_base {
+ _Value _M_value_field;
+ __TRIVIAL_STUFF(_Rb_tree_node)
+};
+
+struct _Rb_tree_base_iterator;
+
+template <class _Dummy>
+class _Rb_global {
+public:
+ typedef _Rb_tree_node_base* _Base_ptr;
+ // those used to be global functions
+ static void _STLP_CALL _Rebalance(_Base_ptr __x, _Base_ptr& __root);
+ static _Base_ptr _STLP_CALL _Rebalance_for_erase(_Base_ptr __z,
+ _Base_ptr& __root,
+ _Base_ptr& __leftmost,
+ _Base_ptr& __rightmost);
+ // those are from _Rb_tree_base_iterator - moved here to reduce code bloat
+ // moved here to reduce code bloat without templatizing _Rb_tree_base_iterator
+ static _Base_ptr _STLP_CALL _M_increment (_Base_ptr);
+ static _Base_ptr _STLP_CALL _M_decrement (_Base_ptr);
+ static void _STLP_CALL _Rotate_left (_Base_ptr __x, _Base_ptr& __root);
+ static void _STLP_CALL _Rotate_right(_Base_ptr __x, _Base_ptr& __root);
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_global<bool>;
+# endif
+
+typedef _Rb_global<bool> _Rb_global_inst;
+
+struct _Rb_tree_base_iterator {
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ _Base_ptr _M_node;
+ _Rb_tree_base_iterator() : _M_node(0) {}
+ _Rb_tree_base_iterator(_Base_ptr __x) : _M_node(__x) {}
+};
+
+template <class _Value, class _Traits>
+struct _Rb_tree_iterator : public _Rb_tree_base_iterator {
+ typedef _Value value_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+ typedef _Rb_tree_iterator<_Value, _Traits> _Self;
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef _Rb_tree_node<_Value>* _Link_type;
+
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Rb_tree_iterator<_Value, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Rb_tree_iterator<_Value, _ConstTraits> const_iterator;
+
+ _Rb_tree_iterator() {}
+#if !defined (_STLP_DEBUG)
+ /* In STL debug mode we need this constructor implicit for the pointer
+ * specialization implementation.
+ */
+ explicit
+#endif
+ _Rb_tree_iterator(_Base_ptr __x) : _Rb_tree_base_iterator(__x) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Rb_tree_iterator(const iterator& __it) : _Rb_tree_base_iterator(__it._M_node) {}
+
+ reference operator*() const {
+ return __STATIC_CAST(_Link_type, _M_node)->_M_value_field;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_node = _Rb_global_inst::_M_increment(_M_node);
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+
+ _Self& operator--() {
+ _M_node = _Rb_global_inst::_M_decrement(_M_node);
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+
+ bool operator == (const_iterator __rhs) const {
+ return _M_node == __rhs._M_node;
+ }
+ bool operator != (const_iterator __rhs) const {
+ return _M_node != __rhs._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Value, class _Traits>
+struct __type_traits<_STLP_PRIV _Rb_tree_iterator<_Value, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Value, class _Traits>
+inline _Value* value_type(const _STLP_PRIV _Rb_tree_iterator<_Value, _Traits>&)
+{ return (_Value*)0; }
+inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _Rb_tree_base_iterator&)
+{ return bidirectional_iterator_tag(); }
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Rb_tree_base_iterator&)
+{ return (ptrdiff_t*) 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+// Base class to help EH
+
+template <class _Tp, class _Alloc>
+class _Rb_tree_base {
+public:
+ typedef _Rb_tree_node_base _Node_base;
+ typedef _Rb_tree_node<_Tp> _Node;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+private:
+ typedef _Rb_tree_base<_Tp, _Alloc> _Self;
+ typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator_type;
+ typedef _STLP_alloc_proxy<_Node_base, _Node, _M_node_allocator_type> _AllocProxy;
+
+public:
+ allocator_type get_allocator() const {
+ return _STLP_CONVERT_ALLOCATOR(_M_header, _Tp);
+ }
+
+protected:
+ _Rb_tree_base(const allocator_type& __a) :
+ _M_header(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base() ) {
+ _M_empty_initialize();
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Rb_tree_base(__move_source<_Self> src) :
+ _M_header(__move_source<_AllocProxy>(src.get()._M_header)) {
+ _M_rebind(&src.get()._M_header._M_data);
+ src.get()._M_empty_initialize();
+ }
+#endif
+
+ void _M_empty_initialize() {
+ _M_header._M_data._M_color = _S_rb_tree_red; // used to distinguish header from
+ // __root, in iterator.operator++
+ _M_header._M_data._M_parent = 0;
+ _M_header._M_data._M_left = &_M_header._M_data;
+ _M_header._M_data._M_right = &_M_header._M_data;
+ }
+
+ void _M_rebind(_Node_base *__static_node) {
+ if (_M_header._M_data._M_parent != 0) {
+ _M_header._M_data._M_parent->_M_parent = &_M_header._M_data;
+ }
+ if (_M_header._M_data._M_right == __static_node) {
+ _M_header._M_data._M_right = &_M_header._M_data;
+ }
+ if (_M_header._M_data._M_left == __static_node) {
+ _M_header._M_data._M_left = &_M_header._M_data;
+ }
+ }
+
+ _AllocProxy _M_header;
+};
+
+#if defined (_STLP_DEBUG)
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+#endif
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits,
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class _Rb_tree : public _Rb_tree_base<_Value, _Alloc> {
+ typedef _Rb_tree_base<_Value, _Alloc> _Base;
+ typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
+protected:
+ typedef _Rb_tree_node_base * _Base_ptr;
+ typedef _Rb_tree_node<_Value> _Node;
+ typedef _Node* _Link_type;
+ typedef _Rb_tree_Color_type _Color_type;
+public:
+ typedef _Key key_type;
+ typedef _Value value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef const value_type* const_pointer;
+ typedef typename _Traits::reference reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+ typedef typename _Base::allocator_type allocator_type;
+
+protected:
+
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+ _Base_ptr _M_create_node(const value_type& __x) {
+ _Link_type __tmp = this->_M_header.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__tmp->_M_value_field, __x);
+ }
+ _STLP_UNWIND(this->_M_header.deallocate(__tmp,1))
+ _S_left(__tmp) = 0;
+ _S_right(__tmp) = 0;
+ return __tmp;
+ }
+
+ _Base_ptr _M_clone_node(_Base_ptr __x) {
+ _Base_ptr __tmp = _M_create_node(_S_value(__x));
+ _S_color(__tmp) = _S_color(__x);
+ return __tmp;
+ }
+
+ size_type _M_node_count; // keeps track of size of tree
+ _Compare _M_key_compare;
+
+ _Base_ptr _M_root() const
+ { return this->_M_header._M_data._M_parent; }
+ _Base_ptr _M_leftmost() const
+ { return this->_M_header._M_data._M_left; }
+ _Base_ptr _M_rightmost() const
+ { return this->_M_header._M_data._M_right; }
+
+ _Base_ptr& _M_root()
+ { return this->_M_header._M_data._M_parent; }
+ _Base_ptr& _M_leftmost()
+ { return this->_M_header._M_data._M_left; }
+ _Base_ptr& _M_rightmost()
+ { return this->_M_header._M_data._M_right; }
+
+ static _Base_ptr& _STLP_CALL _S_left(_Base_ptr __x)
+ { return __x->_M_left; }
+ static _Base_ptr& _STLP_CALL _S_right(_Base_ptr __x)
+ { return __x->_M_right; }
+ static _Base_ptr& _STLP_CALL _S_parent(_Base_ptr __x)
+ { return __x->_M_parent; }
+ static value_type& _STLP_CALL _S_value(_Base_ptr __x)
+ { return __STATIC_CAST(_Link_type, __x)->_M_value_field; }
+ static const _Key& _STLP_CALL _S_key(_Base_ptr __x)
+ { return _KeyOfValue()(_S_value(__x));}
+ static _Color_type& _STLP_CALL _S_color(_Base_ptr __x)
+ { return (_Color_type&)(__x->_M_color); }
+
+ static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_minimum(__x); }
+
+ static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_maximum(__x); }
+
+public:
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Rb_tree_iterator<value_type, _NonConstTraits> iterator;
+ typedef _Rb_tree_iterator<value_type, _ConstTraits> const_iterator;
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0);
+ _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p);
+ void _M_erase(_Base_ptr __x);
+
+public:
+ // allocation/deallocation
+ _Rb_tree()
+ : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(_Compare())
+ {}
+
+ _Rb_tree(const _Compare& __comp)
+ : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(__comp)
+ {}
+
+ _Rb_tree(const _Compare& __comp, const allocator_type& __a)
+ : _Rb_tree_base<_Value, _Alloc>(__a), _M_node_count(0), _M_key_compare(__comp)
+ {}
+
+ _Rb_tree(const _Self& __x)
+ : _Rb_tree_base<_Value, _Alloc>(__x.get_allocator()),
+ _M_node_count(0), _M_key_compare(__x._M_key_compare) {
+ if (__x._M_root() != 0) {
+ _S_color(&this->_M_header._M_data) = _S_rb_tree_red;
+ _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data);
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ }
+ _M_node_count = __x._M_node_count;
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Rb_tree(__move_source<_Self> src)
+ : _Rb_tree_base<_Value, _Alloc>(__move_source<_Base>(src.get())),
+ _M_node_count(src.get()._M_node_count),
+ _M_key_compare(_AsMoveSource(src.get()._M_key_compare))
+ { src.get()._M_node_count = 0; }
+#endif
+
+ ~_Rb_tree() { clear(); }
+ _Self& operator=(const _Self& __x);
+
+public:
+ // accessors:
+ _Compare key_comp() const { return _M_key_compare; }
+
+ iterator begin() { return iterator(_M_leftmost()); }
+ const_iterator begin() const { return const_iterator(_M_leftmost()); }
+ iterator end() { return iterator(&this->_M_header._M_data); }
+ const_iterator end() const { return const_iterator(__CONST_CAST(_Base_ptr, &this->_M_header._M_data)); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_node_count == 0; }
+ size_type size() const { return _M_node_count; }
+ size_type max_size() const { return size_type(-1); }
+
+ void swap(_Self& __t) {
+ if (__t.empty()) {
+ if (this->empty()) return;
+ __t._M_header.swap(this->_M_header);
+ __t._M_rebind(&this->_M_header._M_data);
+ this->_M_empty_initialize();
+ }
+ else if (this->empty()) {
+ __t.swap(*this);
+ return;
+ }
+ else {
+ this->_M_header.swap(__t._M_header);
+ this->_M_rebind(&__t._M_header._M_data);
+ __t._M_rebind(&this->_M_header._M_data);
+ }
+ _STLP_STD::swap(_M_node_count, __t._M_node_count);
+ _STLP_STD::swap(_M_key_compare, __t._M_key_compare);
+ }
+
+public:
+ // insert/erase
+ pair<iterator,bool> insert_unique(const value_type& __x);
+ iterator insert_equal(const value_type& __x);
+
+ iterator insert_unique(iterator __pos, const value_type& __x);
+ iterator insert_equal(iterator __pos, const value_type& __x);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _II> void insert_equal(_II __first, _II __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+ template<class _II> void insert_unique(_II __first, _II __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+#else
+ void insert_unique(const_iterator __first, const_iterator __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+ void insert_unique(const value_type* __first, const value_type* __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+ void insert_equal(const_iterator __first, const_iterator __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+ void insert_equal(const value_type* __first, const value_type* __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+#endif
+
+ void erase(iterator __pos) {
+ _Base_ptr __x = _Rb_global_inst::_Rebalance_for_erase(__pos._M_node,
+ this->_M_header._M_data._M_parent,
+ this->_M_header._M_data._M_left,
+ this->_M_header._M_data._M_right);
+ _STLP_STD::_Destroy(&_S_value(__x));
+ this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x), 1);
+ --_M_node_count;
+ }
+
+ size_type erase(const key_type& __x) {
+ pair<iterator,iterator> __p = equal_range(__x);
+ size_type __n = _STLP_STD::distance(__p.first, __p.second);
+ erase(__p.first, __p.second);
+ return __n;
+ }
+
+ size_type erase_unique(const key_type& __x) {
+ iterator __i = find(__x);
+ if (__i._M_node != &this->_M_header._M_data) {
+ erase(__i);
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase(iterator __first, iterator __last) {
+ if (__first._M_node == this->_M_header._M_data._M_left && // begin()
+ __last._M_node == &this->_M_header._M_data) // end()
+ clear();
+ else
+ while (__first != __last) erase(__first++);
+ }
+
+ void erase(const key_type* __first, const key_type* __last) {
+ while (__first != __last) erase(*__first++);
+ }
+
+ void clear() {
+ if (_M_node_count != 0) {
+ _M_erase(_M_root());
+ _M_leftmost() = &this->_M_header._M_data;
+ _M_root() = 0;
+ _M_rightmost() = &this->_M_header._M_data;
+ _M_node_count = 0;
+ }
+ }
+
+public:
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __k) { return iterator(_M_find(__k)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __k) const { return const_iterator(_M_find(__k)); }
+private:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_find(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); // Last node which is not less than __k.
+ _Base_ptr __x = _M_root(); // Current node.
+
+ while (__x != 0)
+ if (!_M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ if (__y != &this->_M_header._M_data) {
+ if (_M_key_compare(__k, _S_key(__y))) {
+ __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data);
+ }
+ }
+ return __y;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_lower_bound(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is not less than __k. */
+ _Base_ptr __x = _M_root(); /* Current node. */
+
+ while (__x != 0)
+ if (!_M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ return __y;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_upper_bound(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is greater than __k. */
+ _Base_ptr __x = _M_root(); /* Current node. */
+
+ while (__x != 0)
+ if (_M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ return __y;
+ }
+
+public:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const {
+ pair<const_iterator, const_iterator> __p = equal_range(__x);
+ return _STLP_STD::distance(__p.first, __p.second);
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return iterator(_M_lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return const_iterator(_M_lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return iterator(_M_upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return const_iterator(_M_upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return pair<iterator, iterator>(lower_bound(__x), upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
+ { return pair<const_iterator, const_iterator>(lower_bound(__x), upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range_unique(const _KT& __x) {
+ pair<iterator, iterator> __p;
+ __p.second = lower_bound(__x);
+ if (__p.second._M_node != &this->_M_header._M_data &&
+ !_M_key_compare(__x, _S_key(__p.second._M_node))) {
+ __p.first = __p.second++;
+ }
+ else {
+ __p.first = __p.second;
+ }
+ return __p;
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
+ pair<const_iterator, const_iterator> __p;
+ __p.second = lower_bound(__x);
+ if (__p.second._M_node != &this->_M_header._M_data &&
+ !_M_key_compare(__x, _S_key(__p.second._M_node))) {
+ __p.first = __p.second++;
+ }
+ else {
+ __p.first = __p.second;
+ }
+ return __p;
+ }
+
+#if defined (_STLP_DEBUG)
+public:
+ // Debugging.
+ bool __rb_verify() const;
+#endif //_STLP_DEBUG
+};
+
+#if defined (_STLP_DEBUG)
+# undef _Rb_tree
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_tree.c>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_tree.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER _STLP_PRIV _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+struct __move_traits<_STLP_PRIV _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> >
+ : _STLP_PRIV __move_traits_help2<_Compare, _Alloc> {};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_typeinfo.h b/build/stlport/stlport/stl/_typeinfo.h
new file mode 100644
index 000000000..843ba566c
--- /dev/null
+++ b/build/stlport/stlport/stl/_typeinfo.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_TYPEINFO
+#define _STLP_INTERNAL_TYPEINFO
+
+#if !defined (_STLP_NO_TYPEINFO)
+
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# include <typeinfo.h>
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <typeinfo>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
+# endif
+# endif
+
+# if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800))
+// In .NET, <typeinfo> actually includes <typeinfo.h>
+# undef _STLP_OLDSTD_typeinfo
+# endif
+
+// if <typeinfo.h> already included, do not import anything
+# if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \
+ (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \
+ defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG))
+# if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET)
+class bad_cast : public exception {};
+# endif
+
+_STLP_BEGIN_NAMESPACE
+// VC 6 and eVC 4 have type_info in the global namespace
+# if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET)
+using ::type_info;
+# else
+using _STLP_VENDOR_EXCEPT_STD::type_info;
+# endif
+
+# if !defined (__DMC__)
+using _STLP_VENDOR_EXCEPT_STD::bad_typeid;
+# endif
+
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET)
+using ::bad_cast;
+# else
+using _STLP_VENDOR_EXCEPT_STD::bad_cast;
+# endif
+
+_STLP_END_NAMESPACE
+
+# endif
+
+#else
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (__DMC__)
+struct bad_cast : exception {};
+# endif
+_STLP_END_NAMESPACE
+#endif
+
+#endif
diff --git a/build/stlport/stlport/stl/_uninitialized.h b/build/stlport/stlport/stl/_uninitialized.h
new file mode 100644
index 000000000..5489a94a1
--- /dev/null
+++ b/build/stlport/stlport/stl/_uninitialized.h
@@ -0,0 +1,443 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+#define _STLP_INTERNAL_UNINITIALIZED_H
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// uninitialized_copy
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, _Distance*) {
+ _OutputIter __cur = __result;
+ _STLP_TRY {
+ for ( ; __first != __last; ++__first, ++__cur)
+ _Param_Construct(&*__cur, *__first);
+ return __cur;
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW(__cur)
+}
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const input_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const forward_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const bidirectional_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+#endif
+
+template <class _RandomAccessIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last,
+ _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
+ _OutputIter __cur = __result;
+ _STLP_TRY {
+ for (_Distance __n = __last - __first; __n > 0; --__n) {
+ _Param_Construct(&*__cur, *__first);
+ ++__first;
+ ++__cur;
+ }
+ return __cur;
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW(__cur)
+}
+
+//Used internaly
+template <class _RandomAccessIter, class _OutputIter>
+inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result)
+{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
+
+inline void*
+__ucopy_trivial(const void* __first, const void* __last, void* __result) {
+ //dums: this version can use memcpy (__copy_trivial can't)
+ return (__last == __first) ? __result :
+ ((char*)memcpy(__result, __first, ((const char*)__last - (const char*)__first))) +
+ ((const char*)__last - (const char*)__first);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*TrivialUCopy*/)
+{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*TrivialUCopy*/) {
+ // we know they all pointers, so this cast is OK
+ // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
+ return (_OutputIter)__ucopy_trivial(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*BothPtrType*/) {
+ return __ucopy_ptrs(__first, __last, __result,
+ _UseTrivialUCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*BothPtrType*/) {
+ return __ucopy(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _ForwardIter>
+inline _ForwardIter
+uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter>::_Answer()); }
+
+inline char*
+uninitialized_copy(const char* __first, const char* __last, char* __result)
+{ return (char*)_STLP_PRIV __ucopy_trivial(__first, __last, __result); }
+
+# if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
+inline wchar_t*
+uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result)
+{ return (wchar_t*)_STLP_PRIV __ucopy_trivial (__first, __last, __result); }
+# endif
+
+// uninitialized_copy_n (not part of the C++ standard)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Size, class _ForwardIter>
+_STLP_INLINE_LOOP
+pair<_InputIter, _ForwardIter>
+__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result,
+ const input_iterator_tag &) {
+ _ForwardIter __cur = __result;
+ _STLP_TRY {
+ for ( ; __count > 0 ; --__count, ++__first, ++__cur)
+ _Param_Construct(&*__cur, *__first);
+ return pair<_InputIter, _ForwardIter>(__first, __cur);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW((pair<_InputIter, _ForwardIter>(__first, __cur)))
+}
+
+# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _Size, class _ForwardIterator>
+inline pair<_InputIter, _ForwardIterator>
+__ucopy_n(_InputIter __first, _Size __count,
+ _ForwardIterator __result,
+ const forward_iterator_tag &)
+{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
+
+template <class _InputIter, class _Size, class _ForwardIterator>
+inline pair<_InputIter, _ForwardIterator>
+__ucopy_n(_InputIter __first, _Size __count,
+ _ForwardIterator __result,
+ const bidirectional_iterator_tag &)
+{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
+# endif
+
+template <class _RandomAccessIter, class _Size, class _ForwardIter>
+inline pair<_RandomAccessIter, _ForwardIter>
+__ucopy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result,
+ const random_access_iterator_tag &) {
+ _RandomAccessIter __last = __first + __count;
+ return pair<_RandomAccessIter, _ForwardIter>(__last, uninitialized_copy(__first, __last, __result));
+}
+
+// This is used internally in <rope> , which is extension itself.
+template <class _InputIter, class _Size, class _ForwardIter>
+inline pair<_InputIter, _ForwardIter>
+__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Size, class _ForwardIter>
+inline pair<_InputIter, _ForwardIter>
+uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_n(__first, __count, __result); }
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#endif
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Distance*) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for ( ; __cur != __last; ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const input_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const forward_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const bidirectional_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+#endif
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const random_access_iterator_tag &, _Distance*) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for (_Distance __n = __last - __first; __n > 0; --__n, ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) {
+ _STLP_PRIV __ufill(__first, __last, __x,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+// Specialization: for one-byte types we can use memset.
+inline void uninitialized_fill(unsigned char* __first, unsigned char* __last,
+ const unsigned char& __val) {
+ unsigned char __tmp = __val;
+ memset(__first, __tmp, __last - __first);
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+inline void uninitialized_fill(signed char* __first, signed char* __last,
+ const signed char& __val) {
+ signed char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+#endif
+inline void uninitialized_fill(char* __first, char* __last, const char& __val) {
+ char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for ( ; __n > 0; --__n, ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+ return __cur;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const input_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const forward_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const bidirectional_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+#endif
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
+ _ForwardIter __last = __first + __n;
+ __ufill(__first, __last, __x, random_access_iterator_tag(), (ptrdiff_t*)0);
+ return __last;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const random_access_iterator_tag &)
+{ return __uninitialized_fill_n(__first, __n, __x); }
+
+/* __uninitialized_init is an internal algo to init a range with a value
+ * built using default constructor. It is only called with pointer as
+ * iterator.
+ */
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __false_type& /*_HasDefaultZero*/)
+{ return __uninitialized_fill_n(__first, __n, __val); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& /* __val */,
+ const __true_type& /*_HasDefaultZero*/) {
+ memset((unsigned char*)__first, 0, __n * sizeof(_Tp));
+ return __first + __n;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp&,
+ const __true_type& /*_TrivialInit*/)
+{ return __first + __n; }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __false_type& /*_TrivialInit*/)
+{ return __uinit_aux_aux(__first, __n, __val, _HasDefaultZeroValue(__first)._Answer()); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uninitialized_init(_ForwardIter __first, _Size __n, const _Tp& __val)
+{ return __uinit_aux(__first, __n, __val, _UseTrivialInit(__first)._Answer()); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline void
+uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
+{ _STLP_PRIV __ufill_n(__first, __n, __x, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); }
+
+// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
+// __uninitialized_fill_copy.
+
+// __uninitialized_copy_copy
+// Copies [first1, last1) into [result, result + (last1 - first1)), and
+// copies [first2, last2) into
+// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)).
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _ForwardIter>
+inline _ForwardIter
+__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _ForwardIter __result) {
+ _ForwardIter __new_result = uninitialized_copy(__first1, __last1, __result);
+ _STLP_TRY {
+ return uninitialized_copy(__first2, __last2, __new_result);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __new_result))
+ _STLP_RET_AFTER_THROW(__result)
+}
+
+// __uninitialized_fill_copy
+// Fills [result, mid) with x, and copies [first, last) into
+// [mid, mid + (last - first)).
+template <class _ForwardIter, class _Tp, class _InputIter>
+inline _ForwardIter
+__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x,
+ _InputIter __first, _InputIter __last) {
+ uninitialized_fill(__result, __mid, __x);
+ _STLP_TRY {
+ return uninitialized_copy(__first, __last, __mid);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __mid))
+ _STLP_RET_AFTER_THROW(__result)
+}
+
+// __uninitialized_copy_fill
+// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
+// fills [first2 + (last1 - first1), last2) with x.
+template <class _Iter, class _Tp>
+inline void
+__uninitialized_copy_fill(_Iter __first1, _Iter __last1, _Iter __first2, _Iter __last2,
+ const _Tp& __x) {
+ _Iter __mid2 = uninitialized_copy(__first1, __last1, __first2);
+ _STLP_TRY {
+ uninitialized_fill(__mid2, __last2, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first2, __mid2))
+}
+
+/* __uninitialized_move:
+ * This function is used internaly and only with pointers as iterators.
+ */
+template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
+inline _ForwardIter
+__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _TrivialUCpy __trivial_ucpy, const __false_type& /*_Movable*/)
+{ return __ucopy_ptrs(__first, __last, __result, __trivial_ucpy); }
+
+template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
+_STLP_INLINE_LOOP
+_ForwardIter
+__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _TrivialUCpy , const __true_type& /*_Movable*/) {
+ //Move constructor should not throw so we do not need to take care of exceptions here.
+ for (ptrdiff_t __n = __last - __first ; __n > 0; --__n) {
+ _Move_Construct(&*__result, *__first);
+ ++__first; ++__result;
+ }
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNINITIALIZED_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_unordered_map.h b/build/stlport/stlport/stl/_unordered_map.h
new file mode 100644
index 000000000..f2b017ddf
--- /dev/null
+++ b/build/stlport/stlport/stl/_unordered_map.h
@@ -0,0 +1,443 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNORDERED_MAP_H
+#define _STLP_INTERNAL_UNORDERED_MAP_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class unordered_map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMapTraitsT<value_type> _UnorderedMapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_map(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#else
+ unordered_map(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ unordered_map(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ pair<iterator,bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_unique(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_unique(__f, __l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __key) {
+ iterator __it = _M_ht.find(__key);
+ return (__it == _M_ht.end() ?
+ _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
+ (*__it).second );
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+
+#if defined (__DMC__) // disable operator==(pair<x,unordered_map>, pair<x,unordered_map>)
+ bool operator==(const _Self&) const;
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class unordered_multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMultimapTraitsT<value_type> _UnorderedMultimapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMultimapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_multimap(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_multimap(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#else
+ unordered_multimap(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ unordered_multimap(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_equal(__f, __l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+_STLP_END_NAMESPACE
+
+// Specialization of insert_iterator so that it will work for unordered_map
+// and unordered_multimap.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNORDERED_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_unordered_set.h b/build/stlport/stlport/stl/_unordered_set.h
new file mode 100644
index 000000000..ef5f5fe78
--- /dev/null
+++ b/build/stlport/stlport/stl/_unordered_set.h
@@ -0,0 +1,418 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNORDERED_SET_H
+#define _STLP_INTERNAL_UNORDERED_SET_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedSetTraitsT, Const_traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class unordered_set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedSetTraitsT<_Value> _UnorderedSetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _UnorderedSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_set(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#else
+ unordered_set(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ unordered_set(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ pair<iterator, bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const_iterator __f, const_iterator __l)
+ {_M_ht.insert_unique(__f, __l); }
+ void insert(const value_type* __f, const value_type* __l)
+#endif
+ { _M_ht.insert_unique(__f,__l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+_STLP_END_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultisetTraitsT, Const_traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class unordered_multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMultisetTraitsT<_Value> _UnorderedMultisetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _UnorderedMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_multiset(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_multiset(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#else
+ unordered_multiset(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ unordered_multiset(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_equal(__f, __l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER unordered_set<_Value,_HashFcn,_EqualKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER unordered_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+_STLP_END_NAMESPACE
+
+// Specialization of insert_iterator so that it will work for unordered_set
+// and unordered_multiset.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename _STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename _STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNORDERED_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/stl/_valarray.c b/build/stlport/stlport/stl/_valarray.c
new file mode 100644
index 000000000..ee534a9ac
--- /dev/null
+++ b/build/stlport/stlport/stl/_valarray.c
@@ -0,0 +1,191 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_VALARRAY_C
+#define _STLP_VALARRAY_C
+
+#ifndef _STLP_VALARRAY_H
+# include <stl/_valarray.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+_Valarray_bool valarray<_Tp>:: operator!() const {
+ _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = !(*this)[__i];
+ return __tmp;
+}
+
+// Behavior is undefined if __x and *this have different sizes
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x) {
+ _STLP_ASSERT(__x._M_slice.size() == this->size())
+ size_t __index = __x._M_slice.start();
+ for (size_t __i = 0;
+ __i < __x._M_slice.size();
+ ++__i, __index += __x._M_slice.stride())
+ (*this)[__i] = __x._M_array[__index];
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const {
+ valarray<_Tp> __tmp(__slice.size(), _NoInit());
+ size_t __index = __slice.start();
+ for (size_t __i = 0;
+ __i < __slice.size();
+ ++__i, __index += __slice.stride())
+ __tmp[__i] = (*this)[__index];
+ return __tmp;
+}
+
+template <class _Size>
+bool _Gslice_Iter_tmpl<_Size>::_M_incr() {
+ size_t __dim = _M_indices.size() - 1;
+ ++_M_step;
+ for (;;) {
+ _M_1d_idx += _M_gslice._M_strides[__dim];
+ if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim])
+ return true;
+ else if (__dim != 0) {
+ _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
+ _M_indices[__dim] = 0;
+ --__dim;
+ }
+ else
+ return false;
+ }
+}
+
+// Behavior is undefined if __x and *this have different sizes, or if
+// __x was constructed from a degenerate gslice.
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x) {
+ if (this->size() != 0) {
+ _Gslice_Iter __i(__x._M_gslice);
+ do
+ (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx];
+ while(__i._M_incr());
+ }
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const {
+ valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
+ if (__tmp.size() != 0) {
+ _Gslice_Iter __i(__slice);
+ do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr());
+ }
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const {
+ size_t _p_size = 0;
+ {
+ for (size_t __i = 0; __i < __mask.size(); ++__i)
+ if (__mask[__i]) ++_p_size;
+ }
+
+ valarray<_Tp> __tmp(_p_size, _NoInit());
+ size_t __idx = 0;
+ {
+ for (size_t __i = 0; __i < __mask.size(); ++__i)
+ if (__mask[__i]) __tmp[__idx++] = (*this)[__i];
+ }
+
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) {
+ _STLP_ASSERT(__x._M_addr.size() == this->size())
+ for (size_t __i = 0; __i < __x._M_addr.size(); ++__i)
+ (*this)[__i] = __x._M_array[__x._M_addr[__i]];
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const {
+ valarray<_Tp> __tmp(__addr.size(), _NoInit());
+ for (size_t __i = 0; __i < __addr.size(); ++__i)
+ __tmp[__i] = (*this)[__addr[__i]];
+ return __tmp;
+}
+
+//----------------------------------------------------------------------
+// Other valarray noninline member functions
+
+// Shift and cshift
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::shift(int __n) const {
+ valarray<_Tp> __tmp(this->size());
+
+ if (__n >= 0) {
+ if (__n < this->size())
+ copy(this->_M_first + __n, this->_M_first + this->size(),
+ __tmp._M_first);
+ }
+ else {
+ if (-__n < this->size())
+ copy(this->_M_first, this->_M_first + this->size() + __n,
+ __tmp._M_first - __n);
+ }
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::cshift(int __m) const {
+ valarray<_Tp> __tmp(this->size());
+
+ // Reduce __m to an equivalent number in the range [0, size()). We
+ // have to be careful with negative numbers, since the sign of a % b
+ // is unspecified when a < 0.
+ long __n = __m;
+ if (this->size() < (numeric_limits<long>::max)())
+ __n %= long(this->size());
+ if (__n < 0)
+ __n += this->size();
+
+ copy(this->_M_first, this->_M_first + __n,
+ __tmp._M_first + (this->size() - __n));
+ copy(this->_M_first + __n, this->_M_first + this->size(),
+ __tmp._M_first);
+
+ return __tmp;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VALARRAY_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_valarray.h b/build/stlport/stlport/stl/_valarray.h
new file mode 100644
index 000000000..cd9641ab4
--- /dev/null
+++ b/build/stlport/stlport/stl/_valarray.h
@@ -0,0 +1,1684 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_VALARRAY_H
+#define _STLP_VALARRAY_H
+
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class slice;
+class gslice;
+
+template <class _Tp> class valarray;
+typedef valarray<bool> _Valarray_bool;
+typedef valarray<size_t> _Valarray_size_t;
+
+template <class _Tp> class slice_array;
+template <class _Tp> class gslice_array;
+template <class _Tp> class mask_array;
+template <class _Tp> class indirect_array;
+
+//----------------------------------------------------------------------
+// class valarray
+
+// Base class to handle memory allocation and deallocation. We can't just
+// use vector<>, because vector<bool> would be unsuitable as an internal
+// representation for valarray<bool>.
+
+template <class _Tp>
+struct _Valarray_base {
+ _Tp* _M_first;
+ size_t _M_size;
+
+ _Valarray_base() : _M_first(0), _M_size(0) {}
+ _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); }
+ ~_Valarray_base() { _M_deallocate(); }
+
+ void _M_allocate(size_t __n) {
+ if (__n != 0) {
+ _M_first = __STATIC_CAST(_Tp*, __stl_new(__n * sizeof(_Tp)));
+ _M_size = __n;
+ }
+ else {
+ _M_first = 0;
+ _M_size = 0;
+ }
+ }
+
+ void _M_deallocate() {
+ __stl_delete(_M_first);
+ _M_first = 0;
+ _M_size = 0;
+ }
+};
+
+template <class _Tp>
+class valarray : private _Valarray_base<_Tp>
+{
+ friend class gslice;
+
+public:
+ typedef _Tp value_type;
+
+ // Basic constructors
+ valarray() : _Valarray_base<_Tp>() {}
+ explicit valarray(size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, __x); }
+ valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_copy(__p, __p + __n, this->_M_first); }
+ valarray(const valarray<_Tp>& __x) : _Valarray_base<_Tp>(__x._M_size) {
+ uninitialized_copy(__x._M_first, __x._M_first + __x._M_size,
+ this->_M_first);
+ }
+
+ // Constructors from auxiliary array types
+ valarray(const slice_array<_Tp>&);
+ valarray(const gslice_array<_Tp>&);
+ valarray(const mask_array<_Tp>&);
+ valarray(const indirect_array<_Tp>&);
+
+ // Destructor
+ ~valarray() { _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); }
+
+ // Extension: constructor that doesn't initialize valarray elements to a
+ // specific value. This is faster for types such as int and double.
+private:
+ void _M_initialize(const __true_type&) {}
+ void _M_initialize(const __false_type&)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+
+public:
+ struct _NoInit {};
+ valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ }
+
+public: // Assignment
+ // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size()
+ valarray<_Tp>& operator=(const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ if (this != &__x)
+ copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first);
+ return *this;
+ }
+
+ // Scalar assignment
+ valarray<_Tp>& operator=(const value_type& __x) {
+ fill_n(this->_M_first, this->_M_size, __x);
+ return *this;
+ }
+
+ // Assignment of auxiliary array types
+ valarray<_Tp>& operator=(const slice_array<_Tp>&);
+ valarray<_Tp>& operator=(const gslice_array<_Tp>&);
+ valarray<_Tp>& operator=(const mask_array<_Tp>&);
+ valarray<_Tp>& operator=(const indirect_array<_Tp>&);
+
+public: // Element access
+ value_type operator[](size_t __n) const {
+ _STLP_ASSERT(__n < this->size())
+ return this->_M_first[__n];
+ }
+ value_type& operator[](size_t __n) {
+ _STLP_ASSERT(__n < this->size())
+ return this->_M_first[__n];
+ }
+ size_t size() const { return this->_M_size; }
+
+public: // Subsetting operations with auxiliary type
+ valarray<_Tp> operator[](slice) const;
+ slice_array<_Tp> operator[](slice);
+ valarray<_Tp> operator[](const gslice&) const;
+ gslice_array<_Tp> operator[](const gslice&);
+ valarray<_Tp> operator[](const _Valarray_bool&) const;
+ mask_array<_Tp> operator[](const _Valarray_bool&);
+ valarray<_Tp> operator[](const _Valarray_size_t&) const;
+ indirect_array<_Tp> operator[](const _Valarray_size_t&);
+
+public: // Unary operators.
+ valarray<_Tp> operator+() const { return *this; }
+
+ valarray<_Tp> operator-() const {
+ valarray<_Tp> __tmp(this->size(), _NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = -(*this)[__i];
+ return __tmp;
+ }
+
+ valarray<_Tp> operator~() const {
+ valarray<_Tp> __tmp(this->size(), _NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = ~(*this)[__i];
+ return __tmp;
+ }
+
+ _Valarray_bool operator!() const;
+
+public: // Scalar computed assignment.
+ valarray<_Tp>& operator*= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] *= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator/= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] /= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator%= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] %= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator+= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] += __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator-= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] -= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator^= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] ^= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator&= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] &= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator|= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] |= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator<<= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] <<= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator>>= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] >>= __x;
+ return *this;
+ }
+
+public: // Array computed assignment.
+ valarray<_Tp>& operator*= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] *= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator/= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] /= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator%= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] %= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator+= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] += __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator-= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] -= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator^= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] ^= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator&= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] &= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator|= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] |= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator<<= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] <<= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator>>= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] >>= __x[__i];
+ return *this;
+ }
+
+public: // Other member functions.
+
+ // The result is undefined for zero-length arrays
+ value_type sum() const {
+ _STLP_ASSERT(this->size() != 0)
+ return accumulate(this->_M_first + 1, this->_M_first + this->_M_size,
+ (*this)[0]);
+ }
+
+ // The result is undefined for zero-length arrays
+ value_type (min) () const {
+ _STLP_ASSERT(this->size() != 0)
+ return *min_element(this->_M_first + 0, this->_M_first + this->_M_size);
+ }
+
+ value_type (max) () const {
+ _STLP_ASSERT(this->size() != 0)
+ return *max_element(this->_M_first + 0, this->_M_first + this->_M_size);
+ }
+
+ valarray<_Tp> shift(int __n) const;
+ valarray<_Tp> cshift(int __n) const;
+
+ valarray<_Tp> apply(value_type __f(value_type)) const {
+ valarray<_Tp> __tmp(this->size());
+ transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
+ __f);
+ return __tmp;
+ }
+ valarray<_Tp> apply(value_type __f(const value_type&)) const {
+ valarray<_Tp> __tmp(this->size());
+ transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
+ __f);
+ return __tmp;
+ }
+
+ void resize(size_t __n, value_type __x = value_type()) {
+ _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size);
+ _Valarray_base<_Tp>::_M_deallocate();
+ _Valarray_base<_Tp>::_M_allocate(__n);
+ uninitialized_fill_n(this->_M_first, this->_M_size, __x);
+ }
+};
+
+//----------------------------------------------------------------------
+// valarray non-member functions.
+
+// Binary arithmetic operations between two arrays. Behavior is
+// undefined if the two arrays do not have the same length.
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] * __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] / __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] % __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] + __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] - __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] ^ __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] & __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] | __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] << __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >> __y[__i];
+ return __tmp;
+}
+
+// Binary arithmetic operations between an array and a scalar.
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] * __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c * __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] / __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c / __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] % __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c % __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] + __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c + __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] - __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c - __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] ^ __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c ^ __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] & __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c & __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] | __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c | __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] << __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c << __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >> __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c >> __x[__i];
+ return __tmp;
+}
+
+// Binary logical operations between two arrays. Behavior is undefined
+// if the two arrays have different lengths. Note that operator== does
+// not do what you might at first expect.
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] == __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] < __y[__i];
+ return __tmp;
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] != __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] > __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] <= __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >= __y[__i];
+ return __tmp;
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+// fbp : swap ?
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] && __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] || __y[__i];
+ return __tmp;
+}
+
+// Logical operations between an array and a scalar.
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] == __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c == __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] != __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c != __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] < __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c < __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] > __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c > __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] <= __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c <= __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >= __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c >= __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] && __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c && __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] || __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c || __x[__i];
+ return __tmp;
+}
+
+// valarray "transcendentals" (the list includes abs and sqrt, which,
+// of course, are not transcendental).
+
+template <class _Tp>
+inline valarray<_Tp> abs(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::abs(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> acos(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::acos(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> asin(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::asin(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__x[__i], __y[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__x[__i], __c);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__c, __x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> cos(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::cos(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> cosh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::cosh(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> exp(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::exp(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> log(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::log(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> log10(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::log10(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__x[__i], __y[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__x[__i], __c);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__c, __x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sin(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sin(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sinh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sinh(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sqrt(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> tan(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::tan(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> tanh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::tanh(__x[__i]);
+ return __tmp;
+}
+
+//----------------------------------------------------------------------
+// slice and slice_array
+
+class slice {
+public:
+ slice() : _M_start(0), _M_length(0), _M_stride(0) {}
+ slice(size_t __start, size_t __length, size_t __stride)
+ : _M_start(__start), _M_length(__length), _M_stride(__stride)
+ {}
+ __TRIVIAL_DESTRUCTOR(slice)
+
+ size_t start() const { return _M_start; }
+ size_t size() const { return _M_length; }
+ size_t stride() const { return _M_stride; }
+
+private:
+ size_t _M_start;
+ size_t _M_length;
+ size_t _M_stride;
+};
+
+template <class _Tp>
+class slice_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] = __x[__i];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] *= __x[__i];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] /= __x[__i];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] %= __x[__i];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] += __x[__i];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] -= __x[__i];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] ^= __x[__i];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] &= __x[__i];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] |= __x[__i];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] <<= __x[__i];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] >>= __x[__i];
+ }
+
+ void operator=(const value_type& __c) /*const could be const but standard says NO (26.3.5.4-1)*/ {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] = __c;
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ slice_array(const slice_array &__x)
+ : _M_slice(__x._M_slice), _M_array(__x._M_array)
+ {}
+
+ ~slice_array() {}
+
+private:
+ slice_array(const slice& __slice, valarray<_Tp> &__array)
+ : _M_slice(__slice), _M_array(__array)
+ {}
+
+ slice _M_slice;
+ valarray<_Tp>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ slice_array();
+ slice_array& operator=(const slice_array&);
+};
+
+// valarray member functions dealing with slice and slice_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_slice.size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+
+template <class _Tp>
+inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice)
+{ return slice_array<_Tp>(__slice, *this); }
+
+//----------------------------------------------------------------------
+// gslice and gslice_array
+
+template <class _Size>
+struct _Gslice_Iter_tmpl;
+
+class gslice {
+ friend struct _Gslice_Iter_tmpl<size_t>;
+public:
+ gslice() : _M_start(0), _M_lengths(), _M_strides() {}
+ gslice(size_t __start,
+ const _Valarray_size_t& __lengths, const _Valarray_size_t& __strides)
+ : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides)
+ {}
+ __TRIVIAL_DESTRUCTOR(gslice)
+
+ size_t start() const { return _M_start; }
+ _Valarray_size_t size() const { return _M_lengths; }
+ _Valarray_size_t stride() const { return _M_strides; }
+
+ // Extension: check for an empty gslice.
+ bool _M_empty() const { return _M_lengths.size() == 0; }
+
+ // Extension: number of indices this gslice represents. (For a degenerate
+ // gslice, they're not necessarily all distinct.)
+ size_t _M_size() const {
+ return !this->_M_empty()
+ ? accumulate(_M_lengths._M_first + 1,
+ _M_lengths._M_first + _M_lengths._M_size,
+ _M_lengths[0],
+ multiplies<size_t>())
+ : 0;
+ }
+
+# ifndef __HP_aCC
+private:
+# endif
+
+ size_t _M_start;
+ _Valarray_size_t _M_lengths;
+ _Valarray_size_t _M_strides;
+};
+
+// This is not an STL iterator. It is constructed from a gslice, and it
+// steps through the gslice indices in sequence. See 23.3.6 of the C++
+// standard, paragraphs 2-3, for an explanation of the sequence. At
+// each step we get two things: the ordinal (i.e. number of steps taken),
+// and the one-dimensional index.
+
+template <class _Size>
+struct _Gslice_Iter_tmpl {
+ _Gslice_Iter_tmpl(const gslice& __gslice)
+ : _M_step(0), _M_1d_idx(__gslice.start()),
+ _M_indices(size_t(0), __gslice._M_lengths.size()),
+ _M_gslice(__gslice)
+ {}
+
+ bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; }
+
+ bool _M_incr();
+
+ _Size _M_step;
+ _Size _M_1d_idx;
+
+ valarray<_Size> _M_indices;
+ const gslice& _M_gslice;
+};
+
+typedef _Gslice_Iter_tmpl<size_t> _Gslice_Iter;
+
+template <class _Tp>
+class gslice_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator*= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator/= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator%= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator+= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator-= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator^= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator&= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator|= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator<<= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator>>= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator= (const value_type& __c) /*const could be const but standard says NO (26.3.7.4-1)*/ {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr());
+ }
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ gslice_array(const gslice_array& __x)
+ : _M_gslice(__x._M_gslice), _M_array(__x._M_array)
+ {}
+
+ ~gslice_array() {}
+
+private:
+ gslice_array(const gslice &__gslice, valarray<_Tp> &__array)
+ : _M_gslice(__gslice), _M_array(__array)
+ {}
+
+ gslice _M_gslice;
+ valarray<value_type>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ gslice_array();
+ void operator=(const gslice_array<_Tp>&);
+};
+
+// valarray member functions dealing with gslice and gslice_array. Note
+// that it is illegal (behavior is undefined) to construct a gslice_array
+// from a degenerate gslice.
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_gslice._M_size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+template <class _Tp>
+inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __slice)
+{ return gslice_array<_Tp>(__slice, *this); }
+
+
+//----------------------------------------------------------------------
+// mask_array
+
+template <class _Tp>
+class mask_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] = __x[__idx++];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] *= __x[__idx++];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] /= __x[__idx++];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] %= __x[__idx++];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] += __x[__idx++];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] -= __x[__idx++];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] &= __x[__idx++];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] |= __x[__idx++];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++];
+ }
+
+ void operator=(const value_type& __c) const {
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] = __c;
+ }
+
+ // Extension: number of true values in the mask
+ size_t _M_num_true() const {
+ size_t __result = 0;
+ for (size_t __i = 0; __i < _M_mask.size(); ++__i)
+ if (_M_mask[__i]) ++__result;
+ return __result;
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ mask_array(const mask_array& __x)
+ : _M_mask(__x._M_mask), _M_array(__x._M_array)
+ {}
+
+ ~mask_array() {}
+
+private:
+ mask_array(const _Valarray_bool& __mask, valarray<_Tp>& __array)
+ : _M_mask(__mask), _M_array(__array)
+ {}
+ _Valarray_bool _M_mask;
+ valarray<_Tp>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ mask_array();
+ void operator=(const mask_array<_Tp>&);
+};
+
+// valarray member functions dealing with mask_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_num_true()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+// Behavior is undefined if __x._M_num_true() != this->size()
+template <class _Tp>
+inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < __x._M_array.size(); ++__i)
+ if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i];
+ return *this;
+}
+
+template <class _Tp>
+inline mask_array<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) {
+ _STLP_ASSERT(__mask.size() == this->size())
+ return mask_array<_Tp>(__mask, *this);
+}
+
+//----------------------------------------------------------------------
+// indirect_array
+
+template <class _Tp>
+class indirect_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] = __x[__i];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] *= __x[__i];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] /= __x[__i];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] %= __x[__i];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] += __x[__i];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] -= __x[__i];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] ^= __x[__i];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] &= __x[__i];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] |= __x[__i];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] <<= __x[__i];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] >>= __x[__i];
+ }
+
+ void operator=(const value_type& __c) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] = __c;
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ indirect_array(const indirect_array& __x)
+ : _M_addr(__x._M_addr), _M_array(__x._M_array)
+ {}
+
+ ~indirect_array() {}
+
+private:
+ indirect_array(const _Valarray_size_t& __addr, valarray<_Tp>& __array)
+ : _M_addr(__addr), _M_array(__array)
+ {}
+
+ _Valarray_size_t _M_addr;
+ valarray<_Tp>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ indirect_array();
+ void operator=(const indirect_array<_Tp>&);
+};
+
+// valarray member functions dealing with indirect_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_addr.size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+
+template <class _Tp>
+inline indirect_array<_Tp>
+valarray<_Tp>::operator[](const _Valarray_size_t& __addr)
+{ return indirect_array<_Tp>(__addr, *this); }
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_valarray.c>
+# endif
+
+#endif /* _STLP_VALARRAY */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_vector.c b/build/stlport/stlport/stl/_vector.c
new file mode 100644
index 000000000..705f78600
--- /dev/null
+++ b/build/stlport/stlport/stl/_vector.c
@@ -0,0 +1,242 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_VECTOR_C
+#define _STLP_VECTOR_C
+
+#if !defined (_STLP_INTERNAL_VECTOR_H)
+# include <stl/_vector.h>
+#endif
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+void _Vector_base<_Tp,_Alloc>::_M_throw_length_error() const
+{ __stl_throw_length_error("vector"); }
+
+template <class _Tp, class _Alloc>
+void _Vector_base<_Tp, _Alloc>::_M_throw_out_of_range() const
+{ __stl_throw_out_of_range("vector"); }
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define vector _STLP_PTR_IMPL_NAME(vector)
+#elif defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __iterator__ _Tp*
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE vector<_Tp, _Alloc>::iterator
+#endif
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::reserve(size_type __n) {
+ if (capacity() < __n) {
+ if (max_size() < __n) {
+ this->_M_throw_length_error();
+ }
+
+ const size_type __old_size = size();
+ pointer __tmp;
+ if (this->_M_start) {
+ __tmp = _M_allocate_and_copy(__n, this->_M_start, this->_M_finish);
+ _M_clear();
+ } else {
+ __tmp = this->_M_end_of_storage.allocate(__n, __n);
+ }
+ _M_set(__tmp, __tmp + __old_size, __tmp + __n);
+ }
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/,
+ size_type __fill_len, bool __atend ) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __len = _M_compute_next_size(__fill_len);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
+ // handle insertion
+ if (__fill_len == 1) {
+ _Copy_Construct(__new_finish, __x);
+ ++__new_finish;
+ } else
+ __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __fill_len, __x);
+ if (!__atend)
+ __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); // copy remainder
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ _M_clear_after_move();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend ) {
+ size_type __len = _M_compute_next_size(__fill_len);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
+ // handle insertion
+ __new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x);
+ if (!__atend)
+ __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder
+ _M_clear();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const _Tp& __x, const __true_type& /*_Movable*/) {
+ if (_M_is_inside(__x)) {
+ _Tp __x_copy = __x;
+ _M_fill_insert_aux(__pos, __n, __x_copy, __true_type());
+ return;
+ }
+ iterator __src = this->_M_finish - 1;
+ iterator __dst = __src + __n;
+ for (; __src >= __pos; --__dst, --__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ _STLP_PRIV __uninitialized_fill_n(__pos, __n, __x);
+ this->_M_finish += __n;
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert_aux (iterator __pos, size_type __n,
+ const _Tp& __x, const __false_type& /*_Movable*/) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ //Here self referencing needs to be checked even for non movable types.
+ if (_M_is_inside(__x)) {
+ _Tp __x_copy = __x;
+ _M_fill_insert_aux(__pos, __n, __x_copy, __false_type());
+ return;
+ }
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after > __n) {
+ _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __n;
+ _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
+ _STLP_STD::fill(__pos, __pos + __n, __x);
+ } else {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x);
+ _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __elems_after;
+ _STLP_STD::fill(__pos, __old_finish, __x);
+ }
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert(iterator __pos,
+ size_type __n, const _Tp& __x) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__n != 0) {
+ if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
+ _M_fill_insert_aux(__pos, __n, __x, _Movable());
+ } else {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ _M_insert_overflow(__pos, __x, _TrivialCopy(), __n);
+ }
+ }
+}
+
+template <class _Tp, class _Alloc>
+vector<_Tp, _Alloc>& vector<_Tp, _Alloc>::operator = (const vector<_Tp, _Alloc>& __x) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ if (&__x != this) {
+ const size_type __xlen = __x.size();
+ if (__xlen > capacity()) {
+ size_type __len = __xlen;
+ pointer __tmp = _M_allocate_and_copy(__len, __CONST_CAST(const_pointer, __x._M_start) + 0,
+ __CONST_CAST(const_pointer, __x._M_finish) + 0);
+ _M_clear();
+ this->_M_start = __tmp;
+ this->_M_end_of_storage._M_data = this->_M_start + __len;
+ } else if (size() >= __xlen) {
+ pointer __i = _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + 0,
+ __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_start, _TrivialCopy());
+ _STLP_STD::_Destroy_Range(__i, this->_M_finish);
+ } else {
+ _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start),
+ __CONST_CAST(const_pointer, __x._M_start) + size(), this->_M_start, _TrivialCopy());
+ _STLP_PRIV __ucopy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + size(),
+ __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_finish, _TrivialUCopy());
+ }
+ this->_M_finish = this->_M_start + __xlen;
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) {
+ if (__n > capacity()) {
+ vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
+ __tmp.swap(*this);
+ } else if (__n > size()) {
+ fill(begin(), end(), __val);
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - size(), __val);
+ } else
+ erase(_STLP_PRIV __fill_n(begin(), __n, __val), end());
+}
+
+template <class _Tp, class _Alloc>
+__iterator__
+vector<_Tp, _Alloc>::insert(iterator __pos, const _Tp& __x) {
+ size_type __n = __pos - begin();
+ _M_fill_insert(__pos, 1, __x);
+ return begin() + __n;
+}
+
+#undef __iterator__
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VECTOR_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/_vector.h b/build/stlport/stlport/stl/_vector.h
new file mode 100644
index 000000000..ed243ef37
--- /dev/null
+++ b/build/stlport/stlport/stl/_vector.h
@@ -0,0 +1,773 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+#define _STLP_INTERNAL_VECTOR_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// The vector base class serves one purpose, its constructor and
+// destructor allocate (but don't initialize) storage. This makes
+// exception safety easier.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+class _Vector_base {
+public:
+ typedef _Vector_base<_Tp, _Alloc> _Self;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef _Tp* pointer;
+ typedef _STLP_alloc_proxy<pointer, _Tp, allocator_type> _AllocProxy;
+
+ _Vector_base(const _Alloc& __a)
+ : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {}
+
+ _Vector_base(size_t __n, const _Alloc& __a)
+ : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {
+ _M_start = _M_end_of_storage.allocate(__n, __n);
+ _M_finish = _M_start;
+ _M_end_of_storage._M_data = _M_start + __n;
+ _STLP_MPWFIX_TRY _STLP_MPWFIX_CATCH
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Vector_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
+ //Set the source as empty:
+ src.get()._M_finish = src.get()._M_end_of_storage._M_data = src.get()._M_start = 0;
+ }
+#endif
+
+ ~_Vector_base() {
+ if (_M_start != _STLP_DEFAULT_CONSTRUCTED(pointer))
+ _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
+ }
+
+protected:
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+
+ pointer _M_start;
+ pointer _M_finish;
+ _AllocProxy _M_end_of_storage;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define vector _STLP_PTR_IMPL_NAME(vector)
+#elif defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class vector : protected _STLP_PRIV _Vector_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
+ , public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_PRIV _Vector_base<_Tp, _Alloc> _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+public:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _Tp); }
+
+private:
+#if defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef __false_type _Movable;
+#endif
+
+ // handles insertions on overflow
+ void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*_Movable*/,
+ size_type __fill_len, bool __atend);
+ void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __true_type& /*_Movable*/,
+ size_type __fill_len, bool __atend) {
+ //We need to take care of self referencing here:
+ if (_M_is_inside(__x)) {
+ value_type __x_copy = __x;
+ _M_insert_overflow_aux(__pos, __x_copy, __false_type(), __fill_len, __atend);
+ return;
+ }
+ _M_insert_overflow_aux(__pos, __x, __false_type(), __fill_len, __atend);
+ }
+
+ void _M_insert_overflow(pointer __pos, const _Tp& __x, const __false_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend = false) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ _M_insert_overflow_aux(__pos, __x, _Movable(), __fill_len, __atend);
+ }
+ void _M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend = false);
+ void _M_range_check(size_type __n) const {
+ if (__n >= size_type(this->_M_finish - this->_M_start))
+ this->_M_throw_out_of_range();
+ }
+
+ size_type _M_compute_next_size(size_type __n) {
+ const size_type __size = size();
+ if (__n > max_size() - __size)
+ this->_M_throw_length_error();
+ size_type __len = __size + (max)(__n, __size);
+ if (__len > max_size() || __len < __size)
+ __len = max_size(); // overflow
+ return __len;
+ }
+
+public:
+ iterator begin() { return this->_M_start; }
+ const_iterator begin() const { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator end() const { return this->_M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return size_type(this->_M_finish - this->_M_start); }
+ size_type max_size() const {
+ size_type __vector_max_size = size_type(-1) / sizeof(_Tp);
+ typename allocator_type::size_type __alloc_max_size = this->_M_end_of_storage.max_size();
+ return (__alloc_max_size < __vector_max_size)?__alloc_max_size:__vector_max_size;
+ }
+
+ size_type capacity() const { return size_type(this->_M_end_of_storage._M_data - this->_M_start); }
+ bool empty() const { return this->_M_start == this->_M_finish; }
+
+ reference operator[](size_type __n) { return *(begin() + __n); }
+ const_reference operator[](size_type __n) const { return *(begin() + __n); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+
+ reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(const allocator_type& __a = allocator_type())
+#else
+ vector()
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {}
+ vector(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+private:
+ //We always call _M_initialize with only 1 parameter. Default parameter
+ //is used to allow explicit instanciation of vector with types with no
+ //default constructor.
+ void _M_initialize(size_type __n, const _Tp& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp))
+ { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, __val); }
+public:
+ explicit vector(size_type __n)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { _M_initialize(__n); }
+ vector(size_type __n, const _Tp& __val, const allocator_type& __a = allocator_type())
+#else
+ explicit vector(size_type __n)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ vector(size_type __n, const _Tp& __val)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
+ vector(size_type __n, const _Tp& __val, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, __a)
+ { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
+
+ vector(const _Self& __x)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__x.size(), __x.get_allocator()) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ this->_M_finish = _STLP_PRIV __ucopy_ptrs(__x.begin(), __x.end(), this->_M_start, _TrivialUCopy());
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector(__move_source<_Self> src)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _Integer>
+ void _M_initialize_aux(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ size_type __real_n = __n;
+ this->_M_start = this->_M_end_of_storage.allocate(__n, __real_n);
+ this->_M_end_of_storage._M_data = this->_M_start + __real_n;
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/)
+ { _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_aux(__first, __last, _Integral());
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_aux(__first, __last, _Integral());
+ }
+# endif /* _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS */
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ vector(const _Tp* __first, const _Tp* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__last - __first, __a) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ this->_M_finish = _STLP_PRIV __ucopy_ptrs(__first, __last, this->_M_start, _TrivialUCopy());
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ //As the vector container is a back insert oriented container it
+ //seems rather logical to destroy elements in reverse order.
+ ~vector() { _STLP_STD::_Destroy_Range(rbegin(), rend()); }
+
+ _Self& operator=(const _Self& __x);
+
+ void reserve(size_type __n);
+
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
+ void _M_fill_assign(size_type __n, const _Tp& __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIter>
+ void _M_assign_aux(_ForwardIter __first, _ForwardIter __last, const forward_iterator_tag &) {
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIter;
+#endif
+ const size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len > capacity()) {
+ size_type __n = __len;
+ iterator __tmp = _M_allocate_and_copy(__n, __first, __last);
+ _M_clear();
+ _M_set(__tmp, __tmp + __len, __tmp + __n);
+ }
+ else if (size() >= __len) {
+ iterator __new_finish = copy(__first, __last, this->_M_start);
+ _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ }
+ else {
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, this->_M_start);
+ this->_M_finish = _STLP_STD::uninitialized_copy(__mid, __last, this->_M_finish);
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ void _M_assign_aux(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/)
+ { _M_fill_assign(__n, __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/)
+ { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_back(const _Tp& __x) {
+#endif
+ if (this->_M_finish != this->_M_end_of_storage._M_data) {
+ _Copy_Construct(this->_M_finish, __x);
+ ++this->_M_finish;
+ }
+ else {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ _M_insert_overflow(this->_M_finish, __x, _TrivialCopy(), 1, true);
+ }
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp));
+#else
+ iterator insert(iterator __pos, const _Tp& __x);
+#endif
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back() { push_back(_STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+ void swap(_Self& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_end_of_storage.swap(__x._M_end_of_storage);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+private:
+ void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __true_type& /*_Movable*/);
+ void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __false_type& /*_Movable*/);
+ void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x);
+
+ bool _M_is_inside(const value_type& __x) const {
+ return (&__x >= this->_M_start && &__x < this->_M_finish);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_realloc(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_realloc(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif
+ size_type __n) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable());
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ _M_clear_after_move();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif
+ size_type __n, const __true_type& /*_Movable*/) {
+ iterator __src = this->_M_finish - 1;
+ iterator __dst = __src + __n;
+ for (; __src >= __pos; --__dst, --__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ uninitialized_copy(__first, __last, __pos);
+ this->_M_finish += __n;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif
+ size_type __n, const __false_type& /*_Movable*/) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after > __n) {
+ _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __n;
+ _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
+ copy(__first, __last, __pos);
+ }
+ else {
+#if defined ( _STLP_MEMBER_TEMPLATES )
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after);
+#else
+ const_pointer __mid = __first + __elems_after;
+#endif
+ uninitialized_copy(__mid, __last, this->_M_finish);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __elems_after;
+ copy(__first, __mid, __pos);
+ } /* elems_after */
+ }
+
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&)
+ { _M_range_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+private:
+ template <class _InputIterator>
+ void _M_range_insert(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_range_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#else
+public:
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#endif
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ /* This method do not check self referencing.
+ * Standard forbids it, checked by the debug mode.
+ */
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+
+ if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
+ _M_range_insert_aux(__pos, __first, __last, __n, _Movable());
+ }
+ else {
+ _M_range_insert_realloc(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+public:
+ void insert (iterator __pos, size_type __n, const _Tp& __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ void pop_back() {
+ --this->_M_finish;
+ _STLP_STD::_Destroy(this->_M_finish);
+ }
+
+private:
+ iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/) {
+ _STLP_STD::_Destroy(__pos);
+ iterator __dst = __pos, __src = __dst + 1;
+ iterator __end = end();
+ for (; __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ this->_M_finish = __dst;
+ return __pos;
+ }
+ iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/) {
+ if (__pos + 1 != end()) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ _STLP_PRIV __copy_ptrs(__pos + 1, this->_M_finish, __pos, _TrivialCopy());
+ }
+ --this->_M_finish;
+ _STLP_STD::_Destroy(this->_M_finish);
+ return __pos;
+ }
+ iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/) {
+ iterator __dst = __first, __src = __last;
+ iterator __end = end();
+ for (; __dst != __last && __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Destroy(__dst);
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ }
+ if (__dst != __last) {
+ //There is more elements to erase than element to move:
+ _STLP_STD::_Destroy_Range(__dst, __last);
+ _STLP_STD::_Destroy_Moved_Range(__last, __end);
+ }
+ else {
+ //There is more element to move than element to erase:
+ for (; __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Destroy_Moved(__dst);
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(__dst, __end);
+ }
+ this->_M_finish = __dst;
+ return __first;
+ }
+ iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ pointer __i = _STLP_PRIV __copy_ptrs(__last, this->_M_finish, __first, _TrivialCopy());
+ _STLP_STD::_Destroy_Range(__i, this->_M_finish);
+ this->_M_finish = __i;
+ return __first;
+ }
+
+public:
+ iterator erase(iterator __pos) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__first == __last)
+ return __first;
+ return _M_erase(__first, __last, _Movable());
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ if (__new_size < size())
+ erase(begin() + __new_size, end());
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() {
+ erase(begin(), end());
+ }
+
+private:
+ void _M_clear() {
+ _STLP_STD::_Destroy_Range(rbegin(), rend());
+ this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
+ }
+
+ void _M_clear_after_move() {
+ _STLP_STD::_Destroy_Moved_Range(rbegin(), rend());
+ this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
+ }
+
+ void _M_set(pointer __s, pointer __f, pointer __e) {
+ this->_M_start = __s;
+ this->_M_finish = __f;
+ this->_M_end_of_storage._M_data = __e;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ pointer _M_allocate_and_copy(size_type& __n,
+ _ForwardIterator __first, _ForwardIterator __last)
+#else /* _STLP_MEMBER_TEMPLATES */
+ pointer _M_allocate_and_copy(size_type& __n,
+ const_pointer __first, const_pointer __last)
+#endif /* _STLP_MEMBER_TEMPLATES */
+ {
+ pointer __result = this->_M_end_of_storage.allocate(__n, __n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, __result);
+ return __result;
+ }
+ _STLP_UNWIND(this->_M_end_of_storage.deallocate(__result, __n))
+ _STLP_RET_AFTER_THROW(__result)
+ }
+
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ // This function is only called by the constructor.
+ template <class _ForwardIterator>
+ void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ this->_M_start = this->_M_end_of_storage.allocate(__n, __n);
+ this->_M_end_of_storage._M_data = this->_M_start + __n;
+ this->_M_finish = uninitialized_copy(__first, __last, this->_M_start);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_vector.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_vector.h>
+#endif
+
+//We define the bool specialization before the debug interfave
+//to benefit of the debug version of vector even for the bool
+//specialization.
+#if !defined (_STLP_NO_BOOL) || !defined (_STLP_NO_EXTENSIONS)
+# if !defined (_STLP_INTERNAL_BVECTOR_H)
+# include <stl/_bvector.h>
+# endif
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_vector.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_NO_BOOL) && !defined (_STLP_NO_EXTENSIONS)
+// This typedef is non-standard. It is provided for backward compatibility.
+typedef vector<bool, allocator<bool> > bit_vector;
+#endif
+
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER vector<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<vector<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+# endif
+
+# if !defined (_STLP_DEBUG)
+template <class _Tp, class _Alloc>
+struct _DefaultZeroValue<vector<_Tp, _Alloc> >
+{ typedef typename __type_traits<_Alloc>::has_trivial_default_constructor _Ret; };
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/boost_type_traits.h b/build/stlport/stlport/stl/boost_type_traits.h
new file mode 100644
index 000000000..ae3a3f61d
--- /dev/null
+++ b/build/stlport/stlport/stl/boost_type_traits.h
@@ -0,0 +1,150 @@
+/*
+ *
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BOOST_TYPE_TRAITS_H
+#define _STLP_BOOST_TYPE_TRAITS_H
+
+#ifndef BOOST_CONFIG_SUFFIX_HPP
+# ifdef BOOST_CONFIG_HPP
+# undef BOOST_CONFIG_HPP
+# endif
+# include <boost/config.hpp>
+#endif
+
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_float.hpp>
+#include <boost/type_traits/has_trivial_constructor.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+/*
+ * This file mostly wraps boost type_traits in the STLport type_traits.
+ * When checking a type traits like trivial assign operator for instance
+ * both the boost value and STLport values has to be taken into account
+ * as we don't know what the user might have prefer, specializing the boost
+ * type traits or the STLport one.
+ */
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp> struct _IsRef {
+ enum { _Is = ::boost::is_reference<_Tp>::value };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsPtr {
+ enum { is_pointer = ::boost::is_pointer<_Tp>::value };
+ typedef typename __bool2type<is_pointer>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsIntegral {
+ enum { is_integral = ::boost::is_integral<_Tp>::value };
+ typedef typename __bool2type<is_integral>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsRational {
+ enum { is_float = ::boost::is_float<_Tp>::value };
+ typedef typename __bool2type<is_float>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct __type_traits {
+ enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value };
+ typedef typename __bool2type<trivial_constructor>::_Ret has_trivial_default_constructor;
+
+ enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value };
+ typedef typename __bool2type<trivial_copy>::_Ret has_trivial_copy_constructor;
+
+ enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value };
+ typedef typename __bool2type<trivial_assign>::_Ret has_trivial_assignment_operator;
+
+ enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value };
+ typedef typename __bool2type<trivial_destructor>::_Ret has_trivial_destructor;
+
+ enum { pod = ::boost::is_pod<_Tp>::value };
+ typedef typename __bool2type<pod>::_Ret is_POD_type;
+};
+
+template <class _Tp1, class _Tp2>
+struct _TrivialCopy {
+ typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
+ typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
+
+ enum { same = ::boost::is_same<uncv1, uncv2>::value };
+ typedef typename __bool2type<same>::_Ret _Same;
+
+ enum { boost_trivial_assign = ::boost::has_trivial_assign<uncv1>::value };
+ typedef typename __bool2type<boost_trivial_assign>::_Ret _BoostTrivialAssign;
+ typedef typename __type_traits<uncv1>::has_trivial_assignment_operator _STLPTrivialAssign;
+ typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign;
+
+ typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp1, class _Tp2>
+struct _TrivialUCopy {
+ typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
+ typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
+
+ enum { same = ::boost::is_same<uncv1, uncv2>::value };
+ typedef typename __bool2type<same>::_Ret _Same;
+
+ enum { boost_trivial_copy = ::boost::has_trivial_copy<uncv1>::value };
+ typedef typename __bool2type<boost_trivial_copy>::_Ret _BoostTrivialCopy;
+ typedef typename __type_traits<uncv1>::has_trivial_copy_constructor _STLPTrivialCopy;
+ typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy;
+
+ typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp>
+struct _DefaultZeroValue {
+ enum { is_integral = ::boost::is_integral<_Tp>::value };
+ typedef typename __bool2type<is_integral>::_Ret _IsIntegral;
+ enum { is_float = ::boost::is_float<_Tp>::value };
+ typedef typename __bool2type<is_float>::_Ret _IsFloat;
+ enum { is_pointer = ::boost::is_pointer<_Tp>::value };
+ typedef typename __bool2type<is_pointer>::_Ret _IsPointer;
+
+ typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct _TrivialInit {
+ typedef typename ::boost::remove_cv<_Tp>::type uncv;
+
+ enum { boost_trivial_constructor = ::boost::has_trivial_constructor<uncv>::value };
+ typedef typename __bool2type<boost_trivial_constructor>::_Ret _BoostTrivialInit;
+ typedef typename __type_traits<uncv>::has_trivial_default_constructor _STLPTrivialInit;
+ typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1;
+
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
+ typedef typename _Not<_Tr2>::_Ret _Tr3;
+
+ typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_BOOST_TYPE_TRAITS_H */
diff --git a/build/stlport/stlport/stl/c_locale.h b/build/stlport/stlport/stl/c_locale.h
new file mode 100644
index 000000000..cadd2bc10
--- /dev/null
+++ b/build/stlport/stlport/stl/c_locale.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_C_LOCALE_H
+#define _STLP_C_LOCALE_H
+
+/*
+ * Implementation dependent definitions.
+ * Beware: This header is not a purely internal header, it is also included
+ * from the outside world when building the STLport library. So this header
+ * should not reference internal headers (stlport/stl/_*.h) directly.
+ */
+#if defined (__sgi)
+# if defined (ROOT_65) /* IRIX 6.5.x */
+# include <sgidefs.h>
+# include <standards.h>
+# include <wchar.h>
+# include <ctype.h>
+# else /* IRIX pre-6.5 */
+# include <sgidefs.h>
+# include <standards.h>
+# if !defined(_SIZE_T) && !defined(_SIZE_T_)
+# define _SIZE_T
+# if (_MIPS_SZLONG == 32)
+typedef unsigned int size_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef unsigned long size_t;
+# endif
+# endif
+# if !defined (_WCHAR_T)
+# define _WCHAR_T
+# if (_MIPS_SZLONG == 32)
+typedef long wchar_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef __int32_t wchar_t;
+# endif
+# endif /* _WCHAR_T */
+# if !defined (_WINT_T)
+# define _WINT_T
+# if (_MIPS_SZLONG == 32)
+typedef long wint_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef __int32_t wint_t;
+# endif
+# endif /* _WINT_T */
+# if !defined (_MBSTATE_T)
+# define _MBSTATE_T
+/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
+ * by Microsoft compilers to give their version. But we are in a SGI platform section so it
+ * is weird. However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
+# if defined (_MSC_VER)
+typedef int mbstate_t;
+# else
+typedef char mbstate_t;
+# endif
+# endif /* _MBSTATE_T */
+# endif /* ROOT65 */
+#elif defined (_STLP_USE_GLIBC)
+# include <ctype.h>
+#endif
+
+/*
+ * GENERAL FRAMEWORK
+ */
+
+/*
+ * Opaque types, implementation (if there is one) depends
+ * on platform localisation API.
+ */
+struct _Locale_ctype;
+struct _Locale_codecvt;
+struct _Locale_numeric;
+struct _Locale_time;
+struct _Locale_collate;
+struct _Locale_monetary;
+struct _Locale_messages;
+
+/*
+ Bitmask macros.
+*/
+
+/*
+ * For narrow characters, we expose the lookup table interface.
+ */
+
+#if defined (_STLP_USE_GLIBC)
+/* This section uses macros defined in the gnu libc ctype.h header */
+# define _Locale_CNTRL _IScntrl
+# define _Locale_UPPER _ISupper
+# define _Locale_LOWER _ISlower
+# define _Locale_DIGIT _ISdigit
+# define _Locale_XDIGIT _ISxdigit
+# define _Locale_PUNCT _ISpunct
+# define _Locale_SPACE _ISspace
+# define _Locale_PRINT _ISprint
+# define _Locale_ALPHA _ISalpha
+#else
+/* Default values based on C++ Standard 22.2.1.
+ * Under Windows the localisation implementation take care of mapping its
+ * mask values to those internal values. For other platforms without real
+ * localization support we are free to use the most suitable values.*/
+# define _Locale_SPACE 0x0001
+# define _Locale_PRINT 0x0002
+# define _Locale_CNTRL 0x0004
+# define _Locale_UPPER 0x0008
+# define _Locale_LOWER 0x0010
+# define _Locale_ALPHA 0x0020
+# define _Locale_DIGIT 0x0040
+# define _Locale_PUNCT 0x0080
+# define _Locale_XDIGIT 0x0100
+#endif
+
+#endif /* _STLP_C_LOCALE_H */
diff --git a/build/stlport/stlport/stl/char_traits.h b/build/stlport/stlport/stl/char_traits.h
new file mode 100644
index 000000000..f004a7049
--- /dev/null
+++ b/build/stlport/stlport/stl/char_traits.h
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CHAR_TRAITS_H
+#define _STLP_CHAR_TRAITS_H
+
+// Define char_traits
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#if defined (__unix)
+# include <sys/types.h> // For off_t
+#endif /* __unix */
+
+#if defined (__BORLANDC__)
+# include <mem.h>
+# include <string.h>
+# include <_stddef.h>
+# include <sys/types.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp> class allocator;
+
+#define _STLP_NULL_CHAR_INIT(_ChT) _STLP_DEFAULT_CONSTRUCTED(_ChT)
+
+#if defined(_STLP_WCE)
+typedef long streamoff;
+#elif defined (_STLP_WIN32)
+# if defined (_STLP_LONG_LONG) && !defined (__CYGWIN__)
+//The Win32 file io API support 64 bits access so streamoff and streamsize
+//has to reflect that. Do not change the stringbuf behavior.
+typedef _STLP_LONG_LONG streamoff;
+# else
+typedef ptrdiff_t streamoff;
+# endif
+#else // __unix
+# ifdef _STLP_USE_DEFAULT_FILE_OFFSET
+typedef off_t streamoff;
+# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \
+ /* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */
+typedef off64_t streamoff;
+# else
+typedef off_t streamoff;
+# endif
+#endif /* __unix */
+
+#if defined (_STLP_WIN32)
+typedef streamoff streamsize;
+#else
+typedef ptrdiff_t streamsize;
+#endif
+
+// Class fpos, which represents a position within a file. (The C++
+// standard calls for it to be defined in <ios>. This implementation
+// moves it to <iosfwd>, which is included by <ios>.)
+template <class _StateT> class fpos {
+public: // From table 88 of the C++ standard.
+ fpos(streamoff __pos) : _M_pos(__pos), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
+ fpos() : _M_pos(0), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
+
+ operator streamoff() const { return _M_pos; }
+
+ bool operator==(const fpos& __y) const
+ { return _M_pos == __y._M_pos; }
+ bool operator!=(const fpos& __y) const
+ { return _M_pos != __y._M_pos; }
+
+ fpos& operator+=(streamoff __off) {
+ _M_pos += __off;
+ return *this;
+ }
+ fpos& operator-=(streamoff __off) {
+ _M_pos -= __off;
+ return *this;
+ }
+
+ fpos operator+(streamoff __off) {
+ fpos __tmp(*this);
+ __tmp += __off;
+ return __tmp;
+ }
+ fpos operator-(streamoff __off) {
+ fpos __tmp(*this);
+ __tmp -= __off;
+ return __tmp;
+ }
+
+public: // Manipulation of the state member.
+ _StateT state() const { return _M_st; }
+ void state(_StateT __st) { _M_st = __st; }
+private:
+ streamoff _M_pos;
+ _StateT _M_st;
+};
+
+typedef fpos<mbstate_t> streampos;
+typedef fpos<mbstate_t> wstreampos;
+
+// Class __char_traits_base.
+template <class _CharT, class _IntT>
+class __char_traits_base {
+public:
+ typedef _CharT char_type;
+ typedef _IntT int_type;
+ typedef streamoff off_type;
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void _STLP_CALL assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; }
+ static bool _STLP_CALL eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+ static bool _STLP_CALL lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int _STLP_CALL compare(const char_type* __s1, const char_type* __s2, size_t __n) {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return __s1[__i] < __s2[__i] ? -1 : 1;
+ return 0;
+ }
+
+ static size_t _STLP_CALL length(const char_type* __s) {
+ const char_type _NullChar = _STLP_DEFAULT_CONSTRUCTED(char_type);
+ size_t __i(0);
+ for (; !eq(__s[__i], _NullChar); ++__i) {}
+ return __i;
+ }
+
+ static const char_type* _STLP_CALL find(const char_type* __s, size_t __n, const char_type& __c) {
+ for ( ; __n > 0 ; ++__s, --__n)
+ if (eq(*__s, __c))
+ return __s;
+ return 0;
+ }
+
+ static char_type* _STLP_CALL move(char_type* __s1, const char_type* __s2, size_t _Sz)
+ { return (_Sz == 0 ? __s1 : (char_type*)memmove(__s1, __s2, _Sz * sizeof(char_type))); }
+
+ static char_type* _STLP_CALL copy(char_type* __s1, const char_type* __s2, size_t __n) {
+ return (__n == 0 ? __s1 :
+ (char_type*)memcpy(__s1, __s2, __n * sizeof(char_type)));
+ }
+
+ static char_type* _STLP_CALL assign(char_type* __s, size_t __n, char_type __c) {
+ for (size_t __i = 0; __i < __n; ++__i)
+ __s[__i] = __c;
+ return __s;
+ }
+
+ static int_type _STLP_CALL not_eof(const int_type& __c)
+ { return !eq_int_type(__c, eof()) ? __c : __STATIC_CAST(int_type, 0); }
+
+ static char_type _STLP_CALL to_char_type(const int_type& __c)
+ { return (char_type)__c; }
+
+ static int_type _STLP_CALL to_int_type(const char_type& __c)
+ { return (int_type)__c; }
+
+ static bool _STLP_CALL eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type _STLP_CALL eof()
+ { return (int_type)-1; }
+};
+
+// Generic char_traits class. Note that this class is provided only
+// as a base for explicit specialization; it is unlikely to be useful
+// as is for any particular user-defined type. In particular, it
+// *will not work* for a non-POD type.
+
+template <class _CharT>
+class char_traits
+ : public __char_traits_base<_CharT, _CharT> {};
+
+// Specialization for char.
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC char_traits<char>
+ : public __char_traits_base<char, int>,
+ public __stlport_class<char_traits<char> > {
+public:
+ typedef char char_type;
+ typedef int int_type;
+ typedef streamoff off_type;
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static char _STLP_CALL to_char_type(const int& __c)
+ { return (char)(unsigned char)__c; }
+
+ static int _STLP_CALL to_int_type(const char& __c)
+ { return (unsigned char)__c; }
+
+ static int _STLP_CALL compare(const char* __s1, const char* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t _STLP_CALL length(const char* __s)
+ { return strlen(__s); }
+
+ static void _STLP_CALL assign(char& __c1, const char& __c2)
+ { __c1 = __c2; }
+
+ static char* _STLP_CALL assign(char* __s, size_t __n, char __c) {
+ memset(__s, __c, __n);
+ return __s;
+ }
+};
+
+#if defined (_STLP_HAS_WCHAR_T)
+// Specialization for wchar_t.
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC char_traits<wchar_t>
+ : public __char_traits_base<wchar_t, wint_t> {
+# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined (_STLP_WCHAR_HPACC_EXCLUDE)
+public:
+# if !defined (__BORLANDC__)
+ static wchar_t* _STLP_CALL move(wchar_t* __dest, const wchar_t* __src, size_t __n)
+ { return wmemmove(__dest, __src, __n); }
+# endif
+
+ static wchar_t* _STLP_CALL copy(wchar_t* __dest, const wchar_t* __src, size_t __n)
+ { return wmemcpy(__dest, __src, __n); }
+
+# if !defined (__DMC__) && !defined (__BORLANDC__)
+ static int _STLP_CALL compare(const wchar_t* __s1, const wchar_t* __s2, size_t __n)
+ { return wmemcmp(__s1, __s2, __n); }
+# endif
+
+ static wchar_t* _STLP_CALL assign(wchar_t* __s, size_t __n, wchar_t __c)
+ { return wmemset(__s, __c, __n); }
+
+ static size_t _STLP_CALL length(const wchar_t* __s)
+ { return wcslen(__s); }
+
+ static void _STLP_CALL assign(wchar_t& __c1, const wchar_t& __c2)
+ { __c1 = __c2; }
+# endif
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_CHAR_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/concept_checks.h b/build/stlport/stlport/stl/concept_checks.h
new file mode 100644
index 000000000..5fe02c298
--- /dev/null
+++ b/build/stlport/stlport/stl/concept_checks.h
@@ -0,0 +1,810 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+#ifndef __CONCEPT_CHECKS_H
+#define __CONCEPT_CHECKS_H
+
+/*
+ Use these macro like assertions, but they assert properties
+ on types (usually template arguments). In technical terms they
+ verify whether a type "models" a "concept".
+
+ This set of requirements and the terminology used here is derived
+ from the book "Generic Programming and the STL" by Matt Austern
+ (Addison Wesley). For further information please consult that
+ book. The requirements also are intended to match the ANSI/ISO C++
+ standard.
+
+ This file covers the basic concepts and the iterator concepts.
+ There are several other files that provide the requirements
+ for the STL containers:
+ container_concepts.h
+ sequence_concepts.h
+ assoc_container_concepts.h
+
+ Jeremy Siek, 1999
+
+ TO DO:
+ - some issues with regards to concept classification and mutability
+ including AssociativeContianer -> ForwardContainer
+ and SortedAssociativeContainer -> ReversibleContainer
+ - HashedAssociativeContainer
+ - Allocator
+ - Function Object Concepts
+
+ */
+
+#ifndef _STLP_USE_CONCEPT_CHECKS
+
+// Some compilers lack the features that are necessary for concept checks.
+// On those compilers we define the concept check macros to do nothing.
+#define _STLP_REQUIRES(__type_var, __concept) do {} while(0)
+#define _STLP_CLASS_REQUIRES(__type_var, __concept) \
+ static int __##__type_var##_##__concept
+#define _STLP_CONVERTIBLE(__type_x, __type_y) do {} while(0)
+#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
+#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
+ static int __##__type_x##__type_y##_require_same_type
+#define _STLP_GENERATOR_CHECK(__func, __ret) do {} while(0)
+#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \
+ static int __##__func##__ret##_generator_check
+#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
+#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
+ static int __##__func##__ret##__arg##_unary_function_check
+#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+ do {} while(0)
+#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+ static int __##__func##__ret##__first##__second##_binary_function_check
+#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+ do {} while(0)
+#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+ static int __##__opname##__ret##__first##__second##_require_binary_op
+
+#else /* _STLP_USE_CONCEPT_CHECKS */
+
+// This macro tests whether the template argument "__type_var"
+// satisfies the requirements of "__concept". Here is a list of concepts
+// that we know how to check:
+// _Allocator
+// _Assignable
+// _DefaultConstructible
+// _EqualityComparable
+// _LessThanComparable
+// _TrivialIterator
+// _InputIterator
+// _OutputIterator
+// _ForwardIterator
+// _BidirectionalIterator
+// _RandomAccessIterator
+// _Mutable_TrivialIterator
+// _Mutable_ForwardIterator
+// _Mutable_BidirectionalIterator
+// _Mutable_RandomAccessIterator
+
+#define _STLP_REQUIRES(__type_var, __concept) \
+do { \
+ void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
+ ::##__concept##_requirement_violation; __x = __x; } while (0)
+
+// Use this to check whether type X is convertible to type Y
+#define _STLP_CONVERTIBLE(__type_x, __type_y) \
+do { \
+ void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
+ __type_y >::__type_X_is_not_convertible_to_type_Y; \
+ __x = __x; } while (0)
+
+// Use this to test whether two template arguments are the same type
+#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) \
+do { \
+ void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
+ __type_y >::__type_X_not_same_as_type_Y; \
+ __x = __x; } while (0)
+
+
+// function object checks
+#define _STLP_GENERATOR_CHECK(__func, __ret) \
+do { \
+ __ret (*__x)( __func&) = \
+ _STL_GENERATOR_ERROR< \
+ __func, __ret>::__generator_requirement_violation; \
+ __x = __x; } while (0)
+
+
+#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
+do { \
+ __ret (*__x)( __func&, const __arg& ) = \
+ _STL_UNARY_FUNCTION_ERROR< \
+ __func, __ret, __arg>::__unary_function_requirement_violation; \
+ __x = __x; } while (0)
+
+
+#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+do { \
+ __ret (*__x)( __func&, const __first&, const __second& ) = \
+ _STL_BINARY_FUNCTION_ERROR< \
+ __func, __ret, __first, __second>::__binary_function_requirement_violation; \
+ __x = __x; } while (0)
+
+
+#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+ do { \
+ __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
+ __ret, __first, __second>::__binary_operator_requirement_violation; \
+ __ret (*__y)( const __first&, const __second& ) = \
+ _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
+ __const_binary_operator_requirement_violation; \
+ __y = __y; __x = __x; } while (0)
+
+
+#ifdef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
+
+#define _STLP_CLASS_REQUIRES(__type_var, __concept)
+#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
+#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret)
+#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
+#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
+#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
+
+#else
+
+// Use this macro inside of template classes, where you would
+// like to place requirements on the template arguments to the class
+// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
+// since the type_var is used to construct identifiers. Instead typedef
+// the pointer type, then use the typedef name for the __type_var.
+#define _STLP_CLASS_REQUIRES(__type_var, __concept) \
+ typedef void (* __func##__type_var##__concept)( __type_var ); \
+ template <__func##__type_var##__concept _Tp1> \
+ struct __dummy_struct_##__type_var##__concept { }; \
+ static __dummy_struct_##__type_var##__concept< \
+ __concept##_concept_specification< \
+ __type_var>::__concept##_requirement_violation> \
+ __dummy_ptr_##__type_var##__concept
+
+
+#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
+ typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
+ __type_y ); \
+ template < __func_##__type_x##__type_y##same_type _Tp1> \
+ struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
+ static __dummy_struct_##__type_x##__type_y##_same_type< \
+ _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \
+ __dummy_ptr_##__type_x##__type_y##_same_type
+
+
+#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \
+ typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
+ template <__f_##__func##__ret##_generator _Tp1> \
+ struct __dummy_struct_##__func##__ret##_generator { }; \
+ static __dummy_struct_##__func##__ret##_generator< \
+ _STL_GENERATOR_ERROR< \
+ __func, __ret>::__generator_requirement_violation> \
+ __dummy_ptr_##__func##__ret##_generator
+
+
+#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
+ typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
+ const __arg& ); \
+ template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
+ struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
+ static __dummy_struct_##__func##__ret##__arg##_unary_check< \
+ _STL_UNARY_FUNCTION_ERROR< \
+ __func, __ret, __arg>::__unary_function_requirement_violation> \
+ __dummy_ptr_##__func##__ret##__arg##_unary_check
+
+
+#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
+ typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
+ const __second& ); \
+ template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
+ struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
+ static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
+ _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
+ __binary_function_requirement_violation> \
+ __dummy_ptr_##__func##__ret##__first##__second##_binary_check
+
+
+#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
+ typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
+ const __second& ); \
+ template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
+ struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
+ static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
+ _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
+ __binary_operator_requirement_violation> \
+ __dummy_ptr_##__func##__ret##__first##__second##_binary_op
+
+#endif
+
+/* helper class for finding non-const version of a type. Need to have
+ something to assign to etc. when testing constant iterators. */
+
+template <class _Tp>
+struct _Mutable_trait {
+ typedef _Tp _Type;
+};
+template <class _Tp>
+struct _Mutable_trait<const _Tp> {
+ typedef _Tp _Type;
+};
+
+
+/* helper function for avoiding compiler warnings about unused variables */
+template <class _Type>
+void __sink_unused_warning(_Type) { }
+
+template <class _TypeX, class _TypeY>
+struct _STL_CONVERT_ERROR {
+ static void
+ __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) {
+ _TypeY __y = __x;
+ __sink_unused_warning(__y);
+ }
+};
+
+
+template <class _Type> struct __check_equal { };
+
+template <class _TypeX, class _TypeY>
+struct _STL_SAME_TYPE_ERROR {
+ static void
+ __type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
+ __check_equal<_TypeX> t1 = __check_equal<_TypeY>();
+ }
+};
+
+
+// Some Functon Object Checks
+
+template <class _Func, class _Ret>
+struct _STL_GENERATOR_ERROR {
+ static _Ret __generator_requirement_violation(_Func& __f) {
+ return __f();
+ }
+};
+
+template <class _Func>
+struct _STL_GENERATOR_ERROR<_Func, void> {
+ static void __generator_requirement_violation(_Func& __f) {
+ __f();
+ }
+};
+
+
+template <class _Func, class _Ret, class _Arg>
+struct _STL_UNARY_FUNCTION_ERROR {
+ static _Ret
+ __unary_function_requirement_violation(_Func& __f,
+ const _Arg& __arg) {
+ return __f(__arg);
+ }
+};
+
+template <class _Func, class _Arg>
+struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
+ static void
+ __unary_function_requirement_violation(_Func& __f,
+ const _Arg& __arg) {
+ __f(__arg);
+ }
+};
+
+template <class _Func, class _Ret, class _First, class _Second>
+struct _STL_BINARY_FUNCTION_ERROR {
+ static _Ret
+ __binary_function_requirement_violation(_Func& __f,
+ const _First& __first,
+ const _Second& __second) {
+ return __f(__first, __second);
+ }
+};
+
+template <class _Func, class _First, class _Second>
+struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
+ static void
+ __binary_function_requirement_violation(_Func& __f,
+ const _First& __first,
+ const _Second& __second) {
+ __f(__first, __second);
+ }
+};
+
+
+#define _STLP_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
+template <class _Ret, class _First, class _Second> \
+struct _STL_BINARY##_NAME##_ERROR { \
+ static _Ret \
+ __const_binary_operator_requirement_violation(const _First& __first, \
+ const _Second& __second) { \
+ return __first _OP __second; \
+ } \
+ static _Ret \
+ __binary_operator_requirement_violation(_First& __first, \
+ _Second& __second) { \
+ return __first _OP __second; \
+ } \
+}
+
+_STLP_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
+_STLP_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
+_STLP_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
+_STLP_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
+_STLP_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
+_STLP_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
+_STLP_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
+_STLP_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
+// ...
+
+// TODO, add unary operators (prefix and postfix)
+
+/*
+ The presence of this class is just to trick EDG into displaying
+ these error messages before any other errors. Without the
+ classes, the errors in the functions get reported after
+ other class errors deep inside the library. The name
+ choice just makes for an eye catching error message :)
+ */
+struct _STL_ERROR {
+
+ template <class _Type>
+ static _Type
+ __default_constructor_requirement_violation(_Type) {
+ return _Type();
+ }
+ template <class _Type>
+ static _Type
+ __assignment_operator_requirement_violation(_Type __a) {
+ __a = __a;
+ return __a;
+ }
+ template <class _Type>
+ static _Type
+ __copy_constructor_requirement_violation(_Type __a) {
+ _Type __c(__a);
+ return __c;
+ }
+ template <class _Type>
+ static _Type
+ __const_parameter_required_for_copy_constructor(_Type /* __a */,
+ const _Type& __b) {
+ _Type __c(__b);
+ return __c;
+ }
+ template <class _Type>
+ static _Type
+ __const_parameter_required_for_assignment_operator(_Type __a,
+ const _Type& __b) {
+ __a = __b;
+ return __a;
+ }
+ template <class _Type>
+ static _Type
+ __less_than_comparable_requirement_violation(_Type __a, _Type __b) {
+ if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a;
+ return __b;
+ }
+ template <class _Type>
+ static _Type
+ __equality_comparable_requirement_violation(_Type __a, _Type __b) {
+ if (__a == __b || __a != __b) return __a;
+ return __b;
+ }
+ template <class _Iterator>
+ static void
+ __dereference_operator_requirement_violation(_Iterator __i) {
+ __sink_unused_warning(*__i);
+ }
+ template <class _Iterator>
+ static void
+ __dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
+ *__i = *__i;
+ }
+ template <class _Iterator>
+ static void
+ __preincrement_operator_requirement_violation(_Iterator __i) {
+ ++__i;
+ }
+ template <class _Iterator>
+ static void
+ __postincrement_operator_requirement_violation(_Iterator __i) {
+ __i++;
+ }
+ template <class _Iterator>
+ static void
+ __predecrement_operator_requirement_violation(_Iterator __i) {
+ --__i;
+ }
+ template <class _Iterator>
+ static void
+ __postdecrement_operator_requirement_violation(_Iterator __i) {
+ __i--;
+ }
+ template <class _Iterator, class _Type>
+ static void
+ __postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
+ _Type __t) {
+ *__i++ = __t;
+ }
+ template <class _Iterator, class _Distance>
+ static _Iterator
+ __iterator_addition_assignment_requirement_violation(_Iterator __i,
+ _Distance __n) {
+ __i += __n;
+ return __i;
+ }
+ template <class _Iterator, class _Distance>
+ static _Iterator
+ __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
+ __i = __i + __n;
+ __i = __n + __i;
+ return __i;
+ }
+ template <class _Iterator, class _Distance>
+ static _Iterator
+ __iterator_subtraction_assignment_requirement_violation(_Iterator __i,
+ _Distance __n) {
+ __i -= __n;
+ return __i;
+ }
+ template <class _Iterator, class _Distance>
+ static _Iterator
+ __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
+ __i = __i - __n;
+ return __i;
+ }
+ template <class _Iterator, class _Distance>
+ static _Distance
+ __difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
+ _Distance __n) {
+ __n = __i - __j;
+ return __n;
+ }
+ template <class _Exp, class _Type, class _Distance>
+ static _Type
+ __element_access_operator_requirement_violation(_Exp __x, _Type*,
+ _Distance __n) {
+ return __x[__n];
+ }
+ template <class _Exp, class _Type, class _Distance>
+ static void
+ __element_assignment_operator_requirement_violation(_Exp __x,
+ _Type* __t,
+ _Distance __n) {
+ __x[__n] = *__t;
+ }
+
+}; /* _STL_ERROR */
+
+/* Associated Type Requirements */
+
+_STLP_BEGIN_NAMESPACE
+template <class _Iterator> struct iterator_traits;
+_STLP_END_NAMESPACE
+
+template <class _Iter>
+struct __value_type_type_definition_requirement_violation {
+ typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
+};
+
+template <class _Iter>
+struct __difference_type_type_definition_requirement_violation {
+ typedef typename __STD::iterator_traits<_Iter>::difference_type
+ difference_type;
+};
+
+template <class _Iter>
+struct __reference_type_definition_requirement_violation {
+ typedef typename __STD::iterator_traits<_Iter>::reference reference;
+};
+
+template <class _Iter>
+struct __pointer_type_definition_requirement_violation {
+ typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
+};
+
+template <class _Iter>
+struct __iterator_category_type_definition_requirement_violation {
+ typedef typename __STD::iterator_traits<_Iter>::iterator_category
+ iterator_category;
+};
+
+/* Assignable Requirements */
+
+
+template <class _Type>
+struct _Assignable_concept_specification {
+ static void _Assignable_requirement_violation(_Type __a) {
+ _STL_ERROR::__assignment_operator_requirement_violation(__a);
+ _STL_ERROR::__copy_constructor_requirement_violation(__a);
+ _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a);
+ _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a);
+ }
+};
+
+/* DefaultConstructible Requirements */
+
+
+template <class _Type>
+struct _DefaultConstructible_concept_specification {
+ static void _DefaultConstructible_requirement_violation(_Type __a) {
+ _STL_ERROR::__default_constructor_requirement_violation(__a);
+ }
+};
+
+/* EqualityComparable Requirements */
+
+template <class _Type>
+struct _EqualityComparable_concept_specification {
+ static void _EqualityComparable_requirement_violation(_Type __a) {
+ _STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
+ }
+};
+
+/* LessThanComparable Requirements */
+template <class _Type>
+struct _LessThanComparable_concept_specification {
+ static void _LessThanComparable_requirement_violation(_Type __a) {
+ _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
+ }
+};
+
+/* TrivialIterator Requirements */
+
+template <class _TrivialIterator>
+struct _TrivialIterator_concept_specification {
+static void
+_TrivialIterator_requirement_violation(_TrivialIterator __i) {
+ typedef typename
+ __value_type_type_definition_requirement_violation<_TrivialIterator>::
+ value_type __T;
+ // Refinement of Assignable
+ _Assignable_concept_specification<_TrivialIterator>::
+ _Assignable_requirement_violation(__i);
+ // Refinement of DefaultConstructible
+ _DefaultConstructible_concept_specification<_TrivialIterator>::
+ _DefaultConstructible_requirement_violation(__i);
+ // Refinement of EqualityComparable
+ _EqualityComparable_concept_specification<_TrivialIterator>::
+ _EqualityComparable_requirement_violation(__i);
+ // Valid Expressions
+ _STL_ERROR::__dereference_operator_requirement_violation(__i);
+}
+};
+
+template <class _TrivialIterator>
+struct _Mutable_TrivialIterator_concept_specification {
+static void
+_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) {
+ _TrivialIterator_concept_specification<_TrivialIterator>::
+ _TrivialIterator_requirement_violation(__i);
+ // Valid Expressions
+ _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i);
+}
+};
+
+/* InputIterator Requirements */
+
+template <class _InputIterator>
+struct _InputIterator_concept_specification {
+static void
+_InputIterator_requirement_violation(_InputIterator __i) {
+ // Refinement of TrivialIterator
+ _TrivialIterator_concept_specification<_InputIterator>::
+ _TrivialIterator_requirement_violation(__i);
+ // Associated Types
+ __difference_type_type_definition_requirement_violation<_InputIterator>();
+ __reference_type_definition_requirement_violation<_InputIterator>();
+ __pointer_type_definition_requirement_violation<_InputIterator>();
+ __iterator_category_type_definition_requirement_violation<_InputIterator>();
+ // Valid Expressions
+ _STL_ERROR::__preincrement_operator_requirement_violation(__i);
+ _STL_ERROR::__postincrement_operator_requirement_violation(__i);
+}
+};
+
+/* OutputIterator Requirements */
+
+template <class _OutputIterator>
+struct _OutputIterator_concept_specification {
+static void
+_OutputIterator_requirement_violation(_OutputIterator __i) {
+ // Refinement of Assignable
+ _Assignable_concept_specification<_OutputIterator>::
+ _Assignable_requirement_violation(__i);
+ // Associated Types
+ __iterator_category_type_definition_requirement_violation<_OutputIterator>();
+ // Valid Expressions
+ _STL_ERROR::__dereference_operator_requirement_violation(__i);
+ _STL_ERROR::__preincrement_operator_requirement_violation(__i);
+ _STL_ERROR::__postincrement_operator_requirement_violation(__i);
+ _STL_ERROR::
+ __postincrement_operator_and_assignment_requirement_violation(__i, *__i);
+}
+};
+
+/* ForwardIterator Requirements */
+
+template <class _ForwardIterator>
+struct _ForwardIterator_concept_specification {
+static void
+_ForwardIterator_requirement_violation(_ForwardIterator __i) {
+ // Refinement of InputIterator
+ _InputIterator_concept_specification<_ForwardIterator>::
+ _InputIterator_requirement_violation(__i);
+}
+};
+
+template <class _ForwardIterator>
+struct _Mutable_ForwardIterator_concept_specification {
+static void
+_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) {
+ _ForwardIterator_concept_specification<_ForwardIterator>::
+ _ForwardIterator_requirement_violation(__i);
+ // Refinement of OutputIterator
+ _OutputIterator_concept_specification<_ForwardIterator>::
+ _OutputIterator_requirement_violation(__i);
+}
+};
+
+/* BidirectionalIterator Requirements */
+
+template <class _BidirectionalIterator>
+struct _BidirectionalIterator_concept_specification {
+static void
+_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) {
+ // Refinement of ForwardIterator
+ _ForwardIterator_concept_specification<_BidirectionalIterator>::
+ _ForwardIterator_requirement_violation(__i);
+ // Valid Expressions
+ _STL_ERROR::__predecrement_operator_requirement_violation(__i);
+ _STL_ERROR::__postdecrement_operator_requirement_violation(__i);
+}
+};
+
+template <class _BidirectionalIterator>
+struct _Mutable_BidirectionalIterator_concept_specification {
+static void
+_Mutable_BidirectionalIterator_requirement_violation(
+ _BidirectionalIterator __i)
+{
+ _BidirectionalIterator_concept_specification<_BidirectionalIterator>::
+ _BidirectionalIterator_requirement_violation(__i);
+ // Refinement of mutable_ForwardIterator
+ _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>::
+ _Mutable_ForwardIterator_requirement_violation(__i);
+ typedef typename
+ __value_type_type_definition_requirement_violation<
+ _BidirectionalIterator>::value_type __T;
+ typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0;
+ // Valid Expressions
+ _STL_ERROR::
+ __postincrement_operator_and_assignment_requirement_violation(__i,
+ *__tmp_ptr);
+}
+};
+
+/* RandomAccessIterator Requirements */
+
+template <class _RandAccIter>
+struct _RandomAccessIterator_concept_specification {
+static void
+_RandomAccessIterator_requirement_violation(_RandAccIter __i) {
+ // Refinement of BidirectionalIterator
+ _BidirectionalIterator_concept_specification<_RandAccIter>::
+ _BidirectionalIterator_requirement_violation(__i);
+ // Refinement of LessThanComparable
+ _LessThanComparable_concept_specification<_RandAccIter>::
+ _LessThanComparable_requirement_violation(__i);
+ typedef typename
+ __value_type_type_definition_requirement_violation<_RandAccIter>
+ ::value_type
+ value_type;
+ typedef typename
+ __difference_type_type_definition_requirement_violation<_RandAccIter>
+ ::difference_type
+ _Dist;
+ typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
+
+ // Valid Expressions
+ _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i,
+ _MutDist());
+ _STL_ERROR::__iterator_addition_requirement_violation(__i,
+ _MutDist());
+ _STL_ERROR::
+ __iterator_subtraction_assignment_requirement_violation(__i,
+ _MutDist());
+ _STL_ERROR::__iterator_subtraction_requirement_violation(__i,
+ _MutDist());
+ _STL_ERROR::__difference_operator_requirement_violation(__i, __i,
+ _MutDist());
+ typename _Mutable_trait<value_type>::_Type* __dummy_ptr = 0;
+ _STL_ERROR::__element_access_operator_requirement_violation(__i,
+ __dummy_ptr,
+ _MutDist());
+}
+};
+
+template <class _RandAccIter>
+struct _Mutable_RandomAccessIterator_concept_specification {
+static void
+_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i)
+{
+ _RandomAccessIterator_concept_specification<_RandAccIter>::
+ _RandomAccessIterator_requirement_violation(__i);
+ // Refinement of mutable_BidirectionalIterator
+ _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>::
+ _Mutable_BidirectionalIterator_requirement_violation(__i);
+ typedef typename
+ __value_type_type_definition_requirement_violation<_RandAccIter>
+ ::value_type
+ value_type;
+ typedef typename
+ __difference_type_type_definition_requirement_violation<_RandAccIter>
+ ::difference_type
+ _Dist;
+
+ typename _Mutable_trait<value_type>::_Type* __tmp_ptr = 0;
+ // Valid Expressions
+ _STL_ERROR::__element_assignment_operator_requirement_violation(__i,
+ __tmp_ptr, _Dist());
+}
+};
+
+#define _STLP_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
+template <class Type> \
+struct __##__REQUIREMENT##__typedef_requirement_violation { \
+ typedef typename Type::__REQUIREMENT __REQUIREMENT; \
+};
+
+_STLP_TYPEDEF_REQUIREMENT(value_type);
+_STLP_TYPEDEF_REQUIREMENT(difference_type);
+_STLP_TYPEDEF_REQUIREMENT(size_type);
+_STLP_TYPEDEF_REQUIREMENT(reference);
+_STLP_TYPEDEF_REQUIREMENT(const_reference);
+_STLP_TYPEDEF_REQUIREMENT(pointer);
+_STLP_TYPEDEF_REQUIREMENT(const_pointer);
+
+
+template <class _Alloc>
+struct _Allocator_concept_specification {
+static void
+_Allocator_requirement_violation(_Alloc __a) {
+ // Refinement of DefaultConstructible
+ _DefaultConstructible_concept_specification<_Alloc>::
+ _DefaultConstructible_requirement_violation(__a);
+ // Refinement of EqualityComparable
+ _EqualityComparable_concept_specification<_Alloc>::
+ _EqualityComparable_requirement_violation(__a);
+ // Associated Types
+ __value_type__typedef_requirement_violation<_Alloc>();
+ __difference_type__typedef_requirement_violation<_Alloc>();
+ __size_type__typedef_requirement_violation<_Alloc>();
+ __reference__typedef_requirement_violation<_Alloc>();
+ __const_reference__typedef_requirement_violation<_Alloc>();
+ __pointer__typedef_requirement_violation<_Alloc>();
+ __const_pointer__typedef_requirement_violation<_Alloc>();
+ typedef typename _Alloc::value_type _Type;
+ _STLP_REQUIRES_SAME_TYPE(typename _Alloc::rebind<_Type>::other, _Alloc);
+}
+};
+
+#endif /* _STLP_USE_CONCEPT_CHECKS */
+
+#endif /* __CONCEPT_CHECKS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/config/_aix.h b/build/stlport/stlport/stl/config/_aix.h
new file mode 100644
index 000000000..45ea8b6fd
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_aix.h
@@ -0,0 +1,3 @@
+#define _STLP_PLATFORM "AIX"
+
+#define _STLP_USE_UNIX_IO
diff --git a/build/stlport/stlport/stl/config/_android.h b/build/stlport/stlport/stl/config/_android.h
new file mode 100644
index 000000000..ac321e02c
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_android.h
@@ -0,0 +1,73 @@
+#ifndef __stl_config__android_h
+#define __stl_config__android_h
+
+#define _STLP_PLATFORM "Android"
+
+// Mostly Unix-like.
+#define _STLP_UNIX 1
+
+// Have pthreads support.
+#define _PTHREADS
+
+// Don't have native <cplusplus> headers
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// Use unix for streams
+#define _STLP_USE_UNIX_IO 1
+
+// We don't want rtti support
+#define _STLP_NO_RTTI 1
+
+// C library is in the global namespace.
+#define _STLP_VENDOR_GLOBAL_CSTD 1
+
+// Don't have underlying local support.
+#undef _STLP_REAL_LOCALE_IMPLEMENTED
+
+// No pthread_spinlock_t in Android
+#define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
+
+// Enable thread support
+#undef _NOTHREADS
+
+// Little endian platform.
+#define _STLP_LITTLE_ENDIAN 1
+
+// No <exception> headers
+#undef _STLP_NO_EXCEPTION_HEADER
+
+// No throwing exceptions
+#define _STLP_NO_EXCEPTIONS 1
+#define _STLP_NO_EXCEPTION_HEADER 1
+
+// No need to define our own namespace
+#define _STLP_NO_OWN_NAMESPACE 1
+
+// Use __new_alloc instead of __node_alloc, so we don't need static functions.
+#define _STLP_USE_SIMPLE_NODE_ALLOC 1
+
+// Don't use extern versions of range errors, so we don't need to
+// compile as a library.
+#define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
+
+// The system math library doesn't have long double variants, e.g
+// sinl, cosl, etc
+#define _STLP_NO_VENDOR_MATH_L
+
+// Include most of the gcc settings.
+#include <stl/config/_gcc.h>
+
+// Do not use glibc, Android is missing some things.
+#undef _STLP_USE_GLIBC
+
+// No exceptions.
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT 1
+#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT 1
+
+#define _STLP_HAS_INCLUDE_NEXT 1
+
+// Use operator new instead of stlport own node allocator
+#undef _STLP_USE_NEWALLOC
+#define _STLP_USE_NEWALLOC 1
+
+#endif /* __stl_config__android_h */
diff --git a/build/stlport/stlport/stl/config/_apcc.h b/build/stlport/stlport/stl/config/_apcc.h
new file mode 100644
index 000000000..7b4e1397c
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_apcc.h
@@ -0,0 +1,30 @@
+// STLport config file for Apogee 4.x
+
+#define _STLP_COMPILER "Apogee"
+
+#define _STLP_NO_NEW_NEW_HEADER 1
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+#define _STLP_LONG_LONG long long
+#define _STLP_NO_BAD_ALLOC 1
+#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+#define _STLP_NO_EXCEPTION_HEADER 1
+
+#undef _STLP_LINK_TIME_INSTANTIATION
+#define _STLP_LINK_TIME_INSTANTIATION 1
+
+#ifdef __STDLIB
+# undef _STLP_NO_NEW_C_HEADERS
+# undef _STLP_NO_NEW_NEW_HEADER
+# undef _STLP_NO_BAD_ALLOC
+# undef _STLP_LONG_LONG
+#else
+# undef _STLP_NO_EXCEPTION_SPEC
+# define _STLP_NO_EXCEPTION_SPEC 1
+#endif
diff --git a/build/stlport/stlport/stl/config/_apple.h b/build/stlport/stlport/stl/config/_apple.h
new file mode 100644
index 000000000..899ed143a
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_apple.h
@@ -0,0 +1,118 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+/* common configuration settings for Apple MPW MrCpp / SCpp */
+
+#define _STLP_COMPILER "spec me!"
+
+#if defined(__MRC__) && __MRC__ < 0x500
+# error Apple's MPW MrCpp v.5.0.0 or better compiler required
+#endif
+#if defined(__SC__) && __SC__ < 0x890
+# error Apple's MPW SCpp v.8.9.0 or better compiler required
+#endif
+
+/* TODO: Check that this config is necessary for all compiler versions.
+ * It is here for historical reasons for the moment.
+ */
+#define _STLP_NO_CONTAINERS_EXTENSION
+
+#ifdef qMacApp
+# ifndef __CONDITIONALMACROS__ /* skip including ConditionalMacros_AC.h if ConditionalMacros.h is already included */
+# include <CoreSwitches_AC.h>
+# include <ConditionalMacros_AC.h>
+# include <Types_AC.h>
+# define _STLP_FILE__ _FILE_AC
+# define _STLP_DEBUG_MESSAGE
+# define __stl_debug_message ProgramBreak_AC
+# include <ConditionalMacros.h>
+# endif
+# include <Types.h>
+#else
+# include <ConditionalMacros.h>
+# include <Types.h>
+#endif
+
+#define _STLP_UINT32_T UInt32
+typedef int wint_t;
+
+#ifndef TYPE_BOOL
+# error <ConditionalMacros.h> must be included. (TYPE_BOOL)
+#endif
+#if !TYPE_BOOL
+# define _STLP_NO_BOOL
+# define _STLP_DONT_USE_BOOL_TYPEDEF
+#endif
+
+#ifndef TYPE_LONGLONG
+# error <ConditionalMacros.h> must be included. (TYPE_LONGLONG)
+#endif
+#if TYPE_LONGLONG
+# define _STLP_LONG_LONG long long
+#endif
+
+#if !__option(exceptions)
+# define _STLP_HAS_NO_EXCEPTIONS
+#endif
+
+#define _STLP_DEBUG_MESSAGE_POST DebugStr("\pSTL diagnosis issued. See 'stderr' for detail.");
+#define _STLP_ASSERT_MSG_TRAILER " "
+
+#ifdef _STLP_DEBUG
+# define _STLP_THROW(x) (DebugStr("\pSTL is about to throw exception: "#x),throw x)
+#endif
+
+#if defined(__MRC__)
+# ifndef __spillargs
+# define __spillargs 1 // MrCpp requires this symbol to be defined as 1 to properly handle va_start; ref.[ file stdarg.h; line 26 ]
+# endif
+#endif
+
+#if defined(__SC__)
+#define _STLP_VENDOR_LONG_DOUBLE_MATH //*TY 12/03/2000 - SCpp's native math type is long double
+#endif
+
+#ifndef _STLP_NATIVE_INCLUDE_PATH
+# if __option(unix_includes)
+# define _STLP_NATIVE_INCLUDE_PATH ../CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ::CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
+# endif
+#endif
+#if !defined(_STLP_MAKE_HEADER)
+# if !__option(unix_includes)
+# define _STLP_MAKE_HEADER(path, header) <path:header> // Mac uses ":" for directory delimiter
+# endif
+#endif
+
+# define _STLD _DBG // to keep the length of generated symbols within the compiler limitation
+
+#define _STLP_USE_STDIO_IO 1 //*TY 02/24/2000 - see also ; ref.[ file _fstream.h; line 36 ]
+#define _STLP_NO_THREADS //*TY 12/17/2000 - multi-thread capability not explored, yet.
+#undef _REENTRANT //*ty 11/24/2001 - to make sure no thread facility is activated
+#define _NOTHREADS //*ty 12/07/2001 -
+
+// native library limitations
+#define _STLP_VENDOR_GLOBAL_STD // mpw's c++ libs do not utilize namespace std yet
+#define _STLP_NO_BAD_ALLOC // known limitation
+#define _STLP_HAS_NO_NEW_C_HEADERS // known limitation
+#define _STLP_NO_NEW_NEW_HEADER // known limitation
+#define _STLP_NO_NATIVE_MBSTATE_T // known limitation
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS // known limitation
+#define _STLP_NO_NATIVE_WIDE_STREAMS // known limitation
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT // known limitation
+#define _STLP_BROKEN_EXCEPTION_CLASS // known limitation
+
+// compiler limitations
+# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+
+# define _STLP_MPWFIX_TRY try{ //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_MPWFIX_CATCH }catch(...){throw;} //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_MPWFIX_CATCH_ACTION(action) }catch(...){action;throw;} //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_THROW_RETURN_BUG // known limitation
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION // known limitation
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX // known limitation
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER // known limitation
+# define _STLP_NO_RELOPS_NAMESPACE // known limitation
+// end of stl_apple.h
diff --git a/build/stlport/stlport/stl/config/_as400.h b/build/stlport/stlport/stl/config/_as400.h
new file mode 100644
index 000000000..28d960b77
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_as400.h
@@ -0,0 +1,55 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+// AS/400 C++ config
+
+# ifdef _REENTRANT
+# define _PTHREADS
+# endif
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_NO_BOOL
+# define _STLP_LIMITED_DEFAULT_TEMPLATES
+
+# define _STLP_HAS_NO_NAMESPACES
+# define _STLP_NEED_TYPENAME
+# define _STLP_NEED_EXPLICIT
+# define _STLP_HAS_NO_EXCEPTIONS
+# define _STLP_NO_EXCEPTION_SPEC
+# define _STLP_NO_ARROW_OPERATOR
+# define _STLP_NO_NEW_STYLE_CASTS
+
+# define _STLP_NEED_MUTABLE
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_NO_BAD_ALLOC
+# define _STLP_NO_MEMBER_TEMPLATES
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_NO_QUALIFIED_FRIENDS
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+
+# define _STLP_NO_METHOD_SPECIALIZATION
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+// # define _STLP_NO_EXCEPTION_HEADER
+
+# define _STLP_HAS_NO_NEW_C_HEADERS
+
+# define _STLP_STATIC_CONST_INIT_BUG
+# define _STLP_THROW_RETURN_BUG
+# define _STLP_LINK_TIME_INSTANTIATION
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
+
+# if defined(_LONG_LONG)
+# define _STLP_LONG_LONG long long
+# endif
+# if defined(_PTHREADS)
+# define _MULTI_THREADED
+# endif
+// fbp : to fix __partition() problem
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
diff --git a/build/stlport/stlport/stl/config/_auto_link.h b/build/stlport/stlport/stl/config/_auto_link.h
new file mode 100644
index 000000000..8898c5558
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_auto_link.h
@@ -0,0 +1,61 @@
+/* We do not use auto link feature when:
+ * - user asked not to use it (_STLP_DONT_USE_AUTO_LINK)
+ * - STLport is used only as a STL library (_STLP_NO_IOSTREAMS || _STLP_USE_NO_IOSTREAMS)
+ * - we are building a C translation unit, STLport is a C++ Standard library implementation
+ */
+#if !defined (__BUILDING_STLPORT) && !defined (_STLP_DONT_USE_AUTO_LINK) && \
+ !defined (_STLP_NO_IOSTREAMS) && !defined (_STLP_USE_NO_IOSTREAMS) && \
+ defined (__cplusplus)
+
+# define _STLP_STRINGIZE(X) _STLP_STRINGIZE_AUX(X)
+# define _STLP_STRINGIZE_AUX(X) #X
+
+# if defined (_STLP_DEBUG)
+# define _STLP_LIB_OPTIM_MODE "stld"
+# elif defined (_DEBUG)
+# define _STLP_LIB_OPTIM_MODE "d"
+# else
+# define _STLP_LIB_OPTIM_MODE ""
+# endif
+
+# if defined (_STLP_LIB_NAME_MOTIF)
+# define _STLP_LIB_MOTIF "_"_STLP_LIB_NAME_MOTIF
+# else
+# define _STLP_LIB_MOTIF ""
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_LIB_TYPE "_x"
+# else
+# define _STLP_LIB_TYPE ""
+# endif
+# else
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_LIB_TYPE "_statix"
+# else
+# define _STLP_LIB_TYPE "_static"
+# endif
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_VERSION_STR "."_STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR)
+# else
+# define _STLP_VERSION_STR ""
+# endif
+
+# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF""_STLP_VERSION_STR".lib"
+
+# if defined (_STLP_VERBOSE)
+# pragma message ("STLport: Auto linking to "_STLP_STLPORT_LIB)
+# endif
+# pragma comment (lib, _STLP_STLPORT_LIB)
+
+# undef _STLP_STLPORT_LIB
+# undef _STLP_LIB_OPTIM_MODE
+# undef _STLP_LIB_TYPE
+# undef _STLP_STRINGIZE_AUX
+# undef _STLP_STRINGIZE
+
+#endif /* _STLP_DONT_USE_AUTO_LINK */
+
diff --git a/build/stlport/stlport/stl/config/_bc.h b/build/stlport/stlport/stl/config/_bc.h
new file mode 100644
index 000000000..e3802dc09
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_bc.h
@@ -0,0 +1,138 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly */
+
+#define _STLP_COMPILER "Borland"
+
+#if (__BORLANDC__ < 0x551)
+# error - Borland compilers below version 5.5.1 not supported.
+#endif
+
+#pragma defineonoption _STLP_NO_RTTI -RT-
+
+#define _STLP_DONT_SUP_DFLT_PARAM
+
+#if (__BORLANDC__ >= 0x580)
+# define _STLP_HAS_INCLUDE_NEXT
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/dinkumware/##header>
+# define _STLP_NO_NEW_C_HEADERS
+# define _STLP_NO_FORCE_INSTANTIATE
+#endif
+
+#if (__BORLANDC__ >= 0x570) && (__BORLANDC__ < 0x580)
+# define _STLP_NO_NEW_C_HEADERS
+# define _STLP_NO_FORCE_INSTANTIATE
+# define _STLP_DEF_CONST_DEF_PARAM_BUG
+# define _STLP_USE_DEFAULT_FILE_OFFSET
+
+# if defined (__cplusplus)
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include/c++/ ## GCC_VERSION
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include/c++/ ## GCC_VERSION
+# endif
+
+# undef _SYS_CDEFS_H
+# include </usr/include/sys/cdefs.h>
+
+# ifdef __MT__
+# define _PTHREADS
+# if !defined (_RTLDLL)
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK
+# endif
+# else
+# define _NOTHREADS
+# endif
+
+# pragma defineonoption _CPPUNWIND -xd
+# define _STLP_NO_EXCEPTION_HEADER
+# define _STLP_DONT_USE_EXCEPTIONS
+#endif
+
+#if (__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570)
+# define _USE_OLD_RW_STL
+#endif
+
+#if (__BORLANDC__ >= 0x560)
+# if !defined (__BUILDING_STLPORT)
+# define NOWINBASEINTERLOCK
+# endif
+# define _STLP_LANG_INVARIANT_DEFINED
+#endif
+
+#if (__BORLANDC__ < 0x590)
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION
+ // <bitset> problems
+# define _STLP_MEMBER_SPECIALIZATION_BUG 1
+# ifdef __cplusplus
+# define _STLP_TR1 _STLP_STD_NAME::tr1::
+# endif
+#endif
+
+#if (__BORLANDC__ < 0x564)
+# define _STLP_QUALIFIED_SPECIALIZATION_BUG
+# define _STLP_NO_MOVE_SEMANTIC
+#endif
+
+#define _STLP_DONT_USE_PRIV_NAMESPACE
+#define _STLP_NO_TYPENAME_BEFORE_NAMESPACE
+#define _STLP_NO_VENDOR_STDLIB_L
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
+
+#if (__BORLANDC__ < 0x570) || (__BORLANDC__ >= 0x580)
+#define _STLP_NO_NATIVE_MBSTATE_T
+#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+#if (__BORLANDC__ < 0x580) && !defined (_RTLDLL)
+# define _UNCAUGHT_EXCEPTION 1
+#endif
+
+// <limits> problem
+#define _STLP_STATIC_CONST_INIT_BUG
+
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
+
+#define _STLP_LONG_LONG __int64
+
+// auto enable thread safety and exceptions:
+#ifndef _CPPUNWIND
+# define _STLP_HAS_NO_EXCEPTIONS
+#endif
+
+#if defined (__MT__) && !defined (_NOTHREADS)
+# define _STLP_THREADS
+#endif
+
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#if defined (_DLL)
+# define _STLP_DLL
+#endif
+#if defined (_RTLDLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if defined (__BUILDING_STLPORT)
+# define _STLP_CALL __cdecl __export
+# else
+# define _STLP_CALL __cdecl
+# endif
+#else
+# define _STLP_CALL __cdecl
+#endif
+
+#if !defined (__linux__)
+# include <stl/config/_auto_link.h>
+#endif
+
+#include <stl/config/_feedback.h>
diff --git a/build/stlport/stlport/stl/config/_como.h b/build/stlport/stlport/stl/config/_como.h
new file mode 100644
index 000000000..6076f8808
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_como.h
@@ -0,0 +1,207 @@
+
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Comeau"
+
+#include <stl/config/_native_headers.h>
+
+#define _STLP_UINT32_T unsigned int
+
+#define _STLP_HAS_NO_NEW_C_HEADERS
+// #define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+#define _STLP_LONG_LONG long long
+
+
+//
+// ADDITIONS FOR COMEAU C++, made by Comeau Computing.
+// We can be reached through comeau@comeaucomputing.com
+// You shouldn't need to change anything below here for Comeau C++.
+// If you do, please tell us at comeau@comeaucomputing.com
+//
+// Changes made here, AND THROUGH ALL FILES, based upon the __COMO__ macro
+// (and SIMILAR NAMES INVOLVING COMO).... no doubt some of this will
+// change as SGI integrates the changes into their code base since
+// some changes are not really Comeau C++ specific, but required to
+// make the SGI code compliant with Standard C++).
+//
+// Testing was done with Comeau C++ 4.2.44 and 4.2.45.2. Changes were made for
+// both Comeau relaxed mode and Comeau strict mode, especially for end user code
+// (that is, some of the .cxx files cannot compile in strict mode, because they
+// contain extensions to Standard C++, however their object code forms can
+// be used once compiled in relaxed mode, even if the end user code uses
+// strict mode).
+//
+// These changes may also work for some earlier versions of Comeau C++,
+// though we have not tested them.
+//
+// Actual mods made under RedHat 6.1 LINUX, should be ok with SuSE too and
+// other LINUX's, and older Caldera LINUX, Solaris/SPARC, SunOS, SCO UNIX,
+// and NetBSD. Other platforms may be added. Comeau will also perform
+// custom ports for you.
+//
+// Check libcomo details at http://www.comeaucomputing.com/libcomo and
+// http://www.comeaucomputing.com
+//
+// History of Comeau changes (this is rough, as work was often going on in parallel):
+// BETA1 July 14, 2000, Initial port for RedHat 6.1 INTEL/ELF
+// BETA2 Aug 4, 2000, Stronger RedHat support
+// Support for Comeau strict mode for end user code
+// BETA3 Aug 22, 2000, Support for other LINUX/INTEL/ELF's, including older ones
+// BETA4 Sept 2, 2000, Initial support for SCO UNIX + other UNIX x86 SVR3's
+// Stronger support for end user Comeau strict mode
+// BETA5 Oct 5, 2000, Initial support for Solaris/SPARC
+// More SCO support (though still incomplete)
+// BETA6 Feb 5, 2001, Minor mods to accomodate Comeau C++ 4.2.45.1
+// BETA7 Mar 13, 2001, Verified with Comeau C++ 4.2.45.2
+// Minor NetBSD support
+// BETA8 Apr 1. 2001, Initial support for SunOS/SPARC
+// BETA9 Apr 7, 2001, Stronger SCO support + other UNIX x86 SVR3's
+// Mods for an fpos_t problem for some LINUXes
+// Mods since Destroy did not work in strict mode
+// BETA10 Apr 12. 2001, Stronger NetBSD support
+//
+// PLANNED:
+// BETAx TBA TBA, 2001, NetBSD, UNIXWARE, and Windows support expected
+//
+
+
+#ifdef __linux__
+
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# define _STLP_NO_LONG_DOUBLE 1
+
+// Comeau C++ under LINUX/INTEL/ELF
+// Preprocess away "long long" routines for now, even in relaxed mode
+# define __wcstoull_internal_defined 1
+# define __wcstoll_internal_defined 1
+
+#endif /* __COMO__ under __linux__ */
+
+#ifdef __USING_x86SVR3x_WITH_COMO /* SCO et al */
+/* UNIX 386+ SVR3 mods made with __USING_x86SVR3x_WITH_COMO
+ in other sources, not here */
+# define atan2l atan2
+# define cosl cos
+# define sinl sin
+# define sqrtl sqrt
+# include <math.h>
+ inline long double expl(long double arg) { return exp(arg); }
+ inline long double logl(long double arg) { return log(arg); }
+# define log10l log10
+
+# define sinhl sinh
+# define coshl cosh
+# define fabsl fabs
+namespace std {
+ inline int min(int a, int b) { return a>b ? b : a; }
+}
+#endif
+
+#ifdef sun
+// Comeau C++ under Solaris/SPARC or SunOS
+
+#ifdef solarissparc
+#define __USING_SOLARIS_SPARC_WITH_COMO /* show this in the source when grep'ing for COMO */
+// Note comowchar.h for Solaris/SPARC wchar stuff
+
+#include <math.h>
+# define sinf sin
+# define sinl sin
+# define sinhf sinh
+# define sinhl sinh
+# define cosf cos
+# define cosl cos
+# define coshf cosh
+# define coshl cosh
+# define atan2l atan2
+# define atan2f atan2
+ inline float logf(float arg) { return log(arg); }
+ inline long double logl(long double arg) { return log(arg); }
+# define log10f log10
+# define log10l log10
+# define expf exp
+ inline long double expl(long double arg) { return exp(arg); }
+# define sqrtf sqrt
+# define sqrtl sqrt
+# define fabsf fabs
+# define fabsl fabs
+#else
+#define __USING_SUNOS_WITH_COMO
+
+#define __unix 1
+#define __EXTENSIONS__ /* This might create undue noise somewhere */
+#endif
+#endif /* sun */
+
+#if defined(__NetBSD__)
+// From non-como #ifdef __GNUC__ above
+#undef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
+#define __unix 1
+
+#include <sys/cdefs.h>
+// Some joker #define'd __END_DECLS as };
+#undef __END_DECLS
+#define __END_DECLS }
+
+// <sys/stat.h> prob
+#include <sys/cdefs.h>
+#undef __RENAME
+#define __RENAME(x)
+
+#define wchar_t __COMO_WCHAR_T
+#include <stddef.h>
+#undef wchar_t
+
+#include <math.h>
+# ifdef BORIS_DISABLED
+# define atan2l atan2
+# define cosl cos
+# define sinl sin
+# define sqrtl sqrt
+ inline long double expl(long double arg) { return exp(arg); }
+ inline long double logl(long double arg) { return log(arg); }
+# define log10l log10
+# define sinhl sinh
+# define coshl cosh
+# define fabsl fabs
+# endif
+#endif /* __NetBSD__ under __COMO__ */
+
+// Shouldn't need to change anything below here for Comeau C++
+// If so, tell us at comeau@comeaucomputing.com
+
+#define _STLP_NO_DRAND48
+
+#define _STLP_PARTIAL_SPECIALIZATION_SYNTAX
+#define _STLP_NO_USING_CLAUSE_IN_CLASS
+
+#if __COMO_VERSION__ < 4300
+#if __COMO_VERSION__ >= 4245
+#define _STLP_NO_EXCEPTION_HEADER /**/
+ // Is this needed?
+# include <stdexcept.stdh>
+#endif
+#define _STLP_NO_BAD_ALLOC /**/
+#define _STLP_USE_AUTO_PTR_CONVERSIONS /**/
+#endif
+
+// this one is true only with MS
+# if defined (_MSC_VER)
+# define _STLP_WCHAR_T_IS_USHORT 1
+# if _MSC_VER <= 1200
+# define _STLP_VENDOR_GLOBAL_CSTD
+# endif
+# if _MSC_VER < 1100
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_USE_NO_IOSTREAMS 1
+# endif
+# endif
+
+// # define __EDG_SWITCHES
+
+
diff --git a/build/stlport/stlport/stl/config/_cray.h b/build/stlport/stlport/stl/config/_cray.h
new file mode 100644
index 000000000..55327c11d
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_cray.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#define _STLP_COMPILER "CC"
+
+// Mostly correct guess, change it for Alpha (and other environments
+// that has 64-bit "long")
+# define _STLP_UINT32_T unsigned long
+
+// Uncomment if long long is available
+# define _STLP_LONG_LONG long long
+
+// Uncomment this if your compiler can't inline while(), for()
+# define _STLP_LOOP_INLINE_PROBLEMS 1
+
+// Uncomment this if your compiler does not support exceptions
+// Cray C++ supports exceptions when '-h exceptions' option is user;
+// therefore '-D_STLP_HAS_NO_EXCEPTIONS' must be used when '-h exceptions'
+// is NOT used.
+//# define _STLP_HAS_NO_EXCEPTIONS 1
+
+// Delete?
+// Define this if compiler lacks <exception> header
+//# define _STLP_NO_EXCEPTION_HEADER 1
+
+// Uncomment this if your C library has lrand48() function
+# define _STLP_RAND48 1
+
+// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// uncomment if new-style headers <new> is available
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
+// not std::
+# define _STLP_VENDOR_GLOBAL_STD
+
+// uncomment this if <cstdio> and the like put stuff in ::namespace,
+// not std::
+# define _STLP_VENDOR_GLOBAL_CSTD
+
+# define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
+// WARNING: Following is hardcoded to the system default C++ include files
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </opt/ctl/CC/CC/include/##__x>
+
+
+# define _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
+//# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
diff --git a/build/stlport/stlport/stl/config/_cygwin.h b/build/stlport/stlport/stl/config/_cygwin.h
new file mode 100644
index 000000000..8610743b9
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_cygwin.h
@@ -0,0 +1,9 @@
+#define _STLP_PLATFORM "Cygwin"
+
+#define _STLP_UNIX
+
+#ifndef _STLP_USE_STDIO_IO
+# define _STLP_USE_UNIX_IO
+#endif
+
+#define _STLP_LDOUBLE_96
diff --git a/build/stlport/stlport/stl/config/_dec.h b/build/stlport/stlport/stl/config/_dec.h
new file mode 100644
index 000000000..fc8ace7d6
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_dec.h
@@ -0,0 +1,113 @@
+#define _STLP_COMPILER "Dec"
+
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+# define _STLP_NATIVE_HEADER(header) <../cxx/##header>
+# define _STLP_NATIVE_C_HEADER(x) <../include/##x>
+
+#if (__DECCXX_VER < 60300000)
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../cxx/##header>
+#else
+# define _STLP_NATIVE_CPP_C_HEADER(header) </usr/include/cxx_cname/##header>
+#endif
+
+# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../cxx/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../cxx/##header>
+
+/* Alpha is little-endian */
+# define _STLP_LITTLE_ENDIAN
+
+// collisions
+# define _STLP_DONT_PUT_STLPORT_IN_STD
+
+#if (__DECCXX_VER < 60000000)
+
+/*
+ automatic template instantiation does not
+ work with namespaces ;(
+*/
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_EXPLICIT 1
+
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+
+
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+#endif
+
+
+#ifndef __NO_USE_STD_IOSTREAM
+/* default is to use new iostreams, anyway */
+# ifndef __USE_STD_IOSTREAM
+# define __USE_STD_IOSTREAM
+# endif
+#endif
+
+/*
+# ifndef __STD_STRICT_ANSI_ERRORS
+# endif
+*/
+
+#ifndef __EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+# ifdef __IMPLICIT_INCLUDE_ENABLED
+
+/* but, works with ours ;). */
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# else
+# undef _STLP_LINK_TIME_INSTANTIATION
+# endif
+
+# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
+/*
+ we should ban that !
+ # error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
+*/
+# endif
+
+# if (defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
+# define _STLP_STRICT_ANSI 1
+# else
+/* we want to enforce it */
+# define _STLP_LONG_LONG long long
+# endif
+
+/* unsigned 32-bit integer type */
+# define _STLP_UINT32_T unsigned int
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+/* # define _STLP_RAND48 1 */
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# if (__DECCXX_VER <= 60600000)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED)
+# define _STLP_DEC_THREADS
+#endif
diff --git a/build/stlport/stlport/stl/config/_dec_vms.h b/build/stlport/stlport/stl/config/_dec_vms.h
new file mode 100644
index 000000000..44a0fb8b2
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_dec_vms.h
@@ -0,0 +1,89 @@
+// OpenVMS version
+
+#define _STLP_COMPILER "Dec Vms"
+
+# define _STLP_NATIVE_HEADER(header) <sys$library:##header>
+# define _STLP_NATIVE_C_HEADER(x) <sys$library:##x>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <sys$library:##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <sys$library:##header>
+
+#if (__DECCXX_VER < 60000000)
+
+// automatic template instantiation does not
+// work with namespaces ;(
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_EXPLICIT 1
+
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+#endif
+
+
+#ifdef __NO_USE_STD_IOSTREAM
+# define _STLP_USE_NO_IOSTREAMS 1
+# else
+// default is to use new iostreams, anyway
+# ifndef __USE_STD_IOSTREAM
+# define __USE_STD_IOSTREAM
+# endif
+#endif
+
+#ifndef __EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+# ifdef __IMPLICIT_INCLUDE_ENABLED
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+// implicit include introduces conflicts
+// between stlport and native lib.
+# undef __IMPLICIT_INCLUDE_ENABLED
+#endif
+
+// but, works with ours ;).
+# define _STLP_LINK_TIME_INSTANTIATION 1
+
+# endif
+
+# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
+// we should ban that !
+# error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
+# endif
+
+# if !(defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
+// we want to enforce it
+# define _STLP_LONG_LONG long long
+# endif
+
+// unsigned 32-bit integer type
+# define _STLP_UINT32_T unsigned int
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
diff --git a/build/stlport/stlport/stl/config/_detect_dll_or_lib.h b/build/stlport/stlport/stl/config/_detect_dll_or_lib.h
new file mode 100644
index 000000000..a062e6929
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_detect_dll_or_lib.h
@@ -0,0 +1,74 @@
+/* File used to define macros:
+ * _STLP_USE_DYNAMIC_LIB: To signal use STLport as a dll or build of the
+ * STLport dlls.
+ * _STLP_USE_STATIC_LIB: To signal use of STLport as a static lib or build of
+ * the STLport static libs.
+ * _STLP_USING_CROSS_NATIVE_RUNTIME_LIB: Signal that we are using a native runtime
+ * in a version different from the STLport one.
+ * If _STLP_USE_DYNAMIC_LIB or _STLP_USE_STATIC_LIB is alreday defined it means that
+ * user forces use of a specific version. In this case _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+ * will surely be defined otherwise there is no need to force macro defines.
+ *
+ * Before including this file the compiler must define:
+ * _STLP_DLL: If we are building a dll
+ * _STLP_RUNTIME_DLL: If we are using native runtime as a dll
+ */
+#if defined (__BUILDING_STLPORT)
+# undef _STLP_USE_DYNAMIC_LIB
+# undef _STLP_USE_STATIC_LIB
+# if defined (_STLP_DLL)
+/* We are building the STLport dll */
+# define _STLP_USE_DYNAMIC_LIB
+# if !defined (_STLP_RUNTIME_DLL)
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# else
+# define _STLP_USE_STATIC_LIB
+# if defined (_STLP_RUNTIME_DLL)
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# endif
+#else
+# if !defined (_STLP_NO_IOSTREAMS)
+/* STLport use only depend on _STLP_RUNTIME_DLL as we are replacing
+ * the native runtime.
+ */
+# if defined (_STLP_RUNTIME_DLL)
+# if !defined (_STLP_USE_STATIC_LIB)
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# else
+/* The user is forcing use of STLport as a dynamic library. We signal it so
+ * that the STLport namespace will be modify to report such a combination
+ * and force the user to link with the rebuilt STLport library.
+ */
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# else
+# if !defined(_STLP_USE_DYNAMIC_LIB)
+# if !defined (_STLP_USE_STATIC_LIB)
+# define _STLP_USE_STATIC_LIB
+# endif
+# else
+/* Idem previous remark but the user forces use of the static native runtime.
+ */
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# endif
+# else
+/* If we do not build and use STLport libs we consider that we are in a static lib
+ * mode as only dynamic lib needs additional export/import specifier.
+ */
+# define _STLP_USE_STATIC_LIB
+# endif
+#endif
+
+/* we don't have a static native runtime library on evc3/evc4 */
+#ifdef _STLP_WCE
+# undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+#endif
+
+#if !defined (_STLP_USE_DYNAMIC_LIB) && !defined (_STLP_USE_STATIC_LIB)
+# error Unknown STLport usage config (dll/lib?)
+#endif
diff --git a/build/stlport/stlport/stl/config/_dm.h b/build/stlport/stlport/stl/config/_dm.h
new file mode 100644
index 000000000..4f707323a
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_dm.h
@@ -0,0 +1,121 @@
+// STLport configuration file for Digital Mars C++
+
+#define _STLP_COMPILER __DMC_VERSION_STRING__
+
+#if (__DMC__ < 0x849)
+# error "Digital Mars C++ compilers before version 8.49 are not supported!"
+#endif
+
+/* DMC goes too far in template instanciation and tries to fully instanciate
+ * slist<pair<const int, string> > for instance. The generation of assignment
+ * operator fails of course so we are force to use mutable key for this compiler.
+ */
+#define _STLP_NO_CONST_IN_PAIR
+#define _STLP_DONT_SUP_DFLT_PARAM
+
+#ifndef _CPPUNWIND
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI
+#endif
+
+#define _STLP_VENDOR_GLOBAL_CSTD
+
+//DMC prefer enum to real static const variable because it do not consider
+//static const as const enough to be used in switch declaration...
+#define _STLP_STATIC_CONST_INIT_BUG
+
+#if !defined (_WIN32)
+// it's not fully supported on non-Win32 platforms
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+#endif
+
+/* _STLP_NO_OWN_NAMESPACE is defined because Digital Mars' linker and libarian
+ appear to have problems with STLport namespaces. Summary of the issues:
+
+ STATIC: Digital Mars' librarian (lib.exe) may fail with "len <= IDMAX" error
+ if _STLP_DEBUG is defined. This is because Digital Mars' librarian uses
+ Microsoft OMF format, which limits identifier length to about 512 bytes.
+ With STLport namespaces, some identifiers such as Category_Map in
+ src/locale_catalog.cpp may exceed the maximum OMF identifier length.
+
+ DYNAMIC: Export issues with cin, cout, cerr, clog in src/iostream.cpp.
+ Exports in Digital Mars 'def' file must match mangled names in iostream.cpp.
+ With STLport namespaces, the mangled names in the intermediate files no
+ longer match these pre-defined exports. To use STLport dynamic libraries
+ and STLport namespaces with Digital Mars, the pre-defined exports in
+ src/iostream.cpp and the related Digital Mars 'def' files would need to be
+ revised. */
+#define _STLP_NO_OWN_NAMESPACE 1
+
+// select threads strategy
+#if defined (_MT) && !defined (_STLP_NO_THREADS)
+# define _STLP_THREADS
+#endif
+
+#ifndef _BOOL_DEFINED
+# define _STLP_NO_BOOL
+#else
+# define _STLP_DONT_USE_BOOL_TYPEDEF
+#endif
+
+#if _INTEGRAL_MAX_BITS >= 64
+# define _STLP_LONG_LONG long long
+#endif
+
+#define _STLP_MARK_PARAMETER_AS_UNUSED(X)
+#define _STLP_DONT_USE_PRIV_NAMESPACE
+#define _STLP_PRIV
+#define _STLP_THROW_RETURN_BUG
+
+#if !defined (_DLL)
+# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+#if (__DMC__ < 0x849)
+# define _STLP_NO_BAD_ALLOC
+#endif
+
+#define _STLP_USE_ABBREVS
+#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+
+#define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_NEED_ADDITIONAL_STATIC_DECLSPEC
+
+//#define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport)
+//#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport)
+
+#if defined (_WINDLL)
+# define _STLP_DLL
+#endif
+#if defined (_DLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if defined (__BUILDING_STLPORT)
+# define _STLP_CALL __export
+# else
+# define _STLP_CALL
+# endif
+#else
+# define _STLP_CALL
+#endif
+
+#include <stl/config/_auto_link.h>
+
+#undef __SC__
+
+#include <stl/config/_feedback.h>
diff --git a/build/stlport/stlport/stl/config/_epilog.h b/build/stlport/stlport/stl/config/_epilog.h
new file mode 100644
index 000000000..30d1e244e
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_epilog.h
@@ -0,0 +1,29 @@
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# pragma warning (pop)
+# pragma pack (pop)
+
+#elif defined (__BORLANDC__)
+
+# pragma option pop
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+
+#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+
+# pragma reset woff 1174
+# pragma reset woff 1375
+# pragma reset woff 1209
+/* from iterator_base.h */
+# pragma reset woff 1183
+
+#elif defined (__DECCXX)
+
+# ifdef __PRAGMA_ENVIRONMENT
+# pragma __environment __restore
+# endif
+
+#elif defined (__IBMCPP__)
+
+# pragma info(restore)
+
+#endif
diff --git a/build/stlport/stlport/stl/config/_evc.h b/build/stlport/stlport/stl/config/_evc.h
new file mode 100644
index 000000000..c46045068
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_evc.h
@@ -0,0 +1,333 @@
+/*
+ * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport
+ * May 2004
+ * Origin : Zdenek Nemec - zero@mapfactor.com
+ * Michael Fink - vividos@users.sourceforge.net
+ */
+
+#ifndef _STLP_EVC_H
+#define _STLP_EVC_H
+
+#define _STLP_COMPILER "eMbedded Visual C++"
+
+// This flag is being used by STLport to support
+// old-fashioned Windows CE SDK (see stl_wince.h)
+// do not use with eMebedded Visual C++ 3 or 4!
+#ifdef _STLP_WINCE
+# undef _STLP_WINCE
+#endif
+
+/* Compiler dependent define. The following defines may be available:
+ * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3
+ * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET
+ * _STLP_WCE always defined when compiling with one of the above
+ */
+#undef _STLP_WCE_EVC3
+#undef _STLP_WCE_NET
+
+#if (_WIN32_WCE > 300)
+# define _STLP_WCE_NET UNDER_CE
+#elif (_WIN32_WCE == 300)
+# define _STLP_WCE_EVC3 UNDER_CE
+#else
+# error No support for Windows CE below 3.0!
+#endif
+
+// This is defined for all platforms using Windows CE
+#define _STLP_WCE
+
+/* All Windows CE versions up to at least version 5 are little-endian, even
+ * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */
+#define _STLP_LITTLE_ENDIAN
+
+// Ensure _DEBUG is defined.
+#if defined (DEBUG) && !defined (_DEBUG)
+# define _DEBUG
+#endif
+
+// inherit all msvc6 options
+#include <stl/config/_msvc.h>
+
+// CE up to at least version 5 has no C locale support
+#define _STLP_NO_LOCALE_SUPPORT
+
+#if _WIN32_WCE >= 420
+ // SDKs built with PB5 have terminate&co in namespace std...
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD
+ // ...and new_handler/set_new_handler in the global namespace.
+# define _STLP_GLOBAL_NEW_HANDLER 1
+#endif
+
+// Always threaded in eMbedded Visual C++ 3.0 and .NET
+#ifndef _MT
+# define _MT
+#endif
+
+// we don't have a static native runtime library
+#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+
+#if _WIN32_WCE < 400
+// no long double under CE3 and older
+# define _STLP_NO_LONG_DOUBLE
+#endif
+
+// no *f and *l math functions available
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_NO_VENDOR_MATH_L
+
+/*
+ * Redirect cout, cerr and clog:
+ * If defined redirect cout, cerr and clog to
+ * files stdout.txt, stderr.txt and stdlog.txt
+ */
+//# define _STLP_REDIRECT_STDSTREAMS
+
+/*
+ * Static class members may generate LNK1179:
+ * Wrong COMDAT packing may cause LNK1179 error.
+ * For details see http://groups.google.com/groups?th=8a05c82c4ffee280
+ * example P78. This define is not used/needed at this moment
+ * but may came handy in future...
+ */
+//# define _STLP_STATIC_MEMBERS_BUG
+
+// Use wide-string interface of windows native functions (CreateFile...).
+// Note that this should be defined all the time while under CE.
+#if defined (UNICODE)
+# define _STLP_USE_WIDE_INTERFACE
+#endif
+
+// Force exception std to std instead of __std_alias.
+#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES)
+# ifdef _STLP_VENDOR_EXCEPT_STD
+# undef _STLP_VENDOR_EXCEPT_STD
+# endif
+# define _STLP_VENDOR_EXCEPT_STD std
+#endif
+
+// short string optimization bug under evc3, evc4 using ARM compiler
+#if _MSC_VER < 1400 && (defined (ARM) || defined (_ARM_))
+# define _STLP_DONT_USE_SHORT_STRING_OPTIM
+#endif
+
+// when using MFC, disable another placement new declaration, since there is one in wcealt.h
+#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER)
+# define __PLACEMENT_NEW_INLINE
+#endif
+
+// threads
+#undef _REENTRANT
+#define _REENTRANT
+#undef _NOTHREADS
+
+// Use old fashioned headers (ctime vs. time.h).
+#undef _STLP_NO_NEW_C_HEADERS
+#define _STLP_NO_NEW_C_HEADERS
+
+// exception handling support: only on evc4 and user added /GX to project settings
+#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND)
+# define _STLP_NO_EXCEPTION_HEADER
+# define _STLP_NO_EXCEPTIONS
+# undef _STLP_USE_EXCEPTIONS
+# ifndef _STLP_THROW_BAD_ALLOC
+# define _STLP_THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); }
+# endif
+#endif
+
+#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg)
+
+/*
+ * eMbedded Visual C++ .NET specific settings
+ */
+#if defined (_STLP_WCE_NET)
+
+// evc4 has no locale and time support
+# define _STLP_NO_LOCALE_SUPPORT
+# define _STLP_NO_TIME_SUPPORT
+
+// ptrdiff_t is not defined in evc4 headers
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+
+/*
+ * Helper macros for including the native headers in cases where a file with
+ * the same name also exists in the STLport include folder. The idea behind
+ * this is that we first go up one directory and then down into a dir that
+ * is only present in the native install but not in STLport.
+ *
+ */
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# if defined (_X86_)
+# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR)
+# define _STLP_NATIVE_INCLUDE_PATH ../Emulator
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../X86
+# endif
+# elif defined (_ARM_)
+# if _MSC_VER < 1400
+ // eVC3/4
+# if defined (ARMV4)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
+# elif defined (ARMV4I)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
+# elif defined (ARMV4T)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t
+# else
+# error Unknown ARM SDK.
+# endif
+# else
+ // VC8 crosscompiling for CE
+# if defined (ARMV4)
+ // VC8 bundled Pocket PC 2003 SDK don't have a target CPU subfolder.
+# if defined(WIN32_PLATFORM_PSPC)
+# define _STLP_NATIVE_INCLUDE_PATH ../Include
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
+# endif
+# elif defined(ARMV4I) || defined(ARMV4T)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
+# else
+# error Unknown ARM SDK.
+# endif
+# endif
+# elif defined (_MIPS_)
+# if defined (MIPS16)
+# define _STLP_NATIVE_INCLUDE_PATH ../mips16
+# elif defined (MIPSII)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsII
+# elif defined (MIPSII_FP)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp
+# elif defined (MIPSIV)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV
+# elif defined (MIPSIV_FP)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp
+# else
+# error Unknown MIPS SDK.
+# endif
+# elif defined (SHx)
+# if defined (SH3)
+# define _STLP_NATIVE_INCLUDE_PATH ../sh3
+# elif defined (SH4)
+# define _STLP_NATIVE_INCLUDE_PATH ../sh4
+# else
+# error Unknown SHx SDK.
+# endif
+# else
+# error Unknown SDK.
+# endif
+# endif /* !_STLP_NATIVE_INCLUDE_PATH */
+
+/* Workaround when using MFCCE and using <new> together: MFCCE's wcealt.h doesn't
+ * check for __PLACEMENT_NEW_INLINE before defining operator new, so when <new>
+ * defines the operatore before, there will be an error C2084:
+ * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body".
+ */
+# ifdef _STLP_USE_MFC
+# define __PLACEMENT_NEW_INLINE
+# endif
+
+#endif /* _STLP_WCE_NET */
+
+/*
+ * eMbedded Visual C++ 3.0 specific settings
+ */
+#if defined (_STLP_WCE_EVC3)
+
+# define _STLP_NO_NATIVE_MBSTATE_T
+
+// evc3 has no locale and time support
+# define _STLP_NO_LOCALE_SUPPORT
+# define _STLP_NO_TIME_SUPPORT
+
+// evc3 has new, but no explicit header
+# define _STLP_NO_NEW_HEADER
+# define _STLP_NO_NEW_NEW_HEADER
+
+// evc3 has no bad_alloc and no typeinfo
+# undef _STLP_NO_BAD_ALLOC
+# define _STLP_NO_BAD_ALLOC
+
+# undef _STLP_NO_TYPEINFO
+# define _STLP_NO_TYPEINFO
+
+// missing things in eMbedded Visual C++ 3.0 headers
+# ifndef _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+# define _SIZE_T_DEFINED
+# endif
+
+# ifndef _WCHAR_T_DEFINED
+ typedef unsigned short wchar_t;
+# define _WCHAR_T_DEFINED
+# endif
+
+// ptrdiff_t is not defined in evc3 headers
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+
+// clock_t is not defined in evc3 headers
+# ifndef _CLOCK_T_DEFINED
+ typedef long clock_t;
+# define _CLOCK_T_DEFINED
+# endif
+
+// Struct tm is not defined in evc3 headers
+# ifndef _TM_DEFINED
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+};
+# define _TM_DEFINED
+# endif
+
+// define placement new and delete operator
+// note: when MFCCE headers are included first, don't define the new operator,
+// since it was already defined in wcealt.h
+# ifdef __cplusplus
+# ifndef __PLACEMENT_NEW_INLINE
+# ifndef _MFC_VER
+inline void *__cdecl operator new(size_t, void *_P) { return (_P); }
+# endif /* _MFC_VER */
+inline void __cdecl operator delete(void *, void *) { return; }
+# define __PLACEMENT_NEW_INLINE
+# endif
+# endif /* __cplusplus */
+
+// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+
+// evc3 doesn't have assert.h
+# ifndef _ASSERT_DEFINED
+# define assert(expr) _STLP_ASSERT(expr)
+# define _ASSERT_DEFINED
+# endif
+
+#endif /* _STLP_WCE_EVC3 */
+
+/*
+ * original call: TerminateProcess(GetCurrentProcess(), 0);
+ * we substitute the GetCurrentProcess() with the result of the inline function
+ * defined in kfuncs.h, since we then can avoid including <windows.h> at all.
+ * all needed Win32 API functions are defined in <stl/_windows.h>
+ */
+#ifndef _ABORT_DEFINED
+# define _STLP_ABORT() TerminateProcess(reinterpret_cast<HANDLE>(66), 0)
+# define _ABORT_DEFINED
+#endif
+
+// Notice: windows.h isn't included here anymore; all needed defines are in
+// stl/_windows.h now
+
+#endif /* _STLP_EVC_H */
diff --git a/build/stlport/stlport/stl/config/_feedback.h b/build/stlport/stlport/stl/config/_feedback.h
new file mode 100644
index 000000000..0171ca511
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_feedback.h
@@ -0,0 +1,43 @@
+/* Helper header to give feedback about build environment configuration
+ * thanks to #pragma message directives.
+ */
+
+#if defined (_STLP_VERBOSE)
+# define _STLP_VERBOSE_MODE_SUPPORTED
+
+# if defined (_STLP_COMPILER)
+# pragma message (_STLP_COMPILER)
+# endif
+
+# if defined (_STLP_NO_RTTI)
+# pragma message ("STLport: RTTI support -> Disabled")
+# else
+# pragma message ("STLport: RTTI support -> Enabled")
+# endif
+
+# if defined (_STLP_HAS_NO_EXCEPTIONS)
+# pragma message ("STLport: Exception support -> Disabled")
+# else
+# pragma message ("STLport: Exception support -> Enabled")
+# endif
+
+# if defined (_STLP_THREADS)
+# pragma message ("STLport: Threading model -> Multi")
+# else
+# pragma message ("STLport: Threading model -> Mono")
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# pragma message ("STLport: Library model -> Dynamic")
+# else
+# pragma message ("STLport: Library model -> Static")
+# endif
+
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# pragma message ("STLport: Native library model -> Static")
+# else
+# pragma message ("STLport: Native library model -> Dynamic")
+# endif
+# endif
+#endif
diff --git a/build/stlport/stlport/stl/config/_freebsd.h b/build/stlport/stlport/stl/config/_freebsd.h
new file mode 100644
index 000000000..ab9339bd2
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_freebsd.h
@@ -0,0 +1,3 @@
+#define _STLP_PLATFORM "Free BSD"
+
+#define _STLP_USE_UNIX_IO
diff --git a/build/stlport/stlport/stl/config/_fujitsu.h b/build/stlport/stlport/stl/config/_fujitsu.h
new file mode 100644
index 000000000..cf91e05f9
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_fujitsu.h
@@ -0,0 +1,7 @@
+/* STLport configuration for Fujitsu compiler : looks like a perfect one ! */
+#define _STLP_COMPILER "Fujitsu"
+
+#define _STLP_NATIVE_INCLUDE_PATH ../std
+#define _STLP_UINT32_T unsigned int
+#define _STLP_LONG_LONG long long
+#define _STLP_WCHAR_SUNPRO_EXCLUDE 1
diff --git a/build/stlport/stlport/stl/config/_gcc.h b/build/stlport/stlport/stl/config/_gcc.h
new file mode 100644
index 000000000..0d41863ee
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_gcc.h
@@ -0,0 +1,198 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#define _STLP_COMPILER "gcc"
+
+#define _STLP_HAS_INCLUDE_NEXT 1
+
+#if (__GNUC__ < 2) || ((__GNUC__ < 3) && ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)))
+/* We do not support neither the unofficial 2.96 gcc version. */
+# error GNU compilers before 2.95 are not supported anymore.
+#endif
+
+/* Systems having GLIBC installed have different traits */
+#if defined (__linux__)
+# ifndef _STLP_USE_GLIBC
+# define _STLP_USE_GLIBC 1
+# endif
+# if defined (__UCLIBC__) && !defined (_STLP_USE_UCLIBC)
+# define _STLP_USE_UCLIBC 1
+# endif
+#endif
+
+#if defined (__CYGWIN__) && \
+ (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3) && !defined (_GLIBCPP_USE_C99)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_VENDOR_STDLIB_L
+#endif
+
+#if (__GNUC__ < 3)
+# define _STLP_NO_VENDOR_STDLIB_L
+#endif
+
+#if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4))
+/* define for gcc versions before 3.4.0. */
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+#endif
+
+#if !defined (_REENTRANT) && (defined (_THREAD_SAFE) || \
+ (defined (__OpenBSD__) && defined (_POSIX_THREADS)) || \
+ (defined (__MINGW32__) && defined (_MT)))
+# define _REENTRANT
+#endif
+
+#if defined (__DJGPP)
+# define _STLP_RAND48 1
+# define _NOTHREADS 1
+# undef _PTHREADS
+# define _STLP_LITTLE_ENDIAN
+#endif
+
+#if defined (__MINGW32__)
+/* Mingw32, egcs compiler using the Microsoft C runtime */
+# if (__GNUC__ >= 3)
+/* For gcc before version 3 this macro is defined below */
+# define _STLP_VENDOR_GLOBAL_CSTD
+# endif
+# undef _STLP_NO_DRAND48
+# define _STLP_NO_DRAND48
+# define _STLP_CALL
+#endif /* __MINGW32__ */
+
+#if defined (__CYGWIN__) || defined (__MINGW32__)
+# if !defined (_STLP_USE_STATIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+# endif
+/* The following is defined independently of _STLP_USE_STATIC_LIB because it is also
+ * used to import symbols from PSDK under MinGW
+ */
+# define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+#else
+# if (__GNUC__ >= 4)
+# if !defined (_STLP_USE_STATIC_LIB)
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# define _STLP_USE_DECLSPEC 1
+# define _STLP_EXPORT_DECLSPEC __attribute__((visibility("default")))
+# define _STLP_IMPORT_DECLSPEC __attribute__((visibility("default")))
+# define _STLP_CLASS_EXPORT_DECLSPEC __attribute__((visibility("default")))
+# define _STLP_CLASS_IMPORT_DECLSPEC __attribute__((visibility("default")))
+# endif
+# endif
+#endif
+
+#if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__))
+# if !defined (__MINGW32__) && !defined (__CYGWIN__)
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# endif
+# if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+# endif
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+#endif
+
+#define _STLP_NORETURN_FUNCTION __attribute__((noreturn))
+
+/* Mac OS X is a little different with namespaces and cannot instantiate
+ * static data members in template classes */
+#if defined (__APPLE__)
+# if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)))
+/* Mac OS X is missing a required typedef and standard macro */
+typedef unsigned int wint_t;
+# endif
+
+# define __unix
+
+# define _STLP_NO_LONG_DOUBLE
+
+/* Mac OS X needs all "::" scope references to be "std::" */
+# define _STLP_USE_NEW_C_HEADERS
+
+# define _STLP_NO_VENDOR_STDLIB_L
+
+#endif /* __APPLE__ */
+
+/* g++ 2.7.x and above */
+#define _STLP_LONG_LONG long long
+
+#ifdef _STLP_USE_UCLIBC
+ /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
+# define _STLP_NO_VENDOR_MATH_F
+ /* No *l math fuctions variants (i.e. sqrtl, fabsl, etc.) */
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_LONG_DOUBLE
+#endif
+
+#if defined (__OpenBSD__) || defined (__FreeBSD__)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+# ifndef __unix
+# define __unix
+# endif
+#endif
+
+#if defined (__alpha__)
+# define _STLP_NO_VENDOR_MATH_L
+#endif
+
+#if defined (__hpux)
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+ /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
+# define _STLP_NO_VENDOR_MATH_F
+#endif
+
+#if (__GNUC__ >= 3)
+# ifndef _STLP_HAS_NO_NEW_C_HEADERS
+/*
+# ifndef _STLP_USE_UCLIBC
+*/
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+/*
+# endif
+*/
+# else
+# ifdef _STLP_USE_GLIBC
+# define _STLP_VENDOR_LONG_DOUBLE_MATH 1
+# endif
+# endif
+#endif
+
+#if (__GNUC__ < 3)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
+# ifndef __HONOR_STD
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
+# endif
+/* egcs fails to initialize builtin types in expr. like this : new(p) char(); */
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+#endif
+
+#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+
+/* strict ANSI prohibits "long long" ( gcc) */
+#if defined ( __STRICT_ANSI__ )
+# undef _STLP_LONG_LONG
+#endif
+
+#ifndef __EXCEPTIONS
+# undef _STLP_DONT_USE_EXCEPTIONS
+# define _STLP_DONT_USE_EXCEPTIONS 1
+#endif
+
+#if (__GNUC__ >= 3)
+/* Instantiation scheme that used (default) in gcc 3 made void of sense explicit
+ instantiation within library: nothing except increased library size. - ptr
+ */
+# define _STLP_NO_FORCE_INSTANTIATE
+#endif
diff --git a/build/stlport/stlport/stl/config/_hpacc.h b/build/stlport/stlport/stl/config/_hpacc.h
new file mode 100644
index 000000000..920b8b417
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_hpacc.h
@@ -0,0 +1,129 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#define _STLP_COMPILER "aCC"
+
+/* system C-library dependent */
+#if defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+/* # define _STLP_RAND48 1 */
+/* #define _STLP_NO_NATIVE_MBSTATE_T 1 */
+#define _STLP_HPACC_BROKEN_BUFEND 1
+#define _STLP_WCHAR_HPACC_EXCLUDE 1
+
+/* this was reported to help, just as with SUN CC 4.2 */
+#define _STLP_INLINE_STRING_LITERAL_BUG
+
+/* specific prolog is needed to select correct threads impl */
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+/* HP aCC with +noeh */
+#ifdef __HPACC_NOEH
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+#define _STLP_NO_FORCE_INSTANTIATE
+#define _STLP_LONG_LONG long long
+#define _STLP_NO_VENDOR_STDLIB_L
+
+/* The aCC6 compiler is using the EDG Front End. Unfortunately, prior to
+ * version A.06.12, defining the __EDG__ and __EDG_VERSION__ macros was
+ * disabled. It was corrected in A.06.12.
+ */
+#if ((__HP_aCC > 60000) && (__HP_aCC < 61200))
+# define __EDG__
+# define __EDG_VERSION__ 306
+#endif
+
+#if (__HP_aCC >= 32500 )
+# define _STLP_USE_NEW_C_HEADERS
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+ typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+ typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+
+# if defined (_HP_NAMESPACE_STD) // option -AA
+/* from now, we have a full standard lib in namespace std
+ *
+ * -AA indicates that we are compiling against Rogue Wave 2.2.1
+ * STL shipped with the HP aCC compiler. -AA tells the compiler
+ * to use the STL defined in the include_std directory.
+ */
+# define _STLP_NATIVE_INCLUDE_PATH ../include_std
+# else // option -Aa
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# endif
+#endif
+
+#if (__HP_aCC >= 31400 && __HP_aCC < 32500)
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+# define _STLP_NO_CWCHAR
+# if defined (_NAMESPACE_STD) // option -AA
+/* from now, we have a full standard lib in namespace std */
+# define _STLP_NATIVE_INCLUDE_PATH ../include_std
+# else /* kind of compatibility mode */
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# define _STLP_NO_ROPE 1
+# endif
+#endif /* 314 */
+
+#if ((__HP_aCC >= 30000 && __HP_aCC < 31400) || (__HP_aCC == 1)) // A.03.13: __HP_aCC == 1
+
+# if (__HP_aCC != 1)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# endif
+
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+/* aCC bug ? need explicit args on constructors of partial specialized
+ * classes
+ */
+# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1
+/* ?? fbp : maybe present in some versions ? */
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+/* <exception> and stuff is in global namespace */
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+/* fbp : moved here */
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+/* # define _INCLUDE_HPUX_SOURCE */
+# define _XPG4
+# define _INCLUDE_XOPEN_SOURCE
+# define _INCLUDE_AES_SOURCE
+#endif
+
+#if (__HP_aCC <= 30000 && __HP_aCC >= 12100)
+/* Special kludge to workaround bug in aCC A.01.23, CR JAGac40634 */
+# ifdef _STLP_DEBUG
+static void _STLP_dummy_literal() { const char *p = "x";}
+static void _STLP_dummy_literal_2() { const char *p = "123456789"; }
+static void _STLP_dummy_literal_3() { const char *p = "123456700000000000000089";}
+# endif
+
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# if (__HP_aCC < 12700)
+/* new flag: on most HP compilers cwchar is missing */
+# define _STLP_NO_CWCHAR
+# endif
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+ typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+ typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+#endif
+
+#if __HP_aCC == 1
+# define _STLP_BROKEN_USING_IN_CLASS
+# define _STLP_USING_BASE_MEMBER
+# define _STLP_NO_CWCHAR
+/* # define _STLP_NO_WCHAR_T 1 */
+#endif
diff --git a/build/stlport/stlport/stl/config/_hpux.h b/build/stlport/stlport/stl/config/_hpux.h
new file mode 100644
index 000000000..385c514cc
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_hpux.h
@@ -0,0 +1,17 @@
+#ifndef __stl_config__hpux_h
+#define __stl_config__hpux_h
+
+#define _STLP_PLATFORM "HP Unix"
+
+#define _STLP_USE_UNIX_IO
+
+#ifdef __GNUC__
+# define _STLP_NO_WCHAR_T
+# define _STLP_NO_CWCHAR
+# define _STLP_NO_LONG_DOUBLE
+# ifndef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 199506
+# endif
+#endif
+
+#endif /* __stl_config__hpux_h */
diff --git a/build/stlport/stlport/stl/config/_ibm.h b/build/stlport/stlport/stl/config/_ibm.h
new file mode 100644
index 000000000..f74f6d9be
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_ibm.h
@@ -0,0 +1,144 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#if defined (__IBMCPP__) || defined (__IBMC__)
+# define _STLP_COMPILER "Visual Age C++"
+#elif defined (__xlC__)
+# define _STLP_COMPILER "xlc"
+#else
+# error "Unknown compiler"
+#endif
+
+#if !defined(__IBMCPP__) || (__IBMCPP__ < 500)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+#endif
+
+/* string literal problem, same as with SUN and aCC */
+# define _STLP_INLINE_STRING_LITERAL_BUG 1
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+
+# ifdef __IBMCPP__
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+# endif
+
+/* # if ( defined (__MULTI__) && defined (__WINDOWS__))
+ * # define _STLP_WIN32THREADS 1 Only Visual Age 3.5 for Windows
+ * # endif
+ */
+
+# if ( defined (__MULTI__) && defined (__OS2__))
+# define _STLP_OS2THREADS 1
+# endif
+
+/* __TEMPINC__ is set when /Ft+ option is used */
+# ifdef __TEMPINC__
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# endif
+
+# if defined (__MVS__)
+/* long long support is buggy - reported by Tinny Ng
+ * # if __EXTENDED__ && __COMPILER_VER__ >= 0x22060000
+ * # define _STLP_LONG_LONG long long
+ * # endif
+ */
+/* boris : hstash reported it can be treated like UNIX */
+# define _STLP_NO_TYPEINFO 1
+# undef _STLP_NATIVE_INCLUDE_PATH
+# define _STLP_NATIVE_INCLUDE_PATH /usr/lpp/ioclib/include
+/* same for C headers like <string.h> */
+# undef _STLP_NATIVE_C_INCLUDE_PATH
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH /usr/include
+
+# elif (defined (__WINDOWS__) || defined (_AIX) || defined (__OS2__) ) && (__IBMCPP__ >= 350)
+
+# define _STLP_LONG_LONG long long
+
+#endif
+
+#if !( defined( __xlC__ ) && __xlC__ >= 0x500 )
+
+/* AIX xlC 3.1 , 3.0.1 ==0x301
+ * Visual Age C++ 3.x
+ * OS-390 C++
+ * fbp : should be more version-specific!
+ */
+
+# define _STLP_NO_BOOL 1
+# define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# if defined (__OS2__) && (__IBMCPP__ <= 350)
+# define _STLP_NO_TYPEINFO 1
+# endif
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_STATIC_CONST_INIT_BUG 1
+/* # define _STLP_THROW_RETURN_BUG 1 */
+
+
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+/* AIX xlC, Visual Age 3.0 for OS/2 and MS */
+# define _STLP_TRIVIAL_DESTRUCTOR_BUG
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+
+#if __IBMCPP__ <= 350
+# define _STLP_NEED_UNREACHABLE_RETURN 1
+#endif
+
+#if __IBMCPP__ < 350
+# define _STLP_NO_LONG_DOUBLE 1
+#endif
+
+#if __IBMCPP__ >= 365
+/* does not have new C headers, but has div() */
+# define _STLP_LDIV
+#endif
+
+#endif /* xlC 5 */
+
+/* detect xlC5 by: */
+#if defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 700)
+# define _STLP_USE_EXCEPTIONS 1
+# define _STLP_STATIC_CONST_INIT_BUG 1
+/* #pragma report(disable,CPPC1500029)
+ * unsigned 32-bit integer type
+ */
+# define _STLP_UINT32_T unsigned int
+# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+# endif
+/* # define _STLP_RAND48 1 */
+#endif /* __IBMCPP__ == 500 */
diff --git a/build/stlport/stlport/stl/config/_icc.h b/build/stlport/stlport/stl/config/_icc.h
new file mode 100644
index 000000000..1fc1bce3c
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_icc.h
@@ -0,0 +1,44 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+// A list of Intel compiler for Linux portion of STLport settings.
+
+#define _STLP_COMPILER "Intel ICC"
+
+#define _STLP_LONG_LONG long long
+
+// Edit relative path below (or put full path) to get native
+// compiler headers included. Default is "../include".
+// C headers may reside in different directory, so separate macro is provided.
+#if (__INTEL_COMPILER < 800)
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+#endif
+
+#if (__INTEL_COMPILER >= 800)
+# define _STLP_NATIVE_INCLUDE_PATH ../include/c++
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+
+#endif /* __INTEL_COMPILER >= 800 */
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+#define _STLP_VENDOR_GLOBAL_CSTD 1
+
+/* Systems having GLIBC installed have different traits */
+#if !defined (_STLP_USE_GLIBC) && defined (__linux__)
+# define _STLP_USE_GLIBC
+# define _XOPEN_SOURCE 600
+#endif
+
+#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+
+
+#ifndef __GNUC__
+# define __GNUC__ 3
+#endif
+
+//#define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+
+#define _STLP_NO_FORCE_INSTANTIATE
+//#define _REENTRANT
diff --git a/build/stlport/stlport/stl/config/_intel.h b/build/stlport/stlport/stl/config/_intel.h
new file mode 100644
index 000000000..01e09d60f
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_intel.h
@@ -0,0 +1,72 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Intel ICL"
+
+#define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+
+/* You need to undef following macro if your icl install is binded to MSVC 6
+ * native lib and you are building with /Qvc7 or /Qvc7.1 or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1200 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7.1
+ * or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1300 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2003
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
+ * or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1310 */
+/* You need to undef following macro if your icl install is binded to MSVC 2005
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
+ * or /Qvc7.1 option.
+ */
+/* #define _STLP_MSVC_LIB 1400 */
+
+#include <stl/config/_msvc.h>
+
+#if defined (_STLP_DONT_RETURN_VOID)
+# undef _STLP_DONT_RETURN_VOID
+#endif
+
+#if (__ICL < 900)
+# define _STLP_NOTHROW
+#endif
+
+#if (__ICL <= 810)
+/* If method specialization is activated, compiler do not export some
+ * symbols anymore.
+ */
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+#endif
+
+#if (__ICL >= 800 && __ICL < 900)
+# define _STLP_STATIC_CONST_INIT_BUG 1
+#endif
+
+#if (__ICL >= 450)
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
+#endif
+
+#if (__ICL < 450)
+/* only static STLport lib works for ICL */
+# undef _STLP_USE_STATIC_LIB
+# undef _STLP_USE_DYNAMIC_LIB
+# define _STLP_USE_STATIC_LIB
+/* disable hook which makes template symbols to be searched for in the library */
+# undef _STLP_NO_CUSTOM_IO
+#endif
+
+#undef _STLP_LONG_LONG
+#define _STLP_LONG_LONG long long
+
+#if defined (__cplusplus) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+namespace std
+{
+ void _STLP_CALL unexpected();
+}
+#endif
+
+#include <stl/config/_feedback.h>
diff --git a/build/stlport/stlport/stl/config/_kai.h b/build/stlport/stlport/stl/config/_kai.h
new file mode 100644
index 000000000..267158f83
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_kai.h
@@ -0,0 +1,43 @@
+// STLport config file for KAI C++ compiler
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+
+# ifndef __KAI_STRICT /* _NO_LONGLONG */
+# define _STLP_LONG_LONG long long
+# endif
+
+# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+
+# ifndef __BUILDING_STLPORT
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# endif
+
+// two levels of macros do not work good with kcc.
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
+
+// KAI C++ uses EDG front-end, but apparently different switches
+// # define __EDG_SWITCHES 1
+
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_VENDOR_MB_NAMESPACE std
+
+// boris : some of those may also apply to KCC 3.4
+# if __KCC_VERSION < 4000
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
+
+# endif
+
+# if defined (__sgi)
+// this requires some discrimination on whether we are actually on
+// a system officially supported by KAI.
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# include <standards.h>
+# endif
+
diff --git a/build/stlport/stlport/stl/config/_linux.h b/build/stlport/stlport/stl/config/_linux.h
new file mode 100644
index 000000000..4e75b5c33
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_linux.h
@@ -0,0 +1,126 @@
+#ifndef __stl_config__linux_h
+#define __stl_config__linux_h
+
+#define _STLP_PLATFORM "Linux"
+
+#include <features.h>
+
+/* This is defined wether library in use is glibc or not.
+ This may be treated as presence of GNU libc compatible
+ header files (these define is not really intended to check
+ for the presence of a particular library, but rather is used
+ to define an INTERFACE.) */
+#ifndef _STLP_USE_GLIBC
+# define _STLP_USE_GLIBC 1
+#endif
+
+#ifndef _STLP_USE_STDIO_IO
+# define _STLP_USE_UNIX_IO
+#endif
+
+/* #define _STLP_USE_STDIO_IO */
+
+/* If not explicitly specified otherwise, work with threads
+ */
+#if !defined(_STLP_NO_THREADS) && !defined(_REENTRANT)
+# define _REENTRANT
+#endif
+
+#if defined(_REENTRANT) && !defined(_PTHREADS)
+# define _PTHREADS
+#endif
+
+#ifdef __UCLIBC__ /* uClibc 0.9.27 */
+# define _STLP_USE_UCLIBC 1
+# if !defined(__UCLIBC_HAS_WCHAR__)
+# ifndef _STLP_NO_WCHAR_T
+# define _STLP_NO_WCHAR_T
+# endif
+# ifndef _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_NATIVE_MBSTATE_T
+# endif
+# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
+# define _STLP_NO_NATIVE_WIDE_STREAMS
+# endif
+# endif /* __UCLIBC_HAS_WCHAR__ */
+ /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+#endif
+
+
+#if defined(_PTHREADS)
+# define _STLP_THREADS
+# define _STLP_PTHREADS
+/*
+# ifndef __USE_UNIX98
+# define __USE_UNIX98
+# endif
+*/
+/* This feature exist at least since glibc 2.2.4 */
+/* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */
+# ifdef __USE_XOPEN2K
+/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */
+# ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */
+# define _STLP_USE_PTHREAD_SPINLOCK
+# else
+# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
+ /* in uClibc (0.9.26) pthread_spinlock* declared in headers
+ * but absent in library */
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK
+# endif
+# endif
+# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
+# define _STLP_USE_PTHREAD_SPINLOCK
+# define _STLP_STATIC_MUTEX _STLP_mutex
+# endif
+/* # define __FIT_PSHARED_MUTEX */
+# endif
+#endif
+
+/* Endiannes */
+#include <endian.h>
+#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) || !defined(__BIG_ENDIAN)
+# error "One of __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN undefined; Fix me!"
+#endif
+
+#if ( __BYTE_ORDER == __LITTLE_ENDIAN )
+# define _STLP_LITTLE_ENDIAN 1
+#elif ( __BYTE_ORDER == __BIG_ENDIAN )
+# define _STLP_BIG_ENDIAN 1
+#else
+# error "__BYTE_ORDER neither __BIG_ENDIAN nor __LITTLE_ENDIAN; Fix me!"
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+#ifdef __GLIBC__
+# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__GLIBC__ > 2)
+/* From glibc 2.3.x default allocator is malloc_alloc, if was not defined other */
+# if !defined(_STLP_USE_MALLOC) && !defined(_STLP_USE_NEWALLOC) && !defined(_STLP_USE_PERTHREAD_ALLOC) && !defined(_STLP_USE_NODE_ALLOC)
+# define _STLP_USE_MALLOC 1
+# endif
+# endif
+/* Following platforms has no long double:
+ * - Alpha
+ * - PowerPC
+ * - SPARC, 32-bits (64-bits platform has long double)
+ * - MIPS, 32-bits
+ * - ARM
+ * - SH4
+ */
+# if defined(__alpha__) || \
+ defined(__ppc__) || defined(PPC) || defined(__powerpc__) || \
+ ((defined(__sparc) || defined(__sparcv9) || defined(__sparcv8plus)) && !defined ( __WORD64 ) && !defined(__arch64__)) /* ? */ || \
+ (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32)) || \
+ defined(__arm__) || \
+ defined(__le32__) || \
+ defined(__sh__)
+ /* # if defined(__NO_LONG_DOUBLE_MATH) */
+# define _STLP_NO_LONG_DOUBLE
+# endif
+#endif
+
+
+#endif /* __stl_config__linux_h */
diff --git a/build/stlport/stlport/stl/config/_mac.h b/build/stlport/stlport/stl/config/_mac.h
new file mode 100644
index 000000000..575c18381
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_mac.h
@@ -0,0 +1,6 @@
+#define _STLP_PLATFORM "Mac"
+
+#define _STLP_MAC 1
+
+#error Looks like unsupported platform
+#define _STLP_USE_UNIX_EMULATION_IO
diff --git a/build/stlport/stlport/stl/config/_macosx.h b/build/stlport/stlport/stl/config/_macosx.h
new file mode 100644
index 000000000..54a922267
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_macosx.h
@@ -0,0 +1,9 @@
+#define _STLP_PLATFORM "Mac OS X"
+
+#if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+#elif defined (__LITTLE_ENDIAN__)
+# define _STLP_LITTLE_ENDIAN 1
+#endif
+
+#define _STLP_USE_UNIX_IO
diff --git a/build/stlport/stlport/stl/config/_mlc.h b/build/stlport/stlport/stl/config/_mlc.h
new file mode 100644
index 000000000..8687d0bf8
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_mlc.h
@@ -0,0 +1,7 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_NO_MEMBER_TEMPLATES // Compiler does not support member templates
+#define _STLP_NO_MEMBER_TEMPLATE_CLASSES // Compiler does not support member template classes
+
+#define _STLP_HAS_NEW_NEW_HEADER
diff --git a/build/stlport/stlport/stl/config/_msvc.h b/build/stlport/stlport/stl/config/_msvc.h
new file mode 100644
index 000000000..418d018e1
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_msvc.h
@@ -0,0 +1,265 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ * Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0, ICL
+ */
+
+#if !defined (_STLP_COMPILER)
+# define _STLP_COMPILER "Microsoft Visual Studio C++"
+#endif
+
+#if !defined (__ICL) && !defined (_STLP_MSVC)
+# define _STLP_MSVC _MSC_VER
+#endif
+
+#if !defined (_STLP_MSVC_LIB)
+# define _STLP_MSVC_LIB _MSC_VER
+#endif
+
+#if defined (__BUILDING_STLPORT) && defined (_MANAGED)
+/* Building a managed version of STLport is not supported because we haven't
+ * found a good reason to support it. However, building a managed translation
+ * unit using STLport _is_ supported.
+ */
+# error Sorry but building a managed version of STLport is not supported.
+#endif
+
+#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+/* This is a specific section for compilers coming with platform SDKs. Native
+ * library coming with it is different from the one coming with commercial
+ * MSVC compilers so there is some specific settings.
+ */
+# define _STLP_NATIVE_INCLUDE_PATH ../crt
+# define _STLP_VENDOR_GLOBAL_CSTD
+# define _STLP_VENDOR_TERMINATE_STD
+# define _STLP_GLOBAL_NEW_HANDLER
+# if (_STLP_MSVC_LIB <= 1400)
+/* We hope this bug will be fixed in future versions. */
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+# endif
+#endif
+
+#define _STLP_CALL __cdecl
+
+#ifndef _STLP_LONG_LONG
+# define _STLP_LONG_LONG __int64
+#endif
+
+#define _STLP_PRAGMA_ONCE
+
+/* These switches depend on compiler flags. We are hoping here that compilers
+ * simulating MSVC behavior use identical macros to report compilation context.
+ * Otherwise those macros will have to be undef in specific compiler configuration
+ * files.
+ */
+#ifndef _CPPUNWIND
+# define _STLP_DONT_USE_EXCEPTIONS 1
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI 1
+#endif
+
+#if defined (_MT) && !defined (_STLP_NO_THREADS)
+# define _STLP_THREADS 1
+#endif
+
+#if !defined (_NATIVE_WCHAR_T_DEFINED)
+# define _STLP_WCHAR_T_IS_USHORT 1
+#endif
+
+#define _STLP_NO_VENDOR_STDLIB_L 1
+
+#if defined (_STLP_MSVC)
+
+# if (_STLP_MSVC < 1200)
+# error Microsoft Visual C++ compilers before version 6 (SP5) are not supported.
+# endif
+
+# define _STLP_NORETURN_FUNCTION __declspec(noreturn)
+
+/* Full compiler version comes from boost library intrinsics.hpp header. */
+# if defined (_MSC_FULL_VER) && (_MSC_FULL_VER >= 140050215)
+# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
+# define _STLP_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
+# define _STLP_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
+# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
+# define _STLP_IS_POD(T) __is_pod(T)
+# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
+# endif
+
+# ifndef _STLP_MSVC50_COMPATIBILITY
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
+# define _STLP_NO_STATIC_CONST_DEFINITION 1
+
+/* # ifndef __BUILDING_STLPORT
+ * # define _STLP_USE_TEMPLATE_EXPORT 1
+ * # endif
+ */
+
+/** Note: the macro _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT is defined
+unconditionally and undef'ed here when applicable. */
+# if defined (UNDER_CE)
+/* eVCx:
+uncaught_exception is declared in the SDKs delivered with eVC4 (eVC3 is
+unknown) and they all reside in namespace 'std' there. However, they are not
+part of any lib so linking fails. When using VC8 to crosscompile for CE 5 on
+an ARMV4I, the uncaught_exception test fails, the function returns the wrong
+value. */
+/* All eVCs up to at least VC8/CE5 have a broken new operator that
+ returns null instead of throwing bad_alloc. */
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+# else
+/* VCx:
+These are present at least since VC6, but the uncaught_exception() of VC6 is
+broken, it returns the wrong value in the unittests. 7.1 and later seem to
+work, 7.0 is still unknown (we assume it works until negative report). */
+# if (_STLP_MSVC >= 1300)// VC7 and later
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# endif
+# if (_STLP_MSVC < 1300)
+# define _STLP_NOTHROW
+# endif
+# endif
+
+# if (_STLP_MSVC <= 1300)
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+/* There is no partial spec, and MSVC breaks on simulating it for iterator_traits queries */
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
+/* VC++ cannot handle default allocator argument in template constructors */
+# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# endif
+
+# if (_STLP_MSVC < 1300) /* including MSVC 6.0 */
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+# endif
+
+# define _STLP_HAS_NATIVE_FLOAT_ABS 1
+
+// TODO: some eVC4 compilers report _MSC_VER 1201 or 1202, which category do they belong to?
+# if (_STLP_MSVC > 1200) && (_STLP_MSVC < 1310)
+# define _STLP_NO_MOVE_SEMANTIC
+# endif
+
+# if (_STLP_MSVC < 1300)
+/* TODO: remove this if it is handled and documented elsewhere
+ * dums: VC6 do not handle correctly member templates of class that are explicitely
+ * instanciated to be exported. There is a workaround, seperate the non template methods
+ * from the template ones within 2 different classes and only export the non template one.
+ * It is implemented for basic_string and locale at the writing of this note.
+ * However this problem hos not been considered as important enough to remove template member
+ * methods for other classes. Moreover Boost (www.boost.org) required it to be granted.
+ * The workaround is activated thanks to the _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro defined
+ * later in this config file.
+ */
+/*
+# if defined (_DLL)
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# endif
+*/
+
+/* Boris : not defining this macro for SP5 causes other problems */
+/*# if !defined (_MSC_FULL_VER) || (_MSC_FULL_VER < 12008804 ) */
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+/*# endif */
+# define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_DONT_RETURN_VOID 1
+# endif
+
+# if (_STLP_MSVC < 1300) /* MSVC 6.0 and earlier */
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+/* defined for DEBUG and NDEBUG too, to allow user mix own debug build with STLP release library */
+# define _STLP_USE_ABBREVS
+# endif
+
+#endif /* _STLP_MSVC */
+
+/* The desktop variants starting with VC8 have a set of more secure replacements
+ * for the error-prone string handling functions of the C standard lib. */
+/* When user do not consider 'unsafe' string functions as deprecated using _CRT_SECURE_NO_DEPRECATE
+ * macro we use 'unsafe' functions for performance reasons. */
+#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined (UNDER_CE) && \
+ !defined (_CRT_SECURE_NO_DEPRECATE)
+# define _STLP_USE_SAFE_STRING_FUNCTIONS 1
+#endif
+
+#if (_STLP_MSVC_LIB <= 1310)
+# define _STLP_VENDOR_GLOBAL_CSTD
+#endif
+
+#if (_STLP_MSVC_LIB >= 1300) && !defined(UNDER_CE)
+/* Starting with MSVC 7.0 and compilers simulating it,
+ * we assume that the new SDK is granted:
+ */
+# define _STLP_NEW_PLATFORM_SDK 1
+#endif
+
+#if (_STLP_MSVC_LIB < 1300) /* including MSVC 6.0 */
+# define _STLP_GLOBAL_NEW_HANDLER 1
+# define _STLP_VENDOR_UNEXPECTED_STD
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#endif
+
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#if defined (__DLL) || defined (_DLL) || defined (_RTLDLL) || defined (_AFXDLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#if defined (__BUILDING_STLPORT) && \
+ (defined (_STLP_USE_DYNAMIC_LIB) || \
+ defined (_STLP_RUNTIME_DLL) && !defined (_STLP_USE_STATIC_LIB))
+# define _STLP_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# undef _STLP_USE_DECLSPEC
+# define _STLP_USE_DECLSPEC 1
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
+# define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND 1
+# endif
+#endif
+
+#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD)
+# if !defined (_MSC_EXTENSIONS) || defined (_STLP_MSVC) && (_STLP_MSVC >= 1300)
+# define _STLP_IMPORT_TEMPLATE_KEYWORD
+# else
+# define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+# endif
+#endif
+#define _STLP_EXPORT_TEMPLATE_KEYWORD
+
+#include <stl/config/_auto_link.h>
+
+#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+/* The Windows 64 bits SDK required for the moment link to bufferoverflowU.lib for
+ * additional buffer overrun checks. Rather than require the STLport build system and
+ * users to explicitely link with it we use the MSVC auto link feature.
+ */
+# if !defined (_STLP_DONT_USE_AUTO_LINK) || defined (__BUILDING_STLPORT)
+# pragma comment (lib, "bufferoverflowU.lib")
+# if defined (_STLP_VERBOSE)
+# pragma message ("STLport: Auto linking to bufferoverflowU.lib")
+# endif
+# endif
+#endif
+
+#if defined (_STLP_MSVC)
+# include <stl/config/_feedback.h>
+#endif
diff --git a/build/stlport/stlport/stl/config/_mwerks.h b/build/stlport/stlport/stl/config/_mwerks.h
new file mode 100644
index 000000000..f91f3b181
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_mwerks.h
@@ -0,0 +1,159 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Metrowerk Codewarrior"
+
+// Bring in definition of __MSL__ and related items
+#include <mslGlobals.h>
+#include <ansi_parms.h>
+
+//
+// Compiler features
+//
+
+
+// *** CodeWarrior Compiler Common Features ***
+# if __option(longlong)
+# define _STLP_LONG_LONG long long
+# endif
+
+# define _STLP_USE_UNIX_EMULATION_IO 1
+
+# define _STLP_USE_AUTO_PTR_CONVERSIONS 1
+
+# ifdef __INTEL__
+# define _STLP_LITTLE_ENDIAN
+# else
+# define _STLP_BIG_ENDIAN
+# endif
+
+#if defined(_MSL_NO_LOCALE)
+#define _STLP_NO_IMPORT_LOCALE
+#endif
+#if !__option( wchar_type )
+# define _STLP_WCHAR_T_IS_USHORT
+#endif
+
+# if __MWERKS__ < 0x3000
+// *** CodeWarrior Compiler Common Bugs ***
+# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this
+# define _STLP_THROW_RETURN_BUG 1
+# endif
+
+// *** Version-specific settings ***
+
+# if __MWERKS__ >= 0x2405
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+# endif
+
+# if __MWERKS__ < 0x2405
+# define _STLP_STATIC_CONST_INIT_BUG
+# endif
+
+# if __MWERKS__ <= 0x2303
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# endif
+
+# if __MWERKS__ < 0x2301
+# define _STLP_MEMBER_SPECIALIZATION_BUG 1
+# endif
+
+# if __MWERKS__ < 0x2300 // CW Pro5 features
+# define _STLP_INLINE_MEMBER_TEMPLATES 1
+# define _STLP_RELOPS_IN_STD_BUG 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE
+# endif
+
+# if __MWERKS__ < 0x2200 // CW Pro4 features
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# endif
+
+# if __MWERKS__ < 0x2100 // CW Pro3 features
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_TEMPLATE_PARAM_SUBTYPE_BUG 1
+# define _STLP_FORCED_INLINE_INSTANTIATION_BUG 1
+# define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG 1
+# define _STLP_INLINE_NAME_RESOLUTION_BUG 1
+// *** Metrowerks Standard Library Bug ***
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+
+# if __MWERKS__ < 0x2000 // v. 2.0 features
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 // dwa 8/21/97 - this bug fixed for CWPro2
+# endif
+
+# if __MWERKS__ < 0x1900 // dwa 8/19/97 - 1.9 Compiler feature defines
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_BASE_TYPEDEF_BUG 1
+# define _STLP_BASE_MATCH_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+# define _STLP_DEFAULT_TYPE_PARAM 1 // More limited template parameters
+
+# if __MWERKS__ < 0x1800
+ __GIVE_UP_WITH_STL(CW_18)
+# endif
+
+# endif
+
+
+// fixes to native inclusion wrappers.
+# if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
+# else
+
+# define _STLP_NATIVE_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include
+# define _STLP_NATIVE_C_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes
+# define _STLP_NATIVE_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
+# define _STLP_NATIVE_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
+
+# endif
+
+//Following block come from boost intrinsics.hpp file:
+#if defined (__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
+ // Metrowerks compiler is acquiring intrinsic type traits support
+ // post version 8. We hook into the published interface to pick up
+ // user defined specializations as well as compiler intrinsics as
+ // and when they become available:
+# include <msl_utility>
+# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) Metrowerks::has_trivial_default_ctor<T>::value
+# define _STLP_HAS_TRIVIAL_COPY(T) Metrowerks::has_trivial_copy_ctor<T>::value
+# define _STLP_HAS_TRIVIAL_ASSIGN(T) Metrowerks::has_trivial_assignment<T>::value
+# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) Metrowerks::has_trivial_dtor<T>::value
+# define _STLP_IS_POD(T) Metrowerks::is_POD<T>::value
+# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
+#endif
+
+// fbp
+# if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+
+# if defined(__MACH__)
+# define _STLP_MAC
+# define O_BINARY 0
+# elif defined(macintosh)
+# define _NOTHREADS
+# endif
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
diff --git a/build/stlport/stlport/stl/config/_native_headers.h b/build/stlport/stlport/stl/config/_native_headers.h
new file mode 100644
index 000000000..f1f4bc932
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_native_headers.h
@@ -0,0 +1,50 @@
+ /*
+ *
+ * Copyright (c) 2006
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_MAKE_HEADER)
+# define _STLP_MAKE_HEADER(path, header) <path/header>
+#endif
+
+#if !defined (_STLP_NATIVE_HEADER)
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# endif
+# define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header)
+#endif
+
+/* For some compilers, C headers like <stdio.h> are located in separate directory */
+#if !defined (_STLP_NATIVE_C_HEADER)
+# if !defined (_STLP_NATIVE_C_INCLUDE_PATH)
+# define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+# endif
+# define _STLP_NATIVE_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_C_INCLUDE_PATH,header)
+#endif
+
+/* For some compilers, C-library headers like <cstdio> are located in separate directory */
+#if !defined (_STLP_NATIVE_CPP_C_HEADER)
+# if !defined (_STLP_NATIVE_CPP_C_INCLUDE_PATH)
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+# endif
+# define _STLP_NATIVE_CPP_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_C_INCLUDE_PATH,header)
+#endif
+
+/* Some compilers locate basic C++ runtime support headers (<new>, <typeinfo>, <exception>) in separate directory */
+#if !defined ( _STLP_NATIVE_CPP_RUNTIME_HEADER )
+# if !defined (_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH)
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+# endif
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH,header)
+#endif
diff --git a/build/stlport/stlport/stl/config/_openbsd.h b/build/stlport/stlport/stl/config/_openbsd.h
new file mode 100644
index 000000000..86a19d1f3
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_openbsd.h
@@ -0,0 +1,12 @@
+#define _STLP_PLATFORM "Open BSD"
+
+#define _STLP_USE_UNIX_IO
+
+#if defined (_POSIX_THREADS) && !defined (_STLP_THREADS)
+# define _STLP_THREADS
+#endif
+
+#if defined (_POSIX_THREADS) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK)
+# define _STLP_USE_PTHREAD_SPINLOCK
+# define _STLP_STATIC_MUTEX _STLP_mutex
+#endif
diff --git a/build/stlport/stlport/stl/config/_prolog.h b/build/stlport/stlport/stl/config/_prolog.h
new file mode 100644
index 000000000..a16a79469
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_prolog.h
@@ -0,0 +1,43 @@
+
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# pragma warning (push)
+# include <stl/config/_warnings_off.h>
+/* We are forcing the alignment to guaranty that libraries are use
+ * with the same alignment as the one use to build them.
+ */
+# if !defined (_WIN64)
+# pragma pack(push, 8)
+# else
+# pragma pack(push, 16)
+# endif
+
+#elif defined (__BORLANDC__)
+
+# pragma option push
+# pragma option -Vx- -Ve- -a8 -b -pc
+# include <stl/config/_warnings_off.h>
+
+#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+
+# pragma set woff 1209
+# pragma set woff 1174
+# pragma set woff 1375
+/* from iterator_base.h */
+# pragma set woff 1183
+
+#elif defined (__DECCXX)
+
+# ifdef __PRAGMA_ENVIRONMENT
+# pragma __environment __save
+# pragma __environment __header_defaults
+# endif
+
+#elif defined (__IBMCPP__)
+/* supress EDC3130: A constant is being used as a conditional expression */
+# pragma info(nocnd)
+#elif defined (__WATCOMCPLUSPLUS__)
+# pragma warning 604 10 /* must lookahead to determine... */
+# pragma warning 594 10 /* resolved as declaration/type */
+# pragma warning 595 10 /* resolved as an expression */
+#endif
diff --git a/build/stlport/stlport/stl/config/_sgi.h b/build/stlport/stlport/stl/config/_sgi.h
new file mode 100644
index 000000000..7500f3d87
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_sgi.h
@@ -0,0 +1,94 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "CC"
+
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+// define native include path before trying to include anything
+
+#define _STLP_NATIVE_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
+#define _STLP_NATIVE_OLD_STREAMS_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_CPP_C_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </usr/include/CC/##__x>
+
+#define _STLP_NO_NATIVE_MBSTATE_T
+
+#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+#define _STLP_NO_MEMBER_TEMPLATE_CLASSES
+
+// #define _STLP_NO_BAD_ALLOC
+
+#define _STL_HAS_NAMESPACES
+
+#if ! defined (__EXCEPTIONS) && ! defined (_STLP_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#define __EDG_SWITCHES
+
+#define _STLP_USE_SGI_STRING 1
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+
+#define _STLP_NO_POST_COMPATIBLE_SECTION
+
+#include <standards.h>
+
+#if !(_COMPILER_VERSION >= 730)
+# define _STLP_NO_NEW_NEW_HEADER 1
+#endif
+
+#if (_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_EXTERN_RANGE_ERRORS
+#endif
+
+#if !defined(_BOOL)
+# define _STLP_NO_BOOL
+#endif
+#if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
+# define _STLP_STATIC_CONST_INIT_BUG
+#endif
+
+#if (_COMPILER_VERSION < 720) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
+# define _STLP_DEF_CONST_PLCT_NEW_BUG
+# define _STLP_DEF_CONST_DEF_PARAM_BUG
+#endif
+#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+#endif
+#if !defined(_STANDARD_C_PLUS_PLUS)
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+#endif
+#if !((_COMPILER_VERSION >= 721) && defined(_NAMESPACES))
+# define _STLP_HAS_NO_NAMESPACES
+#endif
+#if (_COMPILER_VERSION < 721) || !defined(_STL_HAS_NAMESPACES) || defined(_STLP_NO_NAMESPACES)
+# define _STLP_NO_EXCEPTION_HEADER
+#endif
+#if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || !defined(_NAMESPACES)
+# define _STLP_NO_BAD_ALLOC
+#endif
+#if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
+# define _STLP_LONG_LONG long long
+#endif
+#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_USE_NO_IOSTREAMS
+#endif
+#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_NO_AT_MEMBER_FUNCTION
+#endif
+// # if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+#if !(_COMPILER_VERSION >= 721 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+#endif
+#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+#endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) && !defined (__GNUC__)
+# define _STLP_SGI_THREADS
+#endif
diff --git a/build/stlport/stlport/stl/config/_solaris.h b/build/stlport/stlport/stl/config/_solaris.h
new file mode 100644
index 000000000..8756a060f
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_solaris.h
@@ -0,0 +1,77 @@
+#ifndef __stl_config__solaris_h
+#define __stl_config__solaris_h
+
+#define _STLP_PLATFORM "Sun Solaris"
+
+/* include system features file */
+#include <sys/feature_tests.h>
+
+/* system-dependent defines */
+#define _STLP_USE_UNIX_IO
+
+#ifdef __GNUC__
+/*
+ * See comments (and configuration defines) in the host.h
+ */
+# if !(defined(__SunOS_5_5_1) || defined(__SunOS_5_6) || defined(__SunOS_5_7) || \
+ defined(__SunOS_5_8) || defined(__SunOS_5_9) || defined(__SunOS_5_10))
+# error Uncomment one of the defines (__SunOS_5_x) in the file stlport/stl/config/host.h
+# endif
+#endif
+
+#if defined (__SunOS_5_8) && ! defined (_STLP_HAS_NO_NEW_C_HEADERS) && ( __cplusplus >= 199711L)
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+#endif
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+
+#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) || defined (__SunOS_5_6)
+# define _STLP_WCHAR_SUNPRO_EXCLUDE 1
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+/* boris : this should always be defined for Solaris 5 & 6. Any ideas how to do it? */
+#if !(defined ( __KCC ) && __KCC_VERSION > 3400 ) && \
+ ((defined(__SunOS_5_5_1) || defined(__SunOS_5_6) ))
+# ifndef _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# endif
+#endif /* KCC */
+
+/* For SPARC we use lightweight synchronization */
+#if defined (__sparc) /* && (defined (_REENTRANT) || defined (_PTHREADS)) */
+# if ( (defined (__GNUC__) && defined (__sparc_v9__)) || \
+ defined (__sparcv9) ) \
+ && !defined(_NOTHREADS) && !defined (_STLP_NO_SPARC_SOLARIS_THREADS)
+# define _STLP_SPARC_SOLARIS_THREADS
+# define _STLP_THREADS_DEFINED
+# endif
+#endif
+
+/* gcc does not support ELF64 yet ; however; it supports ultrasparc + v8plus.
+ * limits.h contains invalid values for this combination
+ */
+#ifdef __GNUC__
+# if (defined (__sparc_v9__) || defined (__sparcv9)) && !defined ( __WORD64 ) && !defined(__arch64__)
+# define __LONG_MAX__ 2147483647L
+# endif
+#endif
+
+/*
+ * Attention! See comments (and configuration defines) in the host.h
+ * (you host may has MATH_F and MATH_L functions)
+ *
+ */
+#if !defined(__SunOS_5_10) && !defined(_STLP_SOLARIS_MATH_PATCH)
+# define _STLP_NO_VENDOR_MATH_F
+# define _STLP_NO_VENDOR_MATH_L
+#endif
+
+#ifdef __GNUC__
+# define _STLP_WCHAR_BORLAND_EXCLUDE
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+#endif /* __stl_config__solaris_h */
diff --git a/build/stlport/stlport/stl/config/_sunprocc.h b/build/stlport/stlport/stl/config/_sunprocc.h
new file mode 100644
index 000000000..15fe5cd11
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_sunprocc.h
@@ -0,0 +1,166 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Sunpro CC"
+
+#define _STLP_LONG_LONG long long
+
+// GAB: 11/09/05
+// Starting with 5.0 the STLport code expects to be
+// instantiated during compile time. This is due to undefing
+// a number of defines that are also used in the c versions
+// of the file. When they are undefed the c version fails to
+// compile.
+// # define _STLP_LINK_TIME_INSTANTIATION 1
+
+#if ! defined(_BOOL)
+# define _STLP_NO_BOOL 1
+#endif
+
+// compatibility mode stuff
+#if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
+# define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC
+#elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+#elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4)
+# define _STLP_NATIVE_INCLUDE_PATH ../CC4
+#else
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+#endif
+
+#define _STLP_STATIC_CONST_INIT_BUG 1
+
+#if (__SUNPRO_CC < 0x530)
+// those are tested and proved not to work...
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+#endif
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+#endif
+
+// those do not depend on compatibility
+#if (__SUNPRO_CC < 0x510)
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+#endif
+
+#if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
+
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+
+// no partial , just for explicit one
+# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#endif
+
+// Features that depend on compatibility switch
+#if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_USE_NO_IOSTREAMS 1
+# endif
+# define _STLP_NO_NEW_NEW_HEADER 1
+// # define _STLP_NO_RELOPS_NAMESPACE
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+#elif (__SUNPRO_CC < 0x510)
+// # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh>
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+#elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 )
+# define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
+#else
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
+#endif
+
+#if ( __SUNPRO_CC < 0x500 )
+
+# undef _STLP_NATIVE_C_HEADER
+# undef _STLP_NATIVE_CPP_C_HEADER
+
+# define wint_t __wint_t
+// famous CC 4.2 bug
+# define _STLP_INLINE_STRING_LITERAL_BUG 1
+// /usr/include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+
+// 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;(
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+// 4.2 does not like it
+# undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_ARROW_OPERATOR 1
+
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1
+# undef _STLP_HAS_NO_NEW_C_HEADERS
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+
+# if ( __SUNPRO_CC < 0x420 )
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# if ( __SUNPRO_CC > 0x401 )
+# if (__SUNPRO_CC==0x410)
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+# endif
+# else
+ // SUNPro C++ 4.0.1
+# define _STLP_BASE_MATCH_BUG 1
+# define _STLP_BASE_TYPEDEF_BUG 1
+# if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C))
+ __GIVE_UP_WITH_STL(SUNPRO_401)
+# endif
+# endif /* 4.0.1 */
+# endif /* 4.2 */
+#endif /* < 5.0 */
+
+#ifndef _MBSTATET_H
+# define _MBSTATET_H
+# undef _MBSTATE_T
+# define _MBSTATE_T
+typedef struct __mbstate_t {
+# if defined(_LP64)
+ long __filler[4];
+# else
+ int __filler[6];
+# endif
+} __mbstate_t;
+# ifndef _STLP_HAS_NO_NAMESPACES
+namespace std {
+ typedef __mbstate_t mbstate_t;
+}
+using std::mbstate_t;
+# else
+typedef __mbstate_t mbstate_t;
+# endif
+#endif /* __MBSTATET_H */
+
+#if !defined(_STLP_HAS_NO_NEW_C_HEADERS) && !defined(_STLP_NO_NEW_C_HEADERS)
+/* Since Sun Studio uses <iso/stdlib_iso.h>, we are at its
+ * mercy. GCC is built on top of <stdlib.h>. */
+#define _STLP_NO_VENDOR_STDLIB_L
+#endif
diff --git a/build/stlport/stlport/stl/config/_system.h b/build/stlport/stlport/stl/config/_system.h
new file mode 100644
index 000000000..1e820957e
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_system.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold COMPILER-SPECIFIC portion of STLport settings.
+ * In general, user should not edit this file unless
+ * using the compiler not recognized below.
+ *
+ * If your compiler is not being recognized yet,
+ * please look for definitions of macros in stl_mycomp.h,
+ * copy stl_mycomp.h to stl_YOUR_COMPILER_NAME,
+ * adjust flags for your compiler, and add <include config/stl_YOUR_COMPILER_NAME>
+ * to the secton controlled by unique macro defined internaly by your compiler.
+ *
+ * To change user-definable settings, please edit <user_config.h>
+ *
+ */
+
+#ifndef __stl_config__system_h
+#define __stl_config__system_h
+
+#if defined (__sun)
+# include <stl/config/_solaris.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# elif defined (__SUNPRO_CC) || defined (__SUNPRO_C)
+# include <stl/config/_sunprocc.h>
+/*
+# ifdef __KCC
+# include <stl/config/_kai.h>
+# endif
+*/
+# elif defined (__APOGEE__) /* Apogee 4.x */
+# include <stl/config/_apcc.h>
+# elif defined (__FCC_VERSION) /* Fujitsu Compiler, v4.0 assumed */
+# include <stl/config/_fujitsu.h>
+# endif
+#elif defined (__hpux)
+# include <stl/config/_hpux.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# elif defined (__HP_aCC)
+# include <stl/config/_hpacc.h>
+# endif
+#elif defined (__ANDROID__)
+/* Android mobile phone platform. Somewhat but not entirely GNU/Linux-like */
+# include <stl/config/_android.h>
+#elif defined (linux) || defined (__linux__)
+# include <stl/config/_linux.h>
+# if defined (__BORLANDC__)
+# include <stl/config/_bc.h> /* Borland C++ 0x570 */
+/* Intel's icc define __GNUC__! */
+# elif defined (__INTEL_COMPILER)
+# include <stl/config/_icc.h>
+# elif defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+/*
+# ifdef __KCC
+# include <stl/config/_kai.h>
+# endif
+*/
+#elif defined (__FreeBSD__)
+# include <stl/config/_freebsd.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__OpenBSD__)
+# include <stl/config/_openbsd.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__sgi) /* IRIX? */
+# define _STLP_PLATFORM "SGI Irix"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# else
+# include <stl/config/_sgi.h>
+# endif
+#elif defined (__OS400__) /* AS/400 C++ */
+# define _STLP_PLATFORM "OS 400"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# else
+# include <stl/config/_as400.h>
+# endif
+#elif defined (_AIX)
+# include <stl/config/_aix.h>
+# if defined (__xlC__) || defined (__IBMC__) || defined ( __IBMCPP__ )
+ /* AIX xlC, Visual Age C++ , OS-390 C++ */
+# include <stl/config/_ibm.h>
+# endif
+#elif defined (_CRAY) /* Cray C++ 3.4 or 3.5 */
+# define _STLP_PLATFORM "Cray"
+# include <config/_cray.h>
+#elif defined (__DECCXX) || defined (__DECC)
+# define _STLP_PLATFORM "DECC"
+# ifdef __vms
+# include <stl/config/_dec_vms.h>
+# else
+# include <stl/config/_dec.h>
+# endif
+#elif defined (macintosh) || defined (_MAC)
+# include <stl/config/_mac.h>
+# if defined (__MWERKS__)
+# include <stl/config/_mwerks.h>
+# endif
+#elif defined (__APPLE__)
+# include <stl/config/_macosx.h>
+# ifdef __GNUC__
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__CYGWIN__)
+# include <stl/config/_cygwin.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__MINGW32__)
+# define _STLP_PLATFORM "MinGW"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+# include <stl/config/_windows.h>
+#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \
+ defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# if defined ( __BORLANDC__ ) /* Borland C++ / CodeGear C++ */
+# include <stl/config/_bc.h>
+# elif defined (__WATCOM_CPLUSPLUS__) || defined (__WATCOMC__) /* Watcom C++ */
+# include <stl/config/_watcom.h>
+# elif defined (__COMO__) || defined (__COMO_VERSION_)
+# include <stl/config/_como.h>
+# elif defined (__DMC__) /* Digital Mars C++ */
+# include <stl/config/_dm.h>
+# elif defined (__ICL) /* Intel reference compiler for Win */
+# include <stl/config/_intel.h>
+# elif defined (__MWERKS__)
+# include <stl/config/_mwerks.h>
+# elif defined (_MSC_VER) && (_MSC_VER >= 1200) && defined (UNDER_CE)
+ /* Microsoft eMbedded Visual C++ 3.0, 4.0 (.NET) */
+# include <stl/config/_evc.h>
+# elif defined (_MSC_VER)
+ /* Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0 */
+# include <stl/config/_msvc.h>
+# endif
+
+# include <stl/config/_windows.h>
+#else
+# error Unknown platform !!
+#endif
+
+#if !defined (_STLP_COMPILER)
+/* Unable to identify the compiler, issue error diagnostic.
+ * Edit <config/stl_mycomp.h> to set STLport up for your compiler. */
+# include <stl/config/stl_mycomp.h>
+#endif
+
+#endif /* __stl_config__system_h */
diff --git a/build/stlport/stlport/stl/config/_warnings_off.h b/build/stlport/stlport/stl/config/_warnings_off.h
new file mode 100644
index 000000000..77e9815eb
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_warnings_off.h
@@ -0,0 +1,51 @@
+/* This header turns off warnings that STLport headers generate for compiled
+ * user code.
+ */
+
+#if defined (_STLP_MSVC)
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+/*
+ * 31/07/2004: dums - now that we do not export the basic_string class anymore but only a base class
+ * we have to disable this warning as the string are used as data members type of many iostream classes.
+ */
+# pragma warning ( disable : 4251 ) // ignore template classes being exported in .dll's
+# endif
+
+# if (_STLP_MSVC < 1300) // VC6, eVC3, eVC4
+# pragma warning( disable : 4097 ) // typedef-name used as based class of (...)
+# pragma warning( disable : 4231 ) // non standard extension : 'extern' before template instanciation
+# pragma warning( disable : 4244 ) // implicit conversion: possible loss of data
+# pragma warning( disable : 4284 ) // for -> operator
+//This warning is necessary because of the native platform headers:
+# pragma warning( disable : 4290 ) // c++ exception specification ignored
+# pragma warning( disable : 4514 ) // unreferenced inline function has been removed
+# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated
+# pragma warning( disable : 4701 ) // local variable '...' may be used without having been initialized
+# pragma warning( disable : 4710 ) // function (...) not inlined
+# pragma warning( disable : 4786 ) // identifier truncated to 255 characters
+# endif
+
+# if (_STLP_MSVC < 1400)
+# pragma warning( disable : 4511 ) // copy constructor cannot be generated
+# endif
+
+//Pool of common warnings for all MSVC supported versions:
+//Many are only useful if warning level is set to 4.
+# pragma warning( disable : 4100 ) // unreferenced formal parameter
+# pragma warning( disable : 4127 ) // conditional expression is constant
+# pragma warning( disable : 4146 ) // unary minus operator applied to unsigned type, result still unsigned
+# pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch
+# pragma warning( disable : 4355 ) // this used in base member initializer list (used in rope implementation)
+# pragma warning( disable : 4510 ) // default constructor cannot be generated
+# pragma warning( disable : 4512 ) // assignment operator could not be generated
+# pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
+# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined construtor required
+#elif defined (__BORLANDC__)
+# pragma option -w-ccc // -w-8008 Condition is always true OR Condition is always false
+# pragma option -w-inl // -w-8027 Functions containing reserved words are not expanded inline
+# pragma option -w-ngu // -w-8041 Negating unsigned value
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+# pragma option -w-rch // -w-8066 Unreachable code
+# pragma option -w-par // -w-8057 Parameter 'parameter' is never used
+#endif
diff --git a/build/stlport/stlport/stl/config/_watcom.h b/build/stlport/stlport/stl/config/_watcom.h
new file mode 100644
index 000000000..b0d2defee
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_watcom.h
@@ -0,0 +1,151 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Watcom"
+
+#if (__WATCOMC__ < 1250)
+# error Not supported!
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI 1
+#endif
+
+// for switches (-xs, -xss, -xst)
+#if !(defined (__SW_XS) || defined (__SW_XSS) || defined(__SW_XST))
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+#if defined (_MT) && !defined (_NOTHREADS)
+# define _STLP_THREADS 1
+#endif
+
+#define _STLP_NO_VENDOR_STDLIB_L
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_NO_VENDOR_MATH_L
+
+#define _STLP_LONG_LONG long long
+
+#define _STLP_CALL __cdecl
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_NO_CONST_IN_PAIR
+
+//#define _STLP_DONT_USE_PRIV_NAMESPACE
+//#define _STLP_NO_MOVE_SEMANTIC
+//#define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+#define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+
+#define _STLP_NO_RELOPS_NAMESPACE
+
+#define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+#define _STLP_NO_STATIC_CONST_DEFINITION
+
+//#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+#define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+//#define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+#define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+//#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+//#define _STLP_NO_MEMBER_TEMPLATES 1
+//#define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+
+//#define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+//#define _STLP_HAS_NO_NAMESPACES 1
+//#define _STLP_NEED_TYPENAME 1
+
+#define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+//#define _STLP_STATIC_CONST_INIT_BUG 1
+// #define _STLP_THROW_RETURN_BUG 1
+//#define _STLP_NO_TEMPLATE_CONVERSIONS 1
+
+#define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+#define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+//#define _STLP_NONTEMPL_BASE_MATCH_BUG
+//#define _STLP_NO_EXCEPTION_HEADER 1
+#define _STLP_NO_BAD_ALLOC 1
+
+//#define _STLP_NO_TYPENAME_ON_RETURN_TYPE
+//#define _STLP_NESTED_TYPE_PARAM_BUG 1
+
+//#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+
+#define _STLP_NO_ARROW_OPERATOR 1
+// This one is present in 11, but apparently has bugs (with auto_ptr).
+//#define _STLP_NO_NEW_STYLE_CASTS 1
+
+// Get rid of Watcom's min and max macros
+#undef min
+#undef max
+
+// On QNX, headers are supposed to be found in /usr/include,
+// so default "../include" should work.
+#ifndef __QNX__
+# define _STLP_NATIVE_INCLUDE_PATH ../h
+#else
+// boris : is this true or just the header is not in /usr/include ?
+# define _STLP_NO_TYPEINFO 1
+#endif
+
+// Inline replacements for locking calls under Watcom
+// Define _STLP_NO_WATCOM_INLINE_INTERLOCK to keep using
+// standard WIN32 calls
+// Define _STL_MULTIPROCESSOR to enable lock
+#define _STLP_NO_WATCOM_INLINE_INTERLOCK
+#if !defined(_STLP_NO_WATCOM_INLINE_INTERLOCK)
+
+long __stl_InterlockedIncrement( long *var );
+long __stl_InterlockedDecrement( long *var );
+
+#ifdef _STL_MULTIPROCESSOR
+// Multiple Processors, add lock prefix
+#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 1" \
+ "lock xadd [ecx], eax" \
+ "inc eax" \
+ value [eax];
+
+
+#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 0FFFFFFFFh" \
+ "lock xadd [ecx], eax" \
+ "dec eax" \
+ value [eax];
+#else
+// Single Processor, lock prefix not needed
+#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 1" \
+ "xadd [ecx], eax" \
+ "inc eax" \
+ value [eax];
+
+#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 0FFFFFFFFh" \
+ "xadd [ecx], eax" \
+ "dec eax" \
+ value [eax];
+#endif // _STL_MULTIPROCESSOR
+
+long __stl_InterlockedExchange( long *Destination, long Value );
+
+// xchg has auto-lock
+#pragma aux __stl_InterlockedExchange parm [ecx] [eax] = \
+ ".586" \
+ "xchg eax, [ecx]" \
+ value [eax];
+
+# define _STLP_ATOMIC_INCREMENT(__x) __stl_InterlockedIncrement((long*)__x)
+# define _STLP_ATOMIC_DECREMENT(__x) __stl_InterlockedDecrement((long*)__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y)
+# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y)
+#endif /* INLINE INTERLOCK */
+
diff --git a/build/stlport/stlport/stl/config/_windows.h b/build/stlport/stlport/stl/config/_windows.h
new file mode 100644
index 000000000..6b42e1144
--- /dev/null
+++ b/build/stlport/stlport/stl/config/_windows.h
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_WINDOWS_H
+#define _STLP_INTERNAL_WINDOWS_H
+
+#if !defined (_STLP_PLATFORM)
+# define _STLP_PLATFORM "Windows"
+#endif
+
+#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
+# if defined (_MIPSEB)
+# define _STLP_BIG_ENDIAN 1
+# endif
+# if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
+ defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
+ defined (__alpha__)
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# if defined (__ia64__)
+ /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
+# if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+# else
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# endif
+#endif /* _STLP_BIG_ENDIAN */
+
+#if !defined (_STLP_WINDOWS_H_INCLUDED)
+# define _STLP_WINDOWS_H_INCLUDED
+# if defined (__BUILDING_STLPORT)
+# include <stl/config/_native_headers.h>
+/* Here we define _STLP_OUTERMOST_HEADER_ID to avoid indirect inclusion
+ * of STLport stuffs from C/C++ Standard headers exposed by STLport
+ * as configuration is not yet completed. */
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x100
+# endif
+# if !defined (WIN32_LEAN_AND_MEAN)
+# define WIN32_LEAN_AND_MEAN
+# endif
+# if !defined (VC_EXTRALEAN)
+# define VC_EXTRALEAN
+# endif
+/* Don't let windows.h define its min and max macros. */
+# if !defined (NOMINMAX)
+# define NOMINMAX
+# endif
+# if !defined (STRICT)
+# define STRICT
+# endif
+# if defined (_STLP_USE_MFC)
+# include <afx.h>
+# else
+# include <windows.h>
+# endif
+# if (_STLP_OUTERMOST_HEADER_ID == 0x100)
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# else
+/* This section serves as a replacement for windows.h header. */
+# if defined (__cplusplus)
+extern "C" {
+# endif
+# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
+ (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
+# define InterlockedIncrement _InterlockedIncrement
+# define InterlockedDecrement _InterlockedDecrement
+# define InterlockedExchange _InterlockedExchange
+# define _STLP_STDCALL
+# else
+# if defined (_MAC)
+# define _STLP_STDCALL _cdecl
+# else
+# define _STLP_STDCALL __stdcall
+# endif
+# endif
+
+# if defined (_STLP_NEW_PLATFORM_SDK)
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
+# if defined (_WIN64)
+_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL _InterlockedExchangePointer(void* volatile *, void*);
+# endif
+# elif !defined (_STLP_WCE)
+/* boris : for the latest SDK, you may actually need the other version of the declaration (above)
+ * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
+ */
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
+# else
+/* start of eMbedded Visual C++ specific section */
+# include <stl/config/_native_headers.h>
+
+/* Don't let windef.h define its min and max macros. */
+# if !defined (NOMINMAX)
+# define NOMINMAX
+# endif
+# include <windef.h> /* needed for basic windows types */
+
+ /** in SDKs generated with PB5, windef.h somehow includes headers which then
+ define setjmp. */
+# if (_WIN32_WCE >= 0x500)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# ifndef _WINBASE_ /* winbase.h already included? */
+long WINAPI InterlockedIncrement(long*);
+long WINAPI InterlockedDecrement(long*);
+long WINAPI InterlockedExchange(long*, long);
+# endif
+
+# ifndef __WINDOWS__ /* windows.h already included? */
+
+# if defined (x86)
+# include <winbase.h> /* needed for inline versions of Interlocked* functions */
+# endif
+
+# ifndef _MFC_VER
+
+# define MessageBox MessageBoxW
+int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
+
+# define wvsprintf wvsprintfW
+int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
+
+void WINAPI ExitThread(DWORD dwExitCode);
+
+# if !defined (COREDLL)
+# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
+# else
+# define _STLP_WCE_WINBASEAPI
+# endif
+
+_STLP_WCE_WINBASEAPI int WINAPI
+MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
+ int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
+
+_STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
+
+_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
+
+# define OutputDebugString OutputDebugStringW
+void WINAPI OutputDebugStringW(LPCWSTR);
+
+_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
+
+# undef _STLP_WCE_WINBASEAPI
+
+# endif /* !_MFC_VER */
+
+# endif /* !__WINDOWS__ */
+
+/* end of eMbedded Visual C++ specific section */
+# endif
+
+# if !defined (_STLP_WCE)
+_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
+_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
+# endif
+
+# if defined (InterlockedIncrement)
+# pragma intrinsic(_InterlockedIncrement)
+# pragma intrinsic(_InterlockedDecrement)
+# pragma intrinsic(_InterlockedExchange)
+# if defined (_WIN64)
+# pragma intrinsic(_InterlockedExchangePointer)
+# endif
+# endif
+# if defined (__cplusplus)
+} /* extern "C" */
+# endif
+
+# endif
+
+/* Here we use a macro different than the InterlockedExchangePointer SDK one
+ * to avoid macro definition conflict. */
+# if !defined (_WIN64)
+/* Under 32 bits platform we rely on a simple InterlockedExchange call. */
+# if defined (__cplusplus)
+/* We do not define this function if we are not in a C++ translation unit just
+ * because of the 'inline' keyword portability issue it would introduce. We will
+ * have to fix it the day we need this function for a C translation unit.
+ */
+inline
+void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
+# if defined (_STLP_MSVC)
+/* Here MSVC produces warning if 64 bits portability issue is activated.
+ * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
+ * is based on the platform, Win32 or Win64
+ */
+# pragma warning (push)
+# pragma warning (disable : 4311) // pointer truncation from void* to long
+# pragma warning (disable : 4312) // conversion from long to void* of greater size
+# endif
+# if !defined (_STLP_NO_NEW_STYLE_CASTS)
+ return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
+ reinterpret_cast<long>(__b)));
+# else
+ return (void*)InterlockedExchange((long*)__a, (long)__b);
+# endif
+# if defined (_STLP_MSVC)
+# pragma warning (pop)
+# endif
+}
+# endif
+# else
+# define STLPInterlockedExchangePointer _InterlockedExchangePointer
+# endif
+
+#endif /* _STLP_WINDOWS_H_INCLUDED */
+
+/* _STLP_WIN95_LIKE signal the Windows 95 OS or assimilated Windows OS version that
+ * has Interlockeded[Increment, Decrement] Win32 API functions not returning modified
+ * value.
+ */
+#if (defined (WINVER) && (WINVER < 0x0410) && (!defined (_WIN32_WINNT) || (_WIN32_WINNT < 0x400))) || \
+ (!defined (WINVER) && (defined (_WIN32_WINDOWS) && (_WIN32_WINDOWS < 0x0410) || \
+ (defined (_WIN32_WINNT) && (_WIN32_WINNT < 0x400))))
+# define _STLP_WIN95_LIKE
+#endif
+
+/* Between Windows 95 (0x400) and later Windows OSes an API enhancement forces us
+ * to change _Refcount_Base internal struct. As _Refcount_base member methods might
+ * be partially inlined we need to check that STLport build/use are coherent. To do
+ * so we try to generate a link time error thanks to the following macro.
+ * This additional check is limited to old compilers that might still be used with
+ * Windows 95. */
+#if (defined (_DEBUG) || defined (_STLP_DEBUG)) && \
+ (defined (_STLP_MSVC) && (_STLP_MSVC < 1310) || \
+ defined (__GNUC__) && (__GNUC__ < 3))
+/* We invert symbol names based on macro detection, when building for Windows
+ * 95 we expose a
+ * building_for_windows95_or_previous_but_library_built_for_windows98_or_later
+ * function in order to have a more obvious link error message signaling how
+ * the lib has been built and how it is used. */
+# if defined (__BUILDING_STLPORT)
+# if defined (_STLP_WIN95_LIKE)
+# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98
+# else
+# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95
+# endif
+# else
+# if defined (_STLP_WIN95_LIKE)
+# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98
+# else
+# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95
+# endif
+# endif
+#endif
+
+#if defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# define _STLP_WIN16
+#else
+# define _STLP_WIN32
+#endif
+
+#if defined(_STLP_WIN32)
+# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */
+#endif
+
+#if defined(__MINGW32__) && !defined(_STLP_USE_STDIO_IO)
+# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */
+#endif /* __MINGW32__ */
+
+#ifdef _STLP_WIN16
+# define _STLP_USE_UNIX_EMULATION_IO /* _open/_read/_write */
+# define _STLP_LDOUBLE_80
+#endif
+
+#endif /* _STLP_INTERNAL_WINDOWS_H */
diff --git a/build/stlport/stlport/stl/config/compat.h b/build/stlport/stlport/stl/config/compat.h
new file mode 100644
index 000000000..434f314e7
--- /dev/null
+++ b/build/stlport/stlport/stl/config/compat.h
@@ -0,0 +1,80 @@
+
+/*
+ * Compatibility section
+ * This section sets new-style macros based on old-style ones, for compatibility
+ */
+
+#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG)
+# define _STLP_DEBUG __STL_DEBUG
+#endif
+#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS)
+# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS
+#endif
+#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS)
+# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS
+#endif
+#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS
+#endif
+#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES)
+# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES
+#endif
+#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
+# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS
+#endif
+#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE)
+# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE
+#endif
+
+#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE
+#endif
+
+#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED)
+# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED
+#endif
+#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE)
+# define _STLP_SHRED_BYTE __STL_SHRED_BYTE
+#endif
+#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC)
+# define _STLP_USE_MFC __STL_USE_MFC
+#endif
+
+#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC)
+# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC
+#endif
+#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC)
+# define _STLP_USE_MALLOC __STL_USE_MALLOC
+#endif
+
+#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC)
+# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC
+#endif
+
+#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE)
+# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE
+#endif
+
+#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE)
+# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE
+#endif
+
+#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS)
+# define _STLP_USE_ABBREVS __STL_USE_ABBREVS
+#endif
+
+#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY)
+# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY
+#endif
+
+/* STLport do not support anymore the iostream wrapper mode so this macro should
+ * always been define for other libraries that was using it:
+ */
+#if !defined (_STLP_OWN_IOSTREAMS)
+# define _STLP_OWN_IOSTREAMS
+#endif
+
+#if defined (_STLP_NO_OWN_IOSTREAMS)
+# error STLport do not support anymore the wrapper mode. If you want to use STLport \
+use its iostreams implementation or no iostreams at all.
+#endif
diff --git a/build/stlport/stlport/stl/config/features.h b/build/stlport/stlport/stl/config/features.h
new file mode 100644
index 000000000..dc30eccb2
--- /dev/null
+++ b/build/stlport/stlport/stl/config/features.h
@@ -0,0 +1,1079 @@
+ /*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_FEATURES_H
+#define _STLP_FEATURES_H
+
+/*
+ * Purpose of this file:
+ *
+ * Defines all STLport settings.
+ * This file is actually a wrapper : it includes compiler-specific
+ * settings from <config/stlcomp.h>
+ * and user-defined settings from <config/user_config.h>.
+ * See <config/stl_mycomp.h> and <config/user_config.h> for the description
+ * of those macros
+ *
+ */
+
+/* Definition of the STLport version informations */
+#include <stl/_stlport_version.h>
+
+/* Other macros defined by this file:
+
+ * bool, true, and false, if _STLP_NO_BOOL is defined.
+ * typename, as a null macro if it's not already a keyword.
+ * explicit, as a null macro if it's not already a keyword.
+ * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.)
+ * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.)
+ * _STLP_ASSERT, either as a test or as a null macro, depending on
+ whether or not _STLP_ASSERTIONS is defined.
+*/
+
+/* Definition of the 2 STLport debug levels */
+#define _STLP_STLPORT_DBG_LEVEL 1
+#define _STLP_STANDARD_DBG_LEVEL 2
+
+/* Placeholder for user to override settings.
+ * It could be also used to mask settings from
+ * different directories.
+ */
+#include <stl/config/user_config.h>
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL)
+# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
+#endif
+
+#if defined (__BUILDING_STLPORT)
+/* For the STLport implementation we can use everything:
+ */
+# if defined (_STLP_NO_ANACHRONISMS)
+# undef _STLP_NO_ANACHRONISMS
+# endif
+# if defined (_STLP_NO_EXTENSIONS)
+# undef _STLP_NO_EXTENSIONS
+# endif
+/* Moreover there are things that have no sens:
+ */
+# if defined (_STLP_NO_IOSTREAMS)
+# error If you do not use iostreams you do not need to build the STLport library.
+# endif
+#endif
+
+/* ========================================================= */
+/* This file is used for compatibility; it accepts old-style config
+ switches */
+#include <stl/config/compat.h>
+
+/* Common configuration file for this particular installation. */
+#include <stl/config/host.h>
+
+/* Operational Environment specific */
+#include <stl/config/_system.h>
+
+/* ========================================================= */
+
+/* some fixes to configuration. This also includes modifications
+ * of STLport switches depending on compiler flags,
+ * or settings applicable to a group of compilers, such as
+ * to all who use EDG front-end.
+ */
+#include <stl/config/stl_confix.h>
+
+#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES)
+# define _STLP_MEMBER_TEMPLATES 1
+#endif
+
+#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+# define _STLP_MEMBER_TEMPLATE_CLASSES 1
+#endif
+
+#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+#endif
+
+#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1
+#endif
+
+#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1
+#endif
+
+#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM)
+# define _STLP_USE_SHORT_STRING_OPTIM 1
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \
+ !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_USE_CONTAINERS_EXTENSION
+#endif
+
+#if defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
+#else
+# define _STLP_TEMPLATE_FOR_CONT_EXT
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \
+ (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
+# error Sorry but according the STLport settings your compiler can not support the pointer specialization feature.
+#endif
+
+#if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_NO_OWN_NAMESPACE)
+# error Sorry but asking for both STLport to be in the real std namespace and also having STLport import all native std stuff \
+ is invalid, chose one or none.
+#endif
+
+#if defined (_STLP_VERBOSE) && !defined (_STLP_VERBOSE_MODE_SUPPORTED)
+# error Sorry but the verbose mode is not implemented for your compiler.
+#endif
+
+#if defined (_STLP_NO_IOSTREAMS) && \
+ !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC)
+# define _STLP_USE_NEWALLOC
+#endif
+
+#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
+# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \
+ defined (__hpux) || defined (macintosh) || defined (_MAC)
+# define _STLP_BIG_ENDIAN 1
+# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
+ defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
+ defined (__alpha__) || defined (_MIPSEL)
+# define _STLP_LITTLE_ENDIAN 1
+# elif defined (__ia64__)
+ /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
+# if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+# else
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# else
+# error "can't determine endianess"
+# endif
+#endif /* _STLP_BIG_ENDIAN */
+
+/* ==========================================================
+ * final workaround tuning based on given flags
+ * ========================================================== */
+
+#ifndef _STLP_UINT32_T
+# define _STLP_UINT32_T unsigned long
+#endif
+#ifndef _STLP_ABORT
+# define _STLP_ABORT() abort()
+#endif
+
+#if !defined (_STLP_HAS_NO_NAMESPACES)
+# if defined _STLP_NO_NAMESPACES
+# undef _STLP_USE_NAMESPACES
+# else
+/* assume it as the default, turn it off later if NO_NAMESPACES selected */
+# undef _STLP_USE_NAMESPACES
+# define _STLP_USE_NAMESPACES 1
+# endif
+#endif
+
+#if defined (_STLP_NO_IOSTREAMS)
+# define _STLP_USE_NO_IOSTREAMS
+#endif
+
+/* Operating system recognition (basic) */
+#if (defined(__unix) || defined(__linux__) || defined(__QNX__) || defined(_AIX) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__Lynx__) || defined(__hpux) || defined(__sgi)) && \
+ !defined (_STLP_UNIX)
+# define _STLP_UNIX 1
+#endif /* __unix */
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+# define _STLP_LONGEST_FLOAT_TYPE long double
+#else
+# define _STLP_LONGEST_FLOAT_TYPE double
+#endif
+
+/* Native headers access macros */
+#if !defined (_STLP_HAS_INCLUDE_NEXT)
+# include <stl/config/_native_headers.h>
+#endif
+
+/* shared library tune-up */
+
+#if defined (__BUILDING_STLPORT)
+/* if we are rebuilding right now, place everything here */
+# undef _STLP_DESIGNATED_DLL
+# define _STLP_DESIGNATED_DLL 1
+#endif
+
+/* Use own namespace always if possible and not explicitly instructed otherwise */
+#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \
+ !defined (_STLP_NO_OWN_NAMESPACE)
+# undef _STLP_USE_OWN_NAMESPACE
+# define _STLP_USE_OWN_NAMESPACE 1
+#else
+# undef _STLP_WHOLE_NATIVE_STD
+#endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED)
+
+# if defined (_PTHREADS)
+# define _STLP_PTHREADS
+# define _STLP_THREADS
+# endif
+# if defined (_UITHREADS)
+# define _STLP_UITHREADS
+# define _STLP_THREADS
+# endif
+
+# if defined (_STLP_WIN32) && !defined (_STLP_PTHREADS)
+# define _STLP_WIN32THREADS 1
+# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \
+ !defined(_STLP_PTHREADS)
+# define _STLP_UITHREADS
+# else
+# define _STLP_PTHREADS
+# endif /* __sgi */
+# define _STLP_THREADS_DEFINED
+#endif
+
+#if (defined (_REENTRANT) || defined (_THREAD_SAFE)) && !defined (_STLP_THREADS)
+# define _STLP_THREADS
+#endif
+
+#ifndef _STLP_STATIC_MUTEX
+# define _STLP_STATIC_MUTEX _STLP_mutex_base
+#endif
+
+#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC)
+# define _STLP_USE_MFC 1
+#endif
+
+#if defined (_STLP_THREADS)
+# define _STLP_VOLATILE volatile
+#else
+# define _STLP_VOLATILE
+#endif
+
+#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
+# define _STLP_USE_NEW_C_HEADERS
+#endif
+/* disable new-style headers if requested */
+#if defined (_STLP_NO_NEW_C_HEADERS)
+# undef _STLP_USE_NEW_C_HEADERS
+#endif
+
+#if defined (_STLP_BASE_TYPEDEF_BUG)
+# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG
+#endif
+
+/* SUNpro 4.2 inline string literal bug */
+#ifdef _STLP_INLINE_STRING_LITERAL_BUG
+# define _STLP_FIX_LITERAL_BUG(__x) __x = __x;
+#else
+# define _STLP_FIX_LITERAL_BUG(__x)
+#endif
+
+#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+#endif
+
+#if !defined (_STLP_STATIC_ASSERT)
+/* Some compiler support 0 size array so we use negative size array to generate
+ * a compilation time error.
+ */
+# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1] __attribute__((unused));
+#endif
+
+/* apple mpw exception handling bug */
+#ifndef _STLP_MPWFIX_TRY
+# define _STLP_MPWFIX_TRY
+#endif
+#ifndef _STLP_MPWFIX_CATCH
+# define _STLP_MPWFIX_CATCH
+#endif
+#ifndef _STLP_MPWFIX_CATCH_ACTION
+# define _STLP_MPWFIX_CATCH_ACTION(action)
+#endif
+
+#if !defined (_STLP_WEAK)
+# define _STLP_WEAK
+#endif
+
+/* default parameters as template types derived from arguments ( not always supported ) */
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname
+#else
+# if !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_DEFAULT_TYPE_PARAM 1
+# endif
+# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval
+#endif
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc
+#else
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \
+ class _Alloc = allocator< pair < _Key, _Tp > >
+#endif
+
+/* default parameters as complete types */
+#if defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval
+# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val
+#else
+# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname
+# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name
+#endif
+
+/* SGI compatibility */
+
+#ifdef _STLP_NO_WCHAR_T
+# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+#else
+# define _STLP_HAS_WCHAR_T 1
+#endif
+
+#if !defined (_STLP_NO_AT_MEMBER_FUNCTION)
+# define _STLP_CAN_THROW_RANGE_ERRORS 1
+#endif
+
+/* debug mode tool */
+#if defined (_STLP_DEBUG)
+# define _STLP_NON_DBG_NAME(X) _NonDbg_##X
+#endif
+
+/* pointer specialization tool */
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define _STLP_PTR_IMPL_NAME(X) _Impl_##X
+#endif
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X
+#endif
+
+/* this always mean the C library is in global namespace */
+#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+#endif
+
+/* Depending of whether compiler supports namespaces,
+ * tune the parameters for vendor-supplied libraries.
+ * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES,
+ * since it depends only on the native features, not on user's preference whether
+ * to use namespace for STLport or not.
+ */
+#if !defined (_STLP_HAS_NO_NAMESPACES)
+/* Import some vendor's headers into corresponding STLport ones if they might be needed
+ * (if we wrap native iostreams and use namepace other than std::) */
+# if defined (_STLP_WHOLE_NATIVE_STD)
+# define _STLP_IMPORT_VENDOR_STD 1
+# endif
+
+/* if using stlport:: namespace or if C library stuff is not in vendor's std::,
+ * try importing 'em.
+ * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
+# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
+# define _STLP_IMPORT_VENDOR_CSTD 1
+# endif
+
+# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS)
+# define _STLP_NO_CSTD_FUNCTION_IMPORTS
+# endif
+
+# define _STLP_USING_NAMESPACE(x) using namespace x ;
+
+namespace std { }
+namespace __std_alias = std;
+
+/* assume std:: namespace for C++ std library if not being told otherwise */
+# if defined (_STLP_VENDOR_GLOBAL_STD)
+# define _STLP_VENDOR_STD
+# else
+# define _STLP_VENDOR_STD std
+# endif
+
+/* tune things that come from C library */
+# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS)
+/* in old-style headers, C functions go to global scope. */
+# define _STLP_VENDOR_CSTD
+# define _STLP_USING_VENDOR_CSTD
+# else
+# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD
+# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD)
+# endif /* _STLP_VENDOR_CSTD */
+/* exception, typeinfo, new - always come from the vendor */
+# if !defined (_STLP_VENDOR_EXCEPT_STD)
+# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD)
+# define _STLP_VENDOR_EXCEPT_STD
+# else
+# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD
+# endif
+# endif
+# define _STLP_OLD_IO_NAMESPACE
+# if !defined (_STLP_VENDOR_MB_NAMESPACE)
+# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD
+# endif
+#else
+/* compiler has no namespace support */
+# define _STLP_VENDOR_STD
+# define _STLP_VENDOR_CSTD
+# define _STLP_USING_NAMESPACE(x)
+# define _STLP_USING_VENDOR_CSTD
+# define _STLP_VENDOR_EXCEPT_STD
+#endif
+
+#if defined (_STLP_USE_NAMESPACES)
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+# if !defined (_STLP_STD_NAME)
+# if !defined (_STLP_DEBUG)
+# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpmtx_std
+# else
+# define _STLP_STD_NAME stlp_std
+# endif
+# else
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpxmtx_std
+# else
+# define _STLP_STD_NAME stlpx_std
+# endif
+# endif
+# else
+/*
+ * The STLport debug mode is binary incompatible with the other modes,
+ * lets make it clear on the STLport namespace to generate link errors rather
+ * than runtime ones.
+ */
+# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpdmtx_std
+# else
+# define _STLP_STD_NAME stlpd_std
+# endif
+# else
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpdxmtx_std
+# else
+# define _STLP_STD_NAME stlpdx_std
+# endif
+# endif
+# endif
+# endif
+namespace _STLP_STD_NAME { }
+# else
+# define _STLP_STD_NAME std
+# endif /* _STLP_USE_OWN_NAMESPACE */
+
+# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME {
+# define _STLP_BEGIN_TR1_NAMESPACE namespace tr1 {
+# define _STLP_END_NAMESPACE }
+
+/* decide whether or not we use separate namespace for rel ops */
+# if defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {}
+# define _STLP_END_RELOPS_NAMESPACE }
+# else
+/* Use std::rel_ops namespace */
+# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {
+# define _STLP_END_RELOPS_NAMESPACE } }
+# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# endif /* Use std::rel_ops namespace */
+
+# define _STLP_STD ::_STLP_STD_NAME
+# if !defined (_STLP_TR1)
+# define _STLP_TR1 _STLP_STD::tr1::
+# endif
+
+# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+# define _STLP_PRIV_NAME priv
+# define _STLP_PRIV _STLP_STD::_STLP_PRIV_NAME::
+# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME {
+# define _STLP_MOVE_TO_STD_NAMESPACE }
+# else
+# if !defined (_STLP_PRIV)
+# define _STLP_PRIV _STLP_STD::
+# endif
+# define _STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+/* Official STLport namespace when std is not redefined.
+ * Here we don't use a macro because we do not need it and because
+ * stlport is used as file name by boost and folder name under beos:
+ */
+namespace stlport = _STLP_STD_NAME;
+
+/* Backward compatibility:
+ */
+namespace _STL = _STLP_STD_NAME;
+#undef __STLPORT_NAMESPACE
+#define __STLPORT_NAMESPACE _STLP_STD_NAME
+
+#else /* _STLP_USE_NAMESPACES */
+/* STLport is being put into global namespace */
+# define _STLP_STD
+# define _STLP_PRIV
+# define _STLP_TR1
+# define _STLP_BEGIN_NAMESPACE
+# define _STLP_BEGIN_TR1_NAMESPACE
+# define _STLP_END_NAMESPACE
+# define _STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_MOVE_TO_STD_NAMESPACE
+
+/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+ causes less problems than having relational operator templates in global namespace
+ Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */
+# if !defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# endif
+# define _STLP_BEGIN_RELOPS_NAMESPACE
+# define _STLP_END_RELOPS_NAMESPACE
+# undef _STLP_USE_OWN_NAMESPACE
+#endif /* _STLP_USE_NAMESPACES */
+
+#define STLPORT_CSTD _STLP_VENDOR_CSTD
+#define STLPORT _STLP_STD_NAME
+
+#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG)
+# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy<T>
+#else
+# define _STLP_SIMPLE_TYPE(T) T
+#endif
+
+#ifndef _STLP_RAND48
+# define _STLP_NO_DRAND48
+#endif
+
+/* advanced keywords usage */
+#define __C_CAST(__x, __y) ((__x)(__y))
+#ifndef _STLP_NO_NEW_STYLE_CASTS
+# define __CONST_CAST(__x,__y) const_cast<__x>(__y)
+# define __STATIC_CAST(__x,__y) static_cast<__x>(__y)
+# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y)
+#else
+# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y)
+# define __CONST_CAST(__x,__y) __C_CAST(__x, __y)
+# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y)
+#endif
+
+#if defined (_STLP_NEED_TYPENAME) && ! defined (typename)
+# define typename
+#endif
+
+#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE )
+# define _STLP_TYPENAME_ON_RETURN_TYPE
+#else
+# define _STLP_TYPENAME_ON_RETURN_TYPE typename
+#endif
+
+#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+# define _STLP_HEADER_TYPENAME
+#else
+# define _STLP_HEADER_TYPENAME typename
+#endif
+
+#ifdef _STLP_NO_TYPENAME_BEFORE_NAMESPACE
+# define _STLP_TYPENAME
+#else
+# define _STLP_TYPENAME typename
+#endif
+
+#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_TEMPLATE template
+#else
+# define _STLP_TEMPLATE
+#endif
+
+#if defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_KEY_TYPE_FOR_CONT_EXT(type)
+# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
+#else
+# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT;
+# define _STLP_TEMPLATE_FOR_CONT_EXT
+#endif
+
+#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit)
+# define explicit
+#endif
+
+#if !defined (_STLP_NEED_MUTABLE)
+# define _STLP_MUTABLE(type, x) x
+#else
+# define _STLP_MUTABLE(type, x) __CONST_CAST(type*, this)->x
+# define mutable
+#endif
+
+#if defined (_STLP_NO_SIGNED_BUILTINS)
+/* old HP-UX doesn't understand "signed" keyword */
+# define signed
+#endif
+
+#if defined (_STLP_LOOP_INLINE_PROBLEMS)
+# define _STLP_INLINE_LOOP
+#else
+# define _STLP_INLINE_LOOP inline
+#endif
+
+#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_TEMPLATE_NULL template<>
+#else
+# define _STLP_TEMPLATE_NULL
+#endif
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+# define _STLP_OPERATOR_TEMPLATE
+#else
+# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL
+#endif
+
+#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
+/* unless we have other compiler problem, try simulating partial spec here */
+# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# endif
+/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */
+# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
+# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES )
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# endif
+# elif defined ( _STLP_NO_ANACHRONISMS )
+# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# endif
+#endif
+
+#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+# define _STLP_NULL_TMPL_ARGS <>
+# else
+# define _STLP_NULL_TMPL_ARGS
+#endif
+
+#if !defined (_STLP_ALLOCATOR_TYPE_DFL)
+# if defined (_STLP_DONT_SUP_DFLT_PARAM)
+# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+# endif
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+# define _STLP_ALLOCATOR_TYPE_DFL
+# else
+# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type()
+# endif
+#endif
+
+/* When the compiler do not correctly initialized the basic types value in default parameters we prefer
+ * to avoid them to be able to correct this bug.
+ */
+#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
+# define _STLP_DONT_SUP_DFLT_PARAM 1
+#endif
+
+#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR)
+# define _STLP_NO_ARROW_OPERATOR
+#endif
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \
+ !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY)
+/* this one is needed for proper reverse_iterator<> operator ->() handling */
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+#endif
+
+#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
+# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) )
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef typename _STLP_STD :: reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef typename _STLP_STD :: reverse_iterator<iterator> reverse_iterator
+# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__)
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<iterator> reverse_iterator
+# else
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef _STLP_STD::reverse_iterator<iterator> reverse_iterator
+# endif
+#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
+ const_pointer, difference_type> const_reverse_iterator; \
+ typedef _STLP_STD::__reverse_iterator<iterator, value_type, reference, pointer, difference_type> \
+ reverse_iterator
+# else
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
+ difference_type> const_reverse_iterator; \
+ typedef _STLP_STD::__reverse_iterator<iterator, value_type, \
+ reference, difference_type> \
+ reverse_iterator
+# endif
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \
+ _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator)
+#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \
+ _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator)
+
+#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \
+ typedef typename _Super::value_type value_type; \
+ typedef typename _Super::size_type size_type; \
+ typedef typename _Super::difference_type difference_type; \
+ typedef typename _Super::reference reference; \
+ typedef typename _Super::const_reference const_reference; \
+ typedef typename _Super::pointer pointer; \
+ typedef typename _Super::const_pointer const_pointer; \
+ typedef typename _Super::allocator_type allocator_type;
+
+
+#define __IMPORT_ITERATORS(_Super) \
+ typedef typename _Super::iterator iterator; \
+ typedef typename _Super::const_iterator const_iterator;
+
+#define __IMPORT_REVERSE_ITERATORS(_Super) \
+ typedef typename _Super::const_reverse_iterator const_reverse_iterator; \
+ typedef typename _Super::reverse_iterator reverse_iterator;
+
+#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \
+ __derived_name(const _Super& __x) : _SUPER(__x) {} \
+ _Self& operator=(const _Super& __x) { \
+ *(_Super*)this = __x; \
+ return *this; \
+ } \
+ __derived_name(const _Self& __x) : _SUPER(__x) {} \
+ _Self& operator=(const _Self& __x) { \
+ *(_Super*)this = __x; \
+ return *this; \
+ }
+
+#define __IMPORT_WITH_ITERATORS(_Super) \
+ __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super)
+
+#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \
+ __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super)
+
+#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG)
+# define __TRIVIAL_CONSTRUCTOR(__type) __type() {}
+#else
+# define __TRIVIAL_CONSTRUCTOR(__type)
+#endif
+
+#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG)
+# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {}
+#else
+# define __TRIVIAL_DESTRUCTOR(__type)
+#endif
+
+#define __TRIVIAL_STUFF(__type) \
+ __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type)
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+# define _STLP_STATIC_CONSTANT(__type, __assignment) enum { __assignment }
+#else
+# define _STLP_STATIC_CONSTANT(__type, __assignment) static const __type __assignment
+#endif
+
+#if defined (_STLP_HAS_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS)
+# define _STLP_USE_EXCEPTIONS
+#endif
+
+#if defined (_STLP_USE_EXCEPTIONS)
+# define _STLP_TRY try
+# define _STLP_CATCH_ALL catch(...)
+# ifndef _STLP_THROW
+# define _STLP_THROW(x) throw x
+# endif
+# define _STLP_RETHROW throw
+
+# define _STLP_UNWIND(action) catch(...) { action; throw; }
+
+# ifdef _STLP_THROW_RETURN_BUG
+# define _STLP_RET_AFTER_THROW(data) return data;
+# else
+# define _STLP_RET_AFTER_THROW(data)
+# endif
+
+# if !defined (_STLP_THROWS)
+# define _STLP_THROWS(x) throw(x)
+# endif
+# if !defined (_STLP_NOTHROW)
+# define _STLP_NOTHROW throw()
+# endif
+#else
+# define _STLP_TRY
+# define _STLP_CATCH_ALL if (false)
+# ifndef _STLP_THROW
+# define _STLP_THROW(x)
+# endif
+# define _STLP_RETHROW {}
+# define _STLP_UNWIND(action)
+# define _STLP_THROWS(x)
+# define _STLP_NOTHROW
+# define _STLP_RET_AFTER_THROW(data)
+#endif
+
+/*
+ * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no
+ * exception support but not the _STLP_USE_EXCEPTIONS which simply means
+ * that the user do not want to use them.
+ */
+#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC)
+# define _STLP_THROWS_INHERENTLY(x) throw x
+# define _STLP_NOTHROW_INHERENTLY throw()
+#else
+# define _STLP_THROWS_INHERENTLY(x)
+# define _STLP_NOTHROW_INHERENTLY
+#endif
+
+/* STLport function not returning are functions that throw so we translate
+ * the noreturn functions in throwing functions taking also into account
+ * exception support activation.
+ */
+#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \
+ !defined (_STLP_FUNCTION_THROWS)
+# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION
+#else
+# define _STLP_FUNCTION_THROWS
+#endif
+
+#if defined(_STLP_NO_BOOL)
+# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX)
+# include <isynonym.hpp>
+# if defined (__OS400__)
+typedef int bool;
+# elif !( defined (__xlC__) || defined (_AIX))
+typedef Boolean bool;
+# endif
+# else
+# if defined(_STLP_YVALS_H)
+# include <yvals.h>
+# else
+# if defined (_STLP_DONT_USE_BOOL_TYPEDEF)
+# define bool int
+# else
+typedef int bool;
+# endif
+# define true 1
+# define false 0
+# endif
+# endif /* __IBMCPP__ */
+#else
+# define _STLP_BOOL_KEYWORD 1
+#endif /* _STLP_NO_BOOL */
+
+/* uninitialized value filler */
+#ifndef _STLP_SHRED_BYTE
+/* This value is designed to cause problems if an error occurs */
+# define _STLP_SHRED_BYTE 0xA3
+#endif /* _STLP_SHRED_BYTE */
+
+/* shared library tune-up */
+#ifndef _STLP_IMPORT_DECLSPEC
+# define _STLP_IMPORT_DECLSPEC
+#endif
+
+/* a keyword used to instantiate export template */
+#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD
+# define _STLP_EXPORT_TEMPLATE_KEYWORD
+#endif
+#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD
+# define _STLP_IMPORT_TEMPLATE_KEYWORD
+#endif
+
+#if !defined (_STLP_NO_CONST_IN_PAIR)
+# define _STLP_CONST const
+#else
+# define _STLP_CONST
+#endif
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+/*
+ * If we do not use iostreams we do not use the export/import
+ * techniques to avoid build of the STLport library.
+ */
+# undef _STLP_USE_DECLSPEC
+/* We also undef USE_DYNAMIC_LIB macro as this macro add some code
+ * to use the dynamic (shared) STLport library for some platform/compiler
+ * configuration leading to problem when not linking to the STLport lib.
+ */
+# undef _STLP_USE_DYNAMIC_LIB
+#endif
+
+#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC)
+# if ! defined (_STLP_USE_TEMPLATE_EXPORT)
+/* this setting turns on "extern template" extension use */
+# define _STLP_USE_TEMPLATE_EXPORT
+# endif
+# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE)
+# define _STLP_NO_FORCE_INSTANTIATE
+# endif
+#endif
+
+#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
+# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD
+#else
+# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD
+#endif
+
+#ifndef _STLP_EXPORT_TEMPLATE
+# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template
+#endif
+
+#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */
+
+# ifndef _STLP_EXPORT_DECLSPEC
+# define _STLP_EXPORT_DECLSPEC
+# endif
+# ifndef _STLP_IMPORT_DECLSPEC
+# define _STLP_IMPORT_DECLSPEC
+# endif
+# ifndef _STLP_CLASS_EXPORT_DECLSPEC
+# define _STLP_CLASS_EXPORT_DECLSPEC
+# endif
+# ifndef _STLP_CLASS_IMPORT_DECLSPEC
+# define _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
+# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC
+# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC
+# else
+# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */
+# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+
+#else /* Not using DLL export/import specifications */
+
+# define _STLP_DECLSPEC
+# define _STLP_CLASS_DECLSPEC
+
+#endif
+
+#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC
+
+#if defined (_STLP_NEED_ADDITIONAL_STATIC_DECLSPEC)
+# define _STLP_STATIC_DECLSPEC _STLP_DECLSPEC
+#else
+# define _STLP_STATIC_DECLSPEC
+#endif
+
+#if !defined (_STLP_CALL)
+# define _STLP_CALL
+#endif
+
+#ifndef _STLP_USE_NO_IOSTREAMS
+
+# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM)
+# define __USE_STD_IOSTREAM
+# endif
+
+/* We only need to expose details of streams implementation
+ if we use non-standard i/o or are building STLport*/
+# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO)
+# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1
+# endif
+
+/* We only need to expose details of global implementation if we are building STLport
+ or have not instantiated everything in the lib */
+# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE)
+# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1
+# endif
+
+#else /* _STLP_USE_NO_IOSTREAMS */
+/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+# define _STLP_PSPEC2(t1,t2) < t1,t2 >
+# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 >
+#else
+# define _STLP_PSPEC2(t1,t2) /* nothing */
+# define _STLP_PSPEC3(t1,t2,t3) /* nothing */
+#endif
+
+/* Activation of the partial template workaround:
+ */
+#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\
+ (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER))
+# define _STLP_USE_PARTIAL_SPEC_WORKAROUND
+#endif
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \
+_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\
+_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\
+_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\
+_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);}
+#else
+# define _STLP_RELOPS_OPERATORS(_TMPL, _TP)
+#endif
+
+#if defined ( _STLP_USE_ABBREVS )
+# include <stl/_abbrevs.h>
+#endif
+
+/* Some really useful macro */
+#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0])
+#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0])
+
+#if !defined (_STLP_MARK_PARAMETER_AS_UNUSED)
+# define _STLP_MARK_PARAMETER_AS_UNUSED(X) (void)X;
+#endif
+
+#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# if defined (_STLP_USE_NO_IOSTREAMS)
+# undef _STLP_CHECK_RUNTIME_COMPATIBILITY
+# else
+/* The extern "C" simply makes the symbol simpler. */
+#if defined (__cplusplus)
+extern "C"
+#endif
+void _STLP_DECLSPEC _STLP_CALL _STLP_CHECK_RUNTIME_COMPATIBILITY();
+# endif
+#endif
+
+/* some cleanup */
+#undef _STLP_DONT_USE_BOOL_TYPEDEF
+#undef _STLP_YVALS_H
+#undef _STLP_LOOP_INLINE_PROBLEMS
+#undef _STLP_NEED_EXPLICIT
+#undef _STLP_NEED_TYPENAME
+#undef _STLP_NO_NEW_STYLE_CASTS
+#undef __AUTO_CONFIGURED
+
+#endif /* _STLP_FEATURES_H */
diff --git a/build/stlport/stlport/stl/config/host.h b/build/stlport/stlport/stl/config/host.h
new file mode 100644
index 000000000..b4b608972
--- /dev/null
+++ b/build/stlport/stlport/stl/config/host.h
@@ -0,0 +1,342 @@
+/*
+ * This file defines site configuration.
+ */
+
+/*
+ * _STLP_NO_THREADS: if defined, STLport don't use any
+ * multithreading support. Synonym is _NOTHREADS
+ */
+/*
+#define _NOTHREADS
+#define _STLP_NO_THREADS
+*/
+
+/* _PTHREADS: if defined, use POSIX threads for multithreading support. */
+/*
+#define _PTHREADS
+*/
+
+/* compatibility section
+ */
+
+#if (defined (_STLP_NOTHREADS) || defined (_STLP_NO_THREADS) || defined (NOTHREADS))
+# if !defined (_NOTHREADS)
+# define _NOTHREADS
+# endif
+# if !defined (_STLP_NO_THREADS)
+# define _STLP_NO_THREADS
+# endif
+#endif
+
+#if !defined(_STLP_USE_DYNAMIC_LIB) && !defined(_STLP_USE_STATIC_LIB)
+/*
+ * Turn _STLP_USE_DYNAMIC_LIB to enforce use of .dll version of STLport library.
+ * NOTE: please do that only if you know what you are doing!
+ * Changing default will require you to change makefiles in "build" accordingly
+ * and to rebuild STLPort library!
+ * On UNIX, this has no effect, see build/lib/README for make tags.
+ * See STLport configuration file (build/lib/configure.bat) for help in building
+ * the require library versions.
+ */
+/*
+#define _STLP_USE_DYNAMIC_LIB
+*/
+
+/*
+ * Turn _STLP_USE_STATIC_LIB to enforce use of static version of STLport library.
+ * NOTE: please do that only if you know what you are doing!
+ * Changing default will require you to change makefile in "build" accordingly
+ * and to rebuild STLPort library!
+ * On UNIX, this has no effect, see build/lib/README for make tags.
+ * See STLport configuration file (build/lib/configure.bat) for help in building
+ * the require library versions.
+ */
+/*
+#define _STLP_USE_STATIC_LIB
+*/
+#endif
+
+/*
+ * Edit relative path below (or put full path) to get native
+ * compiler vendor's headers included. Default is "../include"
+ * for _STLP_NATIVE_INCLUDE_PATH, default for other macros is
+ * _STLP_NATIVE_INCLUDE_PATH.
+ * Hint: never install STLport in the directory that ends with "include"
+ */
+/*
+#undef _STLP_NATIVE_INCLUDE_PATH
+#define _STLP_NATIVE_INCLUDE_PATH ../include
+*/
+/* same for C library headers like <cstring> */
+/*
+#undef _STLP_NATIVE_CPP_C_INCLUDE_PATH
+#define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+/* same for C headers like <string.h> */
+/*
+#undef _STLP_NATIVE_C_INCLUDE_PATH
+#define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+/* Some compilers locate basic C++ runtime support headers (<new>, <typeinfo>, <exception>) in separate directory */
+/*
+#undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH
+#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+
+/*
+ * If namespases available, STLport use own namespace (and masquerade
+ * it as std). Disable own namespace may cause undefined behaviour.
+ */
+/*
+#define _STLP_NO_OWN_NAMESPACE 1
+*/
+
+/*
+ * Uncomment _STLP_LEAKS_PEDANTIC to force deallocation of ALL allocated
+ * memory chunks. Normally not required. But if you worry about quazi-leaks
+ * (may be reported by some leaks detection tools), use
+ * _STLP_LEAKS_PEDANTIC. It should be used with _STLP_USE_NEWALLOC or
+ * _STLP_USE_MALLOC (see below), the default node_alloc allocator also clean
+ * its internal memory pool but only if STLport is used as a dynamic library
+ * under Win32 (using MSVC like compilers).
+ */
+/*
+#define _STLP_LEAKS_PEDANTIC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_NEWALLOC to force allocator<T> to use plain "new"
+ * instead of STLport optimized node allocator engine.
+ */
+/*
+#define _STLP_USE_NEWALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_MALLOC to force allocator<T> to use plain "malloc"
+ * instead of STLport optimized node allocator engine.
+ *
+ * This is default allocator for glibc 2.3.x and later, if not mentioned other
+ */
+/*
+#define _STLP_USE_MALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_PERTHREAD_ALLOC to force allocator<T> to use
+ * a specific implementation targetting the massively multi-threaded
+ * environment. The implementation is based on the POSIX pthread
+ * interface.
+ */
+/*
+#define _STLP_USE_PERTHREAD_ALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_NODE_ALLOC if you want to force allocator<T> to use
+ * "node_alloc" allocator (this is default allocator for STLport, if not
+ * used other above, except glibc 2.3.x and later, where default is
+ * "malloc", due to better results)
+ */
+/*
+#define _STLP_USE_NODE_ALLOC 1
+*/
+
+/*
+ * Set _STLP_DEBUG_ALLOC to use allocators that perform memory debugging,
+ * such as padding/checking for memory consistency
+ */
+/*
+#define _STLP_DEBUG_ALLOC 1
+*/
+
+/*
+ * For compiler not supporting partial template specialization or ordering of
+ * template functions STLport implement a workaround based on inheritance
+ * detection. This inheritance can introduce trouble in client code when
+ * a user class derived a STL container (which is not advised as STL containers
+ * do not have virtual destructors). To disable this workaround turn this macro on:
+ */
+/*
+#define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1
+*/
+
+/*
+ * Uncomment this to force all debug diagnostic to be directed through a
+ * user-defined global function:
+ * void __stl_debug_message(const char * format_str, ...)
+ * instead of predefined STLport routine.
+ * This allows you to take control of debug message output.
+ * Default routine calls fprintf(stderr,...)
+ * Note : If you set this macro, you must supply __stl_debug_message
+ * function definition somewhere.
+ */
+/*
+#define _STLP_DEBUG_MESSAGE 1
+*/
+
+/*
+ * Uncomment this to force all failed assertions to be executed through
+ * user-defined global function:
+ * void __stl_debug_terminate(void). This allows
+ * you to take control of assertion behaviour for debugging purposes.
+ * Default routine calls _STLP_ABORT().
+ * Note : If you set this macro, you must supply __stl_debug_terminate
+ * function definition somewhere.
+ */
+/*
+#define _STLP_DEBUG_TERMINATE 1
+*/
+
+/*
+ * Uncomment that to disable exception handling code
+ */
+/*
+#define _STLP_DONT_USE_EXCEPTIONS 1
+*/
+
+/*
+ * _STLP_NO_NAMESPACES: if defined, don't put the library in namespace
+ * stlport:: or std::, even if the compiler supports namespaces
+ */
+/*
+#define _STLP_NO_NAMESPACES 1
+*/
+
+/*==========================================================
+ * Compatibility section
+ *==========================================================*/
+
+/*
+ * Use abbreviated class names for linker benefit (don't affect interface).
+ * This option is obsolete, but should work in this release.
+ *
+ */
+/*
+#define _STLP_USE_ABBREVS
+*/
+
+/*
+ * This definition precludes STLport reverse_iterator to be compatible with
+ * other parts of MSVC library. (With partial specialization, it just
+ * has no effect).
+ * Use it _ONLY_ if you use SGI-style reverse_iterator<> template explicitly
+ */
+/*
+#define _STLP_NO_MSVC50_COMPATIBILITY 1
+*/
+
+/*
+ * Use obsolete overloaded template functions iterator_category(), value_type(), distance_type()
+ * for querying iterator properties. Please note those names are non-standard and are not guaranteed
+ * to be used by every implementation. However, this setting is on by default when partial specialization
+ * is not implemented in the compiler and cannot be simulated (only if _STLP_NO_ANACHRONISMS is not set).
+ * Use of those interfaces for user-defined iterators is strongly discouraged:
+ * please use public inheritance from iterator<> template to achieve desired effect.
+ * Second form is to disable old-style queries in any case.
+ */
+/*
+#define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+#define _STLP_NO_OLD_HP_ITERATOR_QUERIES
+*/
+
+
+/*
+ * On systems with support of large files (_LARGEFILE_SOURCE,
+ * _LARGEFILE64_SOURCE defined) we will use 64-bit file offset, even if
+ * __USE_FILE_OFFSET64 or _FILE_OFFSET_BITS not defined or _FILE_OFFSET_BITS
+ * less than 64. In the last case sizeof(std::streamoff) may not be equal to
+ * sizeof(off_t); if you want to force equal size of off_t and streamoff,
+ * uncomment macro below. But pay attention, this has influence on libstlport
+ * and in future usage it may cause conflict with defined _FILE_OFFSET_BITS macro.
+ */
+
+/*
+#define _STLP_USE_DEFAULT_FILE_OFFSET
+*/
+
+/*
+ * _STLP_USE_STDIO_IO, _STLP_USE_UNIX_IO: force selection of stdio calls
+ * (fopen/flose/fread/fwrite) under fstream buffers or unistd calls
+ * (open/close/read/write + mmap). On systems that have both (i.e. most Unixes)
+ * _STLP_USE_UNIX_IO is used.
+ *
+ * There is a third variant for Windows: _STLP_USE_WIN32_IO, that based
+ * on Windows calls (CreateFile/CloseHandle/ReadFile/WriteFile + CreateFileMapping,
+ * MapViewOfFile)
+ *
+ * Uncomment only one define here!
+ */
+/*
+#define _STLP_USE_UNIX_IO
+*/
+/*
+#define _STLP_USE_STDIO_IO
+*/
+/*
+#define _STLP_USE_WIN32_IO
+ */
+
+/*==========================================================================*/
+
+/* This section contains swithes which should be off by default,
+ * but so few compilers would have it undefined, so that we set them here,
+ * with the option to be turned off later in compiler-specific file
+ */
+
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+
+/*==========================================================================*/
+
+#if defined(__sun) && defined(__GNUC__)
+/* __SunOS_5_x is not defined in headers, and there is no way to derive it from headers only;
+ * nevertheless this macro defined automagically by SunPro compilers family;
+ *
+ * gcc know nothing about it, but defining it with -D on compiler command line
+ * is a bad idea from one side, and this info still useful when we want to use
+ * (or don't use) some Solaris version-specific features from other side.
+ * Of course, the best way is to define it in spec file, but this is beyond our scope.
+ *
+ * Uncomment ONE of the following, depends on what Solaris version you use.
+ */
+
+/*
+#define __SunOS_5_5_1
+ */
+/*
+#define __SunOS_5_6
+ */
+/*
+#define __SunOS_5_7
+ */
+/*
+#define __SunOS_5_8
+ */
+/*
+#define __SunOS_5_9
+ */
+/*
+#define __SunOS_5_10
+ */
+#endif
+
+#if defined(__sun)
+/* With following patches Solaris 8 and 9 will have *l and *f (long double and float)
+ * variants of math functions:
+ * SunOS 5.8 patch 111721-04 (May/08/2003)
+ * <http://sunsolve.sun.com/search/document.do?assetkey=1-21-111721-04-1>
+ * SunOS 5.9 patch 111722-04 (May/08/2003)
+ * <http://sunsolve.sun.com/search/document.do?assetkey=1-21-111722-04-1>
+ * Solaris 10 has this functions from box.
+ */
+/*
+#define _STLP_SOLARIS_MATH_PATCH
+ */
+#endif
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
diff --git a/build/stlport/stlport/stl/config/stl_confix.h b/build/stlport/stlport/stl/config/stl_confix.h
new file mode 100644
index 000000000..120e8f4d5
--- /dev/null
+++ b/build/stlport/stlport/stl/config/stl_confix.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ * Purpose of this file : to define STLport settings that depend on
+ * compiler flags or can be otherwise missed
+ *
+ */
+
+#ifndef _STLP_CONFIX_H
+#define _STLP_CONFIX_H
+
+/* If, by any chance, C compiler gets there, try to help it to pass smoothly */
+#if ! defined (__cplusplus) && ! defined (_STLP_HAS_NO_NAMESPACES)
+# define _STLP_HAS_NO_NAMESPACES
+#endif
+
+#if defined (__MINGW32__)
+# define _STLP_NO_DRAND48
+#endif
+
+/* Modena C++ library */
+#if defined (__MWERKS__) && __MWERKS__ <= 0x2303 || (defined (__KCC) && __KCC_VERSION < 3400)
+# include <mcompile.h>
+# define _STLP_USE_MSIPL 1
+# if defined (__KCC) || (defined(__MSL_CPP__) && \
+ ( (__MSL_CPP__ >= 0x5000 && defined( _MSL_NO_MESSAGE_FACET )) || \
+ (__MSL_CPP__ < 0x5000 && defined( MSIPL_NL_TYPES ))))
+# define _STLP_NO_NATIVE_MESSAGE_FACET 1
+# endif
+#endif
+
+/* common switches for EDG front-end */
+/* __EDG_SWITCHES do not seem to be an official EDG macro.
+ * We keep it for historical reason. */
+#if defined (__EDG_SWITCHES)
+# if !(defined(_TYPENAME) || defined (_TYPENAME_IS_KEYWORD))
+# undef _STLP_NEED_TYPENAME
+# define _STLP_NEED_TYPENAME 1
+# endif
+# ifndef _WCHAR_T_IS_KEYWORD
+# undef _STLP_NO_WCHAR_T
+# define _STLP_NO_WCHAR_T 1
+# endif
+# ifndef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
+# undef _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# endif
+# ifndef _MEMBER_TEMPLATES
+# undef _STLP_NO_MEMBER_TEMPLATES
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# undef _STLP_NO_MEMBER_TEMPLATE_CLASSES
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# endif
+# ifndef _MEMBER_TEMPLATE_KEYWORD
+# undef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# endif
+# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
+# undef _STLP_HAS_NO_EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+# undef __EDG_SWITCHES
+#endif /* EDG */
+
+/* __EDG_VERSION__ is an official EDG macro, compilers based
+ * on EDG have to define it. */
+#if defined (__EDG_VERSION__)
+# if (__EDG_VERSION__ >= 244) && !defined (_STLP_HAS_INCLUDE_NEXT) && !defined(__ANDROID__)
+# define _STLP_HAS_INCLUDE_NEXT
+# endif
+# if (__EDG_VERSION__ <= 240) && !defined (_STLP_DONT_RETURN_VOID)
+# define _STLP_DONT_RETURN_VOID
+# endif
+# if !defined (__EXCEPTIONS) && !defined (_STLP_HAS_NO_EXCEPTIONS)
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+# if !defined (__NO_LONG_LONG) && !defined (_STLP_LONG_LONG)
+# define _STLP_LONG_LONG long long
+# endif
+#endif
+
+#endif
diff --git a/build/stlport/stlport/stl/config/stl_mycomp.h b/build/stlport/stlport/stl/config/stl_mycomp.h
new file mode 100644
index 000000000..f92902fd2
--- /dev/null
+++ b/build/stlport/stlport/stl/config/stl_mycomp.h
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * A list of COMPILER-SPECIFIC portion of STLport settings.
+ * This file is provided to help in manual configuration
+ * of STLport. This file is being included by stlcomp.h
+ * when STLport is unable to identify your compiler.
+ * Please remove the error diagnostic below before adjusting
+ * macros.
+ *
+ */
+#ifndef _STLP_MYCOMP_H
+#define _STLP_MYCOMP_H
+
+#error "Your compiler version is not recognized by STLport. Please edit <stlport/stl/config/stl_mycomp.h>"
+
+//==========================================================
+
+// the values choosen here as defaults try to give
+// maximum functionality on the most conservative settings
+
+// Mostly correct guess, change it for Alpha (and other environments
+// that has 64-bit "long")
+// # define _STLP_UINT32_T unsigned long
+
+// Disables wchar_t functionality
+// # define _STLP_NO_WCHAR_T 1
+
+// Define if wchar_t is not an intrinsic type, and is actually a typedef to unsigned short.
+// # define _STLP_WCHAR_T_IS_USHORT 1
+
+// Uncomment if long long is available
+// # define _STLP_LONG_LONG long long
+
+// Uncomment if long double is not available
+// # define _STLP_NO_LONG_DOUBLE 1
+
+// Uncomment this if your compiler does not support "typename" keyword
+// # define _STLP_NEED_TYPENAME 1
+
+// Uncomment this if your compiler does not support "mutable" keyword
+// # define _STLP_NEED_MUTABLE 1
+
+// Uncomment this if your compiler does not support "explicit" keyword
+// # define _STLP_NEED_EXPLICIT 1
+
+// Uncomment if new-style-casts like const_cast<> are not available
+// # define _STLP_NO_NEW_STYLE_CASTS 1
+
+// Uncomment this if your compiler does not have "bool" type
+// # define _STLP_NO_BOOL 1
+
+// Uncomment this if your compiler does not have "bool" type, but has "bool" keyword reserved
+// # define _STLP_DONT_USE_BOOL_TYPEDEF 1
+
+// Uncomment this if your compiler does not have "bool" type, but defines "bool" in <yvals.h>
+// # define _STLP_YVALS_H 1
+
+// Uncomment this if your compiler has limited or no default template arguments for classes
+// # define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+
+// Uncomment this if your compiler support only complete (not dependent on other parameters)
+// types as default parameters for class templates
+// # define _STLP_DEFAULT_TYPE_PARAM 1
+
+// Uncomment this if your compiler do not support default parameters in template class methods
+// # define _STLP_DONT_SUP_DFLT_PARAM 1
+
+// Uncomment this if your compiler has problem with not-type
+// default template parameters
+// # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+
+// Define if compiler has
+// trouble with functions getting non-type-parameterized classes as parameters
+// # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+// Uncomment this if your compiler does not support namespaces
+// # define _STLP_HAS_NO_NAMESPACES 1
+
+// Uncomment if "using" keyword does not work with template types
+// # define _STLP_BROKEN_USING_DIRECTIVE 1
+
+// Uncomment this if your compiler does not support exceptions
+// # define _STLP_HAS_NO_EXCEPTIONS 1
+
+// Uncomment this when you are able to detect that the user do not
+// want to use the exceptions feature.
+// # define _STLP_DONT_USE_EXCEPTIONS 1
+
+// Uncomment this if your compiler does not support exception specifications
+// # define _STLP_NO_EXCEPTION_SPEC
+
+// Define this if your compiler requires return statement after throw()
+// # define _STLP_THROW_RETURN_BUG 1
+
+// Define this if your compiler do not support return of void
+// # define _STLP_DONT_RETURN_VOID 1
+
+// Header <new> that comes with the compiler
+// does not define bad_alloc exception
+// # define _STLP_NO_BAD_ALLOC 1
+
+// Define this if your compiler do not throw bad_alloc from the new operator
+// # define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+
+// Define this if your compiler has no rtti support or if it has been disabled
+// # define _STLP_NO_RTTI 1
+
+// Define this if there is no native type_info definition
+// # define _STLP_NO_TYPEINFO 1
+
+// Uncomment if member template methods are not available
+// # define _STLP_NO_MEMBER_TEMPLATES 1
+
+// Uncomment if member template classes are not available
+// # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+
+// Uncomment if your compiler do not support the std::allocator rebind technique
+// This is a special case of bad member template classes support, it is automatically
+// defined if _STLP_NO_MEMBER_TEMPLATE_CLASSES is defined.
+// # define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+
+// Uncomment if no "template" keyword should be used with member template classes
+// # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+
+// Compiler does not accept friend declaration qualified with namespace name.
+// # define _STLP_NO_QUALIFIED_FRIENDS 1
+
+// Uncomment if partial specialization is not available
+// # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+
+// Define if class being partially specialized require full name (template parameters)
+// of itself for method declarations
+// # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+
+// Compiler has problem with qualified specializations (cont int, volatile int...)
+// # define _STLP_QUALIFIED_SPECIALIZATION_BUG
+
+// Compiler has problems specializing members of partially
+// specialized class
+// # define _STLP_MEMBER_SPECIALIZATION_BUG
+
+// Uncomment if partial order of template functions is not available
+// # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+// Uncomment if specialization of methods is not allowed
+// # define _STLP_NO_METHOD_SPECIALIZATION 1
+
+// Uncomment if full specialization does not use partial spec. syntax : template <> struct ....
+// # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+// Uncomment if compiler does not support explicit template arguments for functions
+// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+// Uncomment this if your compiler can't inline while(), for()
+// # define _STLP_LOOP_INLINE_PROBLEMS 1
+
+// Define if the compiler fails to match a template function argument of base
+// # define _STLP_BASE_MATCH_BUG 1
+
+// Define if the compiler fails to match a template function argument of base
+// (non-template)
+//# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+
+// Define if the compiler rejects outline method definition
+// explicitly taking nested types/typedefs
+// # define _STLP_NESTED_TYPE_PARAM_BUG 1
+
+// Compiler requires typename keyword on outline method definition
+// explicitly taking nested types/typedefs
+// #define _STLP_TYPENAME_ON_RETURN_TYPE
+
+// Define if the baseclass typedefs not visible from outside
+// # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+// if your compiler have serious problems with typedefs, try this one
+// # define _STLP_BASE_TYPEDEF_BUG 1
+
+// Uncomment if getting errors compiling mem_fun* adaptors
+// # define _STLP_MEMBER_POINTER_PARAM_BUG 1
+
+// Uncomment if the compiler can't handle a constant-initializer in the
+// declaration of a static const data member of integer type.
+// (See section 9.4.2, paragraph 4, of the C++ standard.)
+// # define _STLP_STATIC_CONST_INIT_BUG
+
+// Uncomment to indicate that the compiler do not like static constant
+// definition.
+// Meaningfull only if _STLP_STATIC_CONST_INIT_BUG is not defined.
+// # define _STLP_NO_STATIC_CONST_DEFINITION
+
+// Define if default constructor for builtin integer type fails to initialize it to 0
+// In expression like new(&char) char():
+//# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+// In default function parameter like _M_method(_Tp __x = _Tp())
+//# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+// Defined if constructor
+// required to explicitly call member's default constructors for const objects
+// # define _STLP_CONST_CONSTRUCTOR_BUG 1
+
+// Defined if the compiler has trouble calling POD-types constructors/destructors
+// # define _STLP_TRIVIAL_CONSTRUCTOR_BUG 1
+// # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
+
+// Define if having problems specializing maps/sets with
+// key type being const
+// # define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
+
+// Uncomment this to disable -> operators on all iterators
+// # define _STLP_NO_ARROW_OPERATOR 1
+
+// Uncomment this to disble at() member functions for containers
+// # define _STLP_NO_AT_MEMBER_FUNCTION 1
+
+// Define this if compiler lacks <exception> header
+// # define _STLP_NO_EXCEPTION_HEADER 1
+
+// Uncomment this if your C library has lrand48() function
+// # define _STLP_RAND48 1
+
+// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
+// # define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// uncomment if new-style headers <new> is available
+// # define _STLP_HAS_NEW_NEW_HEADER 1
+
+// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
+// not std::
+// # define _STLP_VENDOR_GLOBAL_STD
+
+// uncomment this if <cstdio> and the like put stuff in ::namespace,
+// not std::
+// # define _STLP_VENDOR_GLOBAL_CSTD
+
+// uncomment this if your compiler consider as ambiguous a function imported within
+// the stlport namespace and called without scope (:: or std::)
+// # define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+
+// uncomment this if your compiler define all the C math functions C++ additional
+// overloads in ::namespace and not only in std::.
+// # define _STLP_HAS_GLOBAL_C_MATH_FUNCTIONS 1
+
+// Edit relative path below (or put full path) to get native
+// compiler headers included. Default is "../include".
+// C headers may reside in different directory, so separate macro is provided.
+// Hint : never install STLport in the directory that ends with "include"
+// # define _STLP_NATIVE_INCLUDE_PATH ../include
+// # define _STLP_NATIVE_C_INCLUDE_PATH ../include
+// # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+
+// This macro constructs header path from directory and name.
+// You may change it if your compiler does not understand "/".
+// # define _STLP_MAKE_HEADER(path, header) <path/header>
+
+// This macro constructs native include header path from include path and name.
+// You may have do define it if experimenting problems with preprocessor
+// # define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header)
+
+// Same for C headers
+// #define _STLP_NATIVE_C_HEADER(header)
+
+//==========================================================
+#endif
diff --git a/build/stlport/stlport/stl/config/user_config.h b/build/stlport/stlport/stl/config/user_config.h
new file mode 100644
index 000000000..4efd7272e
--- /dev/null
+++ b/build/stlport/stlport/stl/config/user_config.h
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold user-definable portion of STLport settings which may be overridden
+ * on per-project basis.
+ * Please note that if you use STLport iostreams (compiled library) then you have
+ * to use consistent settings when you compile STLport library and your project.
+ * Those settings are defined in host.h and have to be the same for a given
+ * STLport installation.
+ */
+
+
+/*==========================================================
+ * User-settable macros that control compilation:
+ * Features selection
+ *==========================================================*/
+
+/*
+ * Use this switch for embedded systems where no iostreams are available
+ * at all. STLport own iostreams will also get disabled automatically then.
+ * You can either use STLport iostreams, or no iostreams.
+ * If you want iostreams, you have to compile library in ../build/lib
+ * and supply resulting library at link time.
+ */
+/*
+#define _STLP_NO_IOSTREAMS 1
+*/
+
+/*
+ * Set _STLP_DEBUG to turn the "Debug Mode" on.
+ * That gets you checked iterators/ranges in the manner
+ * of "Safe STL". Very useful for debugging. Thread-safe.
+ * Please do not forget to link proper STLport library flavor
+ * (e.g libstlportstlg.so or libstlportstlg.a) when you set this flag
+ * in STLport iostreams mode, namespace customization guaranty that you
+ * link to the right library.
+ */
+/*
+#define _STLP_DEBUG 1
+*/
+/*
+ * You can also choose the debug level:
+ * STLport debug level: Default value
+ * Check only what the STLport implementation consider as invalid.
+ * It also change the iterator invalidation schema.
+ * Standard debug level: Check for all operations the standard consider as "undefined behavior"
+ * even if STlport implement it correctly. It also invalidates iterators
+ * more often.
+ */
+/*
+#define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
+#define _STLP_DEBUG_LEVEL _STLP_STANDARD_DBG_LEVEL
+*/
+/* When an inconsistency is detected by the 'safe STL' the program will abort.
+ * If you prefer an exception define the following macro. The thrown exception
+ * will be the Standard runtime_error exception.
+ */
+/*
+#define _STLP_DEBUG_MODE_THROWS
+ */
+
+/*
+ * _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream
+ * classes with custom types (which is most likely the case). Custom means types
+ * other than char, wchar_t, char_traits<> and allocator<> like
+ * basic_ostream<my_char_type, my_traits<my_char_type> > or
+ * basic_string<char, char_traits<char>, my_allocator >
+ * When this option is on, most non-inline template functions definitions for iostreams
+ * are not seen by the client which saves a lot of compile time for most compilers,
+ * also object and executable size for some.
+ * Default is off, just not to break compilation for those who do use those types.
+ * That also guarantees that you still use optimized standard i/o when you compile
+ * your program without optimization. Option does not affect STLport library build; you
+ * may use the same binary library with and without this option, on per-project basis.
+ */
+/*
+#define _STLP_NO_CUSTOM_IO
+*/
+
+/*
+ * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational
+ * operator templates (>, <=, >=, !=) in namespace std::rel_ops, even
+ * if the compiler supports namespaces.
+ * Note : if the compiler do not support namespaces, those operators are not be provided by default,
+ * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity.
+ */
+/*
+#define _STLP_NO_RELOPS_NAMESPACE 1
+*/
+
+/*
+ * If STLport use its own namespace, see _STLP_NO_OWN_NAMESPACE in host.h, it will try
+ * by default to rename std:: for the user to stlport::. If you do not want this feature,
+ * please define the following switch and then use stlport::
+ */
+/*
+#define _STLP_DONT_REDEFINE_STD 1
+*/
+
+/*
+ * _STLP_WHOLE_NATIVE_STD : only meaningful if STLport uses its own namespace.
+ * Normally, STLport only imports necessary components from native std:: namespace.
+ * You might want everything from std:: being available in std:: namespace when you
+ * include corresponding STLport header (like STLport <map> provides std::map as well, etc.),
+ * if you are going to use both stlport:: and std:: components in your code.
+ * Otherwise this option is not recommended as it increases the size of your object files
+ * and slows down compilation.
+ * Beware, if you do not use STLport iostream (_STLP_NO_IOSTREAMS above), ask STLport to
+ * not rename std:: in stlport:: and try to have access to whole native Standard stuff then
+ * STLport will only throw exceptions from the std namespace and not from stlport.
+ * For instance a problem in stlport::vector::at will throw a std::out_of_range exception
+ * and not a stlport::out_of_range.
+ * Notice that STLport exceptions inherits from std::exception.
+ */
+/*
+#define _STLP_WHOLE_NATIVE_STD
+*/
+
+/*
+ * Use this option to catch uninitialized members in your classes.
+ * When it is set, construct() and destroy() fill the class storage
+ * with _STLP_SHRED_BYTE (see below).
+ * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically.
+ */
+/*
+#define _STLP_DEBUG_UNINITIALIZED 1
+#define _STLP_DEBUG_ALLOC 1
+*/
+
+/*
+ * Uncomment and provide a definition for the byte with which raw memory
+ * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined.
+ * Choose a value which is likely to cause a noticeable problem if dereferenced
+ * or otherwise abused. A good value may already be defined for your platform.
+ */
+/*
+#define _STLP_SHRED_BYTE 0xA3
+*/
+
+/*
+ * This option is for gcc users only and only affects systems where native linker
+ * does not let gcc to implement automatic instantiation of static template data members/
+ * It is being put in this file as there is no way to check if we are using GNU ld automatically,
+ * so it becomes user's responsibility.
+ */
+/*
+#define _STLP_GCC_USES_GNU_LD
+*/
+
+/*==========================================================
+ * Compatibility section
+ *==========================================================*/
+
+/*
+ * Define this macro to disable anachronistic constructs (like the ones used in HP STL and
+ * not included in final standard, etc.
+ */
+/*
+#define _STLP_NO_ANACHRONISMS 1
+*/
+
+/*
+ * Define this macro to disable STLport extensions (for example, to make sure your code will
+ * compile with some other implementation )
+ */
+/*
+#define _STLP_NO_EXTENSIONS 1
+*/
+
+/*
+ * You should define this macro if compiling with MFC - STLport <stl/config/_windows.h>
+ * then include <afx.h> instead of <windows.h> to get synchronisation primitives
+ */
+/*
+#define _STLP_USE_MFC 1
+*/
+
+/*
+ * boris : this setting is here as we cannot detect precense of new Platform SDK automatically
+ * If you are using new PSDK with VC++ 6.0 or lower,
+ * please define this to get correct prototypes for InterlockedXXX functions
+ */
+/*
+#define _STLP_NEW_PLATFORM_SDK 1
+*/
+
+/*
+ * For the same reason as the one above we are not able to detect easily use
+ * of the compiler coming with the Platform SDK instead of the one coming with
+ * a Microsoft Visual Studio release. This change native C/C++ library location
+ * and implementation, please define this to get correct STLport configuration.
+ */
+/*
+#define _STLP_USING_PLATFORM_SDK_COMPILER 1
+*/
+
+/*
+ * Some compilers support the automatic linking feature.
+ * Uncomment the following if you prefer to specify the STLport library
+ * to link with yourself.
+ * For the moment, this feature is only supported and implemented within STLport
+ * by the Microsoft compilers.
+ */
+/*
+#define _STLP_DONT_USE_AUTO_LINK 1
+*/
+
+/*
+ * If you customize the STLport generated library names don't forget to give
+ * the motif you used during configuration here if you still want the auto link
+ * to work. (Do not remove double quotes in the macro value)
+ */
+/*
+#define _STLP_LIB_NAME_MOTIF "???"
+ */
+
+/*
+ * Uncomment to get feedback at compilation time about result of build environment
+ * introspection.
+ */
+/*
+#define _STLP_VERBOSE 1
+*/
+
+/*
+ * Use minimum set of default arguments on template classes that have more
+ * than one - for example map<>, set<>.
+ * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on.
+ * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile
+ * set<T> with those compilers, but you'll have to use __set__<T, less<T>>
+ *
+ * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>,
+ * queue<>, priority_queue<>, stack<>, istream_iterator<>
+ */
+/*
+#define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1
+*/
+
+/*
+ * The agregation of strings using the + operator is an expensive operation
+ * as it requires construction of temporary objects that need memory allocation
+ * and deallocation. The problem can be even more important if you are adding
+ * several strings together in a single expression. To avoid this problem STLport
+ * implement expression template. With this technique addition of 2 strings is not
+ * a string anymore but a temporary object having a reference to each of the
+ * original strings involved in the expression. This object carry information
+ * directly to the destination string to set its size correctly and only make
+ * a single call to the allocator. This technique also works for the addition of
+ * N elements where elements are basic_string, C string or a single character.
+ * The drawback can be longer compilation time and bigger executable size.
+ * Another problem is that some compilers (gcc) fail to use string proxy object
+ * if do with class derived from string (see unit tests for details).
+ * STLport rebuild: Yes
+ */
+/*
+#define _STLP_USE_TEMPLATE_EXPRESSION 1
+*/
+
+
+/*
+ * By default the STLport basic_string implementation use a little static buffer
+ * (of 16 chars when writing this doc) to avoid systematically memory allocation
+ * in case of little basic_string. The drawback of such a method is bigger
+ * basic_string size and some performance penalty for method like swap. If you
+ * prefer systematical dynamic allocation turn on this macro.
+ * STLport rebuild: Yes
+ */
+/*
+#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
+*/
+
+/*
+ * To reduce the famous code bloat trouble due to the use of templates STLport grant
+ * a specialization of some containers for pointer types. So all instanciations
+ * of those containers with a pointer type will use the same implementation based on
+ * a container of void*. This feature has shown very good result on object files size
+ * but after link phase and optimization you will only experiment benefit if you use
+ * many container with pointer types.
+ * There are however a number of limitation to use this option:
+ * - with compilers not supporting partial template specialization feature, you won't
+ * be able to access some nested container types like iterator as long as the
+ * definition of the type used to instanciate the container will be incomplete
+ * (see IncompleteClass definition in test/unit/vector_test.cpp).
+ * - you won't be able to use complex Standard allocator implementations which are
+ * allocators having pointer nested type not being a real C pointer.
+ */
+/*
+#define _STLP_USE_PTR_SPECIALIZATIONS 1
+*/
+
+/*
+ * To achieve many different optimizations within the template implementations STLport
+ * uses some type traits technique. With this macro you can ask STLport to use the famous
+ * boost type traits rather than the internal one. The advantages are more compiler
+ * integration and a better support. If you only define this macro once the STLport has been
+ * built you just have to add the boost install path within your include path. If you want
+ * to use this feature at STLport built time you will have to define the
+ * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path.
+ */
+
+/*
+#define _STLP_USE_BOOST_SUPPORT 1
+*/
+
+
+/*==========================================================*/
+
+/*
+ Local Variables:
+ mode: C++
+ End:
+*/
diff --git a/build/stlport/stlport/stl/debug/_debug.c b/build/stlport/stlport/stl/debug/_debug.c
new file mode 100644
index 000000000..99d5c6b24
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_debug.c
@@ -0,0 +1,628 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEBUG_C
+#define _STLP_DEBUG_C
+
+#if defined (_STLP_DEBUG)
+#if defined (_STLP_THREADS)
+# if !defined (_STLP_NEED_MUTABLE)
+# define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock();
+# define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock();
+# else
+# define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock();
+# define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock();
+# endif /* _STLP_NEED_MUTABLE */
+#else
+# define _STLP_ACQUIRE_LOCK(_Lock)
+# define _STLP_RELEASE_LOCK(_Lock)
+#endif /* _STLP_THREADS */
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//==========================================================
+// global non-inline functions
+//==========================================================
+// [ i1, i2)
+#if !defined (__DMC__)
+template <class _Iterator>
+inline bool _STLP_CALL
+stlp_in_range_aux(const _Iterator& __it, const _Iterator& __first,
+ const _Iterator& __last, const random_access_iterator_tag &) {
+ return ( __it >= __first &&
+ __it < __last);
+}
+#endif
+
+template <class _Iterator1, class _Iterator>
+#if defined (_STLP_MSVC)
+inline bool _STLP_CALL stlp_in_range_aux(_Iterator1 __it, const _Iterator& __first,
+#else
+inline bool _STLP_CALL stlp_in_range_aux(const _Iterator1& __it, const _Iterator& __first,
+#endif
+ const _Iterator& __last, const forward_iterator_tag &) {
+ _Iterator1 __i(__first);
+ for (; __i != __last && __i != __it; ++__i);
+ return (__i != __last);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _Iterator1, class _Iterator>
+inline bool _STLP_CALL
+stlp_in_range_aux(const _Iterator1& __it, const _Iterator& __first,
+ const _Iterator& __last, const bidirectional_iterator_tag &) {
+ _Iterator1 __i(__first);
+ for (; __i != __last && __i != __it; ++__i);
+ return (__i != __last);
+}
+#endif
+
+template <class _Iterator>
+bool _STLP_CALL __check_range_aux(const _Iterator& __first, const _Iterator& __last,
+ const __false_type& /*_IsIntegral*/) {
+ _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE )
+ return true;
+}
+
+template <class _Integral>
+bool _STLP_CALL __check_range_aux(_Integral /*__first*/, _Integral /*__last*/,
+ const __true_type& /*_IsIntegral*/)
+{ return true; }
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last) {
+ typedef typename _IsIntegral<_Iterator>::_Ret _Integral;
+ return __check_range_aux(__first, __last, _Integral());
+}
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __it,
+ const _Iterator& __start, const _Iterator& __finish) {
+ _STLP_VERBOSE_RETURN(stlp_in_range(__it, __start, __finish),
+ _StlMsg_NOT_IN_RANGE_1)
+ return true;
+}
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last,
+ const _Iterator& __start, const _Iterator& __finish) {
+ _STLP_VERBOSE_RETURN(stlp_in_range(__first, __last, __start, __finish),
+ _StlMsg_NOT_IN_RANGE_2)
+ return true;
+}
+
+template <class _Tp>
+bool _STLP_CALL __check_ptr_range(const _Tp* __first, const _Tp* __last) {
+ _STLP_VERBOSE_RETURN((__first != 0 || __last == 0), _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_RETURN(__valid_range(__first, __last, random_access_iterator_tag()),
+ _StlMsg_INVALID_RANGE)
+ return true;
+}
+
+//===============================================================
+template <class _Iterator>
+void _STLP_CALL __invalidate_range(const __owned_list* __base,
+ const _Iterator& __first,
+ const _Iterator& __last) {
+ typedef __owned_link _L_type;
+ _STLP_ACQUIRE_LOCK(__base->_M_lock)
+ _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
+ _L_type* __pos = __prev->_M_next;
+
+ while (__pos != 0) {
+ if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
+ stlp_in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
+ __first._M_iterator, __last._M_iterator,
+ _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
+ __pos->_M_owner = 0;
+ __prev->_M_next = __pos->_M_next;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ _STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
+ const _Iterator& __it) {
+ typedef __owned_link _L_type;
+ _STLP_ACQUIRE_LOCK(__base->_M_lock)
+ _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
+ _L_type* __pos = __prev->_M_next;
+ while (__pos != 0) {
+ // this requires safe iterators to be derived from __owned_link
+ if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
+ (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
+ __pos->_M_owner = 0;
+ __prev->_M_next = __pos->_M_next;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ _STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __change_range_owner(const _Iterator& __first,
+ const _Iterator& __last,
+ const __owned_list* __dst) {
+ if (__first._Owner() == __dst)
+ return;
+
+ typedef __owned_link _L_type;
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ //_STLP_ACQUIRE_LOCK(__base->_M_lock)
+ __owned_list *__base = __CONST_CAST(__owned_list*, __first._Owner());
+ _L_type* __src_prev = &__base->_M_node;
+ _L_type* __pos = __src_prev->_M_next;
+ _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
+
+ while (__pos != 0) {
+ if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
+ stlp_in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
+ __first._M_iterator, __last._M_iterator,
+ _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+ //remove __pos from __base:
+ __src_prev->_M_next = __pos->_M_next;
+ //add __pos to __dst:
+ __pos->_M_next = __dst_prev->_M_next;
+ __dst_prev->_M_next = __pos;
+ }
+ else {
+ __src_prev = __pos;
+ }
+ __pos = __src_prev->_M_next;
+ }
+
+#if defined(_STLP_WCE) && defined(_ARM_)
+ // Note: This part is needed for compiling under Windows CE under ARM and correctly using
+ // _STLP_DEBUG mode. This comes from a bug in the ARM compiler where checked iterators that
+ // are passed by value are not copied over correctly. When __change_range_owner is called,
+ // e.g. in std::list::splice() the wrong _M_owner field gets modified and the __first
+ // iterator has the old _M_owner field, but was moved to the new __owned_list. Setting
+ // the first iterator's _M_owner field fixes this. Ugly but works.
+ __pos = __CONST_CAST(_Iterator*, &__first);
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+#endif
+ //_STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __change_ite_owner(const _Iterator& __it,
+ const __owned_list* __dst) {
+ if (__it._Owner() == __dst)
+ return;
+
+ typedef __owned_link _L_type;
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ //_STLP_ACQUIRE_LOCK(__base->_M_lock)
+ __owned_list *__base = __CONST_CAST(__owned_list*, __it._Owner());
+ _L_type* __prev = &__base->_M_node;
+ _L_type* __pos = __prev->_M_next;
+ _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
+
+ while (__pos != 0) {
+ // this requires safe iterators to be derived from __owned_link
+ if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
+ (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+ //remove __pos from __base:
+ __prev->_M_next = __pos->_M_next;
+ //add __pos to __dst:
+ __pos->_M_next = __dst_prev->_M_next;
+ __dst_prev->_M_next = __pos;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ //_STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DEBUG */
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+
+//==========================================================
+// .c section
+// owned_list non-inline methods and global functions
+//==========================================================
+
+# if defined (_STLP_ASSERTIONS)
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+# if !defined (_STLP_STRING_LITERAL)
+# define _STLP_STRING_LITERAL(__x) __x
+# endif
+
+# if defined (_STLP_USE_WIDE_INTERFACE)
+// note: WinCE needs this to format single-byte strings in __stl_debug_engine::_Message
+# define _STLP_PERCENT_S "%hs"
+# else
+# define _STLP_PERCENT_S "%s"
+# endif /* _STLP_USE_WIDE_INTERFACE */
+
+# define _STLP_MESSAGE_TABLE_BODY = { \
+_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: " _STLP_PERCENT_S "\n"), \
+_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \
+_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure: " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \
+_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"), \
+_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"), \
+_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\
+_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"), \
+_STLP_STRING_LITERAL("Index out of bounds"), \
+_STLP_STRING_LITERAL("Container doesn't own the iterator"), \
+_STLP_STRING_LITERAL("Container is owner of the iterator, but should not"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"), \
+_STLP_STRING_LITERAL("Iterators used in expression are from different owners"), \
+_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"), \
+_STLP_STRING_LITERAL("Range [first,last) is invalid"), \
+_STLP_STRING_LITERAL("Iterator is not in range [first,last)"), \
+_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"), \
+_STLP_STRING_LITERAL("The advance would produce invalid iterator"), \
+_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"), \
+_STLP_STRING_LITERAL("Invalid strict weak ordering predicate, if pred(a, b) then we should have !pred(b, a)"), \
+_STLP_STRING_LITERAL("Invalid equivalent predicate, if pred(a, b) then we should have pred(b, a)"), \
+_STLP_STRING_LITERAL("Memory block deallocated twice"), \
+_STLP_STRING_LITERAL("Deallocating a block that was never allocated"), \
+_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"), \
+_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"), \
+_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"), \
+_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"), \
+_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"), \
+_STLP_STRING_LITERAL("Memory allocation function returned a wrongly align memory block"), \
+_STLP_STRING_LITERAL("Unknown problem") \
+ }
+
+template <class _Dummy>
+const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX] _STLP_MESSAGE_TABLE_BODY;
+
+# undef _STLP_STRING_LITERAL
+# undef _STLP_PERCENT_S
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_DEBUG_MESSAGE)
+# ifndef _STLP_INTERNAL_CSTDARG
+# include <stl/_cstdarg.h>
+# endif
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H)
+# include <stl/_range_errors.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) {
+ STLPORT_CSTD::va_list __args;
+ va_start( __args, __format_str );
+
+# if !defined (_STLP_DEBUG_MODE_THROWS)
+# if defined (_STLP_USE_WIDE_INTERFACE)
+ TCHAR __buffer[512];
+ int _convert = strlen(__format_str) + 1;
+ LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t));
+ _lpw[0] = '\0';
+ MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert);
+ wvsprintf(__buffer, _lpw, __args);
+ _STLP_WINCE_TRACE(__buffer);
+# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
+ char __buffer [4096];
+
+# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
+# else
+ vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
+# endif
+
+ OutputDebugStringA(__buffer);
+
+# elif defined (__amigaos__)
+ STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args);
+# else
+ STLPORT_CSTD::vfprintf(stderr, __format_str, __args);
+# endif
+# else
+ char __buffer[4096];
+
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
+# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
+ vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
+# else
+ vsprintf(__buffer, __format_str, __args);
+# endif
+# endif
+
+# ifdef _STLP_DEBUG_MESSAGE_POST
+ _STLP_DEBUG_MESSAGE_POST
+# endif
+
+ va_end(__args);
+
+# if defined (_STLP_DEBUG_MODE_THROWS)
+ __stl_throw_runtime_error(__buffer);
+# endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# else
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...)
+{}
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+# endif /* _STLP_DEBUG_MESSAGE */
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN],
+ __f, __l, _Message_table[__error_ind]);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE],
+ __f, __l, _Message_table[__error_ind], __f, __l, __expr);
+ __stl_debug_terminate();
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr);
+ __stl_debug_terminate();
+}
+
+// if exceptions are present, sends unique exception
+// if not, calls abort() to terminate
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Terminate()
+{ _STLP_ABORT(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_ASSERTIONS */
+
+# if defined (_STLP_DEBUG)
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//==========================================================
+// owned_list non-inline methods
+//==========================================================
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) {
+ _STLP_ACQUIRE_LOCK(__l->_M_lock);
+ _Stamp_all(__l, 0);
+ __l->_M_node._M_next =0;
+ _STLP_RELEASE_LOCK(__l->_M_lock);
+}
+
+// boris : this is unasafe routine; should be used from within critical section only !
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) {
+ // crucial
+ if (__l->_M_node._M_owner) {
+ for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
+ __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
+ _STLP_ASSERT(__pos->_Owner()== __l)
+ __pos->_M_owner=__o;
+ }
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) {
+ _STLP_ACQUIRE_LOCK(__l->_M_lock);
+ if (__l) {
+ _STLP_ASSERT(__l->_M_node._Owner() != 0)
+ for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
+ __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
+ _STLP_ASSERT(__pos->_Owner()== __l)
+ }
+ }
+ _STLP_RELEASE_LOCK(__l->_M_lock);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) {
+ /*
+ * according to the standard : --no swap() function invalidates any references,
+ * pointers, or iterators referring to the elements of the containers being swapped.
+ */
+
+ __owned_link* __tmp;
+
+ /*
+ * boris : there is a deadlock potential situation here if we lock two containers sequentially.
+ * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access
+ * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version
+ */
+
+ __tmp = __x._M_node._M_next;
+
+ _Stamp_all(&__x, &__y);
+ _Stamp_all(&__y, &__x);
+
+ __x._M_node._M_next = __y._M_node._M_next;
+ __y._M_node._M_next = __tmp;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) {
+ if (&__src == &__dst)
+ return;
+
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ typedef __owned_link _L_type;
+ _L_type* __prev = &__src._M_node;
+ _L_type* __pos = __prev->_M_next;
+
+ while (__pos != 0) {
+ __pos->_M_owner = &__dst;
+ __prev = __pos;
+ __pos = __prev->_M_next;
+ }
+ __prev->_M_next = __dst._M_node._M_next;
+ __dst._M_node._M_next = __src._M_node._M_next;
+ __src._M_node._M_next = 0;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) {
+ if (__l != 0) {
+
+ _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
+
+ _STLP_ACQUIRE_LOCK(__l->_M_lock)
+ // boris : re-test the condition in case someone else already deleted us
+ if(__c_node->_M_owner != 0) {
+ __owned_link* __prev, *__next;
+
+ for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node;
+ __prev = __next) {
+ _STLP_ASSERT(__next && __next->_Owner() == __l)
+ }
+
+ __prev->_M_next = __c_node->_M_next;
+ __c_node->_M_owner=0;
+ }
+ _STLP_RELEASE_LOCK(__l->_M_lock)
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) {
+ if (__l ==0) {
+ (__c_node)->_M_owner = 0;
+ } else {
+ _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
+ _STLP_ACQUIRE_LOCK(__l->_M_lock)
+ __c_node->_M_owner = __l;
+ __c_node->_M_next = __l->_M_node._M_next;
+ __l->_M_node._M_next = __c_node;
+ _STLP_RELEASE_LOCK(__l->_M_lock)
+ }
+}
+
+template <class _Dummy>
+void* _STLP_CALL
+__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) {
+ const __owned_list* __owner = __l->_Owner();
+ _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR)
+ void* __ret = __CONST_CAST(void*,__owner->_Owner());
+ _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER)
+ return __ret;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1,
+ const __owned_link& __i2) {
+ _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR)
+ _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR)
+ _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1,
+ const __owned_link& __i2) {
+ _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) {
+ const __owned_list* __owner_ptr = __it._Owner();
+ _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
+ _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) {
+ const __owned_list* __owner_ptr = __it._Owner();
+ _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
+ _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER)
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_DEBUG */
+
+#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */
+
+#endif /* header guard */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_debug.h b/build/stlport/stlport/stl/debug/_debug.h
new file mode 100644
index 000000000..6a2a8ce9e
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_debug.h
@@ -0,0 +1,473 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEBUG_H
+#define _STLP_DEBUG_H
+
+#if (defined (_STLP_DEBUG) || defined (_STLP_DEBUG_ALLOC)) && \
+ !defined (_STLP_ASSERTIONS)
+# define _STLP_ASSERTIONS 1
+#endif
+
+#if defined (_STLP_ASSERTIONS)
+
+# if !defined (_STLP_FILE__)
+# define _STLP_FILE__ __FILE__
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+enum {
+ //General errors
+ _StlFormat_ERROR_RETURN,
+ _StlFormat_ASSERTION_FAILURE,
+ _StlFormat_VERBOSE_ASSERTION_FAILURE,
+ _StlMsg_INVALID_ARGUMENT,
+ //Container/Iterator related errors
+ _StlMsg_INVALID_CONTAINER,
+ _StlMsg_EMPTY_CONTAINER,
+ _StlMsg_ERASE_PAST_THE_END,
+ _StlMsg_OUT_OF_BOUNDS,
+ _StlMsg_NOT_OWNER,
+ _StlMsg_SHOULD_NOT_OWNER,
+ _StlMsg_INVALID_ITERATOR,
+ _StlMsg_INVALID_LEFTHAND_ITERATOR,
+ _StlMsg_INVALID_RIGHTHAND_ITERATOR,
+ _StlMsg_DIFFERENT_OWNERS ,
+ _StlMsg_NOT_DEREFERENCEABLE ,
+ _StlMsg_INVALID_RANGE ,
+ _StlMsg_NOT_IN_RANGE_1 ,
+ _StlMsg_NOT_IN_RANGE_2 ,
+ _StlMsg_INVALID_ADVANCE ,
+ _StlMsg_SINGULAR_ITERATOR ,
+ //Bad predicate for sorting
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE,
+ _StlMsg_INVALID_EQUIVALENT_PREDICATE,
+ // debug alloc messages
+ _StlMsg_DBA_DELETED_TWICE ,
+ _StlMsg_DBA_NEVER_ALLOCATED ,
+ _StlMsg_DBA_TYPE_MISMATCH ,
+ _StlMsg_DBA_SIZE_MISMATCH ,
+ _StlMsg_DBA_UNDERRUN ,
+ _StlMsg_DBA_OVERRUN ,
+ // auto_ptr messages
+ _StlMsg_AUTO_PTR_NULL ,
+ //Memory alignent message
+ _StlMsg_WRONG_MEMORY_ALIGNMENT,
+ _StlMsg_UNKNOWN
+ /* _StlMsg_MAX */
+};
+
+/* have to hardcode that ;() */
+# define _StlMsg_MAX 31
+
+class __owned_link;
+class __owned_list;
+
+# if defined (_STLP_DEBUG_MODE_THROWS)
+# define _STLP_MESSAGE_NORETURN _STLP_FUNCTION_THROWS
+# else
+# define _STLP_MESSAGE_NORETURN
+# endif
+
+template <class _Dummy>
+class __stl_debug_engine {
+public:
+ // Basic routine to report any debug message
+ // Use _STLP_DEBUG_MESSAGE to override
+ static void _STLP_MESSAGE_NORETURN _STLP_CALL _Message(const char * format_str, ...);
+
+ // Micsellanous function to report indexed error message
+ static void _STLP_CALL _IndexedError(int __ind, const char* __f, int __l);
+
+ // Basic assertion report mechanism.
+ // Reports failed assertion via __stl_debug_message and calls _Terminate
+ // if _STLP_DEBUG_TERMINATE is specified, calls __stl_debug_terminate instead
+ static void _STLP_CALL _Assert(const char* __expr, const char* __f, int __l);
+
+ // The same, with additional diagnostics
+ static void _STLP_CALL _VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l);
+
+ // If exceptions are present, sends unique exception
+ // If not, calls _STLP_ABORT() to terminate
+ // Use _STLP_DEBUG_TERMINATE to override
+ static void _STLP_CALL _Terminate();
+
+# if defined (_STLP_DEBUG)
+ // owned_list/link delegate non-inline functions here
+
+ static bool _STLP_CALL _Check_same_owner( const __owned_link& __i1,
+ const __owned_link& __i2);
+ static bool _STLP_CALL _Check_same_or_null_owner( const __owned_link& __i1,
+ const __owned_link& __i2);
+ static bool _STLP_CALL _Check_if_owner( const __owned_list*, const __owned_link&);
+
+ static bool _STLP_CALL _Check_if_not_owner( const __owned_list*, const __owned_link&);
+
+ static void _STLP_CALL _Verify(const __owned_list*);
+
+ static void _STLP_CALL _Swap_owners(__owned_list&, __owned_list&);
+
+ static void _STLP_CALL _Invalidate_all(__owned_list*);
+
+ static void _STLP_CALL _Set_owner(__owned_list& /*src*/, __owned_list& /*dst*/);
+
+ static void _STLP_CALL _Stamp_all(__owned_list*, __owned_list*);
+
+ static void _STLP_CALL _M_detach(__owned_list*, __owned_link*);
+
+ static void _STLP_CALL _M_attach(__owned_list*, __owned_link*);
+
+ // accessor : check and get pointer to the container
+ static void* _STLP_CALL _Get_container_ptr(const __owned_link*);
+# endif
+
+ // debug messages and formats
+ static const char* _Message_table[_StlMsg_MAX];
+};
+
+# undef _STLP_MESSAGE_NORETURN
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __stl_debug_engine<bool>;
+# endif
+
+typedef __stl_debug_engine<bool> __stl_debugger;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_ASSERT)
+# define _STLP_ASSERT(expr) \
+ if (!(expr)) { _STLP_PRIV __stl_debugger::_Assert( # expr, _STLP_FILE__, __LINE__); }
+# endif
+
+#else
+# define _STLP_ASSERT(expr)
+#endif
+
+// this section is for _STLP_DEBUG only
+#if defined (_STLP_DEBUG)
+
+# if !defined (_STLP_VERBOSE_ASSERT)
+// fbp : new form not requiring ";"
+# define _STLP_VERBOSE_ASSERT(expr, __diag_num) \
+ if (!(expr)) { _STLP_PRIV __stl_debugger::_VerboseAssert\
+ ( # expr, _STLP_PRIV __diag_num, _STLP_FILE__, __LINE__ ); \
+ }
+# endif
+
+# define _STLP_DEBUG_CHECK(expr) _STLP_ASSERT(expr)
+
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+# define _STLP_STD_DEBUG_CHECK(expr) _STLP_DEBUG_CHECK(expr)
+# else
+# define _STLP_STD_DEBUG_CHECK(expr)
+# endif
+
+# if !defined (_STLP_VERBOSE_RETURN)
+# define _STLP_VERBOSE_RETURN(__expr,__diag_num) if (!(__expr)) { \
+ _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__ , __LINE__); \
+ return false; }
+# endif
+
+# if !defined (_STLP_VERBOSE_RETURN_0)
+# define _STLP_VERBOSE_RETURN_0(__expr,__diag_num) if (!(__expr)) { \
+ _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__, __LINE__); \
+ return 0; }
+# endif
+
+# ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+# endif
+
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * Special debug iterator traits having an additionnal static member
+ * method _Check. It is used by the slist debug implementation to check
+ * the special before_begin iterator.
+ */
+template <class _Traits>
+struct _DbgTraits : _Traits {
+ typedef _DbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
+ typedef _DbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
+
+ template <class _Iterator>
+ static bool _Check(const _Iterator&) {return true;}
+};
+
+//=============================================================
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const random_access_iterator_tag&)
+{ return (__i1 < __i2) || (__i1 == __i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const bidirectional_iterator_tag&) {
+ // check if comparable
+ bool __dummy(__i1==__i2);
+ return (__dummy==__dummy);
+}
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const forward_iterator_tag&) {
+ // check if comparable
+ bool __dummy(__i1==__i2);
+ return (__dummy==__dummy);
+}
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
+ const input_iterator_tag&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
+ const output_iterator_tag&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1, const _Iterator& __i2)
+{ return __valid_range(__i1,__i2,_STLP_ITERATOR_CATEGORY(__i1, _Iterator)); }
+
+// Note : that means in range [i1, i2].
+template <class _Iterator>
+inline bool _STLP_CALL stlp_in_range(const _Iterator& _It,
+ const _Iterator& __i1, const _Iterator& __i2)
+{ return __valid_range(__i1,_It) && __valid_range(_It,__i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL stlp_in_range(const _Iterator& __first, const _Iterator& __last,
+ const _Iterator& __start, const _Iterator& __finish)
+{ return __valid_range(__first,__last) && __valid_range(__start,__first) && __valid_range(__last,__finish); }
+
+//==========================================================
+class _STLP_CLASS_DECLSPEC __owned_link {
+public:
+ // Note: This and the following special defines for compiling under Windows CE under ARM
+ // is needed for correctly using _STLP_DEBUG mode. This comes from a bug in the ARM
+ // compiler where checked iterators that are passed by value call _M_attach with the wrong
+ // this pointer and calling _M_detach can't find the correct pointer to the __owned_link.
+ // This is circumvented by managing a _M_self pointer that points to the correct value.
+ // Ugly but works.
+#if defined(_STLP_WCE) && defined(_ARM_)
+ __owned_link() : _M_self(this), _M_owner(0) {}
+ __owned_link(const __owned_list* __c) : _M_self(this), _M_owner(0), _M_next(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); }
+ __owned_link(const __owned_link& __rhs): _M_self(this), _M_owner(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); }
+#else
+ __owned_link() : _M_owner(0) {}
+ __owned_link(const __owned_list* __c) : _M_owner(0), _M_next(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); }
+ __owned_link(const __owned_link& __rhs): _M_owner(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); }
+#endif
+ __owned_link& operator=(const __owned_link& __rhs) {
+ __owned_list* __new_owner = __CONST_CAST(__owned_list*,__rhs._M_owner);
+ __owned_list* __old_owner = _M_owner;
+ if ( __old_owner != __new_owner ) {
+ __stl_debugger::_M_detach(__old_owner, this);
+ __stl_debugger::_M_attach(__new_owner, this);
+ }
+ return *this;
+ }
+#if defined(_STLP_WCE) && defined(_ARM_)
+ ~__owned_link() {
+ __stl_debugger::_M_detach(_M_owner, _M_self);
+ _Invalidate();
+ }
+#else
+ ~__owned_link() {
+ __stl_debugger::_M_detach(_M_owner, this);
+ _Invalidate();
+ }
+#endif
+
+ const __owned_list* _Owner() const { return _M_owner; }
+ __owned_list* _Owner() { return _M_owner; }
+ void _Set_owner(const __owned_list* __o) { _M_owner= __CONST_CAST(__owned_list*,__o); }
+ bool _Valid() const { return _M_owner != 0; }
+ void _Invalidate() { _M_owner = 0; _M_next = 0; }
+ void _Link_to_self() { _M_next = 0; }
+
+ __owned_link* _Next() { return _M_next; }
+ const __owned_link* _Next() const { return _M_next; }
+
+public:
+#if defined(_STLP_WCE) && defined(_ARM_)
+ __owned_link* _M_self;
+#endif
+
+ __owned_list* _M_owner;
+ __owned_link* _M_next;
+};
+
+
+class _STLP_CLASS_DECLSPEC __owned_list {
+public:
+ __owned_list(void* __o) {
+ // fprintf(stderr, "__owned_list(): %p\n",(void*)this);
+ _M_node._M_owner = __REINTERPRET_CAST(__owned_list*,__o);
+ _M_node._M_next = 0;
+ }
+ ~__owned_list() {
+ // fprintf(stderr, "~__owned_list(): %p\n",(void*)this);
+ _Invalidate_all();
+ // that prevents detach
+ _M_node._Invalidate();
+ }
+ const void* _Owner() const { return (const void*)_M_node._M_owner; }
+ void* _Owner() { return (void*)_M_node._M_owner; }
+ bool _Valid() const { return _M_node._M_owner != 0; }
+ void _Invalidate() { _M_node._M_owner = 0; }
+
+ __owned_link* _First() { return _M_node._Next(); }
+ __owned_link* _Last() { return 0 ; }
+
+ const __owned_link* _First() const { return (__owned_link*)_M_node._M_next; }
+ const __owned_link* _Last() const { return 0 ;}
+
+ void _Verify() const { __stl_debugger::_Verify(this); }
+ void _Swap_owners(__owned_list& __y) { __stl_debugger::_Swap_owners(*this, __y); }
+ void _Invalidate_all() { __stl_debugger::_Invalidate_all(this); }
+ void _Set_owner(__owned_list& __y) { __stl_debugger::_Set_owner(*this, __y); }
+
+ mutable __owned_link _M_node;
+ mutable _STLP_mutex _M_lock;
+
+private:
+ // should never be called, should be left not implemented,
+ // but some compilers complain about it ;(
+ __owned_list(const __owned_list&){}
+ __owned_list& operator = (const __owned_list&) { return *this; }
+
+ friend class __owned_link;
+ friend class __stl_debug_engine<bool>;
+};
+
+
+//==========================================================
+
+// forward declaratioins
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&, const _Iterator&);
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&,
+ const _Iterator&, const _Iterator&);
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&, const _Iterator& ,
+ const _Iterator&, const _Iterator& );
+template <class _Tp>
+bool _STLP_CALL __check_ptr_range(const _Tp*, const _Tp*);
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_range(const __owned_list* __base,
+ const _Iterator& __first,
+ const _Iterator& __last);
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
+ const _Iterator& __it);
+
+template <class _Iterator>
+void _STLP_CALL __change_range_owner(const _Iterator& __first,
+ const _Iterator& __last,
+ const __owned_list* __dst);
+
+template <class _Iterator>
+void _STLP_CALL __change_ite_owner(const _Iterator& __it,
+ const __owned_list* __dst);
+
+//============================================================
+inline bool _STLP_CALL
+__check_same_owner(const __owned_link& __i1, const __owned_link& __i2)
+{ return __stl_debugger::_Check_same_owner(__i1,__i2); }
+
+inline bool _STLP_CALL
+__check_same_or_null_owner(const __owned_link& __i1, const __owned_link& __i2)
+{ return __stl_debugger::_Check_same_or_null_owner(__i1,__i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_owner( const __owned_list* __owner,
+ const _Iterator& __it)
+{ return __stl_debugger::_Check_if_owner(__owner, (const __owned_link&)__it); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_not_owner( const __owned_list* __owner,
+ const _Iterator& __it)
+{ return __stl_debugger::_Check_if_not_owner(__owner, (const __owned_link&)__it); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#else
+# define _STLP_VERBOSE_ASSERT(expr, diagnostic)
+# define _STLP_DEBUG_CHECK(expr)
+#endif /* _STLP_DEBUG */
+
+#if defined (_STLP_ASSERTIONS)
+
+# if !defined (_STLP_ASSERT_MSG_TRAILER)
+# define _STLP_ASSERT_MSG_TRAILER
+# endif
+
+// dwa 12/30/98 - if _STLP_DEBUG_MESSAGE is defined, the user can supply own definition.
+# if !defined (_STLP_DEBUG_MESSAGE)
+# define __stl_debug_message __stl_debugger::_Message
+# else
+extern void __stl_debug_message(const char * format_str, ...);
+# endif
+
+// fbp: if _STLP_DEBUG_TERMINATE is defined, the user can supply own definition.
+# if !defined (_STLP_DEBUG_TERMINATE)
+# define __stl_debug_terminate __stl_debugger::_Terminate
+# else
+extern void __stl_debug_terminate();
+# endif
+
+#endif
+
+#if defined (_STLP_ASSERTIONS) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/debug/_debug.c>
+#endif
+
+#endif /* DEBUG_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_deque.h b/build/stlport/stlport/stl/debug/_deque.h
new file mode 100644
index 000000000..f5c5ff5d7
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_deque.h
@@ -0,0 +1,414 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_DEQUE_H
+#define _STLP_INTERNAL_DBG_DEQUE_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_DEQUE _STLP_PRIV _STLP_NON_DBG_NAME(deque) <_Tp,_Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp* value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline random_access_iterator_tag iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef deque<_Tp,_Alloc> _Self;
+ typedef _STLP_NON_DBG_DEQUE _Base;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > _ConstructCheck;
+
+public:
+ // Basic types
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ // Iterators
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+public:
+ // Basic accessors
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ // Constructor, destructor.
+ explicit deque(const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+ deque(const _Self& __x) :
+ _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n, const value_type& __x = _Tp(),
+#else
+ deque(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n) :
+ _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+# endif
+#else
+ deque(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_all();
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+#endif
+
+public: // push_* and pop_*
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _Tp()) {
+#else
+ void push_back(const value_type& __t) {
+#endif
+ _Invalidate_all();
+ _M_non_dbg_impl.push_back(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() {
+ _Invalidate_all();
+ _M_non_dbg_impl.push_back();
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _Tp()) {
+#else
+ void push_front(const value_type& __t) {
+#endif
+ _Invalidate_all();
+ _M_non_dbg_impl.push_front(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front() {
+ _Invalidate_all();
+ _M_non_dbg_impl.push_front();
+ }
+#endif
+
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(begin());
+ _M_non_dbg_impl.pop_front();
+ }
+
+public: // Insert
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_all();
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_all();
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator));
+ }
+#endif
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ if (__n != 0) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ // We perform invalidate first to detect self referencing in __check_range as __first and __last
+ // will have been invalidated.
+ if (__first != __last) _Invalidate_all();
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ if (__first != __last) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ if (__first != __last) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+
+ void insert(iterator __pos,
+ iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ if (__first != __last) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif
+ if (__new_size != size()) {
+ if ((__new_size > size()) || (__new_size < size() - 1))
+ _Invalidate_all();
+ else
+ _Invalidate_iterator(end());
+ }
+ _M_non_dbg_impl.resize(__new_size, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+ // Erase
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ if (__pos._M_iterator == _M_non_dbg_impl.begin()) {
+ _Invalidate_iterator(__pos);
+ } else {
+ typename _Base::iterator tmp = --(_M_non_dbg_impl.end());
+ if (__pos._M_iterator == tmp)
+ _Invalidate_iterator(__pos);
+ else
+ _Invalidate_all();
+ }
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ if (!empty()) {
+ if (__first._M_iterator == _M_non_dbg_impl.begin() ||
+ __last._M_iterator == _M_non_dbg_impl.end())
+ _Invalidate_iterators(__first, __last);
+ else
+ _Invalidate_all();
+ }
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_DEQUE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_hashtable.h b/build/stlport/stlport/stl/debug/_hashtable.h
new file mode 100644
index 000000000..523f7e325
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_hashtable.h
@@ -0,0 +1,340 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_HASHTABLE_H
+#define _STLP_INTERNAL_DBG_HASHTABLE_H
+
+// Hashtable class, used to implement the hashed associative containers
+// hash_set, hash_map, hash_multiset, and hash_multimap,
+// unordered_set, unordered_map, unordered_multiset, unordered_multimap
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Key, class _Equal>
+class _DbgEqual {
+public:
+ _DbgEqual() {}
+ _DbgEqual(const _Equal& __eq) : _M_non_dbg_eq(__eq) {}
+ _DbgEqual(const _DbgEqual& __eq) : _M_non_dbg_eq(__eq._M_non_dbg_eq) {}
+
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ bool operator () (const _Key& __lhs, const _Key& __rhs) const
+#else
+ template <class _Kp1, class _Kp2>
+ bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const
+#endif
+ {
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ _STLP_VERBOSE_ASSERT(_M_non_dbg_eq(__rhs, __lhs) == _M_non_dbg_eq(__lhs, __rhs), _StlMsg_INVALID_EQUIVALENT_PREDICATE)
+#endif
+ return _M_non_dbg_eq(__lhs, __rhs) ? true : false;
+ }
+
+ _Equal non_dbg_key_eq() const { return _M_non_dbg_eq; }
+private:
+ _Equal _M_non_dbg_eq;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#define _STLP_NON_DBG_HT \
+_STLP_PRIV _STLP_NON_DBG_NAME(hashtable) <_Val, _Key, _HF, _Traits, _ExK, _STLP_PRIV _DbgEqual<_Key, _EqK>, _All>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Val, class _Key, class _HF,
+ class _ExK, class _EqK, class _All>
+inline _Val*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
+{ return (_Val*)0; }
+
+template <class _Val, class _Key, class _HF,
+ class _ExK, class _EqK, class _All>
+inline forward_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
+{ return forward_iterator_tag(); }
+#endif
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable {
+ typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
+ typedef _STLP_NON_DBG_HT _Base;
+
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
+ typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
+
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ typedef _Key key_type;
+ typedef _HF hasher;
+ typedef _EqK key_equal;
+
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstTraits> > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstTraits> > const_iterator;
+ //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_NonConstLocalTraits> > local_iterator;
+ typedef iterator local_iterator;
+ //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_ConstLocalTraits> > const_local_iterator;
+ typedef const_iterator const_local_iterator;
+
+ typedef typename _Base::iterator _Base_iterator;
+ typedef typename _Base::const_iterator _Base_const_iterator;
+
+ hasher hash_funct() const { return _M_non_dbg_impl.hash_funct(); }
+ key_equal key_eq() const { return _M_non_dbg_impl.key_eq().non_dbg_key_eq(); }
+
+private:
+ void _Invalidate_iterator(const const_iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const _ExK& __ext,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __hf, __eql, __ext, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __hf, __eql, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(const _Self& __ht)
+ : _M_non_dbg_impl(__ht._M_non_dbg_impl),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hashtable(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ _Self& operator=(const _Self& __ht) {
+ if (this != &__ht) {
+ //Should not invalidate end iterator
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __ht._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ void swap(_Self& __ht) {
+ _M_iter_list._Swap_owners(__ht._M_iter_list);
+ _M_non_dbg_impl.swap(__ht._M_non_dbg_impl);
+ }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ local_iterator begin(size_type __n) {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
+ }
+ local_iterator end(size_type __n) {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
+ }
+
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_local_iterator begin(size_type __n) const {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
+ }
+ const_local_iterator end(size_type __n) const {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
+ }
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__obj);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+
+ iterator insert_equal(const value_type& __obj)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__obj)); }
+
+ pair<iterator, bool> insert_unique_noresize(const value_type& __obj) {
+ pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique_noresize(__obj);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+
+ iterator insert_equal_noresize(const value_type& __obj)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal_noresize(__obj)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l){
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+#else
+ void insert_unique(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(__f, __l);
+ }
+
+ void insert_equal(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(__f, __l);
+ }
+
+ void insert_unique(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(__f._M_iterator, __l._M_iterator);
+ }
+
+ void insert_equal(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(__f._M_iterator, __l._M_iterator);
+ }
+#endif
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_non_dbg_impl.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key) {
+ pair<_Base_iterator, _Base_iterator> __res = _M_non_dbg_impl.equal_range(__key);
+ return pair<iterator,iterator> (iterator(&_M_iter_list,__res.first),
+ iterator(&_M_iter_list,__res.second));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
+ pair <_Base_const_iterator, _Base_const_iterator> __res = _M_non_dbg_impl.equal_range(__key);
+ return pair<const_iterator,const_iterator> (const_iterator(&_M_iter_list,__res.first),
+ const_iterator(&_M_iter_list,__res.second));
+ }
+
+ size_type erase(const key_type& __key) {
+ pair<iterator, iterator> __p = equal_range(__key);
+ size_type __n = _STLP_STD::distance(__p.first, __p.second);
+ _Invalidate_iterators(__p.first, __p.second);
+ _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator);
+ return __n;
+ }
+
+ void erase(const const_iterator& __it) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__it))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __it))
+ _Invalidate_iterator(__it);
+ _M_non_dbg_impl.erase(__it._M_iterator);
+ }
+ void erase(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last,
+ const_iterator(begin()), const_iterator(end())))
+ _Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
+ }
+
+ void rehash(size_type __num_buckets_hint) { _M_non_dbg_impl.rehash(__num_buckets_hint); }
+ void resize(size_type __num_elements_hint) { _M_non_dbg_impl.resize(__num_elements_hint); }
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+ reference _M_insert(const value_type& __obj) { return _M_non_dbg_impl._M_insert(__obj); }
+
+ size_type bucket_count() const { return _M_non_dbg_impl.bucket_count(); }
+ size_type max_bucket_count() const { return _M_non_dbg_impl.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const {
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.elems_in_bucket(__n);
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_non_dbg_impl.bucket(__k); }
+
+ float load_factor() const { return _M_non_dbg_impl.load_factor(); }
+ float max_load_factor() const { return _M_non_dbg_impl.max_load_factor(); }
+ void max_load_factor(float __z) {
+ _STLP_VERBOSE_ASSERT((__z > 0.0f), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.max_load_factor(__z);
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_HT
+
+#endif /* _STLP_INTERNAL_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_iterator.h b/build/stlport/stlport/stl/debug/_iterator.h
new file mode 100644
index 000000000..b2c8956ec
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_iterator.h
@@ -0,0 +1,457 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DBG_ITERATOR_H
+#define _STLP_DBG_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//============================================================
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const bidirectional_iterator_tag &)
+{ --__it; }
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const random_access_iterator_tag &)
+{ --__it; }
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const forward_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator&, ptrdiff_t, const forward_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator& __it, ptrdiff_t, const bidirectional_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &)
+{ __it += __n; }
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
+{ return __x - __y; }
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return 0;
+}
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return 0;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return false;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return false;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
+{ return __x < __y; }
+
+template <class _Iterator>
+bool _Dereferenceable(const _Iterator& __it)
+{ return (__it._Get_container_ptr() != 0) && !(__it._M_iterator == (__it._Get_container_ptr())->end()); }
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const forward_iterator_tag &)
+{ return (__n == 1) && _Dereferenceable(__it); }
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const bidirectional_iterator_tag &) {
+ typedef typename _Iterator::_Container_type __container_type;
+ __container_type* __c = __it._Get_container_ptr();
+ return (__c != 0) && ((__n == 1 && __it._M_iterator != __c->end() ) ||
+ (__n == -1 && __it._M_iterator != __c->begin()));
+}
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) {
+ typedef typename _Iterator::_Container_type __container_type;
+ __container_type* __c = __it._Get_container_ptr();
+ if (__c == 0) return false;
+ ptrdiff_t __new_pos = (__it._M_iterator - __c->begin()) + __n;
+ return (__new_pos >= 0) && (__STATIC_CAST(typename __container_type::size_type, __new_pos) <= __c->size());
+}
+
+
+template <class _Container>
+struct _DBG_iter_base : public __owned_link {
+public:
+ typedef typename _Container::value_type value_type;
+ typedef typename _Container::reference reference;
+ typedef typename _Container::pointer pointer;
+ typedef ptrdiff_t difference_type;
+ //private:
+ typedef typename _Container::iterator _Nonconst_iterator;
+ typedef typename _Container::const_iterator _Const_iterator;
+ typedef _Container _Container_type;
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef typename iterator_traits<_Const_iterator>::iterator_category _Iterator_category;
+#else
+ typedef typename _Container::_Iterator_category _Iterator_category;
+#endif
+ typedef _Iterator_category iterator_category;
+
+ _DBG_iter_base() : __owned_link(0) {}
+ _DBG_iter_base(const __owned_list* __c, const _Const_iterator& __it) :
+#if defined(__HP_aCC) && (__HP_aCC < 60000)
+ __owned_link(__c), _M_iterator(*__REINTERPRET_CAST(const _Nonconst_iterator *, &__it)) {}
+#else
+ __owned_link(__c), _M_iterator(*(const _Nonconst_iterator*)&__it) {}
+#endif
+ _Container* _Get_container_ptr() const {
+ return (_Container*)__stl_debugger::_Get_container_ptr(this);
+ }
+
+ void __increment();
+ void __decrement();
+ void __advance(ptrdiff_t __n);
+
+// protected:
+ _Nonconst_iterator _M_iterator;
+};
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__increment() {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, 1, _Iterator_category()))
+ ++_M_iterator;
+}
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__decrement() {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, -1, _Iterator_category()))
+ _Decrement(_M_iterator, _Iterator_category());
+}
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__advance(ptrdiff_t __n) {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, __n, _Iterator_category()))
+ _Advance(_M_iterator, __n, _Iterator_category());
+}
+
+template <class _Container>
+ptrdiff_t operator-(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y ) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Iterator_category;
+ _STLP_DEBUG_CHECK(__check_same_owner(__x, __y))
+ return _DBG_distance(__x._M_iterator,__y._M_iterator, _Iterator_category());
+}
+
+template <class _Container, class _Traits>
+struct _DBG_iter_mid : public _DBG_iter_base<_Container> {
+ typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_self;
+ typedef typename _Container::iterator _Nonconst_iterator;
+ typedef typename _Container::const_iterator _Const_iterator;
+
+ _DBG_iter_mid() {}
+
+ explicit _DBG_iter_mid(const _Nonconst_self& __it) :
+ _DBG_iter_base<_Container>(__it) {}
+
+ _DBG_iter_mid(const __owned_list* __c, const _Const_iterator& __it) :
+ _DBG_iter_base<_Container>(__c, __it) {}
+};
+
+template <class _Container, class _Traits>
+struct _DBG_iter : public _DBG_iter_mid<_Container, _Traits> {
+ typedef _DBG_iter_base<_Container> _Base;
+public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+
+ typedef typename _Base::_Nonconst_iterator _Nonconst_iterator;
+ typedef typename _Base::_Const_iterator _Const_iterator;
+
+private:
+ typedef _DBG_iter<_Container, _Traits> _Self;
+ typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_mid;
+
+public:
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef typename _Base::iterator_category iterator_category;
+#endif
+ typedef typename _Base::_Iterator_category _Iterator_category;
+
+public:
+ _DBG_iter() {}
+ // boris : real type of iter would be nice
+ _DBG_iter(const __owned_list* __c, const _Const_iterator& __it) :
+ _DBG_iter_mid<_Container, _Traits>(__c, __it) {}
+
+ // This allows conversions from iterator to const_iterator without being
+ // redundant with the copy constructor below.
+ _DBG_iter(const _Nonconst_mid& __rhs) :
+ _DBG_iter_mid<_Container, _Traits>(__rhs) {}
+
+ _DBG_iter(const _Self& __rhs) :
+ _DBG_iter_mid<_Container, _Traits>(__rhs) {}
+
+ // This allows conversions from iterator to const_iterator without being
+ // redundant with the copy assignment operator below.
+ _Self& operator=(const _Nonconst_mid& __rhs) {
+ (_Base&)*this = __rhs;
+ return *this;
+ }
+
+ _Self& operator=(const _Self& __rhs) {
+ (_Base&)*this = __rhs;
+ return *this;
+ }
+
+ reference operator*() const;
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ this->__increment();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ this->__increment();
+ return __tmp;
+ }
+ _Self& operator--() {
+ this->__decrement();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ this->__decrement();
+ return __tmp;
+ }
+
+ _Self& operator+=(difference_type __n) {
+ this->__advance(__n);
+ return *this;
+ }
+
+ _Self& operator-=(difference_type __n) {
+ this->__advance(-__n);
+ return *this;
+ }
+ _Self operator+(difference_type __n) const {
+ _Self __tmp(*this);
+ __tmp.__advance(__n);
+ return __tmp;
+ }
+ _Self operator-(difference_type __n) const {
+ _Self __tmp(*this);
+ __tmp.__advance(-__n);
+ return __tmp;
+ }
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+template <class _Container, class _Traits>
+inline
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+_STLP_TYPENAME_ON_RETURN_TYPE _Traits::reference
+#else
+_STLP_TYPENAME_ON_RETURN_TYPE _DBG_iter<_Container, _Traits>::reference
+#endif
+_DBG_iter<_Container, _Traits>::operator*() const {
+ _STLP_DEBUG_CHECK(_Dereferenceable(*this))
+ _STLP_DEBUG_CHECK(_Traits::_Check(*this))
+ return *this->_M_iterator;
+}
+
+template <class _Container>
+inline bool
+operator==(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ return __x._M_iterator == __y._M_iterator;
+}
+
+template <class _Container>
+inline bool
+operator<(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _CompareIt(__x._M_iterator , __y._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator>(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _CompareIt(__y._M_iterator , __x._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator>=(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return !_CompareIt(__x._M_iterator , __y._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator<=(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return !_CompareIt(__y._M_iterator , __x._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator!=(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ return __x._M_iterator != __y._M_iterator;
+}
+
+//------------------------------------------
+
+template <class _Container, class _Traits>
+inline _DBG_iter<_Container, _Traits>
+operator+(ptrdiff_t __n, const _DBG_iter<_Container, _Traits>& __it) {
+ _DBG_iter<_Container, _Traits> __tmp(__it);
+ return __tmp += __n;
+}
+
+
+template <class _Iterator>
+inline _Iterator _Non_Dbg_iter(_Iterator __it)
+{ return __it; }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Container, class _Traits>
+inline typename _DBG_iter<_Container, _Traits>::_Nonconst_iterator
+_Non_Dbg_iter(const _DBG_iter<_Container, _Traits>& __it)
+{ return __it._M_iterator; }
+#endif
+
+/*
+ * Helper classes to check iterator range or pointer validity
+ * at construction time.
+ */
+template <class _Container>
+class __construct_checker {
+ typedef typename _Container::value_type value_type;
+protected:
+ __construct_checker() {}
+
+ __construct_checker(const value_type* __p) {
+ _STLP_VERBOSE_ASSERT((__p != 0), _StlMsg_INVALID_ARGUMENT)
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ __construct_checker(const _InputIter& __f, const _InputIter& __l) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_check_dispatch(__f, __l, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_check_dispatch(_Integer , _Integer, const __true_type& /*IsIntegral*/) {}
+
+ template <class _InputIter>
+ void _M_check_dispatch(const _InputIter& __f, const _InputIter& __l, const __false_type& /*IsIntegral*/) {
+ _STLP_DEBUG_CHECK(__check_range(__f,__l))
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ __construct_checker(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__f,__l))
+ }
+
+ typedef _DBG_iter_base<_Container> _IteType;
+ __construct_checker(const _IteType& __f, const _IteType& __l) {
+ _STLP_DEBUG_CHECK(__check_range(__f,__l))
+ }
+#endif
+#if defined (__BORLANDC__)
+ ~__construct_checker(){}
+#endif
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# if defined (_STLP_NESTED_TYPE_PARAM_BUG) ||\
+ (defined (__SUNPRO_CC) && __SUNPRO_CC < 0x600)
+# define _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS 1
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Container>
+inline ptrdiff_t*
+distance_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { return (ptrdiff_t*) 0; }
+
+# if !defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Container>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::value_type*
+value_type(const _STLP_PRIV _DBG_iter_base<_Container>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _DBG_iter_base<_Container>::value_type _Val;
+ return (_Val*)0;
+}
+
+template <class _Container>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category
+iterator_category(const _STLP_PRIV _DBG_iter_base<_Container>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _Category();
+}
+# endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* INTERNAL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_list.h b/build/stlport/stlport/stl/debug/_list.h
new file mode 100644
index 000000000..c45e1e786
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_list.h
@@ -0,0 +1,495 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_LIST_H
+#define _STLP_INTERNAL_DBG_LIST_H
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline bidirectional_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
+{ return bidirectional_iterator_tag(); }
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class list :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_NON_DBG_LIST _Base;
+ typedef list<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+public:
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+
+public:
+ explicit list(const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const _Tp& __x = _Tp(),
+#else
+ list(size_type __n, const _Tp& __x,
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n)
+ : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ list(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+
+ list(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#endif
+
+ list(const _Self& __x) :
+ _ConstructCheck(__x),
+ _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ //Should not invalidate end iterator
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ // those are here to enforce checking
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const _Tp& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) );
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert(iterator __pos, const _Tp* __first, const _Tp* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first))
+# endif
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert(iterator __pos,
+ iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first))
+# endif
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+ void insert(iterator __pos, size_type __n, const _Tp& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+ void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); }
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(begin());
+ _M_non_dbg_impl.pop_front();
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _Invalidate_iterator(__pos);
+ return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _Base_iterator __i = _M_non_dbg_impl.begin();
+ size_type __len = 0;
+ for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len);
+
+ if (__len == __new_size)
+ erase(iterator(&_M_iter_list, __i), end());
+ else // __i == end()
+ _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __new_size - __len, __x);
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Invalidate_iterators(begin(), end());
+ }
+#else
+ void assign(const _Tp* __first, const _Tp* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.assign(__first, __last);
+ _Invalidate_iterators(begin(), end());
+ }
+
+ void assign(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ _Invalidate_iterators(begin(), end());
+ }
+
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ _Invalidate_iterators(begin(), end());
+ }
+#endif
+
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ void remove(const _Tp& __x) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__x == *__first) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+public:
+ void splice(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (get_allocator() == __x.get_allocator())
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:4
+ // end iterator is not invalidated:
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i))
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (get_allocator() == __x.get_allocator())
+ _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:7
+ __x._Invalidate_iterator(__i);
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
+ _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true)
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (this->get_allocator() == __x.get_allocator())
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:12
+ __x._Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator);
+ }
+
+ void merge(_Self& __x) {
+#if !defined (_STLP_NO_EXTENSIONS)
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator))
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
+ if (this->get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+ void reverse() {
+ _M_non_dbg_impl.reverse();
+ }
+ void unique() {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (*__first == *__next) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+ void sort() {
+ _M_non_dbg_impl.sort();
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__pred(*__first)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __binary_pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp) {
+#if !defined (_STLP_NO_EXTENSIONS)
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp))
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp);
+ if (this->get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp) {
+ _M_non_dbg_impl.sort(__comp);
+ }
+#endif
+};
+
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_LIST
+
+#endif /* _STLP_INTERNAL_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_slist.h b/build/stlport/stlport/stl/debug/_slist.h
new file mode 100644
index 000000000..2eeaf3673
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_slist.h
@@ -0,0 +1,613 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_SLIST_H
+#define _STLP_INTERNAL_DBG_SLIST_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
+{ return (_Tp*)0; }
+
+template <class _Tp, class _Alloc>
+inline forward_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
+{ return forward_iterator_tag(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * slist special debug traits version.
+ */
+template <class _Traits>
+struct _SlistDbgTraits : _Traits {
+ typedef _SlistDbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
+ typedef _SlistDbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
+
+ /*
+ * We don't want the before_begin iterator to return false at _Dereferenceable
+ * call to do not break the current debug framework but calling * operator should
+ * fail.
+ */
+ template <class _Iterator>
+ static bool _Check(const _Iterator& __it)
+ { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_NON_DBG_SLIST _Base;
+ typedef slist<_Tp,_Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck;
+
+public:
+
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+
+public:
+ explicit slist(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _Tp(),
+#else
+ slist(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+#endif
+
+ slist(const _Self& __x) :
+ _ConstructCheck(__x),
+ _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Self& operator= (const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ ~slist() {}
+
+ void assign(size_type __n, const value_type& __val) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ iterator before_begin()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
+ const_iterator before_begin() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
+
+ iterator begin()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
+
+ iterator end()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return _M_non_dbg_impl.front();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return _M_non_dbg_impl.front();
+ }
+ void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _M_non_dbg_impl.pop_front();
+ }
+ iterator previous(const_iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
+ }
+ const_iterator previous(const_iterator __pos) const {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
+ }
+
+public:
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert_after(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos) {
+ return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InIter>
+ void insert_after(iterator __pos, _InIter __first, _InIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+
+ template <class _InIter>
+ void insert(iterator __pos, _InIter __first, _InIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
+ }
+
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert(iterator __pos, const value_type* __first,
+ const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos) {
+ return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+public:
+ iterator erase_after(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ iterator __tmp = __pos; ++__tmp;
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
+ _Invalidate_iterator(__tmp);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
+ }
+ iterator erase_after(iterator __before_first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
+ iterator __tmp = __before_first; ++__tmp;
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
+ _Invalidate_iterators(__tmp, __last);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_iterator(__pos);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _M_non_dbg_impl.resize(__new_size, __x);
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+public:
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void splice_after(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ // Moves the element that follows __prev to *this, inserting it immediately
+ // after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x, iterator __prev) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
+ iterator __elem = __prev; ++__elem;
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterator(__elem);
+ }
+ }
+
+ // Moves the range [__before_first + 1, __before_last + 1) to *this,
+ // inserting it immediately after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last))
+ iterator __first = __before_first; ++__first;
+ iterator __last = __before_last; ++__last;
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__first, __last);
+ }
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
+ __before_first._M_iterator, __before_last._M_iterator);
+ }
+
+ void splice(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ //__pos should be owned by *this and not be the before_begin iterator
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ //__i should be dereferenceable, not before_begin and be owned by __x
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
+ _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterator(__i);
+ }
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__first, __last);
+ }
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
+ __first._M_iterator, __last._M_iterator);
+ }
+
+ void reverse()
+ { _M_non_dbg_impl.reverse(); }
+
+ void remove(const value_type& __val) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__val == *__first) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+ void unique() {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (*__first == *__next) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+ void merge(_Self& __x) {
+ _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+#if !defined (_STLP_NO_EXTENSIONS)
+ /* comments below due to bug in GCC compilers: ones eat all memory and die if see
+ * something like namespace_name::func_name() - ptr
+ */
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+ void sort() {
+ _M_non_dbg_impl.sort();
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__pred(*__first)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __ord) {
+ _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+#if !defined (_STLP_NO_EXTENSIONS)
+ /* comments below due to bug in GCC compilers: ones eat all memory and die if see
+ * something like namespace_name::func_name() - ptr
+ */
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_non_dbg_impl.sort(__comp); }
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_SLIST
+
+#endif /* _STLP_INTERNAL_DBG_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_string.h b/build/stlport/stlport/stl/debug/_string.h
new file mode 100644
index 000000000..49f7ab225
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_string.h
@@ -0,0 +1,828 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_DBG_STRING_H
+#define _STLP_DBG_STRING_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str)
+#define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _CharT,class _Traits, class _Alloc>
+inline _CharT*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
+{ return (_CharT*)0; }
+template <class _CharT, class _Traits, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string :
+#if !defined (__DMC__)
+ private
+#else
+ public
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+protected:
+ typedef _STLP_NON_DBG_STRING _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > _ConstructCheck;
+ typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+ typedef typename _Base::traits_type traits_type;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+public: // Constructor, destructor, assignment.
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Compare_Capacity (size_type __old_capacity) {
+ if (this->capacity() > __old_capacity) {
+ _Invalidate_all();
+ }
+ }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __f, const iterator& __l)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); }
+
+public:
+#include <stl/_string_npos.h>
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ explicit basic_string(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(_Reserve_t __r, size_t __n,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__r, __n, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _Self& __s)
+ : _ConstructCheck(__s),
+ _M_non_dbg_impl(__s._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__s),
+ _M_non_dbg_impl(__s, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __c, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base >(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ basic_string(const _CharT* __f, const _CharT* __l,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(__f, __l, __a), _M_iter_list(&_M_non_dbg_impl) {
+ }
+ basic_string(const_iterator __f, const_iterator __l,
+ const allocator_type & __a = allocator_type())
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) {
+ }
+#else
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#endif
+
+private:
+ // constructor from non-debug version for substr
+ basic_string (const _Base& __x)
+ : _M_non_dbg_impl(__x), _M_iter_list(&_M_non_dbg_impl) {}
+
+public:
+ _Self& operator=(const _Self& __s) {
+ if (this != &__s) {
+ assign(__s);
+ }
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return assign(__s);
+ }
+
+ _Self& operator=(_CharT __c) {
+ return assign(1, __c);
+ }
+
+ // Iterators.
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ // Size, capacity, etc.
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type length() const { return _M_non_dbg_impl.length(); }
+ size_t max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void resize(size_type __n, _CharT __c) {
+ if (__n > capacity())
+ _Invalidate_all();
+ else if (__n < size())
+ _Invalidate_iterators(begin() + __n, end());
+ _M_non_dbg_impl.resize(__n, __c);
+ }
+ void resize(size_type __n) { resize(__n, _STLP_DEFAULT_CONSTRUCTED(_CharT)); }
+ size_type capacity() const { return _M_non_dbg_impl.capacity(); }
+
+ void reserve(size_type __s = 0) {
+ if (__s > capacity()) _Invalidate_all();
+ _M_non_dbg_impl.reserve(__s);
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS);
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+
+ // Append, operator+=, push_back.
+ _Self& operator+=(const _Self& __s) { return append(__s); }
+ _Self& operator+=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return append(__s);
+ }
+ _Self& operator+=(_CharT __c) { return append(1, __c); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& append(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__f, __l);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+ _Self& append(const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s, size_type __pos, size_type __n) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(size_type __n, _CharT __c) {
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.append(__n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ void push_back(_CharT __c) {
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.push_back(__c);
+ _Compare_Capacity(__old_capacity);
+ }
+
+ void pop_back() {
+ _Invalidate_iterator(this->end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ // Assign
+ _Self& assign(const _Self& __s) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__s._M_non_dbg_impl);
+ return *this;
+ }
+
+ _Self& assign(const _Self& __s, size_type __pos, size_type __n) {
+ if (__pos < __s.size()) {
+ _Invalidate_all();
+ }
+ _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__s, __s + __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__s);
+ return *this;
+ }
+
+ _Self& assign(size_type __n, _CharT __c) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __c);
+ return *this;
+ }
+
+#if defined(_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ inline _Self& assign(_InputIter __first, _InputIter __last) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__f, __l);
+ return *this;
+ }
+ _Self& assign(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator);
+ return *this;
+ }
+#endif
+
+ // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return insert(__pos, __s, _Traits::length(__s));
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ size_type __old_capacity = capacity();
+ typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c);
+ _Compare_Capacity(__old_capacity);
+ return iterator(&_M_iter_list, __ret);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f, __l);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ // Those overloads are necessary to check self referencing correctly in non debug
+ // basic_string implementation
+ void insert(iterator __p, const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f))
+# endif
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+ void insert(iterator __p, iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f))
+# endif
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+ // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ if (__pos < size()) {
+ _Invalidate_iterators(begin() + __pos, end());
+ }
+ _M_non_dbg_impl.erase(__pos, __n);
+ return *this;
+ }
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _Invalidate_iterators(__pos, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _Invalidate_iterators(__f, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator));
+ }
+
+ // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _M_non_dbg_impl.substr(__pos, __n); }
+
+ // Replace. (Conceptually equivalent to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __s, __n2);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __n2, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _Self& __s) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ _Self& replace(iterator __first, iterator __last,
+ const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+ _Self& replace(iterator __first, iterator __last,
+ iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+ // Other modifier member functions.
+ void swap(_Self& __s) {
+ _M_iter_list._Swap_owners(__s._M_iter_list);
+ _M_non_dbg_impl.swap(__s._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ int compare(const _Self& __s) const
+ { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); }
+ int compare(size_type __pos, size_type __n, const _Self& __s) const
+ { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) const
+ { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); }
+ int compare(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__s);
+ }
+ int compare(size_type __pos, size_type __n, const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__pos, __n, __s);
+ }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s,
+ size_type __n2) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2);
+ }
+
+ // Helper functions for compare.
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const _CharT* __f2, const _CharT* __l2)
+ { return _Base::_M_compare(__f1, __l1, __f2, __l2); }
+ static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
+ const _CharT* __f2, const _CharT* __l2)
+ { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); }
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const_iterator __f2, const_iterator __l2)
+ { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); }
+ static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
+ const_iterator __f2, const_iterator __l2)
+ { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); }
+
+ const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); }
+ const _CharT* data() const { return _M_non_dbg_impl.data(); }
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ { return _M_non_dbg_impl.copy(__s, __n, __pos); }
+
+ // find.
+ size_type find(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); }
+ size_type find(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find(__s, __pos);
+ }
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find(__s, __pos, __n);
+ }
+ // WIE: Versant schema compiler 5.2.2 ICE workaround
+ size_type find(_CharT __c) const { return find(__c, 0); }
+ size_type find(_CharT __c, size_type __pos /* = 0 */) const
+ { return _M_non_dbg_impl.find(__c, __pos); }
+
+ // rfind.
+ size_type rfind(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.rfind(__s, __pos);
+ }
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.rfind(__s, __pos, __n);
+ }
+ size_type rfind(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__c, __pos); }
+
+ // find_first_of
+ size_type find_first_of(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_of(__s, __pos);
+ }
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_of(__s, __pos, __n);
+ }
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_of(__c, __pos); }
+
+ // find_last_of
+ size_type find_last_of(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_of(__s, __pos);
+ }
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_of(__s, __pos, __n);
+ }
+ size_type find_last_of(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__c, __pos); }
+
+ // find_first_not_of
+ size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_not_of(__s, __pos);
+ }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n);
+ }
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_not_of(__c, __pos); }
+
+ // find_last_not_of
+ size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_not_of(__s, __pos);
+ }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n);
+ }
+ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_not_of(__c, __pos); }
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+# include <stl/debug/_string_sum_methods.h>
+#endif
+};
+
+// This is a hook to instantiate STLport exports in a designated DLL
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <char, char_traits<char>, allocator<char> > >;
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif
+
+#undef _STLP_NON_DBG_STRING
+#undef _STLP_NON_DBG_STRING_NAME
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DBG_STRING */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_string_sum_methods.h b/build/stlport/stlport/stl/debug/_string_sum_methods.h
new file mode 100644
index 000000000..3fca19484
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_string_sum_methods.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * All the necessary methods used for template expressions with basic_string
+ * This file do not have to be macro guarded as it is only used in the _string.h
+ * file and it is a part of the basic_string definition.
+ */
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s)
+ : _M_non_dbg_impl(_Reserve_t(), __s.size(), __s.get_allocator()),
+ _M_iter_list(&_M_non_dbg_impl)
+ { _M_append_sum(__s, _M_non_dbg_impl); }
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ size_type __size = __s.size();
+ if (__pos > __size)
+ //This call will generate the necessary out of range exception:
+ _M_non_dbg_impl.at(0);
+ else
+ _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos), _M_non_dbg_impl);
+ }
+
+private:
+ _Base& _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str)
+ { return __str += __c.getValue(); }
+ _Base& _M_append_fast(_CharT const* __s, size_type __s_size, _Base &__str)
+ { return __str.append(__s, __s_size); }
+ _Base& _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str)
+ { return _M_append_fast(__s.c_str(), __s.size(), __str); }
+ _Base& _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str)
+ { return _M_append_fast(__s.b_str(), __str); }
+ _Base& _M_append_fast(_Self const& __s, _Base &__str)
+ { return _M_append_fast(__s.data(), __s.size(), __str); }
+ _Base& _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str)
+ { return __str; }
+ template <class _Left, class _Right, class _StorageDir>
+ _Base& _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _Base &__str)
+ { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __str)); }
+
+ _Base& _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str, size_type /*__pos*/, size_type __n) {
+ if (__n == 0)
+ return __str;
+ return __str += __c.getValue();
+ }
+ _Base& _M_append_fast_pos(_CharT const* __s, size_type __s_size, _Base &__str,
+ size_type __pos, size_type __n)
+ { return __str.append(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos)); }
+ _Base& _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.c_str(), __s.size(), __str, __pos, __n); }
+ _Base& _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.b_str(), __str, __pos, __n); }
+ _Base& _M_append_fast_pos(_Self const& __s, _Base &__str, size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.data(), __s.size(), __str, __pos, __n); }
+ _Base& _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str,
+ size_type /*__pos*/, size_type /*__n*/)
+ { return __str; }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Base& _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _Base &__str, size_type __pos, size_type __n) {
+ if (__n == 0) {
+ return __str;
+ }
+ size_type __lhs_size = __s.getLhs().size();
+ if (__pos < __lhs_size) {
+ if (__n < (__lhs_size - __pos)) {
+ return _M_append_fast_pos(__s.getLhs(), __str, __pos, __n);
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __str, __pos, __n),
+ 0, __n - (__lhs_size - __pos));
+ }
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), __str, __pos - __lhs_size, __n);
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _Base &__impl) {
+ _M_append_fast(__s, __impl);
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum_pos (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n, _Base &__impl) {
+ _M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (min) (__s.size() - __pos, __n));
+ _M_append_fast_pos(__s, __impl, __pos, __n);
+ return *this;
+ }
diff --git a/build/stlport/stlport/stl/debug/_tree.h b/build/stlport/stlport/stl/debug/_tree.h
new file mode 100644
index 000000000..a32eda2c5
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_tree.h
@@ -0,0 +1,317 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_TREE_H
+#define _STLP_INTERNAL_DBG_TREE_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Key, class _Compare>
+class _DbgCompare {
+public:
+ _DbgCompare() {}
+ _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {}
+ _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {}
+
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ bool operator () (const _Key& __lhs, const _Key& __rhs) const {
+#else
+ template <class _Kp1, class _Kp2>
+ bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const {
+#endif
+ if (_M_non_dbg_cmp(__lhs, __rhs)) {
+ return true;
+ }
+ return false;
+ }
+
+ _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; }
+private:
+ _Compare _M_non_dbg_cmp;
+};
+
+#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc >
+inline _Value*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
+{ return (_Value*)0; }
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc >
+inline bidirectional_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
+{ return bidirectional_iterator_tag(); }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits,
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class _Rb_tree {
+ typedef _STLP_NON_DBG_TREE _Base;
+ typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+ typedef typename _Base::key_type key_type;
+
+ typedef typename _Traits::_NonConstTraits _NonConstIteTraits;
+ typedef typename _Traits::_ConstTraits _ConstIteTraits;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+ typedef typename _Base::const_iterator _Base_const_iterator;
+
+public:
+ _Rb_tree()
+ : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Compare& __comp)
+ : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Compare& __comp, const allocator_type& __a)
+ : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Self& __x)
+ : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Rb_tree(__move_source<_Self> src):
+ _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+ ~_Rb_tree() {}
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ //Should not invalidate end iterator:
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+ _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); }
+
+ void swap(_Self& __t) {
+ _M_non_dbg_impl.swap(__t._M_non_dbg_impl);
+ _M_iter_list._Swap_owners(__t._M_iter_list);
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __k)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __k) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x) {
+ return pair<iterator, iterator>(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
+ iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ return pair<const_iterator,const_iterator>(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
+ const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range_unique(const _KT& __x) {
+ _STLP_STD::pair<_Base_iterator, _Base_iterator> __p;
+ __p = _M_non_dbg_impl.equal_range_unique(__x);
+ return pair<iterator, iterator>(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
+ _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p;
+ __p = _M_non_dbg_impl.equal_range_unique(__x);
+ return pair<const_iterator, const_iterator>(const_iterator(&_M_iter_list, __p.first),
+ const_iterator(&_M_iter_list, __p.second));
+ }
+
+ pair<iterator,bool> insert_unique(const value_type& __x) {
+ _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+ iterator insert_equal(const value_type& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); }
+
+ iterator insert_unique(iterator __pos, const value_type& __x) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x));
+ }
+ iterator insert_equal(iterator __pos, const value_type& __x) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos))
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _InputIterator>
+ void insert_equal(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+ template<class _InputIterator>
+ void insert_unique(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert_unique(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator);
+ }
+ void insert_unique(const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(__first, __last);
+ }
+ void insert_equal(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator);
+ }
+ void insert_equal(const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(__first, __last);
+ }
+#endif
+
+ void erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_Dereferenceable(__pos))
+ _Invalidate_iterator(__pos);
+ _M_non_dbg_impl.erase(__pos._M_iterator);
+ }
+ size_type erase(const key_type& __x) {
+ pair<iterator, iterator> __p = equal_range(__x);
+ size_type __n = _STLP_STD::distance(__p.first._M_iterator, __p.second._M_iterator);
+ _Invalidate_iterators(__p.first, __p.second);
+ _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator);
+ return __n;
+ }
+ size_type erase_unique(const key_type& __x) {
+ _Base_iterator __i = _M_non_dbg_impl.find(__x);
+ if (__i != _M_non_dbg_impl.end()) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __i));
+ _M_non_dbg_impl.erase(__i);
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
+ }
+ void erase(const key_type* __first, const key_type* __last) {
+ while (__first != __last) erase(*__first++);
+ }
+
+ void clear() {
+ //should not invalidate end:
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_TREE
+
+#endif /* _STLP_INTERNAL_DBG_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/debug/_vector.h b/build/stlport/stlport/stl/debug/_vector.h
new file mode 100644
index 000000000..c5800e962
--- /dev/null
+++ b/build/stlport/stlport/stl/debug/_vector.h
@@ -0,0 +1,425 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_VECTOR_H
+#define _STLP_INTERNAL_DBG_VECTOR_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_VECTOR _STLP_PRIV _STLP_NON_DBG_NAME(vector) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _NcIt>
+struct _Vector_const_traits;
+
+template <class _Tp, class _NcIt>
+struct _Vector_nonconst_traits {
+ typedef _Nonconst_traits<_Tp> _BaseT;
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+ typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
+ typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
+};
+
+template <class _Tp, class _NcIt>
+struct _Vector_const_traits {
+ typedef _Const_traits<_Tp> _BaseT;
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
+ typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Vector_nonconst_traits<bool, _Bit_iterator> {
+ typedef _Bit_iterator::value_type value_type;
+ typedef _Bit_iterator::reference reference;
+ typedef _Bit_iterator::pointer pointer;
+ typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
+ typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Vector_const_traits<bool, _Bit_iterator> {
+ typedef _Bit_const_iterator::value_type value_type;
+ typedef _Bit_const_iterator::reference reference;
+ typedef _Bit_const_iterator::pointer pointer;
+ typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
+ typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class vector :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker< _STLP_NON_DBG_VECTOR >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_NON_DBG_VECTOR _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_VECTOR > _ConstructCheck;
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base,
+ _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_nonconst_traits<value_type, typename _Base::iterator> > > iterator;
+
+ typedef _STLP_PRIV _DBG_iter<_Base,
+ _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_const_traits<value_type, typename _Base::iterator> > > const_iterator;
+
+private:
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ void _Check_Overflow(size_type __nb) {
+ if (size() + __nb > capacity())
+ _Invalidate_all();
+ }
+ void _Compare_Capacity (size_type __old_capacity) {
+ if (capacity() > __old_capacity) {
+ _Invalidate_all();
+ }
+ }
+
+public:
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ size_type capacity() const { return _M_non_dbg_impl.capacity(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n, const _Tp& __x = _Tp(),
+#else
+ vector(size_type __n, const _Tp& __x,
+#endif
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n)
+ : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif
+
+ vector(const _Self& __x)
+ : _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+ vector(const _Tp* __first, const _Tp* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last), _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ // mysterious VC++ bug ?
+ vector(const_iterator __first, const_iterator __last ,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_all();
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ void reserve(size_type __n) {
+ if (capacity() < __n)
+ _Invalidate_all();
+ _M_non_dbg_impl.reserve(__n);
+ }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Check_Overflow(1);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos,
+ _InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert (iterator __pos,
+ const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+ void insert(iterator __pos,
+ iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+ void insert (iterator __pos, size_type __n, const _Tp& __x){
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Check_Overflow(__n);
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_iterators(__pos, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ if (__new_size > capacity()) {
+ _Invalidate_all();
+ }
+ else if (__new_size < size()) {
+ _Invalidate_iterators(begin() + __new_size, end());
+ }
+ _M_non_dbg_impl.resize(__new_size, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+private:
+ void _M_assign(const value_type *__first, const value_type *__last) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+public:
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
+ _M_assign(__first, __last);
+ }
+
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _M_assign(__first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+ void push_back(const _Tp& __x) {
+ _Check_Overflow(1);
+ _M_non_dbg_impl.push_back(__x);
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_VECTOR
+
+#endif /* _STLP_DBG_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/msl_string.h b/build/stlport/stlport/stl/msl_string.h
new file mode 100644
index 000000000..1fa493146
--- /dev/null
+++ b/build/stlport/stlport/stl/msl_string.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998
+ * Mark of the Unicorn, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Mark of the Unicorn, Inc. makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+#if defined( _STLP_USE_MSIPL ) && !defined( _STLP_MSL_STRING_H_ )
+#define _STLP_MSL_STRING_H_
+
+//# define char_traits __msl_char_traits
+# define basic_string __msl_basic_string
+# define b_str_ref __msl_b_str_ref
+# define basic_istream __msl_basic_istream
+# define basic_ostream __msl_basic_ostream
+# define string __msl_string
+# define wstring __msl_wstring
+# define iterator_traits __msl_iterator_traits
+
+namespace std
+{
+ template<class charT, class traits> class basic_istream;
+ template<class charT, class traits> class basic_ostream;
+}
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string>
+#else
+# include _STLP_NATIVE_HEADER(string)
+#endif
+
+// # undef char_traits
+# undef basic_string
+# undef b_str_ref
+# undef basic_istream
+# undef basic_ostream
+# undef string
+# undef wstring
+# undef iterator_traits
+
+#endif
diff --git a/build/stlport/stlport/stl/pointers/_deque.h b/build/stlport/stlport/stl/pointers/_deque.h
new file mode 100644
index 000000000..f82a559bc
--- /dev/null
+++ b/build/stlport/stlport/stl/pointers/_deque.h
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_DEQUE_H
+#define _STLP_SPECIALIZED_DEQUE_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * struct helper to cast deque iterators:
+ */
+template <class _StorageT, class _ValueT>
+struct _DequeIteCast {
+ typedef _Deque_iterator<_ValueT, _Nonconst_traits<_ValueT> > iterator;
+ typedef _Deque_iterator<_ValueT, _Const_traits<_ValueT> > const_iterator;
+ typedef _Deque_iterator<_StorageT, _Nonconst_traits<_StorageT> > storage_iterator;
+ typedef _Deque_iterator<_StorageT, _Const_traits<_StorageT> > const_storage_iterator;
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ static iterator to_value_type_ite (storage_iterator const& __ite) {
+ iterator tmp;
+ tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
+ return tmp;
+ }
+ static storage_iterator to_storage_type_ite (iterator const& __ite) {
+ storage_iterator tmp;
+ tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
+ return tmp;
+ }
+
+ static const_iterator to_value_type_cite (const_storage_iterator const& __ite) {
+ const_iterator tmp;
+ tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
+ return tmp;
+ }
+
+ static const_storage_iterator to_storage_type_cite (const_iterator const& __ite) {
+ const_storage_iterator tmp;
+ tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
+ return tmp;
+ }
+};
+
+#define DEQUE_IMPL _STLP_PTR_IMPL_NAME(deque)
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void***, void**, allocator<void**> >;
+_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Deque_base<void*,allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS DEQUE_IMPL<void*,allocator<void*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
+ : public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV DEQUE_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef deque<_Tp, _Alloc> _Self;
+
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef _STLP_PRIV _DequeIteCast<_StorageType, _Tp> ite_cast_traits;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+ typedef _STLP_PRIV _Deque_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _Deque_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+public: // Basic accessors
+ iterator begin() { return ite_cast_traits::to_value_type_ite(_M_impl.begin()); }
+ iterator end() { return ite_cast_traits::to_value_type_ite(_M_impl.end()); }
+ const_iterator begin() const { return ite_cast_traits::to_value_type_cite(_M_impl.begin()); }
+ const_iterator end() const { return ite_cast_traits::to_value_type_cite(_M_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type __n)
+ { return cast_traits::to_value_type_ref(_M_impl[__n]); }
+ const_reference operator[](size_type __n) const
+ { return cast_traits::to_value_type_cref(_M_impl[__n]); }
+
+ reference at(size_type __n)
+ { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
+ const_reference at(size_type __n) const
+ { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
+
+ reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
+ reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
+ const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
+ const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+ bool empty() const { return _M_impl.empty(); }
+ allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit deque(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+ deque(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ deque(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ // int,long variants may be needed
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n) : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+#if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last,
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+#else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+#endif
+#if defined (_STLP_USE_ITERATOR_WRAPPER)
+ insert(end(), __first, __last);
+#endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last) {}
+# else
+ { insert(end(), __first, __last); }
+# endif
+# endif
+
+#else
+ deque(const_pointer __first, const_pointer __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+ _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ void assign(size_type __n, const value_type& __val) {
+ _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const_pointer __first, const_pointer __last)
+ { _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+ void assign(const_iterator __first, const_iterator __last)
+ { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_back(const value_type& __t)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_front(const value_type& __t)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); }
+
+# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() { _M_impl.push_back(); }
+ void push_front() { _M_impl.push_front(); }
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() { _M_impl.pop_back(); }
+ void pop_front() { _M_impl.pop_front(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ cast_traits::to_storage_type_cref(__x))); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos,
+ const_pointer __first, const_pointer __last) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last));
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ iterator erase(iterator __pos)
+ { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); }
+
+ iterator erase(iterator __first, iterator __last)
+ { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first),
+ ite_cast_traits::to_storage_type_ite(__last))); }
+ void clear() { _M_impl.clear(); }
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef DEQUE_IMPL
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/pointers/_list.h b/build/stlport/stlport/stl/pointers/_list.h
new file mode 100644
index 000000000..52a9262a7
--- /dev/null
+++ b/build/stlport/stlport/stl/pointers/_list.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_PTR_SPECIALIZED_LIST_H
+#define _STLP_PTR_SPECIALIZED_LIST_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define LIST_IMPL _STLP_PTR_IMPL_NAME(list)
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _List_node<void*>;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node<void*> >;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node<void*>, allocator<_List_node<void*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _List_base<void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class list
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
+ : public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef typename _Base::iterator _BaseIte;
+ typedef typename _Base::const_iterator _BaseConstIte;
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef list<_Tp, _Alloc> _Self;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _List_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _List_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit list(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ list(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n)
+ : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+# else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+ insert(begin(), __first, __last);
+ }
+# endif
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_WRAPPER_ITERATOR)
+ : _M_impl(__first, __last) {}
+# else
+ { insert(begin(), __first, __last); }
+# endif
+# endif
+
+#else /* _STLP_MEMBER_TEMPLATES */
+
+ list(const value_type *__first, const value_type *__last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ list(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ list(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+ iterator begin() { return iterator(_M_impl.begin()._M_node); }
+ const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); }
+
+ iterator end() { return iterator(_M_impl.end()._M_node); }
+ const_iterator end() const { return const_iterator(_M_impl.end()._M_node); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ bool empty() const { return _M_impl.empty(); }
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(--end()); }
+ const_reference back() const { return *(--end()); }
+
+ void swap(_Self &__x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+ void clear() { _M_impl.clear(); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const_reference __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type *__first, const value_type *__last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+ void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
+ void push_back(const value_type& __x) { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); }
+ void push_front() { _M_impl.push_front();}
+ void push_back() { _M_impl.push_back();}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ iterator erase(iterator __pos)
+ { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
+
+ void pop_front() { _M_impl.pop_front(); }
+ void pop_back() { _M_impl.pop_back(); }
+
+ _Self& operator=(const _Self& __x)
+ { _M_impl = __x._M_impl; return *this; }
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void assign(const_iterator __first, const_iterator __last)
+ { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+#endif
+
+ void splice(iterator __pos, _Self& __x)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x, iterator __i)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
+
+ void remove(const_reference __val)
+ { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
+ void unique() { _M_impl.unique(); }
+ void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
+ void reverse() { _M_impl.reverse(); }
+ void sort() { _M_impl.sort(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __bin_pred)
+ { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self &__x, _StrictWeakOrdering __comp)
+ { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (list)
+# undef list
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef LIST_IMPL
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTR_SPECIALIZED_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/pointers/_set.h b/build/stlport/stlport/stl/pointers/_set.h
new file mode 100644
index 000000000..f997a5ae1
--- /dev/null
+++ b/build/stlport/stlport/stl/pointers/_set.h
@@ -0,0 +1,564 @@
+/*
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_PTR_SPECIALIZED_SET_H
+#define _STLP_PTR_SPECIALIZED_SET_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC less<void*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef _Rb_tree_node<void*> _Node;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Rb_tree_node_base, _Node, allocator<_Node> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree_base<void*, allocator<void*> >;
+# if defined (_STLP_DEBUG)
+_STLP_EXPORT_TEMPLATE_CLASS _DbgCompare<void*, less<void*> >;
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, _DbgCompare<void*, less<void*> >, void*, _Identity<void*>,
+ _SetTraitsT<void*>, allocator<void*> >;
+# undef _Rb_tree
+# endif
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, less<void*>, void*, _Identity<void*>,
+ _SetTraitsT<void*>, allocator<void*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<set<_Key, _Compare, _Alloc> >
+#endif
+{
+#if !defined (__BORLANDC__)
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
+ typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
+ typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
+#else
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_KeyStorageType _KeyStorageType;
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_CompareStorageType _CompareStorageType;
+#endif
+ typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
+
+ typedef set<_Key, _Compare, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _SetTraits, _Alloc> _Priv_Rep_type;
+
+ typedef _STLP_PRIV _SetTraitsT<_KeyStorageType> _SetStorageTraits;
+
+public:
+ //dums: need the following public for the __move_traits framework
+ typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
+ _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
+ _SetStorageTraits, _StorageTypeAlloc> _Rep_type;
+
+private:
+ typedef typename _Rep_type::iterator base_iterator;
+ typedef typename _Rep_type::const_iterator const_base_iterator;
+
+public:
+ typedef typename _Priv_Rep_type::pointer pointer;
+ typedef typename _Priv_Rep_type::const_pointer const_pointer;
+ typedef typename _Priv_Rep_type::reference reference;
+ typedef typename _Priv_Rep_type::const_reference const_reference;
+ typedef typename _Priv_Rep_type::iterator iterator;
+ typedef typename _Priv_Rep_type::const_iterator const_iterator;
+ typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Priv_Rep_type::size_type size_type;
+ typedef typename _Priv_Rep_type::difference_type difference_type;
+ typedef typename _Priv_Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing set
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+#if defined (_STLP_DEBUG)
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+#else
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._M_node); }
+#endif
+
+public:
+ set() : _M_t(_CompareStorageType(), _StorageTypeAlloc()) {}
+ explicit set(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+# endif
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+#else
+ set(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ set(const value_type* __first, const value_type* __last,
+ const _Compare& __comp, const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ set(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc())
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+
+ set(const_iterator __first, const_iterator __last,
+ const _Compare& __comp, const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ set(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ set(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
+
+ iterator begin() { return _S_to_value_ite(_M_t.begin()); }
+ iterator end() { return _S_to_value_ite(_M_t.end()); }
+ const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
+ const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x) {
+ pair<base_iterator, bool> ret = _M_t.insert_unique(cast_traits::to_storage_type_cref(__x));
+ return pair<iterator, bool>(_S_to_value_ite(ret.first), ret.second);
+ }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _S_to_value_ite(_M_t.insert_unique(_S_to_storage_ite(__pos), cast_traits::to_storage_type_cref(__x))); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+#else
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void insert(const value_type* __first, const value_type* __last) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif
+ void erase(iterator __pos)
+ { _M_t.erase(_S_to_storage_ite(__pos)); }
+ size_type erase(const key_type& __x)
+ { return _M_t.erase_unique(cast_traits::to_storage_type_cref(__x)); }
+ void erase(iterator __first, iterator __last)
+ { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void clear() { _M_t.clear(); }
+
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x)
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.find(cast_traits::to_storage_type_crefT(__x)) == _M_t.end() ? 0 : 1; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) {
+ pair<base_iterator, base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ pair<const_base_iterator, const_base_iterator> __ret;
+ __ret = _M_t.equal_range_unique(cast_traits::to_storage_type_crefT(__x));
+ return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
+#endif
+{
+#if !defined (__BORLANDC__)
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
+ typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
+ typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
+#else
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_KeyStorageType _KeyStorageType;
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_CompareStorageType _CompareStorageType;
+#endif
+ typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
+
+ typedef multiset<_Key, _Compare, _Alloc> _Self;
+public:
+ // typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _MultisetTraits, _Alloc> _Priv_Rep_type;
+
+ typedef _STLP_PRIV _MultisetTraitsT<_KeyStorageType> _MultisetStorageTraits;
+public:
+ //dums: need the following public for the __move_traits framework
+ typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
+ _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
+ _MultisetStorageTraits, _StorageTypeAlloc> _Rep_type;
+
+private:
+ typedef typename _Rep_type::iterator base_iterator;
+ typedef typename _Rep_type::const_iterator const_base_iterator;
+
+public:
+ typedef typename _Priv_Rep_type::pointer pointer;
+ typedef typename _Priv_Rep_type::const_pointer const_pointer;
+ typedef typename _Priv_Rep_type::reference reference;
+ typedef typename _Priv_Rep_type::const_reference const_reference;
+ typedef typename _Priv_Rep_type::iterator iterator;
+ typedef typename _Priv_Rep_type::const_iterator const_iterator;
+ typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Priv_Rep_type::size_type size_type;
+ typedef typename _Priv_Rep_type::difference_type difference_type;
+ typedef typename _Priv_Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multiset
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+#if defined (_STLP_DEBUG)
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+#else
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._M_node); }
+#endif
+
+public:
+ multiset() : _M_t(_Compare(), _StorageTypeAlloc()) {}
+ explicit multiset(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+# endif
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+
+#else
+ multiset(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ multiset(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ multiset(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc())
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+
+ multiset(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multiset(const _Self& __x)
+ : _M_t(__x._M_t) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ multiset(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
+
+ iterator begin() { return _S_to_value_ite(_M_t.begin()); }
+ iterator end() { return _S_to_value_ite(_M_t.end()); }
+ const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
+ const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ iterator insert(const value_type& __x)
+ { return _S_to_value_ite(_M_t.insert_equal(cast_traits::to_storage_type_cref(__x))); }
+ iterator insert(iterator __pos, const value_type& __x) {
+ return _S_to_value_ite(_M_t.insert_equal(_S_to_storage_ite(__pos),
+ cast_traits::to_storage_type_cref(__x)));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+#else
+ void insert(const value_type* __first, const value_type* __last) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void erase(iterator __pos)
+ { _M_t.erase(_S_to_storage_ite(__pos)); }
+ size_type erase(const key_type& __x)
+ { return _M_t.erase(cast_traits::to_storage_type_cref(__x)); }
+ void erase(iterator __first, iterator __last)
+ { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void clear() { _M_t.clear(); }
+
+ // multiset operations:
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x)
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.count(cast_traits::to_storage_type_crefT(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) {
+ pair<base_iterator, base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ pair<const_base_iterator, const_base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+};
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTR_SPECIALIZED_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/pointers/_slist.h b/build/stlport/stlport/stl/pointers/_slist.h
new file mode 100644
index 000000000..76189fe0e
--- /dev/null
+++ b/build/stlport/stlport/stl/pointers/_slist.h
@@ -0,0 +1,427 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_SLIST_H
+#define _STLP_SPECIALIZED_SLIST_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define SLIST_IMPL _STLP_PTR_IMPL_NAME(slist)
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _Slist_node<void*>;
+typedef _Slist_node<void*> _VoidPtrSNode;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base, _VoidPtrSNode, allocator<_VoidPtrSNode> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Slist_base<void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS SLIST_IMPL<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
+ : public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV SLIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef typename _Base::iterator _BaseIte;
+ typedef typename _Base::const_iterator _BaseConstIte;
+ typedef slist<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Slist_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _Slist_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+
+public:
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit slist(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ slist(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__x), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n) : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+# else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+ insert_after(before_begin(), __first, __last);
+ }
+# endif
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // VC++ needs this crazyness
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_WRAPPER_ITERATOR)
+ : _M_impl(__first, __last) {}
+# else
+ { insert_after(before_begin(), __first, __last); }
+# endif
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ slist(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+ _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ _M_impl.assign(_BaseConstIte(__first._M_node),
+ _BaseConstIte(__last._M_node));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator before_begin() { return iterator(_M_impl.before_begin()._M_node); }
+ const_iterator before_begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.before_begin()._M_node)); }
+
+ iterator begin() { return iterator(_M_impl.begin()._M_node); }
+ const_iterator begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.begin()._M_node));}
+
+ iterator end() { return iterator(_M_impl.end()._M_node); }
+ const_iterator end() const { return iterator(_M_impl.end()._M_node); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+ bool empty() const { return _M_impl.empty(); }
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_front(const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
+
+# if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_front() { _M_impl.push_front();}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_front() { _M_impl.pop_front(); }
+
+ iterator previous(const_iterator __pos)
+ { return iterator(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node); }
+ const_iterator previous(const_iterator __pos) const
+ { return const_iterator(const_cast<_Node_base*>(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node)); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert_after(iterator __pos, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos)
+ { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node))._M_node);}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert_after(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_after_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_after_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert_after(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_after_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert_after(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last)
+ { _M_impl.insert_after(_BaseIte(__pos._M_node),
+ _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos)
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node))._M_node); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node), _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const_iterator __first, const_iterator __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+ void insert(iterator __pos, const value_type* __first, const value_type* __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator erase_after(iterator __pos)
+ { return iterator(_M_impl.erase_after(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase_after(iterator __before_first, iterator __last)
+ { return iterator(_M_impl.erase_after(_BaseIte(__before_first._M_node),
+ _BaseIte(__last._M_node))._M_node); }
+
+ iterator erase(iterator __pos)
+ { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() { _M_impl.clear(); }
+
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__before_first._M_node), _BaseIte(__before_last._M_node)); }
+ void splice_after(iterator __pos, _Self& __x, iterator __prev)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__prev._M_node)); }
+ void splice_after(iterator __pos, _Self& __x)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x, iterator __i)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
+
+ void reverse() { _M_impl.reverse(); }
+
+ void remove(const value_type& __val) { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
+ void unique() { _M_impl.unique(); }
+ void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
+ void sort() {_M_impl.sort(); }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred)
+ { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__pred)); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp)
+ { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (slist)
+# undef slist
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef SLIST_IMPL
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/stl/pointers/_tools.h b/build/stlport/stlport/stl/pointers/_tools.h
new file mode 100644
index 000000000..80cbcfa57
--- /dev/null
+++ b/build/stlport/stlport/stl/pointers/_tools.h
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+#define _STLP_POINTERS_SPEC_TOOLS_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Some usefull declarations:
+template <class _Tp> struct less;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _StorageT, class _ValueT, class _BinaryPredicate>
+struct _BinaryPredWrapper;
+
+/*
+ * Since the compiler only allows at most one non-trivial
+ * implicit conversion we can make use of a shim class to
+ * be sure that functions below doesn't accept classes with
+ * implicit pointer conversion operators
+ */
+struct _VoidPointerShim
+{ _VoidPointerShim(void*); };
+struct _ConstVoidPointerShim
+{ _ConstVoidPointerShim(const void*); };
+struct _VolatileVoidPointerShim
+{ _VolatileVoidPointerShim(volatile void*); };
+struct _ConstVolatileVoidPointerShim
+{ _ConstVolatileVoidPointerShim(const volatile void*); };
+
+//The dispatch functions:
+template <class _Tp>
+char _UseVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseVoidPtrStorageType(const __true_type& /*POD*/, _VoidPointerShim);
+
+template <class _Tp>
+char _UseConstVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseConstVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseConstVoidPtrStorageType(const __true_type& /*POD*/, _ConstVoidPointerShim);
+
+template <class _Tp>
+char _UseVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, _VolatileVoidPointerShim);
+
+template <class _Tp>
+char _UseConstVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, _ConstVolatileVoidPointerShim);
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* Thanks to class partial specialization the pointer specialization feature can even be used in
+ * presence of incomplete type:
+ * struct MyStruct {
+ * typedef vector<MyStruct> MyStructContainer;
+ * typedef MyStructContainer::iterator MyStructIterator;
+ * };
+ */
+
+template <class _Tp>
+struct _StorageType {
+ typedef _Tp _QualifiedType;
+ typedef _Tp _Type;
+ enum { use_const_volatile_void_ptr = 0 };
+};
+
+template <class _Tp>
+struct _StorageType<_Tp*> {
+ // Even if we detect a pointer type we use dispatch function to consider if it can be stored as a void*.
+ // For instance function pointer might not necessarily be convertible to void*.
+ enum { use_void_ptr = (sizeof(_STLP_PRIV _UseVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(_Tp*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ void*,
+ _Tp*>::_Ret _QualifiedType;
+ typedef _QualifiedType _Type;
+};
+
+template <class _Tp>
+struct _StorageType<_Tp const*> {
+ enum { use_void_ptr = (sizeof(_STLP_PRIV _UseConstVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(const _Tp*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ const void*,
+ const _Tp*>::_Ret _QualifiedType;
+ typedef typename __select<use_void_ptr,
+ void*,
+ const _Tp*>::_Ret _Type;
+};
+
+template <class _Tp>
+struct _StorageType<_Tp volatile*> {
+ enum { use_void_ptr = (sizeof(_STLP_PRIV _UseVolatileVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(_Tp volatile*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ volatile void*,
+ volatile _Tp*>::_Ret _QualifiedType;
+ typedef typename __select<use_void_ptr,
+ void*,
+ volatile _Tp*>::_Ret _Type;
+};
+
+template <class _Tp>
+struct _StorageType<_Tp const volatile*> {
+ enum { use_void_ptr = (sizeof(_STLP_PRIV _UseConstVolatileVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(_Tp const volatile*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ const volatile void*,
+ const volatile _Tp*>::_Ret _QualifiedType;
+ typedef typename __select<use_void_ptr,
+ void*,
+ const volatile _Tp*>::_Ret _Type;
+};
+#else
+template <class _Tp>
+struct _StorageType {
+ typedef typename __type_traits<_Tp>::is_POD_type _PODType;
+
+#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ static _Tp __null_rep();
+#else
+ static _Tp __null_rep;
+#endif
+ enum { use_void_ptr = (sizeof(_STLP_PRIV _UseVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_const_void_ptr = (sizeof(_STLP_PRIV _UseConstVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_volatile_void_ptr = (sizeof(_STLP_PRIV _UseVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = (sizeof(_STLP_PRIV _UseConstVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+
+ typedef typename __select<!use_const_volatile_void_ptr,
+ _Tp,
+ typename __select<use_void_ptr,
+ void*,
+ typename __select<use_const_void_ptr,
+ const void*,
+ typename __select<use_volatile_void_ptr,
+ volatile void*,
+ const volatile void*>::_Ret >::_Ret >::_Ret >::_Ret _QualifiedType;
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ /* If the compiler do not support the iterator_traits structure we cannot wrap
+ * iterators pass to container template methods. The iterator dereferenced value
+ * has to be storable without any cast in the chosen storage type. To guaranty
+ * that the void pointer has to be correctly qualified.
+ */
+ typedef _QualifiedType _Type;
+#else
+ /* With iterator_traits we can wrap passed iterators and make the necessary casts.
+ * We can always use a simple void* storage type:
+ */
+ typedef typename __select<use_const_volatile_void_ptr,
+ void*,
+ _Tp>::_Ret _Type;
+#endif
+};
+#endif
+
+template <class _Tp, class _Compare>
+struct _AssocStorageTypes {
+ typedef _StorageType<_Tp> _StorageTypeInfo;
+ typedef typename _StorageTypeInfo::_Type _SType;
+
+ //We need to also check that the comparison functor used to instanciate the assoc container
+ //is the default Standard less implementation:
+ enum { ptr_type = _StorageTypeInfo::use_const_volatile_void_ptr };
+ typedef typename _IsSTLportClass<_Compare>::_Ret _STLportLess;
+ enum { is_default_less = __type2bool<_STLportLess>::_Ret };
+ typedef typename __select<is_default_less, _SType, _Tp>::_Ret _KeyStorageType;
+ typedef typename __select<is_default_less && ptr_type,
+ _BinaryPredWrapper<_KeyStorageType, _Tp, _Compare>,
+ _Compare>::_Ret _CompareStorageType;
+};
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/*
+ * Base struct to deal with qualifiers
+ */
+template <class _StorageT, class _QualifiedStorageT>
+struct _VoidCastTraitsAux {
+ typedef _QualifiedStorageT void_cv_type;
+ typedef _StorageT void_type;
+
+ static void_type * uncv_ptr(void_cv_type *__ptr)
+ { return __ptr; }
+ static void_type const* uncv_cptr(void_cv_type const*__ptr)
+ { return __ptr; }
+ static void_type ** uncv_pptr(void_cv_type **__ptr)
+ { return __ptr; }
+ static void_type & uncv_ref(void_cv_type & __ref)
+ { return __ref; }
+ static void_type const& uncv_cref(void_cv_type const& __ref)
+ { return __ref; }
+ static void_cv_type* cv_ptr(void_type *__ptr)
+ { return __ptr; }
+ static void_cv_type const* cv_cptr(void_type const*__ptr)
+ { return __ptr; }
+ static void_cv_type ** cv_pptr(void_type **__ptr)
+ { return __ptr; }
+ static void_cv_type & cv_ref(void_type & __ref)
+ { return __ref; }
+ static void_cv_type const& cv_cref(void_type const& __ref)
+ { return __ref; }
+};
+
+template <class _VoidCVType>
+struct _VoidCastTraitsAuxBase {
+ typedef _VoidCVType* void_cv_type;
+ typedef void* void_type;
+
+ static void_type* uncv_ptr(void_cv_type *__ptr)
+ { return __CONST_CAST(void_type*, __ptr); }
+ static void_type const* uncv_cptr(void_cv_type const*__ptr)
+ { return __CONST_CAST(void_type const*, __ptr); }
+ static void_type** uncv_pptr(void_cv_type **__ptr)
+ { return __CONST_CAST(void_type**, __ptr); }
+ static void_type& uncv_ref(void_cv_type &__ref)
+ { return __CONST_CAST(void_type&, __ref); }
+ static void_type const& uncv_cref(void_cv_type const& __ptr)
+ { return __CONST_CAST(void_type const&, __ptr); }
+ // The reverse versions
+ static void_cv_type * cv_ptr(void_type *__ptr)
+ { return __CONST_CAST(void_cv_type *, __ptr); }
+ static void_cv_type const* cv_cptr(void_type const*__ptr)
+ { return __CONST_CAST(void_cv_type const*, __ptr); }
+ static void_cv_type ** cv_pptr(void_type **__ptr)
+ { return __CONST_CAST(void_cv_type**, __ptr); }
+ static void_cv_type & cv_ref(void_type &__ref)
+ { return __CONST_CAST(void_cv_type &, __ref); }
+ static void_cv_type const& cv_cref(void_type const& __ref)
+ { return __CONST_CAST(void_cv_type const&, __ref); }
+};
+
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, const void*> : _VoidCastTraitsAuxBase<void const>
+{};
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, volatile void*> : _VoidCastTraitsAuxBase<void volatile>
+{};
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, const volatile void*> : _VoidCastTraitsAuxBase<void const volatile>
+{};
+
+template <class _StorageT, class _ValueT>
+struct _CastTraits {
+ typedef _ValueT value_type;
+ typedef typename _StorageType<_ValueT>::_QualifiedType _QualifiedStorageT;
+ typedef _VoidCastTraitsAux<_StorageT, _QualifiedStorageT> cv_traits;
+ typedef typename cv_traits::void_type void_type;
+ typedef typename cv_traits::void_cv_type void_cv_type;
+
+ static value_type * to_value_type_ptr(void_type *__ptr)
+ { return __REINTERPRET_CAST(value_type *, cv_traits::cv_ptr(__ptr)); }
+ static value_type const* to_value_type_cptr(void_type const*__ptr)
+ { return __REINTERPRET_CAST(value_type const*, cv_traits::cv_cptr(__ptr)); }
+ static value_type ** to_value_type_pptr(void_type **__ptr)
+ { return __REINTERPRET_CAST(value_type **, cv_traits::cv_pptr(__ptr)); }
+ static value_type & to_value_type_ref(void_type &__ref)
+ { return __REINTERPRET_CAST(value_type &, cv_traits::cv_ref(__ref)); }
+ static value_type const& to_value_type_cref(void_type const& __ptr)
+ { return __REINTERPRET_CAST(value_type const&, cv_traits::cv_cref(__ptr)); }
+ // Reverse versions
+ static void_type * to_storage_type_ptr(value_type *__ptr)
+ { return cv_traits::uncv_ptr(__REINTERPRET_CAST(void_cv_type *, __ptr)); }
+ static void_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return cv_traits::uncv_cptr(__REINTERPRET_CAST(void_cv_type const*, __ptr)); }
+ static void_type ** to_storage_type_pptr(value_type **__ptr)
+ { return cv_traits::uncv_pptr(__REINTERPRET_CAST(void_cv_type **, __ptr)); }
+ static void_type const& to_storage_type_cref(value_type const& __ref)
+ { return cv_traits::uncv_cref(__REINTERPRET_CAST(void_cv_type const&, __ref)); }
+
+ //Method used to treat set container template method extension
+ static void_type const& to_storage_type_crefT(value_type const& __ref)
+ { return to_storage_type_cref(__ref); }
+};
+
+template <class _Tp>
+struct _CastTraits<_Tp, _Tp> {
+ typedef _Tp storage_type;
+ typedef _Tp value_type;
+
+ static value_type * to_value_type_ptr(storage_type *__ptr)
+ { return __ptr; }
+ static value_type const* to_value_type_cptr(storage_type const*__ptr)
+ { return __ptr; }
+ static value_type ** to_value_type_pptr(storage_type **__ptr)
+ { return __ptr; }
+ static value_type & to_value_type_ref(storage_type &__ref)
+ { return __ref; }
+ static value_type const& to_value_type_cref(storage_type const&__ref)
+ { return __ref; }
+ // Reverse versions
+ static storage_type * to_storage_type_ptr(value_type *__ptr)
+ { return __ptr; }
+ static storage_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return __ptr; }
+ static storage_type ** to_storage_type_pptr(value_type **__ptr)
+ { return __ptr; }
+ static storage_type const& to_storage_type_cref(value_type const& __ref)
+ { return __ref; }
+
+ //Method used to treat set container template method extension
+ template <class _Tp1>
+ static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
+ { return __ref; }
+};
+
+#define _STLP_USE_ITERATOR_WRAPPER
+
+template <class _StorageT, class _ValueT, class _Iterator>
+struct _IteWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+ typedef iterator_traits<_Iterator> _IteTraits;
+
+ typedef typename _IteTraits::iterator_category iterator_category;
+ typedef _StorageT value_type;
+ typedef typename _IteTraits::difference_type difference_type;
+ typedef value_type* pointer;
+ typedef value_type const& const_reference;
+ //This wrapper won't be used for input so to avoid surprise
+ //the reference type will be a const reference:
+ typedef const_reference reference;
+
+ typedef _IteWrapper<_StorageT, _ValueT, _Iterator> _Self;
+ typedef _Self _Ite;
+
+ _IteWrapper(_Iterator &__ite) : _M_ite(__ite) {}
+
+ const_reference operator*() const
+ // See http://code.google.com/p/android/issues/detail?id=38630
+ //{ return cast_traits::to_storage_type_cref(*_M_ite); }
+ { return __REINTERPRET_CAST(const_reference, *_M_ite); }
+
+ _Self& operator= (_Self const& __rhs) {
+ _M_ite = __rhs._M_ite;
+ return *this;
+ }
+
+ _Self& operator++() {
+ ++_M_ite;
+ return *this;
+ }
+
+ _Self& operator--() {
+ --_M_ite;
+ return *this;
+ }
+
+ _Self& operator += (difference_type __offset) {
+ _M_ite += __offset;
+ return *this;
+ }
+ difference_type operator -(_Self const& __other) const
+ { return _M_ite - __other._M_ite; }
+
+ bool operator == (_Self const& __other) const
+ { return _M_ite == __other._M_ite; }
+
+ bool operator != (_Self const& __other) const
+ { return _M_ite != __other._M_ite; }
+
+ bool operator < (_Self const& __rhs) const
+ { return _M_ite < __rhs._M_ite; }
+
+private:
+ _Iterator _M_ite;
+};
+
+template <class _Tp, class _Iterator>
+struct _IteWrapper<_Tp, _Tp, _Iterator>
+{ typedef _Iterator _Ite; };
+
+#else
+
+/*
+ * In this config the storage type is qualified in respect of the
+ * value_type qualification. Simple reinterpret_cast is enough.
+ */
+template <class _StorageT, class _ValueT>
+struct _CastTraits {
+ typedef _StorageT storage_type;
+ typedef _ValueT value_type;
+
+ static value_type * to_value_type_ptr(storage_type *__ptr)
+ { return __REINTERPRET_CAST(value_type*, __ptr); }
+ static value_type const* to_value_type_cptr(storage_type const*__ptr)
+ { return __REINTERPRET_CAST(value_type const*, __ptr); }
+ static value_type ** to_value_type_pptr(storage_type **__ptr)
+ { return __REINTERPRET_CAST(value_type **, __ptr); }
+ static value_type & to_value_type_ref(storage_type &__ref)
+ { return __REINTERPRET_CAST(value_type&, __ref); }
+ static value_type const& to_value_type_cref(storage_type const&__ref)
+ { return __REINTERPRET_CAST(value_type const&, __ref); }
+ // Reverse versions
+ static storage_type * to_storage_type_ptr(value_type *__ptr)
+ { return __REINTERPRET_CAST(storage_type*, __ptr); }
+ static storage_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return __REINTERPRET_CAST(storage_type const*, __ptr); }
+ static storage_type ** to_storage_type_pptr(value_type **__ptr)
+ { return __REINTERPRET_CAST(storage_type **, __ptr); }
+ static storage_type const& to_storage_type_cref(value_type const&__ref)
+ { return __REINTERPRET_CAST(storage_type const&, __ref); }
+ template <class _Tp1>
+ static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
+ { return __ref; }
+};
+
+#endif
+
+//Wrapper functors:
+template <class _StorageT, class _ValueT, class _UnaryPredicate>
+struct _UnaryPredWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ _UnaryPredWrapper (_UnaryPredicate const& __pred) : _M_pred(__pred) {}
+
+ bool operator () (_StorageT const& __ref) const
+ { return _M_pred(cast_traits::to_value_type_cref(__ref)); }
+
+private:
+ _UnaryPredicate _M_pred;
+};
+
+template <class _StorageT, class _ValueT, class _BinaryPredicate>
+struct _BinaryPredWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ _BinaryPredWrapper () {}
+ _BinaryPredWrapper (_BinaryPredicate const& __pred) : _M_pred(__pred) {}
+
+ _BinaryPredicate get_pred() const { return _M_pred; }
+
+ bool operator () (_StorageT const& __fst, _StorageT const& __snd) const
+ { return _M_pred(cast_traits::to_value_type_cref(__fst), cast_traits::to_value_type_cref(__snd)); }
+
+ //Cast operator used to transparently access underlying predicate
+ //in set::key_comp() method
+ operator _BinaryPredicate() const
+ { return _M_pred; }
+
+private:
+ _BinaryPredicate _M_pred;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_POINTERS_SPEC_TOOLS_H */
diff --git a/build/stlport/stlport/stl/pointers/_vector.h b/build/stlport/stlport/stl/pointers/_vector.h
new file mode 100644
index 000000000..64705bf24
--- /dev/null
+++ b/build/stlport/stlport/stl/pointers/_vector.h
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_VECTOR_H
+#define _STLP_SPECIALIZED_VECTOR_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define VECTOR_IMPL _STLP_PTR_IMPL_NAME(vector)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV _Vector_base<void*,allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV VECTOR_IMPL<void*, allocator<void*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class vector
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
+ : public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+ /* In the vector implementation iterators are pointer which give a number
+ * of opportunities for optimization. To not break those optimizations
+ * iterators passed to template should not be wrapped for casting purpose.
+ * So vector implementation will always use a qualified void pointer type and
+ * won't use iterator wrapping.
+ */
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_QualifiedType _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV VECTOR_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ iterator begin() { return cast_traits::to_value_type_ptr(_M_impl.begin()); }
+ const_iterator begin() const { return cast_traits::to_value_type_cptr(_M_impl.begin()); }
+ iterator end() { return cast_traits::to_value_type_ptr(_M_impl.end()); }
+ const_iterator end() const { return cast_traits::to_value_type_cptr(_M_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+
+ size_type capacity() const { return _M_impl.capacity(); }
+ bool empty() const { return _M_impl.empty(); }
+
+ reference operator[](size_type __n) { return cast_traits::to_value_type_ref(_M_impl[__n]); }
+ const_reference operator[](size_type __n) const { return cast_traits::to_value_type_cref(_M_impl[__n]); }
+
+ reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
+ const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
+ reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
+ const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
+
+ reference at(size_type __n) { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
+ const_reference at(size_type __n) const { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ vector(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n)
+ : _M_impl(__n, allocator_type() ) {}
+#endif
+
+ vector(const _Self& __x)
+ : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ explicit vector(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
+ : _M_impl(__first, __last,
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _M_impl(__first, __last) {}
+# endif
+
+#else
+ vector(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void reserve(size_type __n) {_M_impl.reserve(__n);}
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last)
+ { _M_impl.assign(__first, __last); }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_back(const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return cast_traits::to_value_type_ptr(_M_impl.insert(cast_traits::to_storage_type_ptr(__pos),
+ cast_traits::to_storage_type_cref(__x))); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back() { _M_impl.push_back(); }
+ iterator insert(iterator __pos)
+ { return _M_impl.insert(cast_traits::to_storage_type_ptr(__pos)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last)
+ { _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __first, __last); }
+#else
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+ _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif
+
+ void insert (iterator __pos, size_type __n, const value_type& __x) {
+ _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __n, cast_traits::to_storage_type_cref(__x));
+ }
+
+ void pop_back() {_M_impl.pop_back();}
+ iterator erase(iterator __pos)
+ {return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__pos)));}
+ iterator erase(iterator __first, iterator __last) {
+ return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__first),
+ cast_traits::to_storage_type_ptr(__last)));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() { _M_impl.clear(); }
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef VECTOR_IMPL
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_VECTOR_H */
diff --git a/build/stlport/stlport/stl/type_manips.h b/build/stlport/stlport/stl/type_manips.h
new file mode 100644
index 000000000..410b59d25
--- /dev/null
+++ b/build/stlport/stlport/stl/type_manips.h
@@ -0,0 +1,321 @@
+/*
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+#ifndef _STLP_TYPE_MANIPS_H
+#define _STLP_TYPE_MANIPS_H
+
+_STLP_BEGIN_NAMESPACE
+
+struct __true_type {};
+struct __false_type {};
+
+#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+using _STLP_STD::__true_type;
+using _STLP_STD::__false_type;
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+//bool to type
+template <int _Is>
+struct __bool2type
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct __bool2type<1> { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct __bool2type<0> { typedef __false_type _Ret; };
+
+//type to bool
+template <class __bool_type>
+struct __type2bool { enum {_Ret = 1}; };
+
+_STLP_TEMPLATE_NULL
+struct __type2bool<__true_type> { enum {_Ret = 1}; };
+
+_STLP_TEMPLATE_NULL
+struct __type2bool<__false_type> { enum {_Ret = 0}; };
+
+//Negation
+template <class _BoolType>
+struct _Not { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Not<__false_type> { typedef __true_type _Ret; };
+
+// logical and of 2 predicated
+template <class _P1, class _P2>
+struct _Land2 { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Land2<__true_type, __true_type> { typedef __true_type _Ret; };
+
+// logical and of 3 predicated
+template <class _P1, class _P2, class _P3>
+struct _Land3 { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Land3<__true_type, __true_type, __true_type> { typedef __true_type _Ret; };
+
+//logical or of 2 predicated
+template <class _P1, class _P2>
+struct _Lor2 { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Lor2<__false_type, __false_type> { typedef __false_type _Ret; };
+
+// logical or of 3 predicated
+template <class _P1, class _P2, class _P3>
+struct _Lor3 { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Lor3<__false_type, __false_type, __false_type> { typedef __false_type _Ret; };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template __select
+// Selects one of two types based upon a boolean constant
+// Invocation: __select<_Cond, T, U>::Result
+// where:
+// flag is a compile-time boolean constant
+// T and U are types
+// Result evaluates to T if flag is true, and to U otherwise.
+////////////////////////////////////////////////////////////////////////////////
+// BEWARE: If the compiler do not support partial template specialization or nested template
+//classes the default behavior of the __select is to consider the condition as false and so return
+//the second template type!!
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if defined (__BORLANDC__)
+template <class _CondT, class _Tp1, class _Tp2>
+struct __selectT { typedef _Tp1 _Ret; };
+
+template <class _Tp1, class _Tp2>
+struct __selectT<__false_type, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
+# endif
+
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)
+template <bool _Cond, class _Tp1, class _Tp2>
+struct __select { typedef _Tp1 _Ret; };
+
+template <class _Tp1, class _Tp2>
+struct __select<false, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
+# else
+template <bool _Cond, class _Tp1, class _Tp2>
+struct __select
+{ typedef __selectT<typename __bool2type<_Cond>::_Ret, _Tp1, _Tp2>::_Ret _Ret; };
+# endif
+
+#else
+
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+template <int _Cond>
+struct __select_aux {
+ template <class _Tp1, class _Tp2>
+ struct _In {
+ typedef _Tp1 _Ret;
+ };
+};
+
+_STLP_TEMPLATE_NULL
+struct __select_aux<0> {
+ template <class _Tp1, class _Tp2>
+ struct _In {
+ typedef _Tp2 _Ret;
+ };
+};
+
+template <int _Cond, class _Tp1, class _Tp2>
+struct __select {
+ typedef typename __select_aux<_Cond>::_STLP_TEMPLATE _In<_Tp1, _Tp2>::_Ret _Ret;
+};
+# else /* _STLP_MEMBER_TEMPLATE_CLASSES */
+//default behavior
+template <int _Cond, class _Tp1, class _Tp2>
+struct __select {
+ typedef _Tp2 _Ret;
+};
+# endif /* _STLP_MEMBER_TEMPLATE_CLASSES */
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+/* Rather than introducing a new macro for the following constrution we use
+ * an existing one (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) that
+ * is used for a similar feature.
+ */
+#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \
+ (!defined (__GNUC__) || (__GNUC__ > 2))
+// Helper struct that will forbid volatile qualified types:
+# if !defined (__BORLANDC__)
+struct _NoVolatilePointerShim { _NoVolatilePointerShim(const void*); };
+template <class _Tp>
+char _STLP_CALL _IsCopyableFun(bool, _NoVolatilePointerShim, _Tp const*, _Tp*); // no implementation is required
+char* _STLP_CALL _IsCopyableFun(bool, ...); // no implementation is required
+
+template <class _Src, class _Dst>
+struct _Copyable {
+ static _Src* __null_src();
+ static _Dst* __null_dst();
+ enum { _Ret = (sizeof(_IsCopyableFun(false, __null_src(), __null_src(), __null_dst())) == sizeof(char)) };
+ typedef typename __bool2type<_Ret>::_Ret _RetT;
+};
+# else
+template <class _Tp1, class _Tp2> struct _AreSameTypes;
+template <class _Tp> struct _IsUnQual;
+template <class _Src, class _Dst>
+struct _Copyable {
+ typedef typename _AreSameTypes<_Src, _Dst>::_Ret _Tr1;
+ typedef typename _IsUnQual<_Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _RetT;
+ enum { _Ret = __type2bool<_RetT>::_Ret };
+};
+# endif
+#else
+template <class _Src, class _Dst>
+struct _Copyable {
+ enum { _Ret = 0 };
+ typedef __false_type _RetT;
+};
+#endif
+
+/*
+ * The following struct will tell you if 2 types are the same and if copying memory
+ * from the _Src type to the _Dst type is right considering qualifiers. If _Src and
+ * _Dst types are the same unqualified types _Ret will be false if:
+ * - any of the type has the volatile qualifier
+ * - _Dst is const qualified
+ */
+template <class _Src, class _Dst>
+struct _AreCopyable {
+ enum { _Same = _Copyable<_Src, _Dst>::_Ret };
+ typedef typename _Copyable<_Src, _Dst>::_RetT _Ret;
+};
+
+template <class _Tp1, class _Tp2>
+struct _AreSameTypes {
+ enum { _Same = 0 };
+ typedef __false_type _Ret;
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct _AreSameTypes<_Tp, _Tp> {
+ enum { _Same = 1 };
+ typedef __true_type _Ret;
+};
+#endif
+
+#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+template <class _Src, class _Dst>
+struct _ConversionHelper {
+ static char _Test(bool, _Dst);
+ static char* _Test(bool, ...);
+ static _Src _MakeSource();
+};
+
+template <class _Src, class _Dst>
+struct _IsConvertible {
+ typedef _ConversionHelper<_Src*, const volatile _Dst*> _H;
+ enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
+ typedef typename __bool2type<value>::_Ret _Ret;
+};
+
+# if defined (__BORLANDC__)
+# if (__BORLANDC__ < 0x590)
+template<class _Tp>
+struct _UnConstPtr { typedef _Tp _Type; };
+
+template<class _Tp>
+struct _UnConstPtr<_Tp*> { typedef _Tp _Type; };
+
+template<class _Tp>
+struct _UnConstPtr<const _Tp*> { typedef _Tp _Type; };
+# endif
+
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp>
+struct _IsConst { typedef __false_type _Ret; };
+# else
+template <class _Tp>
+struct _IsConst { typedef _AreSameTypes<_Tp, const _Tp>::_Ret _Ret; };
+# endif
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp>
+struct _IsConst <const _Tp> { typedef __true_type _Ret; };
+# endif
+
+# if (__BORLANDC__ < 0x590)
+template<class _Tp>
+struct _IsConst<_Tp*> { typedef _AreSameTypes<_Tp*, const _Tp*>::_Ret _Ret; };
+# endif
+template <class _Tp>
+struct _IsVolatile { typedef _AreSameTypes<_Tp, volatile _Tp>::_Ret _Ret; };
+
+template<class _Tp>
+struct _IsUnQual {
+ typedef _IsConst<_Tp>::_Ret _Tr1;
+ typedef _IsVolatile<_Tp>::_Ret _Tr2;
+ typedef _Not<_Tr1>::_Ret _NotCon;
+ typedef _Not<_Tr2>::_Ret _NotVol;
+ typedef _Land2<_NotCon, _NotVol>::_Ret _Ret;
+};
+
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp> struct _UnQual { typedef _Tp _Type; };
+template <class _Tp> struct _UnQual<const _Tp> { typedef _Tp _Type; };
+template <class _Tp> struct _UnQual<volatile _Tp> { typedef _Tp _Type; };
+template <class _Tp> struct _UnQual<const volatile _Tp> { typedef _Tp _Type; };
+# endif
+# endif
+
+/* This struct is intended to say if a pointer can be convertible to an other
+ * taking into account cv qualifications. It shouldn't be instanciated with
+ * something else than pointer type as it uses pass by value parameter that
+ * results in compilation error when parameter type has a special memory
+ * alignment
+ */
+template <class _Src, class _Dst>
+struct _IsCVConvertible {
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)
+ typedef _ConversionHelper<_Src, _Dst> _H;
+ enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
+# else
+ enum { _Is1 = __type2bool<_IsConst<_Src>::_Ret>::_Ret };
+ enum { _Is2 = _IsConvertible<_UnConstPtr<_Src>::_Type, _UnConstPtr<_Dst>::_Type>::value };
+ enum { value = _Is1 ? 0 : _Is2 };
+# endif
+ typedef typename __bool2type<value>::_Ret _Ret;
+};
+
+#else
+template <class _Src, class _Dst>
+struct _IsConvertible {
+ enum { value = 0 };
+ typedef __false_type _Ret;
+};
+
+template <class _Src, class _Dst>
+struct _IsCVConvertible {
+ enum { value = 0 };
+ typedef __false_type _Ret;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TYPE_MANIPS_H */
diff --git a/build/stlport/stlport/stl/type_traits.h b/build/stlport/stlport/stl/type_traits.h
new file mode 100644
index 000000000..af0923d03
--- /dev/null
+++ b/build/stlport/stlport/stl/type_traits.h
@@ -0,0 +1,626 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_TYPE_TRAITS_H
+#define _STLP_TYPE_TRAITS_H
+
+/*
+This header file provides a framework for allowing compile time dispatch
+based on type attributes. This is useful when writing template code.
+For example, when making a copy of an array of an unknown type, it helps
+to know if the type has a trivial copy constructor or not, to help decide
+if a memcpy can be used.
+
+The class template __type_traits provides a series of typedefs each of
+which is either __true_type or __false_type. The argument to
+__type_traits can be any type. The typedefs within this template will
+attain their correct values by one of these means:
+ 1. The general instantiation contain conservative values which work
+ for all types.
+ 2. Specializations may be declared to make distinctions between types.
+ 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers)
+ will automatically provide the appropriate specializations for all
+ types.
+
+EXAMPLE:
+
+//Copy an array of elements which have non-trivial copy constructors
+template <class T> void copy(T* source, T* destination, int n, __false_type);
+//Copy an array of elements which have trivial copy constructors. Use memcpy.
+template <class T> void copy(T* source, T* destination, int n, __true_type);
+
+//Copy an array of any type by using the most efficient copy mechanism
+template <class T> inline void copy(T* source,T* destination,int n) {
+ copy(source, destination, n,
+ typename __type_traits<T>::has_trivial_copy_constructor());
+}
+*/
+
+#ifdef __WATCOMC__
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_TYPE_MANIPS_H
+# include <stl/type_manips.h>
+#endif
+
+#ifdef _STLP_USE_BOOST_SUPPORT
+# include <stl/boost_type_traits.h>
+# include <boost/type_traits/add_reference.hpp>
+# include <boost/type_traits/add_const.hpp>
+#endif /* _STLP_USE_BOOST_SUPPORT */
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_USE_BOOST_SUPPORT)
+
+// The following could be written in terms of numeric_limits.
+// We're doing it separately to reduce the number of dependencies.
+
+template <class _Tp> struct _IsIntegral
+{ typedef __false_type _Ret; };
+
+# ifndef _STLP_NO_BOOL
+_STLP_TEMPLATE_NULL struct _IsIntegral<bool>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_NO_BOOL */
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<char>
+{ typedef __true_type _Ret; };
+
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_TEMPLATE_NULL struct _IsIntegral<signed char>
+{ typedef __true_type _Ret; };
+# endif
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned char>
+{ typedef __true_type _Ret; };
+
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_TEMPLATE_NULL struct _IsIntegral<wchar_t>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_HAS_WCHAR_T */
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<short>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned short>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<int>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned int>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<long>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned long>
+{ typedef __true_type _Ret; };
+
+# ifdef _STLP_LONG_LONG
+_STLP_TEMPLATE_NULL struct _IsIntegral<_STLP_LONG_LONG>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned _STLP_LONG_LONG>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_LONG_LONG */
+
+template <class _Tp> struct _IsRational
+{ typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsRational<float>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsRational<double>
+{ typedef __true_type _Ret; };
+
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+_STLP_TEMPLATE_NULL struct _IsRational<long double>
+{ typedef __true_type _Ret; };
+# endif
+
+// Forward declarations.
+template <class _Tp> struct __type_traits;
+template <class _IsPOD> struct __type_traits_aux {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_TEMPLATE_NULL
+struct __type_traits_aux<__false_type> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_TEMPLATE_NULL
+struct __type_traits_aux<__true_type> {
+ typedef __true_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __true_type is_POD_type;
+};
+
+template <class _Tp>
+struct _IsRef {
+ typedef __false_type _Ret;
+};
+
+# if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+/*
+ * Boris : simulation technique is used here according to Adobe Open Source License Version 1.0.
+ * Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.
+ * Authors: Mat Marcus and Jesse Jones
+ * The original version of this source code may be found at
+ * http://opensource.adobe.com.
+ */
+
+struct _PointerShim {
+ /*
+ * Since the compiler only allows at most one non-trivial
+ * implicit conversion we can make use of a shim class to
+ * be sure that IsPtr below doesn't accept classes with
+ * implicit pointer conversion operators
+ */
+ _PointerShim(const volatile void*); // no implementation
+};
+
+// These are the discriminating functions
+char _STLP_CALL _IsP(bool, _PointerShim); // no implementation is required
+char* _STLP_CALL _IsP(bool, ...); // no implementation is required
+
+template <class _Tp>
+struct _IsPtr {
+ /*
+ * This template meta function takes a type T
+ * and returns true exactly when T is a pointer.
+ * One can imagine meta-functions discriminating on
+ * other criteria.
+ */
+ static _Tp& __null_rep();
+ enum { _Ptr = (sizeof(_IsP(false,__null_rep())) == sizeof(char)) };
+ typedef typename __bool2type<_Ptr>::_Ret _Ret;
+
+};
+
+// we make general case dependant on the fact the type is actually a pointer.
+template <class _Tp>
+struct __type_traits : __type_traits_aux<typename _IsPtr<_Tp>::_Ret> {};
+
+# else /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
+
+template <class _Tp> struct _IsPtr {
+ typedef __false_type _Ret;
+};
+
+template <class _Tp>
+struct __type_traits {
+ typedef __true_type this_dummy_member_must_be_first;
+ /* Do not remove this member. It informs a compiler which
+ automatically specializes __type_traits that this
+ __type_traits template is special. It just makes sure that
+ things work if an implementation is using a template
+ called __type_traits for something unrelated. */
+
+ /* The following restrictions should be observed for the sake of
+ compilers which automatically produce type specific specializations
+ of this class:
+ - You may reorder the members below if you wish
+ - You may remove any of the members below if you wish
+ - You must not rename members without making the corresponding
+ name change in the compiler
+ - Members you add will be treated like regular members unless
+
+ you add the appropriate support in the compiler. */
+# if !defined (_STLP_HAS_TYPE_TRAITS_INTRINSICS)
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+# else
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_CONSTRUCTOR(_Tp)>::_Ret has_trivial_default_constructor;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_COPY(_Tp)>::_Ret has_trivial_copy_constructor;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_ASSIGN(_Tp)>::_Ret has_trivial_assignment_operator;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_DESTRUCTOR(_Tp)>::_Ret has_trivial_destructor;
+ typedef typename __bool2type<_STLP_IS_POD(_Tp)>::_Ret is_POD_type;
+# endif
+};
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp> struct _IsPtr<_Tp*>
+{ typedef __true_type _Ret; };
+template <class _Tp> struct _IsRef<_Tp&>
+{ typedef __true_type _Ret; };
+
+template <class _Tp> struct __type_traits<_Tp*> : __type_traits_aux<__true_type>
+{};
+# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+# endif /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
+
+// Provide some specializations. This is harmless for compilers that
+// have built-in __types_traits support, and essential for compilers
+// that don't.
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
+_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< const Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< volatile Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< const volatile Type > : __type_traits_aux<__true_type> {}
+# else
+# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
+_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {};
+# endif
+
+# ifndef _STLP_NO_BOOL
+_STLP_DEFINE_TYPE_TRAITS_FOR(bool);
+# endif /* _STLP_NO_BOOL */
+_STLP_DEFINE_TYPE_TRAITS_FOR(char);
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_DEFINE_TYPE_TRAITS_FOR(signed char);
+# endif
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned char);
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_DEFINE_TYPE_TRAITS_FOR(wchar_t);
+# endif /* _STLP_HAS_WCHAR_T */
+
+_STLP_DEFINE_TYPE_TRAITS_FOR(short);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned short);
+_STLP_DEFINE_TYPE_TRAITS_FOR(int);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned int);
+_STLP_DEFINE_TYPE_TRAITS_FOR(long);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned long);
+
+# ifdef _STLP_LONG_LONG
+_STLP_DEFINE_TYPE_TRAITS_FOR(_STLP_LONG_LONG);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned _STLP_LONG_LONG);
+# endif /* _STLP_LONG_LONG */
+
+_STLP_DEFINE_TYPE_TRAITS_FOR(float);
+_STLP_DEFINE_TYPE_TRAITS_FOR(double);
+
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+_STLP_DEFINE_TYPE_TRAITS_FOR(long double);
+# endif
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf
+{ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
+
+template <class _Src, class _Dst>
+struct _IsCVConvertibleIf<__false_type, _Src, _Dst>
+{ typedef __false_type _Ret; };
+# else
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+template <class _ArePtrs>
+struct _IsCVConvertibleIfAux {
+ template <class _Src, class _Dst>
+ struct _In
+ { typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
+};
+
+_STLP_TEMPLATE_NULL
+struct _IsCVConvertibleIfAux<__false_type> {
+ template <class _Src, class _Dst>
+ struct _In
+ { typedef __false_type _Ret; };
+};
+
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf {
+ typedef typename _IsCVConvertibleIfAux<_ArePtrs>::_STLP_TEMPLATE _In<_Src, _Dst>::_Ret _Ret;
+};
+# else
+/* default behavior: we prefer to miss an optimization rather than taking the risk of
+ * a compilation error if playing with types with exotic memory alignment.
+ */
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf
+{ typedef __false_type _Ret; };
+# endif
+# endif
+
+template <class _Src, class _Dst>
+struct _TrivialNativeTypeCopy {
+ typedef typename _IsPtr<_Src>::_Ret _Ptr1;
+ typedef typename _IsPtr<_Dst>::_Ret _Ptr2;
+ typedef typename _Land2<_Ptr1, _Ptr2>::_Ret _BothPtrs;
+ typedef typename _IsCVConvertibleIf<_BothPtrs, _Src, _Dst>::_Ret _Convertible;
+ typedef typename _Land2<_BothPtrs, _Convertible>::_Ret _Trivial1;
+
+ typedef typename __bool2type<(sizeof(_Src) == sizeof(_Dst))>::_Ret _SameSize;
+
+#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x564)
+ typedef typename _IsIntegral<_Src>::_Ret _Int1;
+#else
+ typedef typename _UnQual<_Src>::_Type _UnQuSrc;
+ typedef typename _IsIntegral<_UnQuSrc>::_Ret _Int1;
+#endif
+ typedef typename _IsIntegral<_Dst>::_Ret _Int2;
+ typedef typename _Land2<_Int1, _Int2>::_Ret _BothInts;
+
+ typedef typename _IsRational<_Src>::_Ret _Rat1;
+ typedef typename _IsRational<_Dst>::_Ret _Rat2;
+ typedef typename _Land2<_Rat1, _Rat2>::_Ret _BothRats;
+
+ typedef typename _Lor2<_BothInts, _BothRats>::_Ret _BothNatives;
+#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
+ typedef typename _Land2<_BothNatives, _SameSize>::_Ret _Trivial2;
+#else
+ typedef typename _IsUnQual<_Dst>::_Ret _UnQualDst;
+ typedef typename _Land3<_BothNatives, _SameSize, _UnQualDst>::_Ret _Trivial2;
+#endif
+ typedef typename _Lor2<_Trivial1, _Trivial2>::_Ret _Ret;
+};
+
+template <class _Src, class _Dst>
+struct _TrivialCopy {
+ typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
+# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Src>::has_trivial_assignment_operator _Tr1;
+# else
+ typedef typename _UnConstPtr<_Src*>::_Type _UnConstSrc;
+ typedef typename __type_traits<_UnConstSrc>::has_trivial_assignment_operator _Tr1;
+# endif
+ typedef typename _AreCopyable<_Src, _Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
+ typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Src, class _Dst>
+struct _TrivialUCopy {
+ typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
+# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Src>::has_trivial_copy_constructor _Tr1;
+# else
+ typedef typename _UnConstPtr<_Src*>::_Type _UnConstSrc;
+ typedef typename __type_traits<_UnConstSrc>::has_trivial_copy_constructor _Tr1;
+# endif
+ typedef typename _AreCopyable<_Src, _Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
+ typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp>
+struct _DefaultZeroValue {
+ typedef typename _IsIntegral<_Tp>::_Ret _Tr1;
+ typedef typename _IsRational<_Tp>::_Ret _Tr2;
+ typedef typename _IsPtr<_Tp>::_Ret _Tr3;
+ typedef typename _Lor3<_Tr1, _Tr2, _Tr3>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct _TrivialInit {
+# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Tr1;
+# else
+ typedef typename _UnConstPtr<_Tp*>::_Type _Tp1;
+ typedef typename __type_traits<_Tp1>::has_trivial_copy_constructor _Tr1;
+# endif
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
+ typedef typename _Not<_Tr2>::_Ret _Tr3;
+ typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+#endif /* !_STLP_USE_BOOST_SUPPORT */
+
+template <class _Tp>
+struct _IsPtrType {
+ typedef typename _IsPtr<_Tp>::_Ret _Type;
+ static _Type _Ret() { return _Type(); }
+};
+
+template <class _Tp>
+struct _IsRefType {
+ typedef typename _IsRef<_Tp>::_Ret _Type;
+ static _Type _Ret() { return _Type();}
+};
+
+template <class _Tp>
+struct __call_traits {
+#if defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef typename __select< ::boost::is_reference<_Tp>::value,
+ typename ::boost::add_const<_Tp>::type,
+ typename ::boost::add_reference< typename ::boost::add_const<_Tp>::type >::type>::_Ret const_param_type;
+ typedef typename __select< ::boost::is_reference<_Tp>::value,
+ typename ::boost::remove_const<_Tp>::type,
+ typename ::boost::add_reference<_Tp>::type>::_Ret param_type;
+#else
+ typedef const _Tp& const_param_type;
+ typedef _Tp& param_type;
+#endif
+};
+
+#if !defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __call_traits<_Tp&> {
+ typedef _Tp& param_type;
+ typedef const _Tp& const_param_type;
+};
+template <class _Tp>
+struct __call_traits<const _Tp&> {
+ typedef _Tp& param_type;
+ typedef const _Tp& const_param_type;
+};
+#endif
+
+template <class _Tp1, class _Tp2>
+struct _BothPtrType {
+ typedef typename _IsPtr<_Tp1>::_Ret _IsPtr1;
+ typedef typename _IsPtr<_Tp2>::_Ret _IsPtr2;
+
+ typedef typename _Land2<_IsPtr1, _IsPtr2>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
+struct _OKToSwap {
+ typedef typename _AreSameTypes<_Tp1, _Tp2>::_Ret _Same;
+ typedef typename _Land3<_Same, _IsRef1, _IsRef2>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
+inline _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>
+_IsOKToSwap(_Tp1*, _Tp2*, const _IsRef1&, const _IsRef2&)
+{ return _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>(); }
+
+template <class _Src, class _Dst>
+inline _TrivialCopy<_Src, _Dst> _UseTrivialCopy(_Src*, _Dst*)
+{ return _TrivialCopy<_Src, _Dst>(); }
+
+template <class _Src, class _Dst>
+inline _TrivialUCopy<_Src, _Dst> _UseTrivialUCopy(_Src*, _Dst*)
+{ return _TrivialUCopy<_Src, _Dst>(); }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (__BORLANDC__) || \
+ defined (__DMC__)
+struct _NegativeAnswer {
+ typedef __false_type _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialCopy(_Src*, const _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialCopy(_Src*, volatile _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialCopy(_Src*, const volatile _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialUCopy(_Src*, const _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialUCopy(_Src*, volatile _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialUCopy(_Src*, const volatile _Dst*)
+{ return _NegativeAnswer(); }
+#endif
+
+template <class _Tp>
+inline _TrivialInit<_Tp> _UseTrivialInit(_Tp*)
+{ return _TrivialInit<_Tp>(); }
+
+template <class _Tp>
+struct _IsPOD {
+ typedef typename __type_traits<_Tp>::is_POD_type _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp>
+inline _IsPOD<_Tp> _Is_POD(_Tp*)
+{ return _IsPOD<_Tp>(); }
+
+template <class _Tp>
+struct _DefaultZeroValueQuestion {
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp>
+inline _DefaultZeroValueQuestion<_Tp> _HasDefaultZeroValue(_Tp*)
+{ return _DefaultZeroValueQuestion<_Tp>(); }
+
+/*
+ * Base class used:
+ * - to simulate partial template specialization
+ * - to simulate partial function ordering
+ * - to recognize STLport class from user specialized one
+ */
+template <class _Tp>
+struct __stlport_class
+{ typedef _Tp _Type; };
+
+template <class _Tp>
+struct _IsSTLportClass {
+ typedef typename _IsConvertible<_Tp, __stlport_class<_Tp> >::_Ret _Ret;
+#if defined (__BORLANDC__)
+ enum { _Is = _IsConvertible<_Tp, __stlport_class<_Tp> >::value };
+#endif
+};
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Tp>
+struct _SwapImplemented {
+ typedef typename _IsSTLportClass<_Tp>::_Ret _Ret;
+# if defined (__BORLANDC__)
+ enum { _Is = _IsSTLportClass<_Tp>::_Is };
+# endif
+};
+#endif
+
+template <class _Tp>
+class _TpWithState : private _Tp {
+ _TpWithState();
+ int _state;
+};
+
+/* This is an internal helper struct used to guess if we are working
+ * on a stateless class. It can only be instanciated with a class type. */
+template <class _Tp>
+struct _IsStateless {
+ enum { _Is = sizeof(_TpWithState<_Tp>) == sizeof(int) };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+};
+
+_STLP_END_NAMESPACE
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+# if defined (__BORLANDC__) || \
+ defined (__SUNPRO_CC) || \
+ (defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
+ (defined (__sgi) && defined (_COMPILER_VERSION)) || \
+ defined (__DMC__)
+# define _STLP_IS_POD_ITER(_It, _Tp) __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
+# else
+# define _STLP_IS_POD_ITER(_It, _Tp) typename __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
+# endif
+#else
+# define _STLP_IS_POD_ITER(_It, _Tp) _Is_POD( _STLP_VALUE_TYPE( _It, _Tp ) )._Answer()
+#endif
+
+#endif /* _STLP_TYPE_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/streambuf b/build/stlport/stlport/streambuf
new file mode 100644
index 000000000..f4dc2533d
--- /dev/null
+++ b/build/stlport/stlport/streambuf
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_STREAMBUF
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1066
+# include <stl/_prolog.h>
+# define _STLP_STREAMBUF
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1066) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1066) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <streambuf>
+# else
+# include _STLP_NATIVE_HEADER(streambuf)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1066)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STREAMBUF */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/streambuf.h b/build/stlport/stlport/streambuf.h
new file mode 100644
index 000000000..ff2bff517
--- /dev/null
+++ b/build/stlport/stlport/streambuf.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_STREAMBUF_H
+#define _STLP_STREAMBUF_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2067
+# include <stl/_prolog.h>
+#endif
+
+#include <stl/_ioserr.h>
+
+#include <streambuf>
+
+#include <ios.h>
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+_STLP_USING_NAMESPACE(stlport)
+# else
+using _STLP_STD::basic_streambuf;
+using _STLP_STD::streambuf;
+# ifndef _STLP_NO_WCHAR_T
+using _STLP_STD::wstreambuf;
+# endif
+# endif
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2067)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STREAMBUF_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/string b/build/stlport/stlport/string
new file mode 100644
index 000000000..74d458951
--- /dev/null
+++ b/build/stlport/stlport/string
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x68
+# include <stl/_prolog.h>
+# define _STLP_STRING
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
+# ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+# endif
+
+# ifndef _STLP_STRING_HASH_H
+# include <stl/_string_hash.h>
+# endif
+
+# if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_STRING_IO_H)
+# include <stl/_string_io.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x68) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string>
+# else
+# include _STLP_NATIVE_HEADER(string)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRING */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/string.h b/build/stlport/stlport/string.h
new file mode 100644
index 000000000..52013cfb4
--- /dev/null
+++ b/build/stlport/stlport/string.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include string.h, which results in warnings and errors
+ */
+#ifndef _STLP_STRING_H
+
+#if !defined (RC_INVOKED)
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x269
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x269) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_STRING_H
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+# if (_STLP_OUTERMOST_HEADER_ID != 0x269) || defined (_STLP_DONT_POP_HEADER_ID)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string.h>
+# else
+# include _STLP_NATIVE_C_HEADER(string.h)
+# endif
+# else
+# if defined (__BORLANDC__) && !defined (__linux__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <_str.h>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string.h>
+# else
+# include _STLP_NATIVE_C_HEADER(string.h)
+# endif
+# endif
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x269)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+#endif /* RC_INVOKED */
+#endif /* _STLP_STRING_H */
diff --git a/build/stlport/stlport/strstream b/build/stlport/stlport/strstream
new file mode 100644
index 000000000..247574f4c
--- /dev/null
+++ b/build/stlport/stlport/strstream
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: The classes defined in this header are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+
+#ifndef _STLP_STRSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1070
+# include <stl/_prolog.h>
+# define _STLP_STRSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1070) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_STRSTREAM
+# include <stl/_strstream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1070) || defined (_STLP_IMPORT_VENDOR_STD)
+/* Even if deprecated strstream header is still part of the Standard. Remove
+ * _STLP_IMPORT_VENDOR_STD check if the native compiler library do not grant
+ * it anymore. */
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <strstream>
+# else
+# include _STLP_NATIVE_HEADER(strstream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1070)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/strstream.h b/build/stlport/stlport/strstream.h
new file mode 100644
index 000000000..e302a168d
--- /dev/null
+++ b/build/stlport/stlport/strstream.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRSTREAM_H
+# define _STLP_STRSTREAM_H
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2071
+# include <stl/_prolog.h>
+#endif
+
+#include <strstream>
+
+#include <iostream.h>
+
+
+#ifndef _STLP_HAS_NO_NAMESPACES
+
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+
+using namespace _STLP_STD;
+
+# else
+
+using _STLP_STD::strstreambuf;
+using _STLP_STD::istrstream;
+using _STLP_STD::ostrstream;
+using _STLP_STD::strstream;
+
+# endif /* _STLP_BROKEN_USING_DIRECTIVE */
+
+#endif /* _STLP_HAS_NO_NAMESPACES */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2071)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/time.h b/build/stlport/stlport/time.h
new file mode 100644
index 000000000..e73aa8566
--- /dev/null
+++ b/build/stlport/stlport/time.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x272
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x272) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#ifdef _STLP_WCE_EVC3
+/* only show message when directly including this file in a non-library build */
+# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x272)
+# pragma message("eMbedded Visual C++ 3 doesn't have a time.h header; STLport won't include native time.h here")
+# endif
+#else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <time.h>
+# else
+# include _STLP_NATIVE_C_HEADER(time.h)
+# endif
+#endif
+
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x272)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/build/stlport/stlport/type_traits b/build/stlport/stlport/type_traits
new file mode 100644
index 000000000..e6fe23429
--- /dev/null
+++ b/build/stlport/stlport/type_traits
@@ -0,0 +1,798 @@
+// -*- C++ -*- Time-stamp: <08/07/20 19:10:15 ptr>
+
+/*
+ * Copyright (c) 2007, 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License version 3.0
+ *
+ * Derived from original <misc/type_traits.h> of 'complement' project
+ * [http://complement.sourceforge.net]
+ * to make it close to JTC1/SC22/WG21 C++ 0x working draft
+ * [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2521.pdf]
+ */
+
+#ifndef __STLP_TYPE_TRAITS
+#define __STLP_TYPE_TRAITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x3
+# include <stl/_prolog.h>
+#endif
+
+// libstdc++ v3, timestamp 20050519 (3.4.4) has __type_traits,
+// libstdc++ v3, timestamp 20060306 (3.4.6) has __type_traits,
+// while libstdc++ v3, 20050921 (4.0.2) not; use libstdc++ instead
+// # if defined(STLPORT) || (defined(__GNUC__) && (__GNUC__ < 4)) /* !defined(__GLIBCXX__) || (defined(__GNUC__) && (__GNUC__ < 4)) */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+namespace detail {
+
+struct __select_types
+{
+ typedef char __t1;
+ struct __t2
+ {
+ char __two[2];
+ };
+};
+
+template <class _Tp>
+struct __instance :
+ public __select_types
+{
+ private:
+ template <class _Up>
+ static __t1 __test(_Up(*)[1]);
+
+ template <class>
+ static __t2 __test(...);
+
+ public:
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+ static const bool __value;
+#else
+ static const bool __value = sizeof(__test<_Tp>(0)) == sizeof(__select_types::__t1);
+#endif
+
+};
+
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+template <class _Tp>
+const bool __instance<_Tp>::__value = sizeof(__instance<_Tp>::__test<_Tp>(0)) == sizeof(__select_types::__t1);
+#endif
+
+template <class T>
+struct __uoc_aux : // union or class
+ public __select_types
+{
+ private:
+ template <class _Up>
+ static __t1 __test( int _Up::* );
+
+ template <class>
+ static __t2 __test(...);
+
+ public:
+#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION
+ static const bool __value;
+#else
+ static const bool __value = sizeof(__test<T>(0)) == sizeof(__select_types::__t1);
+#endif
+};
+
+#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION
+template <class T>
+const bool __uoc_aux<T>::__value = sizeof(__uoc_aux<T>::__test<T>(0)) == sizeof(__select_types::__t1);
+#endif
+
+template <class T>
+class __empty
+{ };
+
+template <class T, bool B>
+class __inheritance_aux
+{};
+
+template <class T>
+class __inheritance_aux<T,true> :
+ public T
+{
+ public:
+ virtual ~__inheritance_aux()
+ { }
+};
+
+#if 0
+template <class T, bool B>
+struct __virtual_aux
+{
+ public:
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+ static const bool __value;
+#else
+ static const bool __value = B ? (sizeof(__inheritance_aux<T,B>) == sizeof(T)) : false;
+#endif
+};
+
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+template <class T, bool B>
+const bool __virtual_aux<T,B>::__value = B ? (sizeof(__inheritance_aux<T,B>) == sizeof(T)) : false;
+#endif
+#endif
+
+} // namespace detail
+
+template <class _Tp, _Tp __v>
+struct integral_constant
+{
+ static const _Tp value = __v;
+ // enum { value = __v }; ?
+
+ typedef _Tp value_type;
+ typedef integral_constant<_Tp, __v> type;
+};
+
+typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, false> false_type;
+
+namespace detail {
+
+template <typename _Tp>
+struct __is_union_or_class :
+ public integral_constant<bool, __uoc_aux<_Tp>::__value>
+{ };
+
+#if 0
+template<typename _Tp>
+struct __is_vtbl : // has virtual table?
+ public integral_constant<bool, __virtual_aux<_Tp,__is_union_or_class<_Tp>::value >::__value>
+{ };
+#endif
+
+template <typename _Tp>
+struct __is_vtbl : // has virtual table?
+ public integral_constant<bool, __is_union_or_class<_Tp>::value ? (sizeof(__inheritance_aux<_Tp,__is_union_or_class<_Tp>::value>) == sizeof(_Tp)) : false >
+{ };
+
+} // namespace detail
+
+#define __SPEC_(C,T,B) \
+template <> \
+struct C<T> : \
+ public integral_constant<bool, B> \
+{ }
+
+#define __CV_SPEC(C,T,B) \
+__SPEC_(C,T,B); \
+__SPEC_(C,const T,B); \
+__SPEC_(C,volatile T,B); \
+__SPEC_(C,const volatile T,B)
+
+#define __SPEC_1(C,T,B) \
+template <class _Tp> \
+struct C<T> : \
+ public integral_constant<bool, B> \
+{ }
+
+#define __CV_SPEC_1(C,T,B) \
+__SPEC_1(C,T,B); \
+__SPEC_1(C,T const,B); \
+__SPEC_1(C,T volatile,B); \
+__SPEC_1(C,T const volatile,B)
+
+#define __SPEC_2(C,T,B) \
+template <class _Tp1, class _Tp2> \
+struct C<T> : \
+ public integral_constant<bool, B> \
+{ }
+
+#define __CV_SPEC_2(C,T,B) \
+__SPEC_2(C,T,B); \
+__SPEC_2(C,T const,B); \
+__SPEC_2(C,T volatile,B); \
+__SPEC_2(C,T const volatile,B)
+
+// [4.5.1] primary type categories:
+
+template <class _Tp>
+struct is_void :
+ public false_type
+{ };
+
+template <>
+struct is_void<void> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_integral :
+ public false_type
+{ };
+
+__CV_SPEC(is_integral,bool,true);
+__CV_SPEC(is_integral,char,true);
+__CV_SPEC(is_integral,signed char,true);
+__CV_SPEC(is_integral,unsigned char,true);
+__CV_SPEC(is_integral,wchar_t,true);
+__CV_SPEC(is_integral,short,true);
+__CV_SPEC(is_integral,unsigned short,true);
+__CV_SPEC(is_integral,int,true);
+__CV_SPEC(is_integral,unsigned int,true);
+__CV_SPEC(is_integral,long,true);
+__CV_SPEC(is_integral,unsigned long,true);
+__CV_SPEC(is_integral,long long,true);
+__CV_SPEC(is_integral,unsigned long long,true);
+
+template <class _Tp>
+struct is_floating_point :
+ public false_type
+{ };
+
+__CV_SPEC(is_floating_point,float,true);
+__CV_SPEC(is_floating_point,double,true);
+__CV_SPEC(is_floating_point,long double,true);
+
+template <class _Tp>
+struct is_array :
+ public false_type
+{ };
+
+template <class _Tp, std::size_t _Sz>
+struct is_array<_Tp[_Sz]> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_array<_Tp[]> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_pointer :
+ public false_type
+{ };
+
+__CV_SPEC_1(is_pointer,_Tp *,true);
+
+template <class _Tp>
+struct is_lvalue_reference :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_lvalue_reference<_Tp&> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_rvalue_reference :
+ public false_type
+{ };
+
+// template <class _Tp>
+// struct is_rvalue_reference<_Tp&&> :
+// public true_type
+// { };
+
+template <class _Tp>
+struct is_reference :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_reference<_Tp&> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_function :
+ public integral_constant<bool, !(detail::__instance<_Tp>::__value
+ || detail::__is_union_or_class<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_void<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_member_object_pointer :
+ public false_type
+{ };
+
+// _SPEC_FULL2(is_member_object_pointer, _Tp1 _Tp2::*,!is_function<_Tp1>::value);
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::*> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::* const> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::* volatile> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::* const volatile> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp>
+struct is_member_function_pointer :
+ public false_type
+{ };
+
+// _SPEC_FULL2(is_member_function_pointer,_Tp1 _Tp2::*,is_function<_Tp1>::value);
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::*> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::* const> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::* volatile> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::* const volatile> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp>
+struct is_member_pointer :
+ public integral_constant<bool, (is_member_object_pointer<_Tp>::value || is_member_function_pointer<_Tp>::value)>
+{ };
+
+// 4.5.2 composite type categories
+
+template <class _Tp>
+struct is_arithmetic :
+ public integral_constant<bool, (is_integral<_Tp>::value || is_floating_point<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_fundamental :
+ public integral_constant<bool, (is_arithmetic<_Tp>::value || is_void<_Tp>::value)>
+{ };
+
+// [4.5.1] primary type categories (continued):
+
+template <class _Tp>
+struct is_enum :
+ public integral_constant<bool, !(is_fundamental<_Tp>::value
+ || is_array<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_member_pointer<_Tp>::value
+ || is_function<_Tp>::value
+ || detail::__is_union_or_class<_Tp>::value) >
+{ };
+
+template <class T>
+struct is_union
+{ };
+
+template <class T>
+struct is_class
+{ };
+
+// is_function (above)
+
+// 4.5.2 composite type categories (continued)
+
+// is_arithmetic (above)
+// is_fundamental (above)
+
+template <class _Tp>
+struct is_object :
+ public integral_constant<bool, (is_arithmetic<_Tp>::value ||
+ is_array<_Tp>::value ||
+ is_pointer<_Tp>::value ||
+ is_member_pointer<_Tp>::value ||
+ detail::__is_union_or_class<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_scalar :
+ public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_enum<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_member_pointer<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_compound :
+ public integral_constant<bool, !is_fundamental<_Tp>::value>
+{ };
+
+// is_member_pointer
+
+// 4.5.3 type properties:
+
+template <class _Tp>
+struct is_const :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_const<_Tp const> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_volatile :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_volatile<_Tp volatile> :
+ public true_type
+{ };
+
+
+// 4.7.3 array modifications:
+
+template <class _Tp>
+struct remove_extent
+{
+ typedef _Tp type;
+};
+
+template <class _Tp, std::size_t _Sz>
+struct remove_extent<_Tp[_Sz]>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_extent<_Tp[]>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_all_extents
+{
+ typedef _Tp type;
+};
+
+template <class _Tp, std::size_t _Size>
+struct remove_all_extents<_Tp[_Size]>
+{
+ typedef typename remove_all_extents<_Tp>::type type;
+};
+
+template<typename _Tp>
+struct remove_all_extents<_Tp[]>
+{
+ typedef typename remove_all_extents<_Tp>::type type;
+};
+
+// 4.5.3 type properties (continued):
+
+template <class _Tp>
+struct is_trivial :
+ public integral_constant<bool, (is_void<_Tp>::value
+ || is_scalar<typename remove_all_extents<_Tp>::type>::value)>
+{ };
+
+template <class _Tp>
+struct is_standard_layout :
+ public integral_constant<bool, (is_void<_Tp>::value
+ || is_scalar<typename remove_all_extents<_Tp>::type>::value)>
+{ };
+
+template <class _Tp>
+struct is_pod :
+ public integral_constant<bool, (is_void<_Tp>::value
+ || is_scalar<typename remove_all_extents<_Tp>::type>::value)>
+{ };
+
+template<typename _Tp>
+struct is_empty
+ : public integral_constant<bool, (detail::__is_union_or_class<_Tp>::value
+ && (sizeof(detail::__empty<_Tp>) == sizeof(_Tp)))>
+{ };
+
+// is_polimorphic
+// is_abstract
+
+template <class _Tp>
+struct has_trivial_constructor :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_trivial_copy :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_trivial_assign :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_trivial_destructor :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_nothrow_constructor :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_nothrow_copy :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_nothrow_assign :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_virtual_destructor :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_signed :
+ public false_type
+{ };
+
+__CV_SPEC(is_signed,signed char,true);
+__CV_SPEC(is_signed,short,true);
+__CV_SPEC(is_signed,int,true);
+__CV_SPEC(is_signed,long,true);
+__CV_SPEC(is_signed,long long,true);
+
+template <class _Tp>
+struct is_unsigned :
+ public false_type
+{ };
+
+__CV_SPEC(is_unsigned,unsigned char,true);
+__CV_SPEC(is_unsigned,unsigned short,true);
+__CV_SPEC(is_unsigned,unsigned int,true);
+__CV_SPEC(is_unsigned,unsigned long,true);
+__CV_SPEC(is_unsigned,unsigned long long,true);
+
+// alignment_of
+// rank
+// extent
+
+// 4.6 type relations:
+
+template <class _Tp1, class _Tp2>
+struct is_same :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_same<_Tp, _Tp> :
+ public true_type
+{ };
+
+// is_base_of
+// is_convertible
+
+// 4.7.1 const-volatile modifications
+
+template <class _Tp>
+struct remove_const
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_const<_Tp const>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_volatile
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_volatile<_Tp volatile>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_cv
+{
+ typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type;
+};
+
+template <class _Tp>
+struct add_const
+{
+ typedef _Tp const type;
+};
+
+template <class _Tp>
+struct add_volatile
+{
+ typedef _Tp volatile type;
+};
+
+template <class _Tp>
+struct add_cv
+{
+ typedef typename add_const<typename add_volatile<_Tp>::type>::type type;
+};
+
+// 4.7.2 reference modifications:
+
+template <class _Tp>
+struct remove_reference
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_reference<_Tp&>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct add_reference
+{
+ typedef _Tp& type;
+};
+
+template <class _Tp>
+struct add_reference<_Tp&>
+{
+ typedef _Tp& type;
+};
+
+// 4.7.3 array modifications (see above)
+
+// 4.7.4 pointer modifications:
+
+template <class _Tp>
+struct remove_pointer
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp *>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp * const>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp * volatile>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp * const volatile>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct add_pointer
+{
+ typedef typename remove_reference<_Tp>::type * type;
+};
+
+// 20.5.7 other transformations:
+
+// template <std::size_t Len, std::size_t Align> struct aligned_storage;
+// template <std::size_t Len, class... Types> struct aligned_union;
+
+namespace detail {
+
+template <bool,class _U>
+struct _decay_aux2
+{
+ typedef typename remove_cv<_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux2<true,_U>
+{
+ typedef typename add_pointer<_U>::type type;
+};
+
+template <bool, class _U>
+struct _decay_aux1
+{
+ typedef typename _decay_aux2<is_function<_U>::value,_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux1<true,_U>
+{
+ typedef typename remove_extent<_U>::type* type;
+};
+
+} // namespace detail
+
+template <class _Tp>
+class decay
+{
+ private:
+ typedef typename remove_reference<_Tp>::type _U;
+
+ public:
+ typedef typename detail::_decay_aux1<is_array<_U>::value,_U>::type type;
+};
+
+template <bool, class _Tp = void>
+struct enable_if
+{
+};
+
+template <class _Tp>
+struct enable_if<true,_Tp>
+{
+ typedef _Tp type;
+};
+
+template <bool, class _Tp1, class _Tp2>
+struct conditional
+{
+ typedef _Tp2 type;
+};
+
+template <class _Tp1, class _Tp2>
+struct conditional<true,_Tp1,_Tp2>
+{
+ typedef _Tp1 type;
+};
+
+// template <class... _Tp> struct common_type;
+
+#undef __CV_SPEC
+#undef __SPEC_
+#undef __CV_SPEC_1
+#undef __SPEC_1
+#undef __CV_SPEC_2
+#undef __SPEC_2
+
+_STLP_END_NAMESPACE // tr1
+
+_STLP_END_NAMESPACE
+
+// # else // __GLIBCXX__ && (__GNUC__ >= 4) && !STLPORT
+// # include <tr1/type_traits>
+// # endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x3)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif // __STLP_TYPE_TRAITS
+
diff --git a/build/stlport/stlport/typeinfo b/build/stlport/stlport/typeinfo
new file mode 100644
index 000000000..269123fce
--- /dev/null
+++ b/build/stlport/stlport/typeinfo
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_TYPEINFO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x473
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x473) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_TYPEINFO
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x473) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_TYPEINFO
+# include <stl/_typeinfo.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x473) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <typeinfo>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x473)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/typeinfo.h b/build/stlport/stlport/typeinfo.h
new file mode 100644
index 000000000..0cea71a57
--- /dev/null
+++ b/build/stlport/stlport/typeinfo.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// DMC has hardcoded inclusion of typeinfo.h at the begining of any translation unit.
+// So inclusion of this header will directly reference the native header. This is not
+// a problem as typeinfo.h is neither a C nor C++ Standard header, this header should
+// never be used in user code.
+#if defined (__DMC__)
+// We define _STLP_OUTERMOST_HEADER_ID to signal to other STLport headers that inclusion
+// is done from native typeinfo.h (see exception header).
+# define _STLP_OUTERMOST_HEADER_ID 0x874
+# include <../include/typeinfo.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#else
+# ifndef _STLP_OLDSTD_typeinfo
+# define _STLP_OLDSTD_typeinfo
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x874
+# include <stl/_prolog.h>
+# endif
+
+# ifndef _STLP_NO_TYPEINFO
+
+# if defined (__GNUC__)
+# undef _STLP_OLDSTD_typeinfo
+# include <typeinfo>
+# define _STLP_OLDSTD_typeinfo
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <typeinfo.h>
+# elif !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h)
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(typeinfo.h)
+# endif
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x580) || \
+ defined (__DMC__)
+using std::type_info;
+using std::bad_typeid;
+using std::bad_cast;
+# endif
+# endif
+
+// if <typeinfo> already included, do not import anything
+
+# if defined (_STLP_USE_OWN_NAMESPACE) && !(defined (_STLP_TYPEINFO) && !defined (_STLP_NO_NEW_NEW_HEADER))
+
+_STLP_BEGIN_NAMESPACE
+
+using /*_STLP_VENDOR_EXCEPT_STD */ :: type_info;
+# if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)))
+using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_typeid;
+# endif
+
+using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_cast;
+
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_OWN_NAMESPACE */
+
+# endif /* _STLP_NO_TYPEINFO */
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x874)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+# endif /* _STLP_OLDSTD_typeinfo */
+
+#endif /* __DMC__ */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/unordered_map b/build/stlport/stlport/unordered_map
new file mode 100644
index 000000000..09fa0d249
--- /dev/null
+++ b/build/stlport/stlport/unordered_map
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004,2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_UNORDERED_MAP
+#define _STLP_UNORDERED_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4030
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_unordered_map.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4030)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_UNORDERED_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/unordered_set b/build/stlport/stlport/unordered_set
new file mode 100644
index 000000000..14de43746
--- /dev/null
+++ b/build/stlport/stlport/unordered_set
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004,2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_UNORDERED_SET
+#define _STLP_UNORDERED_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x4031
+# include <stl/_prolog.h>
+#endif
+
+#ifdef _STLP_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <stl/_unordered_set.h>
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x4031)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_UNORDERED_SET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/using/cstring b/build/stlport/stlport/using/cstring
new file mode 100644
index 000000000..42c56602b
--- /dev/null
+++ b/build/stlport/stlport/using/cstring
@@ -0,0 +1,60 @@
+using _STLP_VENDOR_CSTD::size_t;
+
+#if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if defined (__MSL__) && __MC68K__ && !_No_BlockMove && __dest_os == __mac_os
+# undef memcpy
+# undef memmove
+inline void* memcpy(void* dst, const void* src, size_t len)
+{ return _STLP_VENDOR_CSTD::__memcpy(dst, src, len); }
+inline void* memmove(void* dst, const void* src, size_t len)
+{ return _STLP_VENDOR_CSTD::__memmove(dst, src, len); }
+# else
+using _STLP_VENDOR_CSTD::memmove;
+using _STLP_VENDOR_CSTD::memcpy;
+# endif
+
+# if !defined (_STLP_WCE)
+// these functions just don't exist on Windows CE
+using _STLP_VENDOR_CSTD::strcoll;
+using _STLP_VENDOR_CSTD::strerror;
+using _STLP_VENDOR_CSTD::strxfrm;
+# endif
+
+# if defined (__BORLANDC__)
+extern "C++" {
+# endif
+using _STLP_VENDOR_CSTD::memchr;
+using _STLP_VENDOR_CSTD::strchr;
+using _STLP_VENDOR_CSTD::strpbrk;
+using _STLP_VENDOR_CSTD::strrchr;
+using _STLP_VENDOR_CSTD::strstr;
+# if defined (__BORLANDC__)
+}
+# endif
+
+using _STLP_VENDOR_CSTD::memcmp;
+using _STLP_VENDOR_CSTD::memset;
+
+using _STLP_VENDOR_CSTD::strcat;
+
+# if !defined (strcmp) || !defined (__BORLANDC__)
+using _STLP_VENDOR_CSTD::strcmp;
+# else
+using ::strcmp;
+# endif
+
+# if !defined (strcpy) || !defined (__BORLANDC__)
+using _STLP_VENDOR_CSTD::strcpy;
+# else
+using ::strcpy;
+# endif
+using _STLP_VENDOR_CSTD::strcspn;
+using _STLP_VENDOR_CSTD::strlen;
+using _STLP_VENDOR_CSTD::strncat;
+using _STLP_VENDOR_CSTD::strncmp;
+
+using _STLP_VENDOR_CSTD::strncpy;
+using _STLP_VENDOR_CSTD::strspn;
+
+using _STLP_VENDOR_CSTD::strtok;
+#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
diff --git a/build/stlport/stlport/using/export b/build/stlport/stlport/using/export
new file mode 100644
index 000000000..2d3afcd9f
--- /dev/null
+++ b/build/stlport/stlport/using/export
@@ -0,0 +1,12 @@
+cstring
+fstream
+iomanip
+ios
+iosfwd
+iostream
+istream
+locale
+ostream
+sstream
+streambuf
+strstream
diff --git a/build/stlport/stlport/using/fstream b/build/stlport/stlport/using/fstream
new file mode 100644
index 000000000..e79e0480f
--- /dev/null
+++ b/build/stlport/stlport/using/fstream
@@ -0,0 +1,19 @@
+#ifdef _STLP_BROKEN_USING_DIRECTIVE
+using namespace _STLP_STD;
+#else
+using _STLP_NEW_IO_NAMESPACE::basic_filebuf;
+using _STLP_NEW_IO_NAMESPACE::filebuf;
+using _STLP_NEW_IO_NAMESPACE::basic_ifstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ofstream;
+using _STLP_NEW_IO_NAMESPACE::ifstream;
+using _STLP_NEW_IO_NAMESPACE::ofstream;
+using _STLP_NEW_IO_NAMESPACE::basic_fstream;
+using _STLP_NEW_IO_NAMESPACE::fstream;
+
+# ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wofstream;
+using _STLP_NEW_IO_NAMESPACE::wfilebuf;
+using _STLP_NEW_IO_NAMESPACE::wifstream;
+using _STLP_NEW_IO_NAMESPACE::wfstream;
+# endif
+#endif
diff --git a/build/stlport/stlport/using/h/fstream.h b/build/stlport/stlport/using/h/fstream.h
new file mode 100644
index 000000000..660056895
--- /dev/null
+++ b/build/stlport/stlport/using/h/fstream.h
@@ -0,0 +1,4 @@
+using ::streambuf;
+using ::ifstream;
+using ::ofstream;
+using ::fstream;
diff --git a/build/stlport/stlport/using/h/iomanip.h b/build/stlport/stlport/using/h/iomanip.h
new file mode 100644
index 000000000..99e48d998
--- /dev/null
+++ b/build/stlport/stlport/using/h/iomanip.h
@@ -0,0 +1,6 @@
+using ::setiosflags;
+using ::resetiosflags;
+// using ::setbase;
+using ::setfill;
+using ::setprecision;
+using ::setw;
diff --git a/build/stlport/stlport/using/h/iostream.h b/build/stlport/stlport/using/h/iostream.h
new file mode 100644
index 000000000..e85f4e2c7
--- /dev/null
+++ b/build/stlport/stlport/using/h/iostream.h
@@ -0,0 +1,24 @@
+using _STLP_OLD_IO_NAMESPACE::istream;
+using _STLP_OLD_IO_NAMESPACE::ostream;
+
+/* HP aCC include files re-define these when THREAD_SAFE */
+#if !defined(cin)
+using _STLP_OLD_IO_NAMESPACE::cin;
+#endif
+#if !defined(cout)
+using _STLP_OLD_IO_NAMESPACE::cout;
+#endif
+#if !defined(cerr)
+using _STLP_OLD_IO_NAMESPACE::cerr;
+#endif
+#if !defined(clog)
+using _STLP_OLD_IO_NAMESPACE::clog;
+#endif
+
+using _STLP_OLD_IO_NAMESPACE::endl;
+using _STLP_OLD_IO_NAMESPACE::ends;
+
+using _STLP_OLD_IO_NAMESPACE::ios;
+using _STLP_OLD_IO_NAMESPACE::flush;
+
+// using _STLP_OLD_IO_NAMESPACE::ws;
diff --git a/build/stlport/stlport/using/h/ostream.h b/build/stlport/stlport/using/h/ostream.h
new file mode 100644
index 000000000..6ba3f8839
--- /dev/null
+++ b/build/stlport/stlport/using/h/ostream.h
@@ -0,0 +1,6 @@
+using _STLP_OLD_IO_NAMESPACE::ostream;
+using _STLP_OLD_IO_NAMESPACE::endl;
+using _STLP_OLD_IO_NAMESPACE::ends;
+using _STLP_OLD_IO_NAMESPACE::flush;
+
+// using _STLP_OLD_IO_NAMESPACE::ws;
diff --git a/build/stlport/stlport/using/h/streambuf.h b/build/stlport/stlport/using/h/streambuf.h
new file mode 100644
index 000000000..459de3dba
--- /dev/null
+++ b/build/stlport/stlport/using/h/streambuf.h
@@ -0,0 +1 @@
+using ::streambuf;
diff --git a/build/stlport/stlport/using/h/strstream.h b/build/stlport/stlport/using/h/strstream.h
new file mode 100644
index 000000000..a7d9f119c
--- /dev/null
+++ b/build/stlport/stlport/using/h/strstream.h
@@ -0,0 +1,4 @@
+using _STLP_OLD_IO_NAMESPACE::strstreambuf;
+using _STLP_OLD_IO_NAMESPACE::istrstream;
+using _STLP_OLD_IO_NAMESPACE::ostrstream;
+using _STLP_OLD_IO_NAMESPACE::strstream;
diff --git a/build/stlport/stlport/using/iomanip b/build/stlport/stlport/using/iomanip
new file mode 100644
index 000000000..8a7c792f8
--- /dev/null
+++ b/build/stlport/stlport/using/iomanip
@@ -0,0 +1,6 @@
+using _STLP_NEW_IO_NAMESPACE::setiosflags;
+using _STLP_NEW_IO_NAMESPACE::resetiosflags;
+using _STLP_NEW_IO_NAMESPACE::setbase;
+using _STLP_NEW_IO_NAMESPACE::setfill;
+using _STLP_NEW_IO_NAMESPACE::setprecision;
+using _STLP_NEW_IO_NAMESPACE::setw;
diff --git a/build/stlport/stlport/using/ios b/build/stlport/stlport/using/ios
new file mode 100644
index 000000000..d89b495ad
--- /dev/null
+++ b/build/stlport/stlport/using/ios
@@ -0,0 +1,41 @@
+# ifdef _STLP_BROKEN_USING_DIRECTIVE
+using namespace _STLP_NEW_IO_NAMESPACE;
+# else
+
+using _STLP_NEW_IO_NAMESPACE::ios;
+using _STLP_NEW_IO_NAMESPACE::streamoff;
+using _STLP_NEW_IO_NAMESPACE::streamsize;
+
+using _STLP_NEW_IO_NAMESPACE::ios_base;
+using _STLP_NEW_IO_NAMESPACE::basic_ios;
+
+// _lib.std.ios.manip_, manipulators:
+using _STLP_NEW_IO_NAMESPACE::boolalpha;
+using _STLP_NEW_IO_NAMESPACE::noboolalpha;
+using _STLP_NEW_IO_NAMESPACE::showbase;
+using _STLP_NEW_IO_NAMESPACE::noshowbase;
+using _STLP_NEW_IO_NAMESPACE::showpoint;
+using _STLP_NEW_IO_NAMESPACE::noshowpoint;
+using _STLP_NEW_IO_NAMESPACE::showpos;
+using _STLP_NEW_IO_NAMESPACE::noshowpos;
+using _STLP_NEW_IO_NAMESPACE::skipws;
+using _STLP_NEW_IO_NAMESPACE::noskipws;
+using _STLP_NEW_IO_NAMESPACE::uppercase;
+using _STLP_NEW_IO_NAMESPACE::nouppercase;
+
+// _lib.adjustfield.manip_ adjustfield:
+using _STLP_NEW_IO_NAMESPACE::internal;
+using _STLP_NEW_IO_NAMESPACE::left;
+using _STLP_NEW_IO_NAMESPACE::right;
+
+// _lib.basefield.manip_ basefield:
+using _STLP_NEW_IO_NAMESPACE::dec;
+using _STLP_NEW_IO_NAMESPACE::hex;
+using _STLP_NEW_IO_NAMESPACE::oct;
+
+// _lib.floatfield.manip_ floatfield:
+using _STLP_NEW_IO_NAMESPACE::fixed;
+using _STLP_NEW_IO_NAMESPACE::scientific;
+
+# endif /* _STLP_BROKEN_USING_DIRECTIVE */
+
diff --git a/build/stlport/stlport/using/iosfwd b/build/stlport/stlport/using/iosfwd
new file mode 100644
index 000000000..b564e819f
--- /dev/null
+++ b/build/stlport/stlport/using/iosfwd
@@ -0,0 +1,54 @@
+# if defined (_STLP_USE_NEW_IOSTREAMS)
+using _STLP_NEW_IO_NAMESPACE::char_traits;
+using _STLP_NEW_IO_NAMESPACE::basic_ios;
+using _STLP_NEW_IO_NAMESPACE::basic_streambuf;
+using _STLP_NEW_IO_NAMESPACE::basic_istream;
+using _STLP_NEW_IO_NAMESPACE::basic_ostream;
+using _STLP_NEW_IO_NAMESPACE::basic_iostream;
+using _STLP_NEW_IO_NAMESPACE::basic_stringbuf;
+using _STLP_NEW_IO_NAMESPACE::basic_istringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ostringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_stringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_filebuf;
+using _STLP_NEW_IO_NAMESPACE::basic_ifstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ofstream;
+using _STLP_NEW_IO_NAMESPACE::basic_fstream;
+using _STLP_NEW_IO_NAMESPACE::fpos;
+using _STLP_NEW_IO_NAMESPACE::istreambuf_iterator;
+using _STLP_NEW_IO_NAMESPACE::ostreambuf_iterator;
+using _STLP_NEW_IO_NAMESPACE::stringbuf;
+using _STLP_NEW_IO_NAMESPACE::istringstream;
+using _STLP_NEW_IO_NAMESPACE::ostringstream;
+using _STLP_NEW_IO_NAMESPACE::stringstream;
+# endif
+
+using _STLP_NEW_IO_NAMESPACE::ios;
+using _STLP_NEW_IO_NAMESPACE::streambuf;
+using _STLP_NEW_IO_NAMESPACE::istream;
+using _STLP_NEW_IO_NAMESPACE::ostream;
+using _STLP_NEW_IO_NAMESPACE::iostream;
+
+using _STLP_NEW_IO_NAMESPACE::filebuf;
+using _STLP_NEW_IO_NAMESPACE::ifstream;
+using _STLP_NEW_IO_NAMESPACE::ofstream;
+using _STLP_NEW_IO_NAMESPACE::fstream;
+
+using _STLP_NEW_IO_NAMESPACE::streampos;
+using _STLP_NEW_IO_NAMESPACE::streamoff;
+
+# if !defined (_STLP_NO_WIDE_STREAMS)
+using _STLP_NEW_IO_NAMESPACE::wios;
+using _STLP_NEW_IO_NAMESPACE::wstreambuf;
+using _STLP_NEW_IO_NAMESPACE::wistream;
+using _STLP_NEW_IO_NAMESPACE::wostream;
+using _STLP_NEW_IO_NAMESPACE::wiostream;
+using _STLP_NEW_IO_NAMESPACE::wstringbuf;
+using _STLP_NEW_IO_NAMESPACE::wistringstream;
+using _STLP_NEW_IO_NAMESPACE::wostringstream;
+using _STLP_NEW_IO_NAMESPACE::wstringstream;
+using _STLP_NEW_IO_NAMESPACE::wfilebuf;
+using _STLP_NEW_IO_NAMESPACE::wifstream;
+using _STLP_NEW_IO_NAMESPACE::wofstream;
+using _STLP_NEW_IO_NAMESPACE::wfstream;
+using _STLP_NEW_IO_NAMESPACE::wstreampos;
+# endif
diff --git a/build/stlport/stlport/using/iostream b/build/stlport/stlport/using/iostream
new file mode 100644
index 000000000..6169afb2f
--- /dev/null
+++ b/build/stlport/stlport/using/iostream
@@ -0,0 +1,14 @@
+
+# include <using/istream>
+
+using _STLP_VENDOR_STD::cin;
+using _STLP_VENDOR_STD::cout;
+using _STLP_VENDOR_STD::cerr;
+using _STLP_VENDOR_STD::clog;
+
+# if ! defined (_STLP_NO_WIDE_STREAMS)
+using _STLP_VENDOR_STD::wcin;
+using _STLP_VENDOR_STD::wcout;
+using _STLP_VENDOR_STD::wcerr;
+using _STLP_VENDOR_STD::wclog;
+# endif
diff --git a/build/stlport/stlport/using/istream b/build/stlport/stlport/using/istream
new file mode 100644
index 000000000..baf10d285
--- /dev/null
+++ b/build/stlport/stlport/using/istream
@@ -0,0 +1,16 @@
+# include <using/ostream>
+
+using _STLP_NEW_IO_NAMESPACE::basic_istream;
+using _STLP_NEW_IO_NAMESPACE::basic_iostream;
+
+using _STLP_NEW_IO_NAMESPACE::istream;
+using _STLP_NEW_IO_NAMESPACE::iostream;
+
+# if !defined (_STLP_NO_NATIVE_WIDE_STREAMS)
+using _STLP_NEW_IO_NAMESPACE::wistream;
+using _STLP_NEW_IO_NAMESPACE::wiostream;
+# endif
+
+#if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
+using _STLP_NEW_IO_NAMESPACE::ws;
+#endif
diff --git a/build/stlport/stlport/using/locale b/build/stlport/stlport/using/locale
new file mode 100644
index 000000000..aa99b5bee
--- /dev/null
+++ b/build/stlport/stlport/using/locale
@@ -0,0 +1,65 @@
+#if !defined(_STLP_NO_IMPORT_LOCALE)
+
+// from <cwchar>
+#if !defined (_STLP_NO_MBSTATE_T)
+using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
+#endif
+
+// _lib.locale_, locale:
+using _STLP_NEW_IO_NAMESPACE::locale;
+using _STLP_NEW_IO_NAMESPACE::use_facet;
+using _STLP_NEW_IO_NAMESPACE::has_facet;
+
+// _lib.locale.convenience_, convenience interfaces:
+using _STLP_NEW_IO_NAMESPACE::isspace;
+using _STLP_NEW_IO_NAMESPACE::isprint;
+using _STLP_NEW_IO_NAMESPACE::iscntrl;
+using _STLP_NEW_IO_NAMESPACE::isupper;
+using _STLP_NEW_IO_NAMESPACE::islower;
+using _STLP_NEW_IO_NAMESPACE::isalpha;
+using _STLP_NEW_IO_NAMESPACE::isdigit;
+using _STLP_NEW_IO_NAMESPACE::ispunct;
+using _STLP_NEW_IO_NAMESPACE::isxdigit;
+using _STLP_NEW_IO_NAMESPACE::isalnum;
+using _STLP_NEW_IO_NAMESPACE::isgraph;
+using _STLP_NEW_IO_NAMESPACE::toupper;
+using _STLP_NEW_IO_NAMESPACE::tolower;
+
+// _lib.category.ctype_ and _lib.facet.ctype.special_, ctype:
+using _STLP_NEW_IO_NAMESPACE::ctype_base;
+using _STLP_NEW_IO_NAMESPACE::ctype;
+using _STLP_NEW_IO_NAMESPACE::ctype_byname;
+using _STLP_NEW_IO_NAMESPACE::codecvt_base;
+using _STLP_NEW_IO_NAMESPACE::codecvt;
+using _STLP_NEW_IO_NAMESPACE::codecvt_byname;
+
+// _lib.category.numeric_ and _lib.facet.numpunct_, numeric:
+using _STLP_NEW_IO_NAMESPACE::num_get;
+using _STLP_NEW_IO_NAMESPACE::num_put;
+using _STLP_NEW_IO_NAMESPACE::numpunct;
+using _STLP_NEW_IO_NAMESPACE::numpunct_byname;
+
+// _lib.category.collate_, collation:
+using _STLP_NEW_IO_NAMESPACE::collate;
+using _STLP_NEW_IO_NAMESPACE::collate_byname;
+
+// _lib.category.time_, date and time:
+using _STLP_NEW_IO_NAMESPACE::time_base;
+using _STLP_NEW_IO_NAMESPACE::time_get;
+using _STLP_NEW_IO_NAMESPACE::time_get_byname;
+using _STLP_NEW_IO_NAMESPACE::time_put;
+using _STLP_NEW_IO_NAMESPACE::time_put_byname;
+
+// _lib.category.monetary_, money:
+using _STLP_NEW_IO_NAMESPACE::money_base;
+using _STLP_NEW_IO_NAMESPACE::money_get;
+using _STLP_NEW_IO_NAMESPACE::money_put;
+using _STLP_NEW_IO_NAMESPACE::moneypunct;
+using _STLP_NEW_IO_NAMESPACE::moneypunct_byname;
+
+#if !defined (_STLP_OWN_IOSTREAMS) && !defined (_STLP_NO_NATIVE_MESSAGE_FACET)
+using _STLP_NEW_IO_NAMESPACE::messages_base;
+using _STLP_NEW_IO_NAMESPACE::messages;
+using _STLP_NEW_IO_NAMESPACE::messages_byname;
+#endif // _MSL_NO_MESSAGE_FACET
+#endif /* !defined(_STLP_NO_IMPORT_LOCALE) */
diff --git a/build/stlport/stlport/using/ostream b/build/stlport/stlport/using/ostream
new file mode 100644
index 000000000..162b32d8b
--- /dev/null
+++ b/build/stlport/stlport/using/ostream
@@ -0,0 +1,10 @@
+using _STLP_NEW_IO_NAMESPACE::basic_ostream;
+using _STLP_NEW_IO_NAMESPACE::ostream;
+
+# ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wostream;
+# endif
+
+using _STLP_NEW_IO_NAMESPACE::endl;
+using _STLP_NEW_IO_NAMESPACE::ends;
+using _STLP_NEW_IO_NAMESPACE::flush;
diff --git a/build/stlport/stlport/using/sstream b/build/stlport/stlport/using/sstream
new file mode 100644
index 000000000..925c37e2d
--- /dev/null
+++ b/build/stlport/stlport/using/sstream
@@ -0,0 +1,16 @@
+using _STLP_NEW_IO_NAMESPACE::basic_stringbuf;
+using _STLP_NEW_IO_NAMESPACE::stringbuf;
+
+using _STLP_NEW_IO_NAMESPACE::basic_istringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_ostringstream;
+using _STLP_NEW_IO_NAMESPACE::basic_stringstream;
+using _STLP_NEW_IO_NAMESPACE::istringstream;
+using _STLP_NEW_IO_NAMESPACE::ostringstream;
+using _STLP_NEW_IO_NAMESPACE::stringstream;
+
+#ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wstringbuf;
+using _STLP_NEW_IO_NAMESPACE::wistringstream;
+using _STLP_NEW_IO_NAMESPACE::wostringstream;
+using _STLP_NEW_IO_NAMESPACE::wstringstream;
+#endif
diff --git a/build/stlport/stlport/using/streambuf b/build/stlport/stlport/using/streambuf
new file mode 100644
index 000000000..308241dee
--- /dev/null
+++ b/build/stlport/stlport/using/streambuf
@@ -0,0 +1,5 @@
+using _STLP_NEW_IO_NAMESPACE::basic_streambuf;
+using _STLP_NEW_IO_NAMESPACE::streambuf;
+#ifndef _STLP_NO_WIDE_STREAMS
+using _STLP_NEW_IO_NAMESPACE::wstreambuf;
+# endif
diff --git a/build/stlport/stlport/using/strstream b/build/stlport/stlport/using/strstream
new file mode 100644
index 000000000..eb26ac1f5
--- /dev/null
+++ b/build/stlport/stlport/using/strstream
@@ -0,0 +1,4 @@
+using _STLP_NEW_IO_NAMESPACE::strstreambuf;
+using _STLP_NEW_IO_NAMESPACE::istrstream;
+using _STLP_NEW_IO_NAMESPACE::ostrstream;
+using _STLP_NEW_IO_NAMESPACE::strstream;
diff --git a/build/stlport/stlport/utility b/build/stlport/stlport/utility
new file mode 100644
index 000000000..4aaaa5935
--- /dev/null
+++ b/build/stlport/stlport/utility
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_UTILITY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x75
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_UTILITY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x75) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <utility>
+# else
+# include _STLP_NATIVE_HEADER(utility)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_UTILITY */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/valarray b/build/stlport/stlport/valarray
new file mode 100644
index 000000000..0cb07767c
--- /dev/null
+++ b/build/stlport/stlport/valarray
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_VALARRAY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x76
+# include <stl/_prolog.h>
+# define _STLP_VALARRAY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x76)
+# ifndef _STLP_VALARRAY_H
+# include <stl/_valarray.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x76) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <valarray>
+# else
+# include _STLP_NATIVE_HEADER(valarray)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x76)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_VALARRAY */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/build/stlport/stlport/vector b/build/stlport/stlport/vector
new file mode 100644
index 000000000..92c41b744
--- /dev/null
+++ b/build/stlport/stlport/vector
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_VECTOR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x77
+# include <stl/_prolog.h>
+# define _STLP_VECTOR
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x77)
+# ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+# endif
+
+# ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x77) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <vector>
+# else
+# include _STLP_NATIVE_HEADER(vector)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x77)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_VECTOR */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/build/stlport/stlport/wchar.h b/build/stlport/stlport/wchar.h
new file mode 100644
index 000000000..6d6679969
--- /dev/null
+++ b/build/stlport/stlport/wchar.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x278
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x278) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T)
+
+# if defined (__BORLANDC__) && !defined (__linux__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <_str.h>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# endif
+# ifdef __cplusplus
+using _STLP_VENDOR_CSTD::strlen;
+using _STLP_VENDOR_CSTD::strspn;
+# endif
+# endif
+
+# if (((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) && defined (__APPLE__)) || defined (__OpenBSD__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <wchar.h>
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+# endif
+#endif /* !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) */
+
+#ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x278)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
diff --git a/build/stlport/stlport/wctype.h b/build/stlport/stlport/wctype.h
new file mode 100644
index 000000000..c64ab9bea
--- /dev/null
+++ b/build/stlport/stlport/wctype.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x279
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x279) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have wctype.h */
+#if !defined(_STLP_WCE_EVC3)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# if defined (__hpux)
+# include_next <stdarg.h>
+# include_next <wchar.h>
+# endif
+# include_next <wctype.h>
+# else
+# if defined (__hpux)
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+# include _STLP_NATIVE_C_HEADER(wctype.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x279)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/build/stlport/test/.gitignore b/build/stlport/test/.gitignore
new file mode 100644
index 000000000..ee40a85d1
--- /dev/null
+++ b/build/stlport/test/.gitignore
@@ -0,0 +1,2 @@
+obj
+libs
diff --git a/build/subconfigure.py b/build/subconfigure.py
new file mode 100644
index 000000000..3383933a5
--- /dev/null
+++ b/build/subconfigure.py
@@ -0,0 +1,422 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This script is used to capture the content of config.status-generated
+# files and subsequently restore their timestamp if they haven't changed.
+
+import argparse
+import errno
+import itertools
+import os
+import re
+import subprocess
+import sys
+import pickle
+
+import mozpack.path as mozpath
+
+
+class Pool(object):
+ def __new__(cls, size):
+ try:
+ import multiprocessing
+ size = min(size, multiprocessing.cpu_count())
+ return multiprocessing.Pool(size)
+ except:
+ return super(Pool, cls).__new__(cls)
+
+ def imap_unordered(self, fn, iterable):
+ return itertools.imap(fn, iterable)
+
+ def close(self):
+ pass
+
+ def join(self):
+ pass
+
+
+class File(object):
+ def __init__(self, path):
+ self._path = path
+ self._content = open(path, 'rb').read()
+ stat = os.stat(path)
+ self._times = (stat.st_atime, stat.st_mtime)
+
+ @property
+ def path(self):
+ return self._path
+
+ @property
+ def mtime(self):
+ return self._times[1]
+
+ @property
+ def modified(self):
+ '''Returns whether the file was modified since the instance was
+ created. Result is memoized.'''
+ if hasattr(self, '_modified'):
+ return self._modified
+
+ modified = True
+ if os.path.exists(self._path):
+ if open(self._path, 'rb').read() == self._content:
+ modified = False
+ self._modified = modified
+ return modified
+
+ def update_time(self):
+ '''If the file hasn't changed since the instance was created,
+ restore its old modification time.'''
+ if not self.modified:
+ os.utime(self._path, self._times)
+
+
+# As defined in the various sub-configures in the tree
+PRECIOUS_VARS = set([
+ 'build_alias',
+ 'host_alias',
+ 'target_alias',
+ 'CC',
+ 'CFLAGS',
+ 'LDFLAGS',
+ 'LIBS',
+ 'CPPFLAGS',
+ 'CPP',
+ 'CCC',
+ 'CXXFLAGS',
+ 'CXX',
+ 'CCASFLAGS',
+ 'CCAS',
+])
+
+
+CONFIGURE_DATA = 'configure.pkl'
+
+
+# Autoconf, in some of the sub-configures used in the tree, likes to error
+# out when "precious" variables change in value. The solution it gives to
+# straighten things is to either run make distclean or remove config.cache.
+# There's no reason not to do the latter automatically instead of failing,
+# doing the cleanup (which, on buildbots means a full clobber), and
+# restarting from scratch.
+def maybe_clear_cache(data):
+ env = dict(data['env'])
+ for kind in ('target', 'host', 'build'):
+ arg = data[kind]
+ if arg is not None:
+ env['%s_alias' % kind] = arg
+ # configure can take variables assignments in its arguments, and that
+ # overrides whatever is in the environment.
+ for arg in data['args']:
+ if arg[:1] != '-' and '=' in arg:
+ key, value = arg.split('=', 1)
+ env[key] = value
+
+ comment = re.compile(r'^\s+#')
+ cache = {}
+ with open(data['cache-file']) as f:
+ for line in f:
+ if not comment.match(line) and '=' in line:
+ key, value = line.rstrip(os.linesep).split('=', 1)
+ # If the value is quoted, unquote it
+ if value[:1] == "'":
+ value = value[1:-1].replace("'\\''", "'")
+ cache[key] = value
+ for precious in PRECIOUS_VARS:
+ # If there is no entry at all for that precious variable, then
+ # its value is not precious for that particular configure.
+ if 'ac_cv_env_%s_set' % precious not in cache:
+ continue
+ is_set = cache.get('ac_cv_env_%s_set' % precious) == 'set'
+ value = cache.get('ac_cv_env_%s_value' % precious) if is_set else None
+ if value != env.get(precious):
+ print 'Removing %s because of %s value change from:' \
+ % (data['cache-file'], precious)
+ print ' %s' % (value if value is not None else 'undefined')
+ print 'to:'
+ print ' %s' % env.get(precious, 'undefined')
+ os.remove(data['cache-file'])
+ return True
+ return False
+
+
+def split_template(s):
+ """Given a "file:template" string, returns "file", "template". If the string
+ is of the form "file" (without a template), returns "file", "file.in"."""
+ if ':' in s:
+ return s.split(':', 1)
+ return s, '%s.in' % s
+
+
+def get_config_files(data):
+ config_status = mozpath.join(data['objdir'], 'config.status')
+ if not os.path.exists(config_status):
+ return [], []
+
+ configure = mozpath.join(data['srcdir'], 'configure')
+ config_files = []
+ command_files = []
+
+ # Scan the config.status output for information about configuration files
+ # it generates.
+ config_status_output = subprocess.check_output(
+ [data['shell'], '-c', '%s --help' % config_status],
+ stderr=subprocess.STDOUT).splitlines()
+ state = None
+ for line in config_status_output:
+ if line.startswith('Configuration') and line.endswith(':'):
+ if line.endswith('commands:'):
+ state = 'commands'
+ else:
+ state = 'config'
+ elif not line.strip():
+ state = None
+ elif state:
+ for f, t in (split_template(couple) for couple in line.split()):
+ f = mozpath.join(data['objdir'], f)
+ t = mozpath.join(data['srcdir'], t)
+ if state == 'commands':
+ command_files.append(f)
+ else:
+ config_files.append((f, t))
+
+ return config_files, command_files
+
+
+def prepare(srcdir, objdir, shell, args):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--target', type=str)
+ parser.add_argument('--host', type=str)
+ parser.add_argument('--build', type=str)
+ parser.add_argument('--cache-file', type=str)
+ # The --srcdir argument is simply ignored. It's a useless autoconf feature
+ # that we don't support well anyways. This makes it stripped from `others`
+ # and allows to skip setting it when calling the subconfigure (configure
+ # will take it from the configure path anyways).
+ parser.add_argument('--srcdir', type=str)
+
+ data_file = os.path.join(objdir, CONFIGURE_DATA)
+ previous_args = None
+ if os.path.exists(data_file):
+ with open(data_file, 'rb') as f:
+ data = pickle.load(f)
+ previous_args = data['args']
+
+ # Msys likes to break environment variables and command line arguments,
+ # so read those from stdin, as they are passed from the configure script
+ # when necessary (on windows).
+ # However, for some reason, $PATH is not handled like other environment
+ # variables, and msys remangles it even when giving it is already a msys
+ # $PATH. Fortunately, the mangling/demangling is just find for $PATH, so
+ # we can just take the value from the environment. Msys will convert it
+ # back properly when calling subconfigure.
+ input = sys.stdin.read()
+ if input:
+ data = {a: b for [a, b] in eval(input)}
+ environ = {a: b for a, b in data['env']}
+ environ['PATH'] = os.environ['PATH']
+ args = data['args']
+ else:
+ environ = os.environ
+
+ args, others = parser.parse_known_args(args)
+
+ data = {
+ 'target': args.target,
+ 'host': args.host,
+ 'build': args.build,
+ 'args': others,
+ 'shell': shell,
+ 'srcdir': srcdir,
+ 'env': environ,
+ }
+
+ if args.cache_file:
+ data['cache-file'] = mozpath.normpath(mozpath.join(os.getcwd(),
+ args.cache_file))
+ else:
+ data['cache-file'] = mozpath.join(objdir, 'config.cache')
+
+ if previous_args is not None:
+ data['previous-args'] = previous_args
+
+ try:
+ os.makedirs(objdir)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+
+ with open(data_file, 'wb') as f:
+ pickle.dump(data, f)
+
+
+def prefix_lines(text, prefix):
+ return ''.join('%s> %s' % (prefix, line) for line in text.splitlines(True))
+
+
+def run(objdir):
+ ret = 0
+ output = ''
+
+ with open(os.path.join(objdir, CONFIGURE_DATA), 'rb') as f:
+ data = pickle.load(f)
+
+ data['objdir'] = objdir
+
+ cache_file = data['cache-file']
+ cleared_cache = True
+ if os.path.exists(cache_file):
+ cleared_cache = maybe_clear_cache(data)
+
+ config_files, command_files = get_config_files(data)
+ contents = []
+ for f, t in config_files:
+ contents.append(File(f))
+
+ # AC_CONFIG_COMMANDS actually only registers tags, not file names
+ # but most commands are tagged with the file name they create.
+ # However, a few don't, or are tagged with a directory name (and their
+ # command is just to create that directory)
+ for f in command_files:
+ if os.path.isfile(f):
+ contents.append(File(f))
+
+ # Only run configure if one of the following is true:
+ # - config.status doesn't exist
+ # - config.status is older than configure
+ # - the configure arguments changed
+ # - the environment changed in a way that requires a cache clear.
+ configure = mozpath.join(data['srcdir'], 'configure')
+ config_status_path = mozpath.join(objdir, 'config.status')
+ skip_configure = True
+ if not os.path.exists(config_status_path):
+ skip_configure = False
+ config_status = None
+ else:
+ config_status = File(config_status_path)
+ if config_status.mtime < os.path.getmtime(configure) or \
+ data.get('previous-args', data['args']) != data['args'] or \
+ cleared_cache:
+ skip_configure = False
+
+ relobjdir = os.path.relpath(objdir, os.getcwd())
+
+ if not skip_configure:
+ command = [data['shell'], configure]
+ for kind in ('target', 'build', 'host'):
+ if data.get(kind) is not None:
+ command += ['--%s=%s' % (kind, data[kind])]
+ command += data['args']
+ command += ['--cache-file=%s' % cache_file]
+
+ # Pass --no-create to configure so that it doesn't run config.status.
+ # We're going to run it ourselves.
+ command += ['--no-create']
+
+ print prefix_lines('configuring', relobjdir)
+ print prefix_lines('running %s' % ' '.join(command[:-1]), relobjdir)
+ sys.stdout.flush()
+ try:
+ output += subprocess.check_output(command,
+ stderr=subprocess.STDOUT, cwd=objdir, env=data['env'])
+ except subprocess.CalledProcessError as e:
+ return relobjdir, e.returncode, e.output
+
+ # Leave config.status with a new timestamp if configure is newer than
+ # its original mtime.
+ if config_status and os.path.getmtime(configure) <= config_status.mtime:
+ config_status.update_time()
+
+ # Only run config.status if one of the following is true:
+ # - config.status changed or did not exist
+ # - one of the templates for config files is newer than the corresponding
+ # config file.
+ skip_config_status = True
+ if not config_status or config_status.modified:
+ # If config.status doesn't exist after configure (because it's not
+ # an autoconf configure), skip it.
+ if os.path.exists(config_status_path):
+ skip_config_status = False
+ else:
+ # config.status changed or was created, so we need to update the
+ # list of config and command files.
+ config_files, command_files = get_config_files(data)
+ for f, t in config_files:
+ if not os.path.exists(t) or \
+ os.path.getmtime(f) < os.path.getmtime(t):
+ skip_config_status = False
+
+ if not skip_config_status:
+ if skip_configure:
+ print prefix_lines('running config.status', relobjdir)
+ sys.stdout.flush()
+ try:
+ output += subprocess.check_output([data['shell'], '-c',
+ './config.status'], stderr=subprocess.STDOUT, cwd=objdir,
+ env=data['env'])
+ except subprocess.CalledProcessError as e:
+ ret = e.returncode
+ output += e.output
+
+ for f in contents:
+ f.update_time()
+
+ return relobjdir, ret, output
+
+
+def subconfigure(args):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--list', type=str,
+ help='File containing a list of subconfigures to run')
+ parser.add_argument('--skip', type=str,
+ help='File containing a list of Subconfigures to skip')
+ parser.add_argument('subconfigures', type=str, nargs='*',
+ help='Subconfigures to run if no list file is given')
+ args, others = parser.parse_known_args(args)
+ subconfigures = args.subconfigures
+ if args.list:
+ subconfigures.extend(open(args.list, 'rb').read().splitlines())
+ if args.skip:
+ skips = set(open(args.skip, 'rb').read().splitlines())
+ subconfigures = [s for s in subconfigures if s not in skips]
+
+ if not subconfigures:
+ return 0
+
+ ret = 0
+ # One would think using a ThreadPool would be faster, considering
+ # everything happens in subprocesses anyways, but no, it's actually
+ # slower on Windows. (20s difference overall!)
+ pool = Pool(len(subconfigures))
+ for relobjdir, returncode, output in \
+ pool.imap_unordered(run, subconfigures):
+ print prefix_lines(output, relobjdir)
+ sys.stdout.flush()
+ ret = max(returncode, ret)
+ if ret:
+ break
+ pool.close()
+ pool.join()
+ return ret
+
+
+def main(args):
+ if args[0] != '--prepare':
+ return subconfigure(args)
+
+ topsrcdir = os.path.abspath(args[1])
+ subdir = args[2]
+ # subdir can be of the form srcdir:objdir
+ if ':' in subdir:
+ srcdir, subdir = subdir.split(':', 1)
+ else:
+ srcdir = subdir
+ srcdir = os.path.join(topsrcdir, srcdir)
+ objdir = os.path.abspath(subdir)
+
+ return prepare(srcdir, objdir, args[3], args[4:])
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/build/templates.mozbuild b/build/templates.mozbuild
new file mode 100644
index 000000000..c69096b0d
--- /dev/null
+++ b/build/templates.mozbuild
@@ -0,0 +1,118 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+@template
+def Binary():
+ '''Generic template for target binaries. Meant to be used by other
+ templates.'''
+
+ if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
+ USE_LIBS += ['stdc++compat']
+
+ # Ideally, we'd support not adding this to the LIB_IS_C_ONLY case,
+ # but that variable is actually only set in db/sqlite/src, which
+ # doesn't build a shared library on the relevant platforms anyways.
+ # Eventually, though, we should detect LIB_IS_C_ONLY based on the
+ # associated SOURCES (and there might actually be places where we
+ # haven't set it but should have).
+ if CONFIG['STLPORT_LIBS']:
+ OS_LIBS += [CONFIG['STLPORT_LIBS']]
+ elif CONFIG['OS_TARGET'] == 'Android':
+ USE_LIBS += ['stlport']
+
+
+@template
+def Program(name):
+ '''Template for program executables.'''
+ PROGRAM = name
+
+ Binary()
+
+
+@template
+def SimplePrograms(names, ext='.cpp'):
+ '''Template for simple program executables.
+
+ Those have a single source with the same base name as the executable.
+ '''
+ SIMPLE_PROGRAMS += names
+ SOURCES += ['%s%s' % (name, ext) for name in names]
+
+ Binary()
+
+
+@template
+def CppUnitTests(names, ext='.cpp'):
+ '''Template for C++ unit tests.
+
+ Those have a single source with the same base name as the executable.
+ '''
+ CPP_UNIT_TESTS += names
+ SOURCES += ['%s%s' % (name, ext) for name in names]
+
+ Binary()
+
+
+@template
+def Library(name):
+ '''Template for libraries.'''
+ LIBRARY_NAME = name
+
+
+@template
+def SharedLibrary(name):
+ '''Template for shared libraries.'''
+ Library(name)
+
+ FORCE_SHARED_LIB = True
+
+ Binary()
+
+
+@template
+def Framework(name):
+ '''Template for OSX Frameworks.'''
+ SharedLibrary(name)
+
+ IS_FRAMEWORK = True
+
+
+@template
+def HostStdCppCompat():
+ '''Template for libstdc++ compatibility for host binaries.'''
+
+ if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
+ HOST_USE_LIBS += ['host_stdc++compat']
+
+
+@template
+def HostProgram(name):
+ '''Template for build tools executables.'''
+ HOST_PROGRAM = name
+
+ HostStdCppCompat()
+
+
+@template
+def HostSimplePrograms(names, ext='.cpp'):
+ '''Template for simple build tools executables.
+
+ Those have a single source with the same base name as the executable.
+ '''
+ HOST_SIMPLE_PROGRAMS += names
+ HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
+ for name in names]
+
+ HostStdCppCompat()
+
+
+@template
+def HostLibrary(name):
+ '''Template for build tools libraries.'''
+ HOST_LIBRARY_NAME = name
+
+
+include('goanna_templates.mozbuild')
diff --git a/build/unix/Makefile.in b/build/unix/Makefile.in
index 5f2f4ff83..1f1386f60 100644
--- a/build/unix/Makefile.in
+++ b/build/unix/Makefile.in
@@ -4,15 +4,16 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
SDK_BINARY = run-mozilla.sh
+ifneq ($(LLVM_SYMBOLIZER),)
+# Install a copy of the llvm-symbolizer binary to dist/bin, so it can
+# be used for symbolizing traces for e.g. AddressSanitizer
+LLVMSYM_EXECUTABLES=$(LLVM_SYMBOLIZER)
+LLVMSYM_DEST=$(FINAL_TARGET)
+INSTALL_TARGETS += LLVMSYM
+endif
+
include $(topsrcdir)/config/rules.mk
libs:: $(srcdir)/run-mozilla.sh
diff --git a/build/unix/abs2rel.pl b/build/unix/abs2rel.pl
deleted file mode 100644
index 1d511a03b..000000000
--- a/build/unix/abs2rel.pl
+++ /dev/null
@@ -1,35 +0,0 @@
-#!env perl
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-use File::Spec::Unix;
-use strict;
-
-print "Usage: $0 dest_path start_path\n" if ($#ARGV+1 != 2);
-my $finish = my_canonpath(shift);
-my $start = my_canonpath(shift);
-
-my $res = File::Spec::Unix->abs2rel($finish, $start);
-
-#print STDERR "abs2rel($finish,$start) = $res\n";
-print "$res\n";
-
-sub my_canonpath($) {
- my ($file) = @_;
- my (@inlist, @outlist, $dir);
-
- # Do what File::Spec::Unix->no_upwards should do
- my @inlist = split(/\//, File::Spec::Unix->canonpath($file));
- foreach $dir (@inlist) {
- if ($dir eq '..') {
- pop @outlist;
- } else {
- push @outlist, $dir;
- }
- }
- $file = join '/',@outlist;
- return $file;
-}
-
diff --git a/build/unix/build-clang/build-clang.py b/build/unix/build-clang/build-clang.py
index ca8029e66..a6b46e1f6 100755
--- a/build/unix/build-clang/build-clang.py
+++ b/build/unix/build-clang/build-clang.py
@@ -3,45 +3,45 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-llvm_revision = "170890"
-moz_version = "moz0"
-
-##############################################
-
import os
import os.path
import shutil
-import tarfile
import subprocess
import platform
import sys
import json
import collections
+import argparse
+
def check_run(args):
r = subprocess.call(args)
assert r == 0
+
def run_in(path, args):
d = os.getcwd()
os.chdir(path)
check_run(args)
os.chdir(d)
-def patch(patch, plevel, srcdir):
+
+def patch(patch, srcdir):
patch = os.path.realpath(patch)
- check_run(['patch', '-d', srcdir, '-p%s' % plevel, '-i', patch, '--fuzz=0',
+ check_run(['patch', '-d', srcdir, '-p1', '-i', patch, '--fuzz=0',
'-s'])
+
def build_package(package_source_dir, package_build_dir, configure_args,
make_args):
if not os.path.exists(package_build_dir):
os.mkdir(package_build_dir)
run_in(package_build_dir,
["%s/configure" % package_source_dir] + configure_args)
- run_in(package_build_dir, ["make", "-j8"] + make_args)
+ run_in(package_build_dir, ["make", "-j4"] + make_args)
run_in(package_build_dir, ["make", "install"])
+
def with_env(env, f):
old_env = os.environ.copy()
os.environ.update(env)
@@ -49,32 +49,23 @@ def with_env(env, f):
os.environ.clear()
os.environ.update(old_env)
+
def build_tar_package(tar, name, base, directory):
name = os.path.realpath(name)
run_in(base, [tar, "-cjf", name, directory])
+
def svn_co(url, directory, revision):
check_run(["svn", "co", "-r", revision, url, directory])
-# The directories end up in the debug info, so the easy way of getting
-# a reproducible build is to run it in a know absolute directory.
-# We use a directory in /builds/slave because the mozilla infrastructure
-# cleans it up automatically.
-base_dir = "/builds/slave/moz-toolchain"
-
-source_dir = base_dir + "/src"
-build_dir = base_dir + "/build"
-llvm_source_dir = source_dir + "/llvm"
-clang_source_dir = source_dir + "/clang"
-compiler_rt_source_dir = source_dir + "/compiler-rt"
-
-def build_one_stage(env, stage_dir, is_stage_one):
+def build_one_stage(env, stage_dir, llvm_source_dir, gcc_toolchain_dir):
def f():
- build_one_stage_aux(stage_dir, is_stage_one)
+ build_one_stage_aux(stage_dir, llvm_source_dir, gcc_toolchain_dir)
with_env(env, f)
-def build_tooltool_manifest():
+
+def build_tooltool_manifest(llvm_revision):
basedir = os.path.split(os.path.realpath(sys.argv[0]))[0]
tooltool = basedir + '/tooltool.py'
setup = basedir + '/setup.sh'
@@ -82,17 +73,33 @@ def build_tooltool_manifest():
check_run(['python', tooltool, '-m', manifest, 'add',
setup, 'clang.tar.bz2'])
data = json.load(file(manifest), object_pairs_hook=collections.OrderedDict)
- data = [{'clang_version' : 'r%s' % llvm_revision }] + data
- out = file(manifest,'w')
+ data = [{'clang_version': 'r%s' % llvm_revision}] + data
+ out = file(manifest, 'w')
json.dump(data, out, indent=0)
out.write('\n')
assert data[2]['filename'] == 'clang.tar.bz2'
os.rename('clang.tar.bz2', data[2]['digest'])
-isDarwin = platform.system() == "Darwin"
-def build_one_stage_aux(stage_dir, is_stage_one):
+def get_platform():
+ p = platform.system()
+ if p == "Darwin":
+ return "macosx64"
+ elif p == "Linux":
+ if platform.processor() == "x86_64":
+ return "linux64"
+ else:
+ return "linux32"
+ else:
+ raise NotImplementedError("Not supported platform")
+
+
+def is_darwin():
+ return platform.system() == "Darwin"
+
+
+def build_one_stage_aux(stage_dir, llvm_source_dir, gcc_toolchain_dir):
os.mkdir(stage_dir)
build_dir = stage_dir + "/build"
@@ -103,60 +110,89 @@ def build_one_stage_aux(stage_dir, is_stage_one):
# with objects in compiler-rt that are compiled for arm. Since the arm
# support is only necessary for iOS (which we don't support), only enable
# arm support on Linux.
- if not isDarwin:
+ if not is_darwin():
targets.append("arm")
configure_opts = ["--enable-optimized",
"--enable-targets=" + ",".join(targets),
"--disable-assertions",
"--prefix=%s" % inst_dir,
- "--with-gcc-toolchain=/tools/gcc-4.7.3-0moz1"]
- build_package(llvm_source_dir, build_dir, configure_opts,
- [])
-
-if isDarwin:
- os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
-
-if not os.path.exists(source_dir):
- os.makedirs(source_dir)
- svn_co("http://llvm.org/svn/llvm-project/llvm/branches/release_32",
- llvm_source_dir, llvm_revision)
- svn_co("http://llvm.org/svn/llvm-project/cfe/branches/release_32",
- clang_source_dir, llvm_revision)
- svn_co("http://llvm.org/svn/llvm-project/compiler-rt/branches/release_32",
- compiler_rt_source_dir, llvm_revision)
- os.symlink("../../clang", llvm_source_dir + "/tools/clang")
- os.symlink("../../compiler-rt", llvm_source_dir + "/projects/compiler-rt")
- patch("llvm-debug-frame.patch", 1, llvm_source_dir)
- if not isDarwin:
- patch("no-sse-on-linux.patch", 0, clang_source_dir)
-
-if os.path.exists(build_dir):
- shutil.rmtree(build_dir)
-os.makedirs(build_dir)
-
-stage1_dir = build_dir + '/stage1'
-stage1_inst_dir = stage1_dir + '/clang'
-
-if isDarwin:
- extra_cflags = ""
- extra_cxxflags = ""
- cc = "/usr/bin/clang"
- cxx = "/usr/bin/clang++"
-else:
- extra_cflags = "-static-libgcc"
- extra_cxxflags = "-static-libgcc -static-libstdc++"
- cc = "/usr/bin/gcc"
- cxx = "/usr/bin/g++"
-
-build_one_stage({"CC" : cc,
- "CXX" : cxx },
- stage1_dir, True)
-
-stage2_dir = build_dir + '/stage2'
-build_one_stage({"CC" : stage1_inst_dir + "/bin/clang %s" % extra_cflags,
- "CXX" : stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
- stage2_dir, False)
-
-build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
-build_tooltool_manifest()
+ "--with-gcc-toolchain=%s" % gcc_toolchain_dir,
+ "--disable-compiler-version-checks"]
+ build_package(llvm_source_dir, build_dir, configure_opts, [])
+
+if __name__ == "__main__":
+ # The directories end up in the debug info, so the easy way of getting
+ # a reproducible build is to run it in a know absolute directory.
+ # We use a directory in /builds/slave because the mozilla infrastructure
+ # cleans it up automatically.
+ base_dir = "/builds/slave/moz-toolchain"
+
+ source_dir = base_dir + "/src"
+ build_dir = base_dir + "/build"
+
+ llvm_source_dir = source_dir + "/llvm"
+ clang_source_dir = source_dir + "/clang"
+ compiler_rt_source_dir = source_dir + "/compiler-rt"
+
+ gcc_dir = "/tools/gcc-4.7.3-0moz1"
+
+ if is_darwin():
+ os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-c', '--config', required=True,
+ type=argparse.FileType('r'),
+ help="Clang configuration file")
+
+ args = parser.parse_args()
+ config = json.load(args.config)
+ llvm_revision = config["llvm_revision"]
+ llvm_repo = config["llvm_repo"]
+ clang_repo = config["clang_repo"]
+ compiler_repo = config["compiler_repo"]
+
+ if not os.path.exists(source_dir):
+ os.makedirs(source_dir)
+ svn_co(llvm_repo, llvm_source_dir, llvm_revision)
+ svn_co(clang_repo, clang_source_dir, llvm_revision)
+ svn_co(compiler_repo, compiler_rt_source_dir, llvm_revision)
+ os.symlink("../../clang", llvm_source_dir + "/tools/clang")
+ os.symlink("../../compiler-rt",
+ llvm_source_dir + "/projects/compiler-rt")
+ for p in config.get("patches", {}).get(get_platform(), []):
+ patch(p, source_dir)
+
+ if os.path.exists(build_dir):
+ shutil.rmtree(build_dir)
+ os.makedirs(build_dir)
+
+ stage1_dir = build_dir + '/stage1'
+ stage1_inst_dir = stage1_dir + '/clang'
+
+ if is_darwin():
+ extra_cflags = ""
+ extra_cxxflags = ""
+ cc = "/usr/bin/clang"
+ cxx = "/usr/bin/clang++"
+ else:
+ extra_cflags = "-static-libgcc"
+ extra_cxxflags = "-static-libgcc -static-libstdc++"
+ cc = gcc_dir + "/bin/gcc"
+ cxx = gcc_dir + "/bin/g++"
+
+ if os.environ.has_key('LD_LIBRARY_PATH'):
+ os.environ['LD_LIBRARY_PATH'] = '%s/lib64/:%s' % (gcc_dir, os.environ['LD_LIBRARY_PATH']);
+ else:
+ os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir
+
+ build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir, llvm_source_dir, gcc_dir)
+
+ stage2_dir = build_dir + '/stage2'
+ build_one_stage(
+ {"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags,
+ "CXX": stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
+ stage2_dir, llvm_source_dir, gcc_dir)
+
+ build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
+ build_tooltool_manifest(llvm_revision)
diff --git a/build/unix/build-clang/clang-3.3.json b/build/unix/build-clang/clang-3.3.json
new file mode 100644
index 000000000..a165d4003
--- /dev/null
+++ b/build/unix/build-clang/clang-3.3.json
@@ -0,0 +1,11 @@
+{
+ "llvm_revision": "183744",
+ "llvm_repo": "http://llvm.org/svn/llvm-project/llvm/branches/release_33",
+ "clang_repo": "http://llvm.org/svn/llvm-project/cfe/branches/release_33",
+ "compiler_repo": "http://llvm.org/svn/llvm-project/compiler-rt/branches/release_33",
+ "patches": {
+ "macosx64": ["llvm-debug-frame.patch"],
+ "linux64": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"],
+ "linux32": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"]
+ }
+}
diff --git a/build/unix/build-clang/clang-trunk.json b/build/unix/build-clang/clang-trunk.json
new file mode 100644
index 000000000..92663cc2c
--- /dev/null
+++ b/build/unix/build-clang/clang-trunk.json
@@ -0,0 +1,11 @@
+{
+ "llvm_revision": "200213",
+ "llvm_repo": "https://llvm.org/svn/llvm-project/llvm/trunk",
+ "clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
+ "compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
+ "patches": {
+ "macosx64": ["llvm-debug-frame.patch"],
+ "linux64": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"],
+ "linux32": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"]
+ }
+}
diff --git a/build/unix/build-clang/llvm-debug-frame.patch b/build/unix/build-clang/llvm-debug-frame.patch
index 91a45b683..ad8e1ad76 100644
--- a/build/unix/build-clang/llvm-debug-frame.patch
+++ b/build/unix/build-clang/llvm-debug-frame.patch
@@ -1,7 +1,7 @@
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index d6d4510..c488d4a 100644
---- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
-+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
++++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -172,6 +172,8 @@ bool AsmPrinter::doInitialization(Module &M) {
OutStreamer.EmitFileDirective(M.getModuleIdentifier());
}
diff --git a/build/unix/build-clang/no-sse-on-linux-trunk.patch b/build/unix/build-clang/no-sse-on-linux-trunk.patch
new file mode 100644
index 000000000..ac65e057c
--- /dev/null
+++ b/build/unix/build-clang/no-sse-on-linux-trunk.patch
@@ -0,0 +1,13 @@
+Index: lib/Driver/Tools.cpp
+===================================================================
+--- a/clang/lib/Driver/Tools.cpp (revision 199443)
++++ b/clang/lib/Driver/Tools.cpp (working copy)
+@@ -1226,7 +1226,7 @@
+ // All x86 devices running Android have core2 as their common
+ // denominator. This makes a better choice than pentium4.
+ if (Triple.getEnvironment() == llvm::Triple::Android)
+- return "core2";
++ return "686";
+
+ // Everything else goes to x86-64 in 64-bit mode.
+ if (Is64Bit)
diff --git a/build/unix/build-clang/no-sse-on-linux.patch b/build/unix/build-clang/no-sse-on-linux.patch
index 1d6f9149f..f729f3eed 100644
--- a/build/unix/build-clang/no-sse-on-linux.patch
+++ b/build/unix/build-clang/no-sse-on-linux.patch
@@ -1,13 +1,13 @@
Index: lib/Driver/Tools.cpp
===================================================================
---- lib/Driver/Tools.cpp (revision 167750)
-+++ lib/Driver/Tools.cpp (working copy)
-@@ -1179,7 +1179,7 @@
- else if (getToolChain().getArch() == llvm::Triple::x86)
- // All x86 devices running Android have core2 as their common
- // denominator. This makes a better choice than pentium4.
-- CPUName = isAndroid ? "core2" : "pentium4";
-+ CPUName = "i686";
- }
- }
-
+--- a/clang/lib/Driver/Tools.cpp (revision 181515)
++++ b/clang/lib/Driver/Tools.cpp (working copy)
+@@ -1245,7 +1245,7 @@
+ // All x86 devices running Android have core2 as their common
+ // denominator. This makes a better choice than pentium4.
+ if (Triple.getEnvironment() == llvm::Triple::Android)
+- return "core2";
++ return "686";
+
+ // Fallback to p4.
+ return "pentium4";
diff --git a/build/unix/build-clang/tooltool.py b/build/unix/build-clang/tooltool.py
index 1ef3f97a0..ccb77aaea 100755
--- a/build/unix/build-clang/tooltool.py
+++ b/build/unix/build-clang/tooltool.py
@@ -22,16 +22,13 @@
__version__ = '1'
+import json
import os
import optparse
import logging
import hashlib
import urllib2
import ConfigParser
-try:
- import simplejson as json # I hear simplejson is faster
-except ImportError:
- import json
log = logging.getLogger(__name__)
diff --git a/build/unix/build-gcc/build-gcc.sh b/build/unix/build-gcc/build-gcc.sh
new file mode 100644
index 000000000..9d094504c
--- /dev/null
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+gcc_version=4.7.3
+binutils_version=2.23.1
+this_path=$(readlink -f $(dirname $0))
+gcc_bt_patch=${this_path}/gcc-bt.patch
+gcc_pr55650_patch=${this_path}/gcc48-pr55650.patch
+make_flags='-j12'
+
+root_dir=$(mktemp -d)
+cd $root_dir
+
+if test -z $TMPDIR; then
+ TMPDIR=/tmp/
+fi
+
+wget -c -P $TMPDIR ftp://ftp.gnu.org/gnu/binutils/binutils-$binutils_version.tar.bz2 || exit 1
+tar xjf $TMPDIR/binutils-$binutils_version.tar.bz2
+mkdir binutils-objdir
+cd binutils-objdir
+../binutils-$binutils_version/configure --prefix /tools/gcc/ --enable-gold --enable-plugins --disable-nls || exit 1
+make $make_flags || exit 1
+make install $make_flags DESTDIR=$root_dir || exit 1
+cd ..
+
+ wget -c -P $TMPDIR ftp://ftp.gnu.org/gnu/gcc/gcc-$gcc_version/gcc-$gcc_version.tar.bz2 || exit 1
+tar xjf $TMPDIR/gcc-$gcc_version.tar.bz2
+cd gcc-$gcc_version
+
+./contrib/download_prerequisites
+
+# gcc 4.7 doesn't dump a stack on ICE so hack that in
+patch -p1 < $gcc_bt_patch || exit 1
+
+patch -p0 < $gcc_pr55650_patch || exit 1
+
+cd ..
+mkdir gcc-objdir
+cd gcc-objdir
+../gcc-$gcc_version/configure --prefix=/tools/gcc --enable-languages=c,c++ --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro || exit 1
+make $make_flags || exit 1
+make $make_flags install DESTDIR=$root_dir || exit 1
+
+cd $root_dir/tools
+tar caf $root_dir/gcc.tar.xz gcc/
diff --git a/build/unix/build-gcc/gcc-bt.patch b/build/unix/build-gcc/gcc-bt.patch
new file mode 100644
index 000000000..087515c2d
--- /dev/null
+++ b/build/unix/build-gcc/gcc-bt.patch
@@ -0,0 +1,25 @@
+--- gcc-4.7.3/gcc/diagnostic.c 2012-02-02 15:46:06.000000000 -0500
++++ gcc-patched/gcc/diagnostic.c 2013-05-23 14:07:10.756527912 -0400
+@@ -31,6 +31,10 @@
+ #include "intl.h"
+ #include "diagnostic.h"
+
++#include <execinfo.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdio.h>
+ #define pedantic_warning_kind(DC) \
+ ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING)
+ #define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR)
+@@ -237,6 +241,11 @@
+ if (context->abort_on_error)
+ real_abort ();
+
++ {
++ void *stack[100];
++ int count = backtrace(stack, 100);
++ backtrace_symbols_fd(stack, count, STDERR_FILENO);
++ }
+ fnotice (stderr, "Please submit a full bug report,\n"
+ "with preprocessed source if appropriate.\n"
+ "See %s for instructions.\n", bug_report_url);
diff --git a/build/unix/build-gcc/gcc48-pr55650.patch b/build/unix/build-gcc/gcc48-pr55650.patch
new file mode 100644
index 000000000..e051ab84c
--- /dev/null
+++ b/build/unix/build-gcc/gcc48-pr55650.patch
@@ -0,0 +1,52 @@
+2012-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR gcov-profile/55650
+ * coverage.c (coverage_obj_init): Return false if no functions
+ are being emitted.
+
+ * g++.dg/other/pr55650.C: New test.
+ * g++.dg/other/pr55650.cc: New file.
+
+--- gcc/coverage.c.jj 2012-11-19 14:41:24.000000000 +0100
++++ gcc/coverage.c 2012-12-12 08:54:35.005180211 +0100
+@@ -999,6 +999,9 @@ coverage_obj_init (void)
+ /* The function is not being emitted, remove from list. */
+ *fn_prev = fn->next;
+
++ if (functions_head == NULL)
++ return false;
++
+ for (ix = 0; ix != GCOV_COUNTERS; ix++)
+ if ((1u << ix) & prg_ctr_mask)
+ n_counters++;
+--- gcc/testsuite/g++.dg/other/pr55650.C.jj 2012-12-12 09:03:53.342876593 +0100
++++ gcc/testsuite/g++.dg/other/pr55650.C 2012-12-12 09:03:11.000000000 +0100
+@@ -0,0 +1,21 @@
++// PR gcov-profile/55650
++// { dg-do link }
++// { dg-options "-O2 -fprofile-generate" }
++// { dg-additional-sources "pr55650.cc" }
++
++struct A
++{
++ virtual void foo ();
++};
++
++struct B : public A
++{
++ B ();
++ void foo () {}
++};
++
++inline A *
++bar ()
++{
++ return new B;
++}
+--- gcc/testsuite/g++.dg/other/pr55650.cc.jj 2012-12-12 09:03:56.329858741 +0100
++++ gcc/testsuite/g++.dg/other/pr55650.cc 2012-12-12 09:03:48.982900718 +0100
+@@ -0,0 +1,4 @@
++int
++main ()
++{
++}
diff --git a/build/unix/build-toolchain/binutils-deterministic.patch b/build/unix/build-toolchain/binutils-deterministic.patch
deleted file mode 100644
index f602013cb..000000000
--- a/build/unix/build-toolchain/binutils-deterministic.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -ru a/binutils/ar.c b/binutils/ar.c
---- a/binutils/ar.c 2011-03-16 04:35:58.000000000 -0400
-+++ b/binutils/ar.c 2012-01-19 15:44:46.211226017 -0500
-@@ -98,7 +98,7 @@
- /* Operate in deterministic mode: write zero for timestamps, uids,
- and gids for archive members and the archive symbol table, and write
- consistent file modes. */
--int deterministic = 0;
-+int deterministic = TRUE;
-
- /* Nonzero means it's the name of an existing member; position new or moved
- files with respect to this one. */
-@@ -634,9 +634,6 @@
- if (newer_only && operation != replace)
- fatal (_("`u' is only meaningful with the `r' option."));
-
-- if (newer_only && deterministic)
-- fatal (_("`u' is not meaningful with the `D' option."));
--
- if (postype != pos_default)
- posname = argv[arg_index++];
-
diff --git a/build/unix/build-toolchain/build-gcc.py b/build/unix/build-toolchain/build-gcc.py
deleted file mode 100755
index cd1e63f9d..000000000
--- a/build/unix/build-toolchain/build-gcc.py
+++ /dev/null
@@ -1,315 +0,0 @@
-#!/usr/bin/python
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-# The directories end up in the debug info, so the easy way of getting
-# a reproducible build is to run it in a know absolute directory.
-# We use a directory in /builds/slave because the mozilla infrastructure
-# cleans it up automatically.
-base_dir = "/builds/slave/moz-toolchain"
-
-source_dir = base_dir + "/src"
-build_dir = base_dir + "/build"
-aux_inst_dir = build_dir + '/aux_inst'
-old_make = aux_inst_dir + '/bin/make'
-
-##############################################
-
-import urllib
-import os
-import os.path
-import shutil
-import tarfile
-import subprocess
-
-def download_uri(uri):
- fname = uri.split('/')[-1]
- if (os.path.exists(fname)):
- return fname
- urllib.urlretrieve(uri, fname)
- return fname
-
-def extract(tar, path):
- t = tarfile.open(tar)
- t.extractall(path)
-
-def check_run(args):
- r = subprocess.call(args)
- assert r == 0
-
-def run_in(path, args):
- d = os.getcwd()
- os.chdir(path)
- check_run(args)
- os.chdir(d)
-
-def patch(patch, plevel, srcdir):
- patch = os.path.realpath(patch)
- check_run(['patch', '-d', srcdir, '-p%s' % plevel, '-i', patch, '--fuzz=0',
- '-s'])
-
-def build_package(package_source_dir, package_build_dir, configure_args,
- make = old_make):
- if not os.path.exists(package_build_dir):
- os.mkdir(package_build_dir)
- run_in(package_build_dir,
- ["%s/configure" % package_source_dir] + configure_args)
- run_in(package_build_dir, [make, "-j8"])
- run_in(package_build_dir, [make, "install"])
-
-def build_aux_tools(base_dir):
- make_build_dir = base_dir + '/make_build'
- build_package(make_source_dir, make_build_dir,
- ["--prefix=%s" % aux_inst_dir], "make")
-
- run_in(unifdef_source_dir, ["make"])
- run_in(unifdef_source_dir, ["make", "prefix=%s" % aux_inst_dir, "install"])
-
- tar_build_dir = base_dir + '/tar_build'
- build_package(tar_source_dir, tar_build_dir,
- ["--prefix=%s" % aux_inst_dir])
-
- gawk_build_dir = base_dir + '/gawk_build'
- build_package(gawk_source_dir, gawk_build_dir,
- ["--prefix=%s" % aux_inst_dir])
-
-def with_env(env, f):
- old_env = os.environ.copy()
- os.environ.update(env)
- f()
- os.environ.clear()
- os.environ.update(old_env)
-
-def build_glibc(env, stage_dir, inst_dir):
- def f():
- build_glibc_aux(stage_dir, inst_dir)
- with_env(env, f)
-
-def build_glibc_aux(stage_dir, inst_dir):
- glibc_build_dir = stage_dir + '/glibc'
- build_package(glibc_source_dir, glibc_build_dir,
- ["--disable-profile",
- "--enable-add-ons=nptl",
- "--without-selinux",
- "--enable-kernel=%s" % linux_version,
- "--libdir=%s/lib64" % inst_dir,
- "--prefix=%s" % inst_dir])
-
-def build_linux_headers_aux(inst_dir):
- run_in(linux_source_dir, [old_make, "headers_check"])
- run_in(linux_source_dir, [old_make, "INSTALL_HDR_PATH=dest",
- "headers_install"])
- shutil.move(linux_source_dir + "/dest/include", inst_dir + '/include')
-
-def build_linux_headers(inst_dir):
- def f():
- build_linux_headers_aux(inst_dir)
- with_env({"PATH" : aux_inst_dir + "/bin:%s" % os.environ["PATH"]}, f)
-
-def build_gcc(stage_dir, is_stage_one):
- gcc_build_dir = stage_dir + '/gcc'
- tool_inst_dir = stage_dir + '/inst'
- lib_inst_dir = stage_dir + '/libinst'
- gcc_configure_args = ["--prefix=%s" % tool_inst_dir,
- "--enable-__cxa_atexit",
- "--with-gmp=%s" % lib_inst_dir,
- "--with-mpfr=%s" % lib_inst_dir,
- "--with-mpc=%s" % lib_inst_dir,
- "--enable-languages=c,c++",
- "--disable-lto",
- "--disable-multilib",
- "--disable-bootstrap"]
- if is_stage_one:
- # We build the stage1 gcc without shared libraries. Otherwise its
- # libgcc.so would depend on the system libc.so, which causes problems
- # when it tries to use that libgcc.so and the libc we are about to
- # build.
- gcc_configure_args.append("--disable-shared")
-
- build_package(gcc_source_dir, gcc_build_dir, gcc_configure_args)
-
- if is_stage_one:
- # The glibc build system uses -lgcc_eh, but at least in this setup
- # libgcc.a has all it needs.
- d = tool_inst_dir + "/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/"
- os.symlink(d + "libgcc.a", d + "libgcc_eh.a")
-
-def build_one_stage(env, stage_dir, is_stage_one):
- def f():
- build_one_stage_aux(stage_dir, is_stage_one)
- with_env(env, f)
-
-def build_one_stage_aux(stage_dir, is_stage_one):
- os.mkdir(stage_dir)
-
- lib_inst_dir = stage_dir + '/libinst'
-
- gmp_build_dir = stage_dir + '/gmp'
- build_package(gmp_source_dir, gmp_build_dir,
- ["--prefix=%s" % lib_inst_dir, "--disable-shared"])
- mpfr_build_dir = stage_dir + '/mpfr'
- build_package(mpfr_source_dir, mpfr_build_dir,
- ["--prefix=%s" % lib_inst_dir, "--disable-shared",
- "--with-gmp=%s" % lib_inst_dir])
- mpc_build_dir = stage_dir + '/mpc'
- build_package(mpc_source_dir, mpc_build_dir,
- ["--prefix=%s" % lib_inst_dir, "--disable-shared",
- "--with-gmp=%s" % lib_inst_dir,
- "--with-mpfr=%s" % lib_inst_dir])
-
- tool_inst_dir = stage_dir + '/inst'
- os.mkdir(tool_inst_dir)
- os.mkdir(tool_inst_dir + '/lib64')
- os.symlink('lib64', tool_inst_dir + '/lib')
-
- build_linux_headers(tool_inst_dir)
-
- # zlib's configure only works if run from the source dir, copy the source
- zlib_build_dir = stage_dir + '/zlib'
- shutil.copytree(zlib_source_dir, zlib_build_dir)
- build_package(zlib_build_dir, zlib_build_dir,
- ["--prefix=%s" % tool_inst_dir])
-
- binutils_build_dir = stage_dir + '/binutils'
- build_package(binutils_source_dir, binutils_build_dir,
- ["--prefix=%s" % tool_inst_dir,
- "--without-zlib"])
-
- # During stage one we have to build gcc first, this glibc doesn't even
- # build with gcc 4.6. During stage two, we have to build glibc first.
- # The problem is that libstdc++ is built with xgcc and if glibc has
- # not been built yet xgcc will use the system one.
- if is_stage_one:
- build_gcc(stage_dir, is_stage_one)
- build_glibc({"CC" : tool_inst_dir + "/bin/gcc",
- "CXX" : tool_inst_dir + "/bin/g++"},
- stage_dir, tool_inst_dir)
- else:
- build_glibc({}, stage_dir, tool_inst_dir)
- build_gcc(stage_dir, is_stage_one)
-
-def build_tar_package(tar, name, base, directory):
- name = os.path.realpath(name)
- run_in(base, [tar, "-cf", name, "--mtime=2012-01-01", "--owner=root",
- directory])
-
-##############################################
-
-def build_source_dir(prefix, version):
- return source_dir + '/' + prefix + version
-
-binutils_version = "2.21.1"
-glibc_version = "2.5.1"
-linux_version = "2.6.18"
-tar_version = "1.26"
-gawk_version = "3.1.5"
-make_version = "3.81"
-gcc_version = "4.5.2"
-mpfr_version = "2.4.2"
-zlib_version = "1.2.3"
-gmp_version = "5.0.1"
-mpc_version = "0.8.1"
-unifdef_version = "2.6"
-
-binutils_source_uri = "http://ftp.gnu.org/gnu/binutils/binutils-%sa.tar.bz2" % \
- binutils_version
-glibc_source_uri = "http://ftp.gnu.org/gnu/glibc/glibc-%s.tar.bz2" % \
- glibc_version
-linux_source_uri = "http://www.kernel.org/pub/linux/kernel/v2.6/linux-%s.tar.bz2" % \
- linux_version
-tar_source_uri = "http://ftp.gnu.org/gnu/tar/tar-%s.tar.bz2" % \
- tar_version
-gawk_source_uri = "http://ftp.gnu.org/gnu/gawk/gawk-%s.tar.bz2" % \
- gawk_version
-make_source_uri = "http://ftp.gnu.org/gnu/make/make-%s.tar.bz2" % \
- make_version
-unifdef_source_uri = "http://dotat.at/prog/unifdef/unifdef-%s.tar.gz" % \
- unifdef_version
-gcc_source_uri = "http://ftp.gnu.org/gnu/gcc/gcc-%s/gcc-%s.tar.bz2" % \
- (gcc_version, gcc_version)
-mpfr_source_uri = "http://www.mpfr.org/mpfr-%s/mpfr-%s.tar.bz2" % \
- (mpfr_version, mpfr_version)
-zlib_source_uri = "http://iweb.dl.sourceforge.net/project/libpng/zlib/%s/zlib-%s.tar.bz2" % (zlib_version, zlib_version)
-gmp_source_uri = "http://ftp.gnu.org/gnu/gmp/gmp-%s.tar.bz2" % gmp_version
-mpc_source_uri = "http://www.multiprecision.org/mpc/download/mpc-%s.tar.gz" % \
- mpc_version
-
-binutils_source_tar = download_uri(binutils_source_uri)
-glibc_source_tar = download_uri(glibc_source_uri)
-linux_source_tar = download_uri(linux_source_uri)
-tar_source_tar = download_uri(tar_source_uri)
-gawk_source_tar = download_uri(gawk_source_uri)
-make_source_tar = download_uri(make_source_uri)
-unifdef_source_tar = download_uri(unifdef_source_uri)
-mpc_source_tar = download_uri(mpc_source_uri)
-mpfr_source_tar = download_uri(mpfr_source_uri)
-zlib_source_tar = download_uri(zlib_source_uri)
-gmp_source_tar = download_uri(gmp_source_uri)
-gcc_source_tar = download_uri(gcc_source_uri)
-
-binutils_source_dir = build_source_dir('binutils-', binutils_version)
-glibc_source_dir = build_source_dir('glibc-', glibc_version)
-linux_source_dir = build_source_dir('linux-', linux_version)
-tar_source_dir = build_source_dir('tar-', tar_version)
-gawk_source_dir = build_source_dir('gawk-', gawk_version)
-make_source_dir = build_source_dir('make-', make_version)
-unifdef_source_dir = build_source_dir('unifdef-', unifdef_version)
-mpc_source_dir = build_source_dir('mpc-', mpc_version)
-mpfr_source_dir = build_source_dir('mpfr-', mpfr_version)
-zlib_source_dir = build_source_dir('zlib-', zlib_version)
-gmp_source_dir = build_source_dir('gmp-', gmp_version)
-gcc_source_dir = build_source_dir('gcc-', gcc_version)
-
-if not os.path.exists(source_dir):
- os.makedirs(source_dir)
- extract(binutils_source_tar, source_dir)
- patch('binutils-deterministic.patch', 1, binutils_source_dir)
- extract(glibc_source_tar, source_dir)
- extract(linux_source_tar, source_dir)
- patch('glibc-deterministic.patch', 1, glibc_source_dir)
- run_in(glibc_source_dir, ["autoconf"])
- extract(tar_source_tar, source_dir)
- extract(gawk_source_tar, source_dir)
- extract(make_source_tar, source_dir)
- extract(unifdef_source_tar, source_dir)
- extract(mpc_source_tar, source_dir)
- extract(mpfr_source_tar, source_dir)
- extract(zlib_source_tar, source_dir)
- extract(gmp_source_tar, source_dir)
- extract(gcc_source_tar, source_dir)
- patch('plugin_finish_decl.diff', 0, gcc_source_dir)
- patch('libtool-74c8993c178a1386ea5e2363a01d919738402f30.patch', 1, gcc_source_dir)
- patch('pr49911.diff', 1, gcc_source_dir)
- patch('r159628-r163231-r171807.patch', 1, gcc_source_dir)
- patch('gcc-fixinc.patch', 1, gcc_source_dir)
- patch('gcc-include.patch', 1, gcc_source_dir)
-
-if os.path.exists(build_dir):
- shutil.rmtree(build_dir)
-os.makedirs(build_dir)
-
-build_aux_tools(build_dir)
-
-basic_path = aux_inst_dir + "/bin:/bin:/usr/bin"
-
-stage1_dir = build_dir + '/stage1'
-build_one_stage({"PATH" : basic_path,
- "CC" : "gcc",
- "CXX" : "g++" },
- stage1_dir, True)
-
-for stage_num in range(2, 4):
- prev_stage_dir = build_dir + '/stage' + str(stage_num - 1)
- prev_stage_inst_dir = prev_stage_dir + '/inst'
- cur_stage_dir = build_dir + '/stage' + str(stage_num)
- build_one_stage({"PATH" : prev_stage_inst_dir + "/bin:" + basic_path,
- "CC" : "gcc -fgnu89-inline",
- "CXX" : "g++",
- "RANLIB" : "true" },
- cur_stage_dir, False)
-
-stage3_dir = build_dir + '/stage3'
-build_tar_package(aux_inst_dir + "/bin/tar",
- "toolchain.tar", stage3_dir, "inst")
diff --git a/build/unix/build-toolchain/gcc-fixinc.patch b/build/unix/build-toolchain/gcc-fixinc.patch
deleted file mode 100644
index 3fb7f5654..000000000
--- a/build/unix/build-toolchain/gcc-fixinc.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ru a/fixincludes/Makefile.in b/fixincludes/Makefile.in
---- a/fixincludes/Makefile.in 2009-07-30 18:33:49.000000000 -0400
-+++ b/fixincludes/Makefile.in 2012-02-27 14:59:09.371875951 -0500
-@@ -126,7 +126,7 @@
- fixlib.o : fixlib.c
-
- fixinc.sh : fixinc.in mkfixinc.sh Makefile
-- srcdir="$(srcdir)" $(SHELL) $(srcdir)/mkfixinc.sh $(target)
-+ echo "#!/bin/sh" > $@
-
- $(srcdir)/fixincl.x: @MAINT@ fixincl.tpl inclhack.def
- cd $(srcdir) ; $(SHELL) ./genfixes
diff --git a/build/unix/build-toolchain/gcc-include.patch b/build/unix/build-toolchain/gcc-include.patch
deleted file mode 100644
index 35c5147a9..000000000
--- a/build/unix/build-toolchain/gcc-include.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -ru a/configure b/configure
---- a/configure 2010-10-06 06:29:55.000000000 -0400
-+++ b/configure 2012-02-27 20:46:26.303460301 -0500
-@@ -8047,7 +8047,7 @@
- # being built; programs in there won't even run.
- if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
- # Search for pre-installed headers if nothing else fits.
-- FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
-+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(exec_prefix)/bin/ -B$(exec_prefix)/lib/ -isystem $(exec_prefix)/include -isystem $(exec_prefix)/sys-include'
- fi
-
- if test "x${use_gnu_ld}" = x &&
-diff -ru a/configure.ac b/configure.ac
---- a/configure.ac 2010-10-06 06:29:55.000000000 -0400
-+++ b/configure.ac 2012-02-27 20:46:22.587442745 -0500
-@@ -3100,7 +3100,7 @@
- # being built; programs in there won't even run.
- if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
- # Search for pre-installed headers if nothing else fits.
-- FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
-+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(exec_prefix)/bin/ -B$(exec_prefix)/lib/ -isystem $(exec_prefix)/include -isystem $(exec_prefix)/sys-include'
- fi
-
- if test "x${use_gnu_ld}" = x &&
diff --git a/build/unix/build-toolchain/glibc-deterministic.patch b/build/unix/build-toolchain/glibc-deterministic.patch
deleted file mode 100644
index bc5a11f09..000000000
--- a/build/unix/build-toolchain/glibc-deterministic.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-diff -ru a/configure.in b/configure.in
---- a/configure.in 2011-01-17 23:34:07.000000000 -0500
-+++ b/configure.in 2012-01-25 20:40:27.919485606 -0500
-@@ -841,14 +841,6 @@
- LIBC_PROG_BINUTILS
- AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
-
--# Accept binutils 2.13 or newer.
--AC_CHECK_PROG_VER(AS, $AS, --version,
-- [GNU assembler.* \([0-9]*\.[0-9.]*\)],
-- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
--AC_CHECK_PROG_VER(LD, $LD, --version,
-- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
-- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
--
- # We need the physical current working directory. We cannot use the
- # "pwd -P" shell builtin since that's not portable. Instead we try to
- # find a pwd binary. Note that assigning to the PWD environment
-@@ -2175,6 +2167,7 @@
- fi
- AC_SUBST(old_glibc_headers)
-
-+libc_cv_slibdir=${prefix}/lib64
- AC_SUBST(libc_cv_slibdir)
- AC_SUBST(libc_cv_localedir)
- AC_SUBST(libc_cv_sysconfdir)
-diff -ru a/csu/Makefile b/csu/Makefile
---- a/csu/Makefile 2011-01-17 23:34:07.000000000 -0500
-+++ b/csu/Makefile 2012-01-23 13:58:28.957792633 -0500
-@@ -223,8 +223,7 @@
- if [ -z "$$os" ]; then \
- os=Linux; \
- fi; \
-- printf '"Compiled on a %s %s system on %s.\\n"\n' \
-- "$$os" "$$version" "`date +%Y-%m-%d`";; \
-+ ;; \
- *) ;; \
- esac; \
- files="$(all-Banner-files)"; \
-diff -ru a/elf/Makefile b/elf/Makefile
---- a/elf/Makefile 2008-10-31 16:35:11.000000000 -0400
-+++ b/elf/Makefile 2012-02-16 12:20:00.038593752 -0500
-@@ -295,18 +295,11 @@
- z-now-yes = -Wl,-z,now
-
- $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
-- @rm -f $@.lds
-- $(LINK.o) -nostdlib -nostartfiles -shared $(z-now-$(bind-now)) \
-- $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
-- LC_ALL=C \
-- sed -e '/^=========/,/^=========/!d;/^=========/d' \
-- -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
-- > $@.lds
- $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
- $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
- $(filter-out $(map-file),$^) $(load-map-file) \
-- -Wl,-soname=$(rtld-installed-name) -T $@.lds
-- rm -f $@.lds
-+ -Wl,-soname=$(rtld-installed-name) \
-+ -Wl,-defsym=_begin=0
-
- # interp.c exists just to get this string into the libraries.
- CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
-diff -ru a/localedata/Makefile b/localedata/Makefile
---- a/localedata/Makefile 2006-04-26 01:14:03.000000000 -0400
-+++ b/localedata/Makefile 2012-02-17 10:31:24.592345047 -0500
-@@ -113,7 +113,7 @@
- $(make-target-directory)
- rm -f $(@:.gz=) $@
- $(INSTALL_DATA) $< $(@:.gz=)
-- gzip -9 $(@:.gz=)
-+ gzip -9n $(@:.gz=)
-
- # Install the locale source files in the appropriate directory.
- $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
-diff -ru a/Makeconfig b/Makeconfig
---- a/Makeconfig 2006-07-10 17:42:27.000000000 -0400
-+++ b/Makeconfig 2012-02-17 08:28:31.859584817 -0500
-@@ -674,7 +674,7 @@
- $(foreach lib,$(libof-$(basename $(@F))) \
- $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
- $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
--override CFLAGS = -std=gnu99 \
-+override CFLAGS = -std=gnu99 -fgnu89-inline \
- $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
- $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
- $(CFLAGS-$(@F))
-diff -ru a/Makerules b/Makerules
---- a/Makerules 2011-01-17 23:34:07.000000000 -0500
-+++ b/Makerules 2012-01-30 08:47:56.565068903 -0500
-@@ -977,9 +977,9 @@
- echo ' Use the shared library, but some functions are only in';\
- echo ' the static library, so try that secondarily. */';\
- cat $<; \
-- echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
-- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
-- ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \
-+ echo 'GROUP ( libc.so$(libc.so-version)' \
-+ '$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
-+ ' AS_NEEDED (' $(rtld-installed-name) ') )' \
- ) > $@.new
- mv -f $@.new $@
-
-diff -ru a/nscd/nscd_stat.c b/nscd/nscd_stat.c
---- a/nscd/nscd_stat.c 2011-01-17 23:34:07.000000000 -0500
-+++ b/nscd/nscd_stat.c 2012-01-23 15:54:45.231607606 -0500
-@@ -38,7 +38,7 @@
-
-
- /* We use this to make sure the receiver is the same. */
--static const char compilation[21] = __DATE__ " " __TIME__;
-+static const char compilation[21] = "don't need this";
-
- /* Statistic data for one database. */
- struct dbstat
diff --git a/build/unix/build-toolchain/libtool-74c8993c178a1386ea5e2363a01d919738402f30.patch b/build/unix/build-toolchain/libtool-74c8993c178a1386ea5e2363a01d919738402f30.patch
deleted file mode 100644
index 15187f6a7..000000000
--- a/build/unix/build-toolchain/libtool-74c8993c178a1386ea5e2363a01d919738402f30.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ruN a/ltmain.sh b/ltmain.sh
---- a/ltmain.sh 2009-12-05 12:18:53.000000000 -0500
-+++ b/ltmain.sh 2012-05-07 16:19:31.871827967 -0400
-@@ -2932,7 +2932,7 @@
- func_extract_an_archive "$my_xdir" "$my_xabs"
- ;;
- esac
-- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
-+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
- done
-
- func_extract_archives_result="$my_oldobjs"
diff --git a/build/unix/build-toolchain/plugin_finish_decl.diff b/build/unix/build-toolchain/plugin_finish_decl.diff
deleted file mode 100644
index 711ba4712..000000000
--- a/build/unix/build-toolchain/plugin_finish_decl.diff
+++ /dev/null
@@ -1,179 +0,0 @@
-Index: gcc/doc/plugins.texi
-===================================================================
---- gcc/doc/plugins.texi (revision 162126)
-+++ gcc/doc/plugins.texi (working copy)
-@@ -144,6 +144,7 @@
- @{
- PLUGIN_PASS_MANAGER_SETUP, /* To hook into pass manager. */
- PLUGIN_FINISH_TYPE, /* After finishing parsing a type. */
-+ PLUGIN_FINISH_DECL, /* After finishing parsing a declaration. */
- PLUGIN_FINISH_UNIT, /* Useful for summary processing. */
- PLUGIN_PRE_GENERICIZE, /* Allows to see low level AST in C and C++ frontends. */
- PLUGIN_FINISH, /* Called before GCC exits. */
-Index: gcc/plugin.def
-===================================================================
---- gcc/plugin.def (revision 162126)
-+++ gcc/plugin.def (working copy)
-@@ -24,6 +24,9 @@
- /* After finishing parsing a type. */
- DEFEVENT (PLUGIN_FINISH_TYPE)
-
-+/* After finishing parsing a declaration. */
-+DEFEVENT (PLUGIN_FINISH_DECL)
-+
- /* Useful for summary processing. */
- DEFEVENT (PLUGIN_FINISH_UNIT)
-
-Index: gcc/testsuite/g++.dg/plugin/plugin.exp
-===================================================================
---- gcc/testsuite/g++.dg/plugin/plugin.exp (revision 162126)
-+++ gcc/testsuite/g++.dg/plugin/plugin.exp (working copy)
-@@ -51,7 +51,8 @@
- { pragma_plugin.c pragma_plugin-test-1.C } \
- { selfassign.c self-assign-test-1.C self-assign-test-2.C self-assign-test-3.C } \
- { dumb_plugin.c dumb-plugin-test-1.C } \
-- { header_plugin.c header-plugin-test.C } ]
-+ { header_plugin.c header-plugin-test.C } \
-+ { decl_plugin.c decl-plugin-test.C } ]
-
- foreach plugin_test $plugin_test_list {
- # Replace each source file with its full-path name
-Index: gcc/testsuite/g++.dg/plugin/decl-plugin-test.C
-===================================================================
---- gcc/testsuite/g++.dg/plugin/decl-plugin-test.C (revision 0)
-+++ gcc/testsuite/g++.dg/plugin/decl-plugin-test.C (revision 0)
-@@ -0,0 +1,32 @@
-+
-+
-+extern int global; // { dg-warning "Decl Global global" }
-+int global_array[] = { 1, 2, 3 }; // { dg-warning "Decl Global global_array" }
-+
-+int takes_args(int arg1, int arg2)
-+{
-+ int local = arg1 + arg2 + global; // { dg-warning "Decl Local local" }
-+ return local + 1;
-+}
-+
-+int global = 12; // { dg-warning "Decl Global global" }
-+
-+struct test_str {
-+ int field; // { dg-warning "Decl Field field" }
-+};
-+
-+class test_class {
-+ int class_field1; // { dg-warning "Decl Field class_field1" }
-+ int class_field2; // { dg-warning "Decl Field class_field2" }
-+
-+ test_class() // { dg-warning "Decl Function test_class" }
-+ : class_field1(0), class_field2(0)
-+ {}
-+
-+ void swap_fields(int bias) // { dg-warning "Decl Function swap_fields" }
-+ {
-+ int temp = class_field1 + bias; // { dg-warning "Decl Local temp" }
-+ class_field1 = class_field2 - bias;
-+ class_field2 = temp;
-+ }
-+};
-Index: gcc/testsuite/g++.dg/plugin/decl_plugin.c
-===================================================================
---- gcc/testsuite/g++.dg/plugin/decl_plugin.c (revision 0)
-+++ gcc/testsuite/g++.dg/plugin/decl_plugin.c (revision 0)
-@@ -0,0 +1,51 @@
-+/* A plugin example that shows which declarations are caught by FINISH_DECL */
-+
-+#include "gcc-plugin.h"
-+#include <stdlib.h>
-+#include "config.h"
-+#include "system.h"
-+#include "coretypes.h"
-+#include "tree.h"
-+#include "tree-pass.h"
-+#include "intl.h"
-+
-+int plugin_is_GPL_compatible;
-+
-+/* Callback function to invoke after GCC finishes a declaration. */
-+
-+void plugin_finish_decl (void *event_data, void *data)
-+{
-+ tree decl = (tree) event_data;
-+
-+ const char *kind = NULL;
-+ switch (TREE_CODE(decl)) {
-+ case FUNCTION_DECL:
-+ kind = "Function"; break;
-+ case PARM_DECL:
-+ kind = "Parameter"; break;
-+ case VAR_DECL:
-+ if (DECL_CONTEXT(decl) != NULL)
-+ kind = "Local";
-+ else
-+ kind = "Global";
-+ break;
-+ case FIELD_DECL:
-+ kind = "Field"; break;
-+ default:
-+ kind = "Unknown";
-+ }
-+
-+ warning (0, G_("Decl %s %s"),
-+ kind, IDENTIFIER_POINTER (DECL_NAME (decl)));
-+}
-+
-+int
-+plugin_init (struct plugin_name_args *plugin_info,
-+ struct plugin_gcc_version *version)
-+{
-+ const char *plugin_name = plugin_info->base_name;
-+
-+ register_callback (plugin_name, PLUGIN_FINISH_DECL,
-+ plugin_finish_decl, NULL);
-+ return 0;
-+}
-Index: gcc/cp/decl.c
-===================================================================
---- gcc/cp/decl.c (revision 162126)
-+++ gcc/cp/decl.c (working copy)
-@@ -5967,6 +5967,8 @@
- /* If this was marked 'used', be sure it will be output. */
- if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
- mark_decl_referenced (decl);
-+
-+ invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
- }
-
- /* Returns a declaration for a VAR_DECL as if:
-Index: gcc/c-decl.c
-===================================================================
---- gcc/c-decl.c (revision 162126)
-+++ gcc/c-decl.c (working copy)
-@@ -4392,6 +4392,8 @@
- && DECL_INITIAL (decl) == NULL_TREE)
- warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
- "uninitialized const %qD is invalid in C++", decl);
-+
-+ invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
- }
-
- /* Given a parsed parameter declaration, decode it into a PARM_DECL. */
-Index: gcc/plugin.c
-===================================================================
---- gcc/plugin.c (revision 162126)
-+++ gcc/plugin.c (working copy)
-@@ -400,6 +400,7 @@
- }
- /* Fall through. */
- case PLUGIN_FINISH_TYPE:
-+ case PLUGIN_FINISH_DECL:
- case PLUGIN_START_UNIT:
- case PLUGIN_FINISH_UNIT:
- case PLUGIN_PRE_GENERICIZE:
-@@ -481,6 +482,7 @@
- gcc_assert (event < event_last);
- /* Fall through. */
- case PLUGIN_FINISH_TYPE:
-+ case PLUGIN_FINISH_DECL:
- case PLUGIN_START_UNIT:
- case PLUGIN_FINISH_UNIT:
- case PLUGIN_PRE_GENERICIZE:
diff --git a/build/unix/build-toolchain/pr49911.diff b/build/unix/build-toolchain/pr49911.diff
deleted file mode 100644
index 3583f00aa..000000000
--- a/build/unix/build-toolchain/pr49911.diff
+++ /dev/null
@@ -1,274 +0,0 @@
-diff -ru gcc-4.5.2/gcc/double-int.c gcc-4.5.2-new/gcc/double-int.c
---- gcc-4.5.2/gcc/double-int.c 2009-11-25 05:55:54.000000000 -0500
-+++ gcc-4.5.2-new/gcc/double-int.c 2011-11-29 10:20:27.625583810 -0500
-@@ -296,7 +296,12 @@
- tree
- double_int_to_tree (tree type, double_int cst)
- {
-- cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type));
-+ /* Size types *are* sign extended. */
-+ bool sign_extended_type = (!TYPE_UNSIGNED (type)
-+ || (TREE_CODE (type) == INTEGER_TYPE
-+ && TYPE_IS_SIZETYPE (type)));
-+
-+ cst = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type);
-
- return build_int_cst_wide (type, cst.low, cst.high);
- }
-diff -ru gcc-4.5.2/gcc/tree.c gcc-4.5.2-new/gcc/tree.c
---- gcc-4.5.2/gcc/tree.c 2010-07-07 11:24:27.000000000 -0400
-+++ gcc-4.5.2-new/gcc/tree.c 2011-11-29 10:20:27.626583813 -0500
-@@ -9750,7 +9750,7 @@
- tree
- upper_bound_in_type (tree outer, tree inner)
- {
-- unsigned HOST_WIDE_INT lo, hi;
-+ double_int high;
- unsigned int det = 0;
- unsigned oprec = TYPE_PRECISION (outer);
- unsigned iprec = TYPE_PRECISION (inner);
-@@ -9797,18 +9797,18 @@
- /* Compute 2^^prec - 1. */
- if (prec <= HOST_BITS_PER_WIDE_INT)
- {
-- hi = 0;
-- lo = ((~(unsigned HOST_WIDE_INT) 0)
-+ high.high = 0;
-+ high.low = ((~(unsigned HOST_WIDE_INT) 0)
- >> (HOST_BITS_PER_WIDE_INT - prec));
- }
- else
- {
-- hi = ((~(unsigned HOST_WIDE_INT) 0)
-+ high.high = ((~(unsigned HOST_WIDE_INT) 0)
- >> (2 * HOST_BITS_PER_WIDE_INT - prec));
-- lo = ~(unsigned HOST_WIDE_INT) 0;
-+ high.low = ~(unsigned HOST_WIDE_INT) 0;
- }
-
-- return build_int_cst_wide (outer, lo, hi);
-+ return double_int_to_tree (outer, high);
- }
-
- /* Returns the smallest value obtainable by casting something in INNER type to
-diff -ru gcc-4.5.2/gcc/tree-vrp.c gcc-4.5.2-new/gcc/tree-vrp.c
---- gcc-4.5.2/gcc/tree-vrp.c 2010-06-14 11:23:31.000000000 -0400
-+++ gcc-4.5.2-new/gcc/tree-vrp.c 2011-11-29 10:20:27.628583820 -0500
-@@ -127,10 +127,10 @@
- static inline tree
- vrp_val_max (const_tree type)
- {
-- if (!INTEGRAL_TYPE_P (type))
-- return NULL_TREE;
-+ if (INTEGRAL_TYPE_P (type))
-+ return upper_bound_in_type (CONST_CAST_TREE (type), CONST_CAST_TREE (type));
-
-- return TYPE_MAX_VALUE (type);
-+ return NULL_TREE;
- }
-
- /* Return the minimum value for TYPE. */
-@@ -138,10 +138,10 @@
- static inline tree
- vrp_val_min (const_tree type)
- {
-- if (!INTEGRAL_TYPE_P (type))
-- return NULL_TREE;
-+ if (INTEGRAL_TYPE_P (type))
-+ return lower_bound_in_type (CONST_CAST_TREE (type), CONST_CAST_TREE (type));
-
-- return TYPE_MIN_VALUE (type);
-+ return NULL_TREE;
- }
-
- /* Return whether VAL is equal to the maximum value of its type. This
-@@ -539,7 +539,7 @@
- set_value_range (vr, VR_RANGE, zero,
- (overflow_infinity
- ? positive_overflow_infinity (type)
-- : TYPE_MAX_VALUE (type)),
-+ : vrp_val_max (type)),
- vr->equiv);
- }
-
-@@ -1595,7 +1595,7 @@
- }
- else if (cond_code == LE_EXPR || cond_code == LT_EXPR)
- {
-- min = TYPE_MIN_VALUE (type);
-+ min = vrp_val_min (type);
-
- if (limit_vr == NULL || limit_vr->type == VR_ANTI_RANGE)
- max = limit;
-@@ -1630,7 +1630,7 @@
- }
- else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
- {
-- max = TYPE_MAX_VALUE (type);
-+ max = vrp_val_max (type);
-
- if (limit_vr == NULL || limit_vr->type == VR_ANTI_RANGE)
- min = limit;
-@@ -2047,11 +2047,11 @@
- || code == ROUND_DIV_EXPR)
- return (needs_overflow_infinity (TREE_TYPE (res))
- ? positive_overflow_infinity (TREE_TYPE (res))
-- : TYPE_MAX_VALUE (TREE_TYPE (res)));
-+ : vrp_val_max (TREE_TYPE (res)));
- else
- return (needs_overflow_infinity (TREE_TYPE (res))
- ? negative_overflow_infinity (TREE_TYPE (res))
-- : TYPE_MIN_VALUE (TREE_TYPE (res)));
-+ : vrp_val_min (TREE_TYPE (res)));
- }
-
- return res;
-@@ -2750,8 +2750,8 @@
- && TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type))
- {
- vr0.type = VR_RANGE;
-- vr0.min = TYPE_MIN_VALUE (inner_type);
-- vr0.max = TYPE_MAX_VALUE (inner_type);
-+ vr0.min = vrp_val_min (inner_type);
-+ vr0.max = vrp_val_max (inner_type);
- }
-
- /* If VR0 is a constant range or anti-range and the conversion is
-@@ -2836,7 +2836,7 @@
- }
- }
- else
-- min = TYPE_MIN_VALUE (type);
-+ min = vrp_val_min (type);
-
- if (is_positive_overflow_infinity (vr0.min))
- max = negative_overflow_infinity (type);
-@@ -2855,7 +2855,7 @@
- }
- }
- else
-- max = TYPE_MIN_VALUE (type);
-+ max = vrp_val_min (type);
- }
- else if (code == NEGATE_EXPR
- && TYPE_UNSIGNED (type))
-@@ -2897,7 +2897,7 @@
- else if (!vrp_val_is_min (vr0.min))
- min = fold_unary_to_constant (code, type, vr0.min);
- else if (!needs_overflow_infinity (type))
-- min = TYPE_MAX_VALUE (type);
-+ min = vrp_val_max (type);
- else if (supports_overflow_infinity (type))
- min = positive_overflow_infinity (type);
- else
-@@ -2911,7 +2911,7 @@
- else if (!vrp_val_is_min (vr0.max))
- max = fold_unary_to_constant (code, type, vr0.max);
- else if (!needs_overflow_infinity (type))
-- max = TYPE_MAX_VALUE (type);
-+ max = vrp_val_max (type);
- else if (supports_overflow_infinity (type)
- /* We shouldn't generate [+INF, +INF] as set_value_range
- doesn't like this and ICEs. */
-@@ -2941,7 +2941,7 @@
- TYPE_MIN_VALUE, remember -TYPE_MIN_VALUE = TYPE_MIN_VALUE. */
- if (TYPE_OVERFLOW_WRAPS (type))
- {
-- tree type_min_value = TYPE_MIN_VALUE (type);
-+ tree type_min_value = vrp_val_min (type);
-
- min = (vr0.min != type_min_value
- ? int_const_binop (PLUS_EXPR, type_min_value,
-@@ -2953,7 +2953,7 @@
- if (overflow_infinity_range_p (&vr0))
- min = negative_overflow_infinity (type);
- else
-- min = TYPE_MIN_VALUE (type);
-+ min = vrp_val_min (type);
- }
- }
- else
-@@ -2974,7 +2974,7 @@
- }
- }
- else
-- max = TYPE_MAX_VALUE (type);
-+ max = vrp_val_max (type);
- }
- }
-
-@@ -3258,11 +3258,11 @@
- if (POINTER_TYPE_P (type) || !TYPE_MIN_VALUE (type))
- tmin = lower_bound_in_type (type, type);
- else
-- tmin = TYPE_MIN_VALUE (type);
-+ tmin = vrp_val_min (type);
- if (POINTER_TYPE_P (type) || !TYPE_MAX_VALUE (type))
- tmax = upper_bound_in_type (type, type);
- else
-- tmax = TYPE_MAX_VALUE (type);
-+ tmax = vrp_val_max (type);
-
- if (vr->type == VR_VARYING || vr->type == VR_UNDEFINED)
- {
-@@ -4146,8 +4146,8 @@
- if ((comp_code == GT_EXPR || comp_code == LT_EXPR)
- && INTEGRAL_TYPE_P (TREE_TYPE (val)))
- {
-- tree min = TYPE_MIN_VALUE (TREE_TYPE (val));
-- tree max = TYPE_MAX_VALUE (TREE_TYPE (val));
-+ tree min = vrp_val_min (TREE_TYPE (val));
-+ tree max = vrp_val_max (TREE_TYPE (val));
-
- if (comp_code == GT_EXPR
- && (!max
-@@ -6426,13 +6426,13 @@
- VARYING. Same if the previous max value was invalid for
- the type and we'd end up with vr_result.min > vr_result.max. */
- if (vrp_val_is_max (vr_result.max)
-- || compare_values (TYPE_MIN_VALUE (TREE_TYPE (vr_result.min)),
-+ || compare_values (vrp_val_min (TREE_TYPE (vr_result.min)),
- vr_result.max) > 0)
- goto varying;
-
- if (!needs_overflow_infinity (TREE_TYPE (vr_result.min))
- || !vrp_var_may_overflow (lhs, phi))
-- vr_result.min = TYPE_MIN_VALUE (TREE_TYPE (vr_result.min));
-+ vr_result.min = vrp_val_min (TREE_TYPE (vr_result.min));
- else if (supports_overflow_infinity (TREE_TYPE (vr_result.min)))
- vr_result.min =
- negative_overflow_infinity (TREE_TYPE (vr_result.min));
-@@ -6448,13 +6448,13 @@
- VARYING. Same if the previous min value was invalid for
- the type and we'd end up with vr_result.max < vr_result.min. */
- if (vrp_val_is_min (vr_result.min)
-- || compare_values (TYPE_MAX_VALUE (TREE_TYPE (vr_result.max)),
-+ || compare_values (vrp_val_max (TREE_TYPE (vr_result.max)),
- vr_result.min) < 0)
- goto varying;
-
- if (!needs_overflow_infinity (TREE_TYPE (vr_result.max))
- || !vrp_var_may_overflow (lhs, phi))
-- vr_result.max = TYPE_MAX_VALUE (TREE_TYPE (vr_result.max));
-+ vr_result.max = vrp_val_max (TREE_TYPE (vr_result.max));
- else if (supports_overflow_infinity (TREE_TYPE (vr_result.max)))
- vr_result.max =
- positive_overflow_infinity (TREE_TYPE (vr_result.max));
-@@ -6782,7 +6782,7 @@
- {
- /* This should not be negative infinity; there is no overflow
- here. */
-- min = TYPE_MIN_VALUE (TREE_TYPE (op0));
-+ min = vrp_val_min (TREE_TYPE (op0));
-
- max = op1;
- if (cond_code == LT_EXPR && !is_overflow_infinity (max))
-@@ -6797,7 +6797,7 @@
- {
- /* This should not be positive infinity; there is no overflow
- here. */
-- max = TYPE_MAX_VALUE (TREE_TYPE (op0));
-+ max = vrp_val_max (TREE_TYPE (op0));
-
- min = op1;
- if (cond_code == GT_EXPR && !is_overflow_infinity (min))
diff --git a/build/unix/build-toolchain/r159628-r163231-r171807.patch b/build/unix/build-toolchain/r159628-r163231-r171807.patch
deleted file mode 100644
index b8ea2f148..000000000
--- a/build/unix/build-toolchain/r159628-r163231-r171807.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-diff -ru gcc-4.5.2/libstdc++-v3/include/bits/stl_pair.h gcc-4.5.2-new/libstdc++-v3/include/bits/stl_pair.h
---- gcc-4.5.2/libstdc++-v3/include/bits/stl_pair.h 2010-06-10 06:26:14.000000000 -0400
-+++ gcc-4.5.2-new/libstdc++-v3/include/bits/stl_pair.h 2011-11-29 10:25:51.203597393 -0500
-@@ -88,6 +88,8 @@
- : first(__a), second(__b) { }
-
- #ifdef __GXX_EXPERIMENTAL_CXX0X__
-+ pair(const pair&) = default;
-+
- // DR 811.
- template<class _U1, class = typename
- std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
-@@ -131,6 +133,15 @@
-
- template<class _U1, class _U2>
- pair&
-+ operator=(const pair<_U1, _U2>& __p)
-+ {
-+ first = __p.first;
-+ second = __p.second;
-+ return *this;
-+ }
-+
-+ template<class _U1, class _U2>
-+ pair&
- operator=(pair<_U1, _U2>&& __p)
- {
- first = std::move(__p.first);
-diff -ru gcc-4.5.2/libstdc++-v3/include/bits/stl_queue.h gcc-4.5.2-new/libstdc++-v3/include/bits/stl_queue.h
---- gcc-4.5.2/libstdc++-v3/include/bits/stl_queue.h 2010-02-04 13:20:34.000000000 -0500
-+++ gcc-4.5.2-new/libstdc++-v3/include/bits/stl_queue.h 2011-11-29 10:26:22.511695475 -0500
-@@ -1,6 +1,6 @@
- // Queue implementation -*- C++ -*-
-
--// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- // Free Software Foundation, Inc.
- //
- // This file is part of the GNU ISO C++ Library. This library is free
-@@ -137,16 +137,6 @@
- explicit
- queue(_Sequence&& __c = _Sequence())
- : c(std::move(__c)) { }
--
-- queue(queue&& __q)
-- : c(std::move(__q.c)) { }
--
-- queue&
-- operator=(queue&& __q)
-- {
-- c = std::move(__q.c);
-- return *this;
-- }
- #endif
-
- /**
-@@ -451,17 +441,6 @@
- c.insert(c.end(), __first, __last);
- std::make_heap(c.begin(), c.end(), comp);
- }
--
-- priority_queue(priority_queue&& __pq)
-- : c(std::move(__pq.c)), comp(std::move(__pq.comp)) { }
--
-- priority_queue&
-- operator=(priority_queue&& __pq)
-- {
-- c = std::move(__pq.c);
-- comp = std::move(__pq.comp);
-- return *this;
-- }
- #endif
-
- /**
-diff -ru gcc-4.5.2/libstdc++-v3/libsupc++/exception_ptr.h gcc-4.5.2-new/libstdc++-v3/libsupc++/exception_ptr.h
---- gcc-4.5.2/libstdc++-v3/libsupc++/exception_ptr.h 2009-11-09 17:09:30.000000000 -0500
-+++ gcc-4.5.2-new/libstdc++-v3/libsupc++/exception_ptr.h 2011-11-29 10:26:10.878659023 -0500
-@@ -129,7 +129,7 @@
- operator==(const exception_ptr&, const exception_ptr&) throw()
- __attribute__ ((__pure__));
-
-- const type_info*
-+ const class type_info*
- __cxa_exception_type() const throw() __attribute__ ((__pure__));
- };
-
-diff -ru gcc-4.5.2/libstdc++-v3/libsupc++/nested_exception.h gcc-4.5.2-new/libstdc++-v3/libsupc++/nested_exception.h
---- gcc-4.5.2/libstdc++-v3/libsupc++/nested_exception.h 2010-02-18 12:20:16.000000000 -0500
-+++ gcc-4.5.2-new/libstdc++-v3/libsupc++/nested_exception.h 2011-11-29 10:26:10.879659026 -0500
-@@ -119,7 +119,7 @@
- // with a type that has an accessible nested_exception base.
- template<typename _Ex>
- inline void
-- __throw_with_nested(_Ex&& __ex, const nested_exception* = 0)
-+ __throw_with_nested(_Ex&& __ex, const nested_exception*)
- { throw __ex; }
-
- template<typename _Ex>
diff --git a/build/unix/elfhack/Makefile.in b/build/unix/elfhack/Makefile.in
index 20f0248ac..fdc6ab107 100644
--- a/build/unix/elfhack/Makefile.in
+++ b/build/unix/elfhack/Makefile.in
@@ -3,54 +3,13 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
INTERNAL_TOOLS = 1
-HOST_PROGRAM = elfhack
-NO_DIST_INSTALL = 1
-NO_PROFILE_GUIDED_OPTIMIZE = 1
-
-VPATH += $(topsrcdir)/build
-
-HOST_CPPSRCS = \
- elf.cpp \
- elfhack.cpp \
- $(NULL)
-
OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
-ifneq (,$(filter %86,$(TARGET_CPU)))
-CPU := x86
-else
-ifneq (,$(filter arm%,$(TARGET_CPU)))
-CPU := arm
-else
-CPU := $(TARGET_CPU)
-endif
-endif
-
-CSRCS := \
- inject/$(CPU).c \
- inject/$(CPU)-noinit.c \
- test-ctors.c \
- test-array.c \
- $(NULL)
-
-ifndef CROSS_COMPILE
-CSRCS += dummy.c
-endif
-
-WRAP_LDFLAGS=
-
include $(topsrcdir)/config/rules.mk
-test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack $(filter inject/%,$(CSRCS:.c=.$(OBJ_SUFFIX)))
+test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack
$(MKSHLIB) $(LDFLAGS) $< -nostartfiles
@echo ===
@echo === If you get failures below, please file a bug describing the error
@@ -62,10 +21,11 @@ test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX)
@rm -f $@.bak
$(CURDIR)/elfhack -b -f $@
# Fail if the backup file doesn't exist
- [ -f "$@.bak" ]
+ [ -f '$@.bak' ]
# Fail if the new library doesn't contain less relocations
[ $$($(TOOLCHAIN_PREFIX)objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ]
+test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): DSO_SONAME=$@
test-array$(DLL_SUFFIX): DT_TYPE=INIT_ARRAY
test-ctors$(DLL_SUFFIX): DT_TYPE=INIT
@@ -73,9 +33,10 @@ test-ctors$(DLL_SUFFIX): DT_TYPE=INIT
GARBAGE += test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX) test-array$(DLL_SUFFIX).bak test-ctors$(DLL_SUFFIX).bak
+ifndef CROSS_COMPILE
+ifdef COMPILE_ENVIRONMENT
libs:: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX)
-ifndef CROSS_COMPILE
dummy: dummy.$(OBJ_SUFFIX)
$(CC) -o $@ $^ $(LDFLAGS)
@@ -86,17 +47,4 @@ libs:: dummy
GARBAGE += dummy
endif
-
-inject:
- $(NSINSTALL) -D $@
-
-inject/%.c: inject.c $(call mkdir_deps,inject)
- cp $< $@
-
-GARBAGE_DIRS += inject
-
-inject/%.$(OBJ_SUFFIX): DEFINES += -DBITS=$(if $(HAVE_64BIT_OS),64,32)
-inject/%.$(OBJ_SUFFIX): CFLAGS := -O2 -fno-stack-protector $(filter -m% -I%,$(CFLAGS))
-inject/$(CPU)-noinit.$(OBJ_SUFFIX): DEFINES += -DNOINIT
-test.$(OBJ_SUFFIX): CFLAGS := -O0
-host_elf.$(OBJ_SUFFIX) host_elfhack.$(OBJ_SUFFIX): elfxx.h
+endif
diff --git a/build/unix/elfhack/elf.cpp b/build/unix/elfhack/elf.cpp
index 571209b3c..666b5351e 100644
--- a/build/unix/elfhack/elf.cpp
+++ b/build/unix/elfhack/elf.cpp
@@ -106,7 +106,7 @@ Elf_Shdr null_section(null32_section);
Elf_Ehdr::Elf_Ehdr(std::ifstream &file, char ei_class, char ei_data)
: serializable<Elf_Ehdr_Traits>(file, ei_class, ei_data),
- ElfSection(null_section, NULL, NULL)
+ ElfSection(null_section, nullptr, nullptr)
{
shdr.sh_size = Elf_Ehdr::size(ei_class);
}
@@ -176,9 +176,9 @@ Elf::Elf(std::ifstream &file)
// Fill sections list
sections = new ElfSection *[ehdr->e_shnum];
for (int i = 0; i < ehdr->e_shnum; i++)
- sections[i] = NULL;
+ sections[i] = nullptr;
for (int i = 1; i < ehdr->e_shnum; i++) {
- if (sections[i] != NULL)
+ if (sections[i] != nullptr)
continue;
getSection(i);
}
@@ -193,31 +193,31 @@ Elf::Elf(std::ifstream &file)
s.sh_link = 0;
s.sh_info = 0;
s.sh_addralign = (e_ident[EI_CLASS] == ELFCLASS32) ? 4 : 8;
- shdr_section = new ElfSection(s, NULL, NULL);
+ shdr_section = new ElfSection(s, nullptr, nullptr);
// Fake section for program headers
s.sh_offset = ehdr->e_phoff;
s.sh_addr = ehdr->e_phoff;
s.sh_entsize = Elf_Phdr::size(e_ident[EI_CLASS]);
s.sh_size = s.sh_entsize * ehdr->e_phnum;
- phdr_section = new ElfSection(s, NULL, NULL);
+ phdr_section = new ElfSection(s, nullptr, nullptr);
phdr_section->insertAfter(ehdr, false);
sections[1]->insertAfter(phdr_section, false);
for (int i = 2; i < ehdr->e_shnum; i++) {
// TODO: this should be done in a better way
- if ((shdr_section->getPrevious() == NULL) && (shdr[i]->sh_offset > ehdr->e_shoff)) {
+ if ((shdr_section->getPrevious() == nullptr) && (shdr[i]->sh_offset > ehdr->e_shoff)) {
shdr_section->insertAfter(sections[i - 1], false);
sections[i]->insertAfter(shdr_section, false);
} else
sections[i]->insertAfter(sections[i - 1], false);
}
- if (shdr_section->getPrevious() == NULL)
+ if (shdr_section->getPrevious() == nullptr)
shdr_section->insertAfter(sections[ehdr->e_shnum - 1], false);
- tmp_file = NULL;
- tmp_shdr = NULL;
+ tmp_file = nullptr;
+ tmp_shdr = nullptr;
for (int i = 0; i < ehdr->e_shnum; i++)
delete shdr[i];
delete[] shdr;
@@ -280,7 +280,7 @@ Elf::~Elf()
delete *seg;
delete[] sections;
ElfSection *section = ehdr;
- while (section != NULL) {
+ while (section != nullptr) {
ElfSection *next = section->getNext();
delete section;
section = next;
@@ -296,11 +296,11 @@ ElfSection *Elf::getSection(int index)
index = ehdr->e_shstrndx; // TODO: should be fixed to use the actual current number
// Special case: the section at index 0 is void
if (index == 0)
- return NULL;
+ return nullptr;
// Infinite recursion guard
if (sections[index] == (ElfSection *)this)
- return NULL;
- if (sections[index] == NULL) {
+ return nullptr;
+ if (sections[index] == nullptr) {
sections[index] = (ElfSection *)this;
switch (tmp_shdr[index]->sh_type) {
case SHT_DYNAMIC:
@@ -330,11 +330,11 @@ ElfSection *Elf::getSectionAt(unsigned int offset)
{
for (int i = 1; i < ehdr->e_shnum; i++) {
ElfSection *section = getSection(i);
- if ((section != NULL) && (section->getFlags() & SHF_ALLOC) && !(section->getFlags() & SHF_TLS) &&
+ if ((section != nullptr) && (section->getFlags() & SHF_ALLOC) && !(section->getFlags() & SHF_TLS) &&
(offset >= section->getAddr()) && (offset < section->getAddr() + section->getSize()))
return section;
}
- return NULL;
+ return nullptr;
}
ElfSegment *Elf::getSegmentByType(unsigned int type, ElfSegment *last)
@@ -348,7 +348,7 @@ ElfSegment *Elf::getSegmentByType(unsigned int type, ElfSegment *last)
for (; seg != segments.end(); seg++)
if ((*seg)->getType() == type)
return *seg;
- return NULL;
+ return nullptr;
}
void Elf::removeSegment(ElfSegment *segment)
@@ -366,18 +366,18 @@ void Elf::removeSegment(ElfSegment *segment)
ElfDynamic_Section *Elf::getDynSection()
{
for (std::vector<ElfSegment *>::iterator seg = segments.begin(); seg != segments.end(); seg++)
- if (((*seg)->getType() == PT_DYNAMIC) && ((*seg)->getFirstSection() != NULL) &&
+ if (((*seg)->getType() == PT_DYNAMIC) && ((*seg)->getFirstSection() != nullptr) &&
(*seg)->getFirstSection()->getType() == SHT_DYNAMIC)
return (ElfDynamic_Section *)(*seg)->getFirstSection();
- return NULL;
+ return nullptr;
}
void Elf::normalize()
{
// fixup section headers sh_name; TODO: that should be done by sections
// themselves
- for (ElfSection *section = ehdr; section != NULL; section = section->getNext()) {
+ for (ElfSection *section = ehdr; section != nullptr; section = section->getNext()) {
if (section->getIndex() == 0)
continue;
else
@@ -414,7 +414,7 @@ void Elf::write(std::ofstream &file)
{
normalize();
for (ElfSection *section = ehdr;
- section != NULL; section = section->getNext()) {
+ section != nullptr; section = section->getNext()) {
file.seekp(section->getOffset());
if (section == phdr_section) {
for (std::vector<ElfSegment *>::iterator seg = segments.begin(); seg != segments.end(); seg++) {
@@ -431,7 +431,7 @@ void Elf::write(std::ofstream &file)
}
} else if (section == shdr_section) {
null_section.serialize(file, ehdr->e_ident[EI_CLASS], ehdr->e_ident[EI_DATA]);
- for (ElfSection *sec = ehdr; sec!= NULL; sec = sec->getNext()) {
+ for (ElfSection *sec = ehdr; sec!= nullptr; sec = sec->getNext()) {
if (sec->getType() != SHT_NULL)
sec->getShdr().serialize(file, ehdr->e_ident[EI_CLASS], ehdr->e_ident[EI_DATA]);
}
@@ -442,11 +442,11 @@ void Elf::write(std::ofstream &file)
ElfSection::ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent)
: shdr(s),
- link(shdr.sh_link == SHN_UNDEF ? NULL : parent->getSection(shdr.sh_link)),
- next(NULL), previous(NULL), index(-1)
+ link(shdr.sh_link == SHN_UNDEF ? nullptr : parent->getSection(shdr.sh_link)),
+ next(nullptr), previous(nullptr), index(-1)
{
- if ((file == NULL) || (shdr.sh_type == SHT_NULL) || (shdr.sh_type == SHT_NOBITS))
- data = NULL;
+ if ((file == nullptr) || (shdr.sh_type == SHT_NULL) || (shdr.sh_type == SHT_NOBITS))
+ data = nullptr;
else {
data = new char[shdr.sh_size];
int pos = file->tellg();
@@ -455,12 +455,12 @@ ElfSection::ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent)
file->seekg(pos);
}
if (shdr.sh_name == 0)
- name = NULL;
+ name = nullptr;
else {
ElfStrtab_Section *strtab = (ElfStrtab_Section *) parent->getSection(-1);
- // Special case (see elfgeneric.cpp): if strtab is NULL, the
+ // Special case (see elfgeneric.cpp): if strtab is nullptr, the
// section being created is the strtab.
- if (strtab == NULL)
+ if (strtab == nullptr)
name = &data[shdr.sh_name];
else
name = strtab->getStr(shdr.sh_name);
@@ -468,7 +468,7 @@ ElfSection::ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent)
// Only SHT_REL/SHT_RELA sections use sh_info to store a section
// number.
if ((shdr.sh_type == SHT_REL) || (shdr.sh_type == SHT_RELA))
- info.section = shdr.sh_info ? parent->getSection(shdr.sh_info) : NULL;
+ info.section = shdr.sh_info ? parent->getSection(shdr.sh_info) : nullptr;
else
info.index = shdr.sh_info;
}
@@ -480,7 +480,7 @@ unsigned int ElfSection::getAddr()
// It should be safe to adjust sh_addr for all allocated sections that
// are neither SHT_NOBITS nor SHT_PROGBITS
- if ((previous != NULL) && isRelocatable()) {
+ if ((previous != nullptr) && isRelocatable()) {
unsigned int addr = previous->getAddr();
if (previous->getType() != SHT_NOBITS)
addr += previous->getSize();
@@ -498,7 +498,7 @@ unsigned int ElfSection::getOffset()
if (shdr.sh_offset != (Elf32_Word)-1)
return shdr.sh_offset;
- if (previous == NULL)
+ if (previous == nullptr)
return (shdr.sh_offset = 0);
unsigned int offset = previous->getOffset();
@@ -547,8 +547,8 @@ int ElfSection::getIndex()
if (getType() == SHT_NULL)
return (index = 0);
ElfSection *reference;
- for (reference = previous; (reference != NULL) && (reference->getType() == SHT_NULL); reference = reference->getPrevious());
- if (reference == NULL)
+ for (reference = previous; (reference != nullptr) && (reference->getType() == SHT_NULL); reference = reference->getPrevious());
+ if (reference == nullptr)
return (index = 1);
return (index = reference->getIndex() + 1);
}
@@ -661,13 +661,13 @@ ElfValue *ElfDynamic_Section::getValueForType(unsigned int tag)
if (dyns[i].tag == tag)
return dyns[i].value;
- return NULL;
+ return nullptr;
}
ElfSection *ElfDynamic_Section::getSectionForType(unsigned int tag)
{
ElfValue *value = getValueForType(tag);
- return value ? value->getSection() : NULL;
+ return value ? value->getSection() : nullptr;
}
bool ElfDynamic_Section::setValueForType(unsigned int tag, ElfValue *val)
@@ -739,7 +739,7 @@ ElfDynamic_Section::ElfDynamic_Section(Elf_Shdr &s, std::ifstream *file, Elf *pa
dyns[i].value = new ElfLocation(dyn.d_un.d_ptr, parent);
break;
default:
- dyns[i].value = NULL;
+ dyns[i].value = nullptr;
}
}
// Another loop to get the section sizes
@@ -788,7 +788,7 @@ void ElfDynamic_Section::serialize(std::ofstream &file, char ei_class, char ei_d
for (unsigned int i = 0; i < shdr.sh_size / shdr.sh_entsize; i++) {
Elf_Dyn dyn;
dyn.d_tag = dyns[i].tag;
- dyn.d_un.d_val = (dyns[i].value != NULL) ? dyns[i].value->getValue() : 0;
+ dyn.d_un.d_val = (dyns[i].value != nullptr) ? dyns[i].value->getValue() : 0;
dyn.serialize(file, ei_class, ei_data);
}
}
@@ -805,7 +805,7 @@ ElfSymtab_Section::ElfSymtab_Section(Elf_Shdr &s, std::ifstream *file, Elf *pare
syms[i].name = strtab->getStr(sym.st_name);
syms[i].info = sym.st_info;
syms[i].other = sym.st_other;
- ElfSection *section = (sym.st_shndx == SHN_ABS) ? NULL : parent->getSection(sym.st_shndx);
+ ElfSection *section = (sym.st_shndx == SHN_ABS) ? nullptr : parent->getSection(sym.st_shndx);
new (&syms[i].value) ElfLocation(section, sym.st_value, ElfLocation::ABSOLUTE);
syms[i].size = sym.st_size;
syms[i].defined = (sym.st_shndx != SHN_UNDEF);
@@ -843,7 +843,7 @@ ElfSymtab_Section::lookup(const char *name, unsigned int type_filter)
return &*sym;
}
}
- return NULL;
+ return nullptr;
}
const char *
@@ -856,14 +856,14 @@ ElfStrtab_Section::getStr(unsigned int index)
index -= t->used;
}
assert(1 == 0);
- return NULL;
+ return nullptr;
}
const char *
ElfStrtab_Section::getStr(const char *string)
{
- if (string == NULL)
- return NULL;
+ if (string == nullptr)
+ return nullptr;
// If the given string is within the section, return it
for (std::vector<table_storage>::iterator t = table.begin();
@@ -892,7 +892,7 @@ ElfStrtab_Section::getStr(const char *string)
unsigned int
ElfStrtab_Section::getStrIndex(const char *string)
{
- if (string == NULL)
+ if (string == nullptr)
return 0;
unsigned int index = 0;
diff --git a/build/unix/elfhack/elfhack.cpp b/build/unix/elfhack/elfhack.cpp
index ed5fffce9..8c1184237 100644
--- a/build/unix/elfhack/elfhack.cpp
+++ b/build/unix/elfhack/elfhack.cpp
@@ -26,7 +26,7 @@
#define R_ARM_THM_JUMP24 0x1e
#endif
-char *rundir = NULL;
+char *rundir = nullptr;
template <typename T>
struct wrapped {
@@ -63,7 +63,7 @@ typedef serializable<Elf_RelHack_Traits> Elf_RelHack;
class ElfRelHack_Section: public ElfSection {
public:
ElfRelHack_Section(Elf_Shdr &s)
- : ElfSection(s, NULL, NULL)
+ : ElfSection(s, nullptr, nullptr)
{
name = elfhack_data;
};
@@ -90,7 +90,7 @@ private:
class ElfRelHackCode_Section: public ElfSection {
public:
ElfRelHackCode_Section(Elf_Shdr &s, Elf &e, unsigned int init)
- : ElfSection(s, NULL, NULL), parent(e), init(init) {
+ : ElfSection(s, nullptr, nullptr), parent(e), init(init) {
std::string file(rundir);
file += "/inject/";
switch (parent.getMachine()) {
@@ -106,8 +106,6 @@ public:
default:
throw std::runtime_error("unsupported architecture");
}
- if (!init)
- file += "-noinit";
file += ".o";
std::ifstream inject(file.c_str(), std::ios::in|std::ios::binary);
elf = new Elf(inject);
@@ -116,40 +114,28 @@ public:
if (elf->getMachine() != parent.getMachine())
throw std::runtime_error("architecture of object for injected code doesn't match");
- ElfSymtab_Section *symtab = NULL;
+ ElfSymtab_Section *symtab = nullptr;
- // Get all executable sections from the injected code object.
- // Most of the time, there will only be one for the init function,
- // but on e.g. x86, there is a separate section for
- // __i686.get_pc_thunk.$reg
- // Find the symbol table at the same time.
- for (ElfSection *section = elf->getSection(1); section != NULL;
+ // Find the symbol table.
+ for (ElfSection *section = elf->getSection(1); section != nullptr;
section = section->getNext()) {
- if ((section->getType() == SHT_PROGBITS) &&
- (section->getFlags() & SHF_EXECINSTR)) {
- code.push_back(section);
- // We need to align this section depending on the greater
- // alignment required by code sections.
- if (shdr.sh_addralign < section->getAddrAlign())
- shdr.sh_addralign = section->getAddrAlign();
- } else if (section->getType() == SHT_SYMTAB) {
+ if (section->getType() == SHT_SYMTAB)
symtab = (ElfSymtab_Section *) section;
- }
}
- assert(code.size() != 0);
- if (symtab == NULL)
+ if (symtab == nullptr)
throw std::runtime_error("Couldn't find a symbol table for the injected code");
// Find the init symbol
entry_point = -1;
- int shndx = 0;
- Elf_SymValue *sym = symtab->lookup("init");
- if (sym) {
- entry_point = sym->value.getValue();
- shndx = sym->value.getSection()->getIndex();
- } else
+ Elf_SymValue *sym = symtab->lookup(init ? "init" : "init_noinit");
+ if (!sym)
throw std::runtime_error("Couldn't find an 'init' symbol in the injected code");
+ entry_point = sym->value.getValue();
+
+ // Get all relevant sections from the injected code object.
+ add_code_section(sym->value.getSection());
+
// Adjust code sections offsets according to their size
std::vector<ElfSection *>::iterator c = code.begin();
(*c)->getShdr().sh_addr = 0;
@@ -158,6 +144,10 @@ public:
if (addr & ((*c)->getAddrAlign() - 1))
addr = (addr | ((*c)->getAddrAlign() - 1)) + 1;
(*c)->getShdr().sh_addr = addr;
+ // We need to align this section depending on the greater
+ // alignment required by code sections.
+ if (shdr.sh_addralign < (*c)->getAddrAlign())
+ shdr.sh_addralign = (*c)->getAddrAlign();
}
shdr.sh_size = code.back()->getAddr() + code.back()->getSize();
data = new char[shdr.sh_size];
@@ -165,8 +155,6 @@ public:
for (c = code.begin(); c != code.end(); c++) {
memcpy(buf, (*c)->getData(), (*c)->getSize());
buf += (*c)->getSize();
- if ((*c)->getIndex() < shndx)
- entry_point += (*c)->getSize();
}
name = elfhack_text;
}
@@ -182,14 +170,15 @@ public:
(*c)->getShdr().sh_addr += getAddr();
// Apply relocations
- for (ElfSection *rel = elf->getSection(1); rel != NULL; rel = rel->getNext())
- if ((rel->getType() == SHT_REL) || (rel->getType() == SHT_RELA)) {
- ElfSection *section = rel->getInfo().section;
- if ((section->getType() == SHT_PROGBITS) && (section->getFlags() & SHF_EXECINSTR)) {
+ for (std::vector<ElfSection *>::iterator c = code.begin(); c != code.end(); c++) {
+ for (ElfSection *rel = elf->getSection(1); rel != nullptr; rel = rel->getNext())
+ if (((rel->getType() == SHT_REL) ||
+ (rel->getType() == SHT_RELA)) &&
+ (rel->getInfo().section == *c)) {
if (rel->getType() == SHT_REL)
- apply_relocations((ElfRel_Section<Elf_Rel> *)rel, section);
+ apply_relocations((ElfRel_Section<Elf_Rel> *)rel, *c);
else
- apply_relocations((ElfRel_Section<Elf_Rela> *)rel, section);
+ apply_relocations((ElfRel_Section<Elf_Rela> *)rel, *c);
}
}
@@ -204,6 +193,46 @@ public:
return entry_point;
}
private:
+ void add_code_section(ElfSection *section)
+ {
+ if (section) {
+ /* Don't add section if it's already been added in the past */
+ for (auto s = code.begin(); s != code.end(); ++s) {
+ if (section == *s)
+ return;
+ }
+ code.push_back(section);
+ find_code(section);
+ }
+ }
+
+ /* Look at the relocations associated to the given section to find other
+ * sections that it requires */
+ void find_code(ElfSection *section)
+ {
+ for (ElfSection *s = elf->getSection(1); s != nullptr;
+ s = s->getNext()) {
+ if (((s->getType() == SHT_REL) ||
+ (s->getType() == SHT_RELA)) &&
+ (s->getInfo().section == section)) {
+ if (s->getType() == SHT_REL)
+ scan_relocs_for_code((ElfRel_Section<Elf_Rel> *)s);
+ else
+ scan_relocs_for_code((ElfRel_Section<Elf_Rela> *)s);
+ }
+ }
+ }
+
+ template <typename Rel_Type>
+ void scan_relocs_for_code(ElfRel_Section<Rel_Type> *rel)
+ {
+ ElfSymtab_Section *symtab = (ElfSymtab_Section *)rel->getLink();
+ for (auto r = rel->rels.begin(); r != rel->rels.end(); r++) {
+ ElfSection *section = symtab->syms[ELF32_R_SYM(r->r_info)].value.getSection();
+ add_code_section(section);
+ }
+ }
+
class pc32_relocation {
public:
Elf32_Addr operator()(unsigned int base_addr, Elf32_Off offset,
@@ -315,7 +344,7 @@ private:
// TODO: various checks on the symbol
const char *name = symtab->syms[ELF32_R_SYM(r->r_info)].name;
unsigned int addr;
- if (symtab->syms[ELF32_R_SYM(r->r_info)].value.getSection() == NULL) {
+ if (symtab->syms[ELF32_R_SYM(r->r_info)].value.getSection() == nullptr) {
if (strcmp(name, "relhack") == 0) {
addr = getNext()->getAddr();
} else if (strcmp(name, "elf_header") == 0) {
@@ -469,7 +498,7 @@ template <typename Rel_Type>
int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type2, bool force, bool fill)
{
ElfDynamic_Section *dyn = elf->getDynSection();
- if (dyn ==NULL) {
+ if (dyn == nullptr) {
fprintf(stderr, "Couldn't find SHT_DYNAMIC section\n");
return -1;
}
@@ -504,7 +533,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type
// are actually run by DT_INIT code.
ElfValue *value = dyn->getValueForType(DT_INIT);
unsigned int original_init = value ? value->getValue() : 0;
- ElfSection *init_array = NULL;
+ ElfSection *init_array = nullptr;
if (!value || !value->getValue()) {
value = dyn->getValueForType(DT_INIT_ARRAYSZ);
if (value && value->getValue() >= entry_sz)
@@ -531,9 +560,9 @@ int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type
// __cxa_pure_virtual is a function used in vtables to point at pure
// virtual methods. The __cxa_pure_virtual function usually abort()s.
// These functions are however normally never called. In the case
- // where they would, jumping to the NULL address instead of calling
+ // where they would, jumping to the null address instead of calling
// __cxa_pure_virtual is going to work just as well. So we can remove
- // relocations for the __cxa_pure_virtual symbol and NULL out the
+ // relocations for the __cxa_pure_virtual symbol and null out the
// content at the offset pointed by the relocation.
if (sym) {
if (sym->defined) {
@@ -586,7 +615,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type
}
if (relhack_entry.r_offset)
relhack->push_back(relhack_entry);
- // Last entry must be NULL
+ // Last entry must be nullptr
relhack_entry.r_offset = relhack_entry.r_info = 0;
relhack->push_back(relhack_entry);
@@ -668,7 +697,7 @@ void do_file(const char *name, bool backup = false, bool force = false, bool fil
return;
}
- for (ElfSection *section = elf.getSection(1); section != NULL;
+ for (ElfSection *section = elf.getSection(1); section != nullptr;
section = section->getNext()) {
if (section->getName() &&
(strncmp(section->getName(), ".elfhack.", 9) == 0)) {
@@ -713,8 +742,8 @@ void undo_file(const char *name, bool backup = false)
return;
}
- ElfSection *data = NULL, *text = NULL;
- for (ElfSection *section = elf.getSection(1); section != NULL;
+ ElfSection *data = nullptr, *text = nullptr;
+ for (ElfSection *section = elf.getSection(1); section != nullptr;
section = section->getNext()) {
if (section->getName() &&
(strcmp(section->getName(), elfhack_data) == 0))
@@ -735,9 +764,9 @@ void undo_file(const char *name, bool backup = false)
ElfSegment *first = elf.getSegmentByType(PT_LOAD);
ElfSegment *second = elf.getSegmentByType(PT_LOAD, first);
- ElfSegment *filler = NULL;
+ ElfSegment *filler = nullptr;
// If the second PT_LOAD is a filler from elfhack --fill, check the third.
- if (!second->isElfHackFillerSegment()) {
+ if (second->isElfHackFillerSegment()) {
filler = second;
second = elf.getSegmentByType(PT_LOAD, filler);
}
@@ -772,7 +801,7 @@ int main(int argc, char *argv[])
bool revert = false;
bool fill = false;
char *lastSlash = rindex(argv[0], '/');
- if (lastSlash != NULL)
+ if (lastSlash != nullptr)
rundir = strndup(argv[0], lastSlash - argv[0]);
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-f") == 0)
diff --git a/build/unix/elfhack/elfxx.h b/build/unix/elfhack/elfxx.h
index 3d87b0f2f..a05b02348 100644
--- a/build/unix/elfhack/elfxx.h
+++ b/build/unix/elfhack/elfxx.h
@@ -115,7 +115,7 @@ public:
class ElfValue {
public:
virtual unsigned int getValue() { return 0; }
- virtual ElfSection *getSection() { return NULL; }
+ virtual ElfSection *getSection() { return nullptr; }
};
class ElfPlainValue: public ElfValue {
@@ -130,7 +130,7 @@ class ElfLocation: public ElfValue {
unsigned int offset;
public:
enum position { ABSOLUTE, RELATIVE };
- ElfLocation(): section(NULL), offset(0) {};
+ ElfLocation(): section(nullptr), offset(0) {};
ElfLocation(ElfSection *section, unsigned int off, enum position pos = RELATIVE);
ElfLocation(unsigned int location, Elf *elf);
unsigned int getValue();
@@ -270,7 +270,7 @@ public:
ElfSection *getSectionAt(unsigned int offset);
- ElfSegment *getSegmentByType(unsigned int type, ElfSegment *last = NULL);
+ ElfSegment *getSegmentByType(unsigned int type, ElfSegment *last = nullptr);
ElfDynamic_Section *getDynSection();
@@ -355,17 +355,17 @@ public:
}
void insertAfter(ElfSection *section, bool dirty = true) {
- if (previous != NULL)
+ if (previous != nullptr)
previous->next = next;
- if (next != NULL)
+ if (next != nullptr)
next->previous = previous;
previous = section;
- if (section != NULL) {
+ if (section != nullptr) {
next = section->next;
section->next = this;
} else
- next = NULL;
- if (next != NULL)
+ next = nullptr;
+ if (next != nullptr)
next->previous = this;
if (dirty)
markDirty();
@@ -373,17 +373,17 @@ public:
}
void insertBefore(ElfSection *section, bool dirty = true) {
- if (previous != NULL)
+ if (previous != nullptr)
previous->next = next;
- if (next != NULL)
+ if (next != nullptr)
next->previous = previous;
next = section;
- if (section != NULL) {
+ if (section != nullptr) {
previous = section->previous;
section->previous = this;
} else
- previous = NULL;
- if (previous != NULL)
+ previous = nullptr;
+ if (previous != nullptr)
previous->next = this;
if (dirty)
markDirty();
@@ -391,7 +391,7 @@ public:
}
void markDirty() {
- if (link != NULL)
+ if (link != nullptr)
shdr.sh_link = -1;
if (info.index)
shdr.sh_info = -1;
@@ -446,7 +446,7 @@ public:
unsigned int getFlags() { return flags; }
unsigned int getAlign() { return align; }
- ElfSection *getFirstSection() { return sections.empty() ? NULL : sections.front(); }
+ ElfSection *getFirstSection() { return sections.empty() ? nullptr : sections.front(); }
int getVPDiff() { return v_p_diff; }
unsigned int getFileSize();
unsigned int getMemSize();
@@ -654,7 +654,7 @@ inline char Elf::getMachine() {
inline unsigned int Elf::getSize() {
ElfSection *section;
for (section = shdr_section /* It's usually not far from the end */;
- section->getNext() != NULL; section = section->getNext());
+ section->getNext() != nullptr; section = section->getNext());
return section->getOffset() + section->getSize();
}
@@ -662,7 +662,7 @@ inline ElfSegment *ElfSection::getSegmentByType(unsigned int type) {
for (std::vector<ElfSegment *>::iterator seg = segments.begin(); seg != segments.end(); seg++)
if ((*seg)->getType() == type)
return *seg;
- return NULL;
+ return nullptr;
}
inline void ElfSection::insertInSegments(std::vector<ElfSegment *> &segs) {
@@ -689,7 +689,7 @@ inline unsigned int ElfLocation::getValue() {
}
inline const char *ElfLocation::getBuffer() {
- return section ? section->getData() + offset : NULL;
+ return section ? section->getData() + offset : nullptr;
}
inline unsigned int ElfSize::getValue() {
diff --git a/build/unix/elfhack/inject.c b/build/unix/elfhack/inject.c
index 879cb4500..942426330 100644
--- a/build/unix/elfhack/inject.c
+++ b/build/unix/elfhack/inject.c
@@ -9,12 +9,12 @@
#undef Elf_Ehdr
#undef Elf_Addr
-#if BITS == 32
-#define Elf_Ehdr Elf32_Ehdr
-#define Elf_Addr Elf32_Addr
-#else
+#if defined(__LP64__)
#define Elf_Ehdr Elf64_Ehdr
#define Elf_Addr Elf64_Addr
+#else
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Addr Elf32_Addr
#endif
extern __attribute__((visibility("hidden"))) void original_init(int argc, char **argv, char **env);
@@ -22,7 +22,8 @@ extern __attribute__((visibility("hidden"))) void original_init(int argc, char *
extern __attribute__((visibility("hidden"))) Elf32_Rel relhack[];
extern __attribute__((visibility("hidden"))) Elf_Ehdr elf_header;
-int init(int argc, char **argv, char **env)
+static inline __attribute__((always_inline))
+void do_relocations(void)
{
Elf32_Rel *rel;
Elf_Addr *ptr, *start;
@@ -31,10 +32,20 @@ int init(int argc, char **argv, char **env)
for (ptr = start; ptr < &start[rel->r_info]; ptr++)
*ptr += (intptr_t)&elf_header;
}
+}
-#ifndef NOINIT
+__attribute__((section(".text._init_noinit")))
+int init_noinit(int argc, char **argv, char **env)
+{
+ do_relocations();
+ return 0;
+}
+
+__attribute__((section(".text._init")))
+int init(int argc, char **argv, char **env)
+{
+ do_relocations();
original_init(argc, argv, env);
-#endif
// Ensure there is no tail-call optimization, avoiding the use of the
// B.W instruction in Thumb for the call above.
return 0;
diff --git a/build/win32/crashinjectdll/Makefile.in b/build/unix/elfhack/inject/Makefile.in
index 179c9049e..07357a2b9 100644
--- a/build/win32/crashinjectdll/Makefile.in
+++ b/build/unix/elfhack/inject/Makefile.in
@@ -1,18 +1,17 @@
+#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
+INTERNAL_TOOLS = 1
-include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
-DEFFILE = $(srcdir)/crashinjectdll.def
-FORCE_SHARED_LIB = 1
-USE_STATIC_LIBS = 1
+export:: $(CSRCS:.c=.$(OBJ_SUFFIX))
-MOZ_GLUE_LDFLAGS =
+$(CSRCS): %.c: ../inject.c
+ cp $< $@
-include $(topsrcdir)/config/rules.mk
+GARBAGE += $(CSRCS)
+
+CFLAGS := -O2 -fno-stack-protector $(filter -m% -I%,$(CFLAGS))
diff --git a/build/unix/elfhack/inject/moz.build b/build/unix/elfhack/inject/moz.build
new file mode 100644
index 000000000..d0edb3ae7
--- /dev/null
+++ b/build/unix/elfhack/inject/moz.build
@@ -0,0 +1,24 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+NO_DIST_INSTALL = True
+
+if CONFIG['TARGET_CPU'].endswith('86'):
+ cpu = 'x86'
+elif CONFIG['TARGET_CPU'].startswith('arm'):
+ cpu = 'arm'
+else:
+ cpu = CONFIG['TARGET_CPU']
+
+GENERATED_SOURCES += [
+ "%s.c" % cpu,
+]
+
+DEFINES['ELFHACK_BUILD'] = True
+
+NO_PGO = True
+
+NO_VISIBILITY_FLAGS = True
diff --git a/build/unix/elfhack/moz.build b/build/unix/elfhack/moz.build
index 895d11993..e5cdae5ec 100644
--- a/build/unix/elfhack/moz.build
+++ b/build/unix/elfhack/moz.build
@@ -4,3 +4,27 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+NO_DIST_INSTALL = True
+DIRS += ['inject']
+
+if not CONFIG['CROSS_COMPILE']:
+ SOURCES += [
+ 'dummy.c',
+ 'test-array.c',
+ 'test-ctors.c',
+ ]
+
+ if '-flto' in CONFIG['OS_CFLAGS']:
+ SOURCES['test-array.c'].flags += ['-fno-lto']
+ SOURCES['test-ctors.c'].flags += ['-fno-lto']
+
+HOST_SOURCES += [
+ 'elf.cpp',
+ 'elfhack.cpp',
+]
+
+HostProgram('elfhack')
+
+DEFINES['ELFHACK_BUILD'] = True
+
+NO_PGO = True
diff --git a/build/unix/moz.build b/build/unix/moz.build
index 2abda39d2..2b009b7c2 100644
--- a/build/unix/moz.build
+++ b/build/unix/moz.build
@@ -4,13 +4,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-if CONFIG['STDCXX_COMPAT']:
+if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] or CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
DIRS += ['stdc++compat']
if CONFIG['USE_ELF_HACK']:
DIRS += ['elfhack']
-TEST_DIRS += ['test']
-
-MODULE = 'build'
-
diff --git a/build/unix/mozconfig.asan b/build/unix/mozconfig.asan
index c8d2c5130..d80014f26 100644
--- a/build/unix/mozconfig.asan
+++ b/build/unix/mozconfig.asan
@@ -1,8 +1,11 @@
+MOZ_AUTOMATION_L10N_CHECK=0
+
. "$topsrcdir/build/mozconfig.common"
# Use Clang as specified in manifest
export CC="$topsrcdir/clang/bin/clang -fgnu89-inline"
export CXX="$topsrcdir/clang/bin/clang++"
+export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer"
# Mandatory flags for ASan
export ASANFLAGS="-fsanitize=address -Dxmalloc=myxmalloc -fPIC"
@@ -19,3 +22,6 @@ ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-jemalloc
ac_add_options --disable-elf-hack
+
+# Avoid dependency on libstdc++ 4.7
+ac_add_options --enable-stdcxx-compat
diff --git a/build/unix/mozconfig.linux b/build/unix/mozconfig.linux
index e1c1bb6a2..4998081e4 100644
--- a/build/unix/mozconfig.linux
+++ b/build/unix/mozconfig.linux
@@ -1,6 +1,43 @@
+if [ "x$IS_NIGHTLY" = "xyes" ]; then
+ MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
+ MOZ_AUTOMATION_UPDATE_PACKAGING=1
+fi
+
. "$topsrcdir/build/mozconfig.common"
-CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
-CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
+# some b2g desktop builds still happen on i686 machines, and the tooltool
+# toolchain is x86_64 only.
+# We also deal with valgrind builds here, they don't use tooltool manifests at
+# all yet.
+if [ -z "$no_tooltool" ]
+then
+ CC="$topsrcdir/gcc/bin/gcc"
+ CXX="$topsrcdir/gcc/bin/g++"
+
+ # We want to make sure we use binutils and other binaries in the tooltool
+ # package.
+ mk_add_options PATH="$topsrcdir/gcc/bin:$PATH"
+else
+ CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
+ CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
+fi
ac_add_options --enable-elf-hack
+
+# Avoid dependency on libstdc++ 4.7
+ac_add_options --enable-stdcxx-compat
+
+# $topsrcdir/gtk3 comes from tooltool, when the tooltool manifest contains it.
+if [ -d "$topsrcdir/gtk3" ]; then
+ # PKG_CONFIG_LIBDIR is appropriately overridden in mozconfig.linux32
+ export PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig:/usr/share/pkgconfig
+ export PKG_CONFIG_SYSROOT_DIR="$topsrcdir/gtk3"
+ export PKG_CONFIG_PATH="$topsrcdir/gtk3/usr/local/lib/pkgconfig"
+ export PATH="$topsrcdir/gtk3/usr/local/bin:${PATH}"
+ # Ensure cairo, gdk-pixbuf, etc. are not taken from the system installed packages.
+ LDFLAGS="-L$topsrcdir/gtk3/usr/local/lib"
+ mk_add_options "export LD_LIBRARY_PATH=$topsrcdir/gtk3/usr/local/lib"
+ ac_add_options --enable-default-toolkit=cairo-gtk3
+fi
+
+export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
diff --git a/build/unix/mozconfig.linux32 b/build/unix/mozconfig.linux32
index 3b8c1e455..5198e3768 100644
--- a/build/unix/mozconfig.linux32
+++ b/build/unix/mozconfig.linux32
@@ -5,6 +5,7 @@ if test `uname -m` = "x86_64"; then
CC="$CC -m32 -march=pentiumpro"
CXX="$CXX -m32 -march=pentiumpro"
ac_add_options --target=i686-pc-linux
+ ac_add_options --host=i686-pc-linux
ac_add_options --x-libraries=/usr/lib
export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/share/pkgconfig
fi
diff --git a/build/unix/print-depth-path.sh b/build/unix/print-depth-path.sh
deleted file mode 100755
index 056cb4c61..000000000
--- a/build/unix/print-depth-path.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#
-# This script will print the depth path for a mozilla directory based
-# on the info in Makefile
-#
-# It's a hack. It's brute force. It's horrible.
-# It don't use Artificial Intelligence. It don't use Virtual Reality.
-# It's not perl. It's not python. But it works.
-#
-# Usage: print-depth-path.sh
-#
-# Send comments, improvements, bugs to jim_nance@yahoo.com
-#
-
-# Make sure a Makefile exists
-if [ ! -f Makefile ]
-then
- echo
- echo "There ain't no 'Makefile' over here: $pwd, dude."
- echo
-
- exit
-fi
-
-# awk can be quite primitave. Try enhanced versions first
-for AWK in gawk nawk awk; do
- if type $AWK 2>/dev/null 1>/dev/null; then
- break;
- fi
-done
-
-$AWK -v PWD=`pwd` '
-{
- if($1 == "DEPTH") {
- DEPTH=$0
- }
-}
-
-END {
- sub("^.*DEPTH.*=[ \t]*", "", DEPTH)
- dlen = split(DEPTH, darray, "/")
- plen = split(PWD, parray, "/")
-
- fsep=""
- for(i=plen-dlen; i<=plen; i++) {
- printf("%s%s", fsep, parray[i])
- fsep="/"
- }
- printf("\n")
-}' Makefile
-
diff --git a/build/unix/rewrite_asan_dylib.py b/build/unix/rewrite_asan_dylib.py
new file mode 100644
index 000000000..6e30374b7
--- /dev/null
+++ b/build/unix/rewrite_asan_dylib.py
@@ -0,0 +1,60 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import sys
+import os
+import subprocess
+import shutil
+from buildconfig import substs
+
+'''
+Scans the given directories for binaries referencing the AddressSanitizer
+runtime library, copies it to the main directory and rewrites binaries to not
+reference it with absolute paths but with @executable_path instead.
+'''
+
+# This is the dylib we're looking for
+DYLIB_NAME='libclang_rt.asan_osx_dynamic.dylib'
+
+def scan_directory(path):
+ dylibCopied = False
+
+ for root, subdirs, files in os.walk(path):
+ for filename in files:
+ filename = os.path.join(root, filename)
+
+ # Skip all files that aren't either dylibs or executable
+ if not (filename.endswith('.dylib') or os.access(filename, os.X_OK)):
+ continue
+
+ try:
+ otoolOut = subprocess.check_output([substs['OTOOL'], '-L', filename])
+ except:
+ # Errors are expected on non-mach executables, ignore them and continue
+ continue
+
+ for line in otoolOut.splitlines():
+ if line.find(DYLIB_NAME) != -1:
+ absDylibPath = line.split()[0]
+
+ # Don't try to rewrite binaries twice
+ if absDylibPath.find('@executable_path/') == 0:
+ continue
+
+ if not dylibCopied:
+ # Copy the runtime once to the main directory, which is passed
+ # as the argument to this function.
+ shutil.copy(absDylibPath, path)
+
+ # Now rewrite the library itself
+ subprocess.check_call(['install_name_tool', '-id', '@executable_path/' + DYLIB_NAME, os.path.join(path, DYLIB_NAME)])
+ dylibCopied = True
+
+ # Now use install_name_tool to rewrite the path in our binary
+ subprocess.check_call(['install_name_tool', '-change', absDylibPath, '@executable_path/' + DYLIB_NAME, filename])
+ break
+
+if __name__ == '__main__':
+ for d in sys.argv[1:]:
+ scan_directory(d)
diff --git a/build/unix/stdc++compat/Makefile.in b/build/unix/stdc++compat/Makefile.in
index 755e2d61a..095039de1 100644
--- a/build/unix/stdc++compat/Makefile.in
+++ b/build/unix/stdc++compat/Makefile.in
@@ -2,23 +2,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-FORCE_STATIC_LIB= 1
-STL_FLAGS =
-NO_EXPAND_LIBS = 1
-NO_PROFILE_GUIDED_OPTIMIZE = 1
-
- $(NULL)
-
-HOST_CPPSRCS = $(CPPSRCS)
+ENABLE_CLANG_PLUGIN :=
include $(topsrcdir)/config/rules.mk
CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
-HOST_CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
+HOST_CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_HOST_VERSION)
diff --git a/build/unix/stdc++compat/moz.build b/build/unix/stdc++compat/moz.build
index a33e690b0..73f4e22e1 100644
--- a/build/unix/stdc++compat/moz.build
+++ b/build/unix/stdc++compat/moz.build
@@ -4,13 +4,18 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-MODULE = 'build'
+if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
+ Library('stdc++compat')
+ SOURCES += ['stdc++compat.cpp']
-CPP_SOURCES += [
- 'stdc++compat.cpp',
-]
+if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
+ HostLibrary('host_stdc++compat')
+ HOST_SOURCES += [
+ 'stdc++compat.cpp',
+ ]
-HOST_LIBRARY_NAME = 'host_stdc++compat'
+FORCE_STATIC_LIB = True
-LIBRARY_NAME = 'stdc++compat'
+NO_PGO = True
+DISABLE_STL_WRAPPING = True
diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp
index aa7507263..dd8565cae 100644
--- a/build/unix/stdc++compat/stdc++compat.cpp
+++ b/build/unix/stdc++compat/stdc++compat.cpp
@@ -25,7 +25,7 @@
GLIBCXX_3.4.21 is from gcc 5.0 (210290)
This file adds the necessary compatibility tricks to avoid symbols with
-version GLIBCXX_3.4.11 and higher, maintaining binary compatibility with
+version GLIBCXX_3.4.11 and bigger, keeping binary compatibility with
libstdc++ 4.3.
*/
@@ -50,8 +50,8 @@ namespace std {
#endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 16)
/* Instantiate these templates to avoid GLIBCXX_3.4.16 symbol versions
- * depending on compiler optimizations */
- template int string::_S_compare(size_type, size_type);
+ * depending on compiler optimizations */
+ template int string::_S_compare(size_type, size_type);
#endif
}
@@ -67,6 +67,8 @@ namespace std MOZ_EXPORT {
void transfer(_List_node_base * const __first,
_List_node_base * const __last) throw();
+ void reverse() throw();
+
/* Hack to avoid GLIBCXX_3.4.15 symbol versions */
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
@@ -84,6 +86,8 @@ namespace std MOZ_EXPORT {
void _M_transfer(_List_node_base * const __first,
_List_node_base * const __last) throw();
+ void _M_reverse() throw();
+
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
#endif
@@ -110,6 +114,12 @@ namespace std MOZ_EXPORT {
(std::_List_node_base * const)__last);
}
+ void
+ _List_node_base::_M_reverse() throw ()
+ {
+ ((std::_List_node_base *)this)->reverse();
+ }
+
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
void
_List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw ()
@@ -132,12 +142,12 @@ namespace std MOZ_EXPORT {
#endif
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 20)
- /* We shouldn't be throwing exceptions at all, but it turns out
+ /* We shouldn't be throwing exceptions at all, but it sadly turns out
we call STL (inline) functions that do. */
void __throw_out_of_range_fmt(char const* fmt, ...)
{
- va_list ap;
- char buf[1024]; // That should be big enough.
+ va_list ap;
+ char buf[1024]; // That should be big enough.
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
@@ -157,19 +167,19 @@ namespace std MOZ_EXPORT {
extern "C" void
__cxa_throw_bad_array_new_length()
{
- MOZ_CRASH();
+ MOZ_CRASH();
}
#endif
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 21)
/* While we generally don't build with exceptions, we have some host tools
- * that do use them. libstdc++ from GCC 5.0 added exception constructors with
- * char const* argument. Older versions only have a constructor with
- * std::string. */
+* that do use them. libstdc++ from GCC 5.0 added exception constructors with
+* char const* argument. Older versions only have a constructor with
+* std::string. */
namespace std {
runtime_error::runtime_error(char const* s)
: runtime_error(std::string(s))
{
- }
+ }
}
#endif
diff --git a/build/unix/test/Makefile.in b/build/unix/test/Makefile.in
deleted file mode 100644
index 237fab8fb..000000000
--- a/build/unix/test/Makefile.in
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- makefile -*-
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-
-##################################################
-## Gather a list of tests, generate timestamp deps
-##################################################
-TS=.ts
-ifneq (,$(findstring check,$(MAKECMDGOALS)))
- allsrc = $(wildcard $(srcdir)/*)
- tests2run = $(notdir $(filter %.tpl,$(allsrc)))
- check_targets += $(addprefix $(TS)/,$(tests2run))
-endif
-
-check:: $(TS) $(check_targets)
-
-#############################################
-# Only invoke tests when sources have changed
-#############################################
-$(TS)/%: $(srcdir)/%
- $(PERL) $(srcdir)/runtest $<
- @touch $@
-
-#####################################################
-## Extra dep needed to synchronize parallel execution
-#####################################################
-$(TS): $(TS)/.done
-$(TS)/.done:
- $(MKDIR) -p $(dir $@)
- touch $@
-
-GARBAGE_DIRS += $(TS)
-
-# EOF
diff --git a/build/unix/test/runtest b/build/unix/test/runtest
deleted file mode 100755
index 3a53b0682..000000000
--- a/build/unix/test/runtest
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env perl
-###########################################################################
-## Intent:
-## Test::Harness is a testing wrapper that will process output
-## from Test.pm module tests. Sumarize results, report stats
-## and exit with overall status for the testing suites.
-##
-## Run testing suite:
-## % make clean test
-## % perl runtest
-##
-## Run Individual tests
-## % perl tUtils0
-###########################################################################
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-use Getopt::Long;
-
-use Test::Harness;
-
-##-------------------##
-##---] EXPORTS [---##
-##-------------------##
-our $VERSION = qw(1.0);
-use FindBin;
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-my %argv;
-
-##----------------##
-##---] MAIN [---##
-##----------------##
-unless(GetOptions(\%argv,
- qw(debug|d)
- ))
-{
- print "Usage: $0\n";
- print " --debug Enable debug mode\n";
- exit 1;
-}
-
-if (2 > $Test::Harness::VERSION)
-{
- print "Unit tests will not be run, Test::Harness is too old\n"
- if ($argv{debug});
- exit 0;
-}
-
-
-my @tests;
-
-########################################
-## Gather a list of tests if none passed
-########################################
-unless (@tests = @ARGV)
-{
- local *D;
- opendir(D, '.');
- while($_ = readdir(D)) {
- next unless /.t\S+$/;
- next if (/\.ts$/);
- push(@tests, $_);
- }
- closedir(D);
-}
-
-###############################################
-## Glob a list of tests when directories passed
-###############################################
-my @tmp;
-foreach (@tests)
-{
- local *D;
- if (-d $_ && (my $dir = $_))
- {
- opendir(D, $_) || die "opendir(D) failed: $!";
- my @tests = grep(/\.t[^\.\s]+/o, readdir(D));
- closedir(D);
- push(@tmp, map{ join('/', $dir, $_); } @tests);
- } else {
- push(@tmp, $_);
- }
-}
-@tests = @tmp;
-
-print "$0: @ARGV\n" if ($argv{debug});
-runtests(@tests);
-
-# EOF
diff --git a/build/unix/test/uniq.tpl b/build/unix/test/uniq.tpl
deleted file mode 100644
index ae692ab5c..000000000
--- a/build/unix/test/uniq.tpl
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env perl
-###########################################################################
-## Intent: Unit test to verify uniq.pl
-###########################################################################
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-use Cwd;
-use Getopt::Long; # GetOptions
-
-use Test;
-sub BEGIN { plan tests => 12 }
-
-##-------------------##
-##---] EXPORTS [---##
-##-------------------##
-our $VERSION = qw(1.0);
-
-##------------------##
-##---] INCLUDES [---##
-##------------------##
-use FindBin;
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-my %argv;
-
-
-###########################################################################
-## Intent: Run the arch command for output
-##
-## Returns:
-## 0 on success
-## $? command shell exit status
-###########################################################################
-sub uniq_pl
-{
- my $cmd = "perl $FindBin::RealBin/../uniq.pl @_";
- print "Running: $cmd\n" if ($argv{debug});
- my @tmp = `$cmd 2>&1`;
- my @output = map{ split(/\s+/o); } @tmp;
- wantarray ? @output : "@output";
-} # uniq_pl
-
-###########################################################################
-## Intent:
-##
-## Returns:
-## 0 on success
-###########################################################################
-sub check_uniq
-{
- print STDERR "Running test: check_uniq\n" if ($argv{debug});
-
- # TODO: improve test, uniq.pl regexpr handling not quite right
-
- my @todo =
- (
- [ '', qw(a a/b a/b/c) ] => [ qw(a a/b a/b/c) ],
- [ '', qw(a/b a a/b/c) ] => [ qw(a/b a a/b/c) ],
- [ '', qw(a/b/c a/b a) ] => [ qw(a/b/c a/b a) ],
-
- [ '', qw(a a/b a/b/c a/b a) ] => [ qw(a a/b a/b/c) ], # dup removal
-
- [ '-s', qw(a a/b a/b/c) ] => [ qw(a a/b a/b/c) ],
- [ '-s', qw(a/b a a/b/c) ] => [ qw(a a/b a/b/c) ],
- [ '-s', qw(a/b/c a/b a) ] => [ qw(a a/b a/b/c) ],
-
- [ '-r', qw(a a/b a/b/c) ] => [ qw(a) ],
- [ '-r', qw(a/b a a/b/c) ] => [ qw(a/b a) ],
- [ '-r', qw(a/b/c a/b a) ] => [ qw(a/b/c a/b a) ],
-
- [ '-r', qw(. .. a/b ../a aa/bb) ] => [ qw(. .. a/b aa/bb) ],
- [ '-r', qw(.. a/b ../a . aa/bb) ] => [ qw(.. a/b . aa/bb) ],
- );
-
- my $ct=1;
- while (@todo)
- {
- my ($a, $b) = splice(@todo, 0, 2);
- my @args = @{ $a };
- my @exp = @{ $b };
-
- my @out = uniq_pl(@args);
-# compareExp(\@out, \@exp, 'Failed on line ' . __LINE__ . ", dataset $ct");
- if (0 && 7 == $ct)
- {
- print STDERR "\n";
- print STDERR map{ "args> $_\n" }@args;
- print STDERR "\n";
- print STDERR map{ "exp> $_\n" }@exp;
- print STDERR "\n";
- print STDERR map{ "out> $_\n" }@out;
- }
-
- ok("@out", "@exp", 'Failed on line ' . __LINE__ . ", dataset $ct");
- $ct++;
- }
-
-} # check_uniq
-
-###########################################################################
-## Intent: Smoke tests for the unittests module
-###########################################################################
-sub smoke
-{
- print STDERR "Running test: smoke()\n" if ($argv{debug});
-} # smoke()
-
-###########################################################################
-## Intent: Intitialize global test objects and consts
-###########################################################################
-sub init
-{
- print "Running: init()\n" if ($argv{debug});
-# testplan(24, 0);
-} # init()
-
-##----------------##
-##---] MAIN [---##
-##----------------##
-unless(GetOptions(\%argv,
- qw(
- debug|d
- manual
- test=s@
- verbose
- )))
-{
- print "USAGE: $0\n";
- print " --debug Enable script debug mode\n";
- print " --fail Force a testing failure condition\n";
- print " --manual Also run disabled tests\n";
- print " --smoke Run smoke tests then exit\n";
- print " --test Run a list of tests by function name\n";
- print " --verbose Enable script verbose mode\n";
- exit 1;
-}
-
-init();
-testbyname(@{ $argv{test} }) if ($argv{test});
-smoke();
-
-check_uniq();
-ok(1, 0, 'Forced failure by command line arg --fail') if ($argv{fail});
-
-# EOF
diff --git a/build/unix/uniq.pl b/build/unix/uniq.pl
deleted file mode 100644
index 301240e03..000000000
--- a/build/unix/uniq.pl
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env perl
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-use Getopt::Long;
-
-##-------------------##
-##---] EXPORTS [---##
-##-------------------##
-our $VERSION = qw(1.1);
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-my %argv;
-my $modver = $Getopt::Long::VERSION || 0;
-my $isOldGetopt = ($modver eq '2.25') ? 1 : 0;
-
-###########################################################################
-## Intent: Script init function
-###########################################################################
-sub init
-{
- if ($isOldGetopt)
- {
- # mozilla.build/mingw perl in need of an upgrade
- # emulate Getopt::Long switch|short:init
- foreach (qw(debug regex sort))
- {
- if (defined($argv{$_}))
- {
- $argv{$_} ||= 1;
- }
- }
- }
-} # init
-
-##----------------##
-##---] MAIN [---##
-##----------------##
-my @args = ($isOldGetopt)
- ? qw(debug|d regex|r sort|s)
- : qw(debug|d:1 regex|r:1 sort|s:1)
- ;
-
-unless(GetOptions(\%argv, @args))
-{
- print "Usage: $0\n";
- print " --sort Sort list elements early\n";
- print " --regex Exclude subdirs by pattern\n";
-}
-
-init();
-my $debug = $argv{debug} || 0;
-
-my %seen;
-my @out;
-my @in = ($argv{sort}) ? sort @ARGV : @ARGV;
-
-foreach my $d (@in)
-{
- next if ($seen{$d}++);
-
- print " arg is $d\n" if ($debug);
-
- if ($argv{regex})
- {
- my $found = 0;
- foreach my $dir (@out)
- {
- my $dirM = quotemeta($dir);
- $found++, last if ($d eq $dir || $d =~ m!^${dirM}\/!);
- }
- print "Adding $d\n" if ($debug && !$found);
- push @out, $d if (!$found);
- } else {
- print "Adding: $d\n" if ($debug);
- push(@out, $d);
- }
-}
-
-print "@out\n"
-
-# EOF
diff --git a/build/package/moz.build b/build/unix/uniq.py
index 895d11993..e3afbbaf0 100644
--- a/build/package/moz.build
+++ b/build/unix/uniq.py
@@ -1,6 +1,10 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
+#! /usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'''Prints the given arguments in sorted order with duplicates removed.'''
+
+import sys
+
+print(' '.join(sorted(set(sys.argv[1:]))))
diff --git a/build/upload.py b/build/upload.py
index 9dae5d9be..6b1112eed 100755
--- a/build/upload.py
+++ b/build/upload.py
@@ -24,7 +24,8 @@
import sys, os
from optparse import OptionParser
-from subprocess import PIPE, Popen, check_call
+from subprocess import check_call, check_output
+import redo
def RequireEnvironmentVariable(v):
"""Return the value of the environment variable named v, or print
@@ -82,12 +83,12 @@ def DoSSHCommand(command, user, host, port=None, ssh_key=None):
cmdline = ["ssh"]
AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key)
cmdline.extend(["%s@%s" % (user, host), command])
- cmd = Popen(cmdline, stdout=PIPE)
- retcode = cmd.wait()
- if retcode != 0:
- raise Exception("Command %s returned non-zero exit code: %i" % \
- (cmdline, retcode))
- return cmd.stdout.read().strip()
+
+ with redo.retrying(check_output, sleeptime=10) as f:
+ output = f(cmdline).strip()
+ return output
+
+ raise Exception("Command %s returned non-zero exit code" % cmdline)
def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None):
"""Upload file to user@host:remote_path using scp. Optionally use
@@ -96,7 +97,11 @@ def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None):
AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key)
cmdline.extend([WindowsPathToMsysPath(file),
"%s@%s:%s" % (user, host, remote_path)])
- check_call(cmdline)
+ with redo.retrying(check_call, sleeptime=10) as f:
+ f(cmdline)
+ return
+
+ raise Exception("Command %s returned non-zero exit code" % cmdline)
def GetRemotePath(path, local_file, base_path):
"""Given a remote path to upload to, a full path to a local file, and an
diff --git a/build/util/hg.py b/build/util/hg.py
new file mode 100644
index 000000000..c76c8ef03
--- /dev/null
+++ b/build/util/hg.py
@@ -0,0 +1,611 @@
+"""Functions for interacting with hg"""
+import os
+import re
+import subprocess
+from urlparse import urlsplit
+from ConfigParser import RawConfigParser
+
+from util.commands import run_cmd, get_output, remove_path
+from util.retry import retry
+
+import logging
+log = logging.getLogger(__name__)
+
+
+class DefaultShareBase:
+ pass
+DefaultShareBase = DefaultShareBase()
+
+
+class HgUtilError(Exception):
+ pass
+
+
+def _make_absolute(repo):
+ if repo.startswith("file://"):
+ path = repo[len("file://"):]
+ repo = "file://%s" % os.path.abspath(path)
+ elif "://" not in repo:
+ repo = os.path.abspath(repo)
+ return repo
+
+
+def make_hg_url(hgHost, repoPath, protocol='https', revision=None,
+ filename=None):
+ """construct a valid hg url from a base hg url (hg.mozilla.org),
+ repoPath, revision and possible filename"""
+ base = '%s://%s' % (protocol, hgHost)
+ repo = '/'.join(p.strip('/') for p in [base, repoPath])
+ if not filename:
+ if not revision:
+ return repo
+ else:
+ return '/'.join([p.strip('/') for p in [repo, 'rev', revision]])
+ else:
+ assert revision
+ return '/'.join([p.strip('/') for p in [repo, 'raw-file', revision, filename]])
+
+
+def get_repo_name(repo):
+ return repo.rstrip('/').split('/')[-1]
+
+
+def get_repo_path(repo):
+ repo = _make_absolute(repo)
+ if repo.startswith("/"):
+ return repo.lstrip("/")
+ else:
+ return urlsplit(repo).path.lstrip("/")
+
+
+def get_revision(path):
+ """Returns which revision directory `path` currently has checked out."""
+ return get_output(['hg', 'parent', '--template', '{node|short}'], cwd=path)
+
+
+def get_branch(path):
+ return get_output(['hg', 'branch'], cwd=path).strip()
+
+
+def get_branches(path):
+ branches = []
+ for line in get_output(['hg', 'branches', '-c'], cwd=path).splitlines():
+ branches.append(line.split()[0])
+ return branches
+
+
+def is_hg_cset(rev):
+ """Retruns True if passed revision represents a valid HG revision
+ (long or short(er) 40 bit hex)"""
+ try:
+ int(rev, 16)
+ return True
+ except (TypeError, ValueError):
+ return False
+
+
+def hg_ver():
+ """Returns the current version of hg, as a tuple of
+ (major, minor, build)"""
+ ver_string = get_output(['hg', '-q', 'version'])
+ match = re.search("\(version ([0-9.]+)\)", ver_string)
+ if match:
+ bits = match.group(1).split(".")
+ if len(bits) < 3:
+ bits += (0,)
+ ver = tuple(int(b) for b in bits)
+ else:
+ ver = (0, 0, 0)
+ log.debug("Running hg version %s", ver)
+ return ver
+
+
+def purge(dest):
+ """Purge the repository of all untracked and ignored files."""
+ try:
+ run_cmd(['hg', '--config', 'extensions.purge=', 'purge',
+ '-a', '--all', dest], cwd=dest)
+ except subprocess.CalledProcessError, e:
+ log.debug('purge failed: %s' % e)
+ raise
+
+
+def update(dest, branch=None, revision=None):
+ """Updates working copy `dest` to `branch` or `revision`. If neither is
+ set then the working copy will be updated to the latest revision on the
+ current branch. Local changes will be discarded."""
+ # If we have a revision, switch to that
+ if revision is not None:
+ cmd = ['hg', 'update', '-C', '-r', revision]
+ run_cmd(cmd, cwd=dest)
+ else:
+ # Check & switch branch
+ local_branch = get_output(['hg', 'branch'], cwd=dest).strip()
+
+ cmd = ['hg', 'update', '-C']
+
+ # If this is different, checkout the other branch
+ if branch and branch != local_branch:
+ cmd.append(branch)
+
+ run_cmd(cmd, cwd=dest)
+ return get_revision(dest)
+
+
+def clone(repo, dest, branch=None, revision=None, update_dest=True,
+ clone_by_rev=False, mirrors=None, bundles=None):
+ """Clones hg repo and places it at `dest`, replacing whatever else is
+ there. The working copy will be empty.
+
+ If `revision` is set, only the specified revision and its ancestors will
+ be cloned.
+
+ If `update_dest` is set, then `dest` will be updated to `revision` if
+ set, otherwise to `branch`, otherwise to the head of default.
+
+ If `mirrors` is set, will try and clone from the mirrors before
+ cloning from `repo`.
+
+ If `bundles` is set, will try and download the bundle first and
+ unbundle it. If successful, will pull in new revisions from mirrors or
+ the master repo. If unbundling fails, will fall back to doing a regular
+ clone from mirrors or the master repo.
+
+ Regardless of how the repository ends up being cloned, the 'default' path
+ will point to `repo`.
+ """
+ if os.path.exists(dest):
+ remove_path(dest)
+
+ if bundles:
+ log.info("Attempting to initialize clone with bundles")
+ for bundle in bundles:
+ if os.path.exists(dest):
+ remove_path(dest)
+ init(dest)
+ log.info("Trying to use bundle %s", bundle)
+ try:
+ if not unbundle(bundle, dest):
+ remove_path(dest)
+ continue
+ adjust_paths(dest, default=repo)
+ # Now pull / update
+ return pull(repo, dest, update_dest=update_dest,
+ mirrors=mirrors, revision=revision, branch=branch)
+ except Exception:
+ remove_path(dest)
+ log.exception("Problem unbundling/pulling from %s", bundle)
+ continue
+ else:
+ log.info("Using bundles failed; falling back to clone")
+
+ if mirrors:
+ log.info("Attempting to clone from mirrors")
+ for mirror in mirrors:
+ log.info("Cloning from %s", mirror)
+ try:
+ retval = clone(mirror, dest, branch, revision,
+ update_dest=update_dest, clone_by_rev=clone_by_rev)
+ adjust_paths(dest, default=repo)
+ return retval
+ except:
+ log.exception("Problem cloning from mirror %s", mirror)
+ continue
+ else:
+ log.info("Pulling from mirrors failed; falling back to %s", repo)
+ # We may have a partial repo here; mercurial() copes with that
+ # We need to make sure our paths are correct though
+ if os.path.exists(os.path.join(dest, '.hg')):
+ adjust_paths(dest, default=repo)
+ return mercurial(repo, dest, branch, revision, autoPurge=True,
+ update_dest=update_dest, clone_by_rev=clone_by_rev)
+
+ cmd = ['hg', 'clone']
+ if not update_dest:
+ cmd.append('-U')
+
+ if clone_by_rev:
+ if revision:
+ cmd.extend(['-r', revision])
+ elif branch:
+ # hg >= 1.6 supports -b branch for cloning
+ ver = hg_ver()
+ if ver >= (1, 6, 0):
+ cmd.extend(['-b', branch])
+
+ cmd.extend([repo, dest])
+ run_cmd(cmd)
+
+ if update_dest:
+ return update(dest, branch, revision)
+
+
+def common_args(revision=None, branch=None, ssh_username=None, ssh_key=None):
+ """Fill in common hg arguments, encapsulating logic checks that depend on
+ mercurial versions and provided arguments"""
+ args = []
+ if ssh_username or ssh_key:
+ opt = ['-e', 'ssh']
+ if ssh_username:
+ opt[1] += ' -l %s' % ssh_username
+ if ssh_key:
+ opt[1] += ' -i %s' % ssh_key
+ args.extend(opt)
+ if revision:
+ args.extend(['-r', revision])
+ elif branch:
+ if hg_ver() >= (1, 6, 0):
+ args.extend(['-b', branch])
+ return args
+
+
+def pull(repo, dest, update_dest=True, mirrors=None, **kwargs):
+ """Pulls changes from hg repo and places it in `dest`.
+
+ If `update_dest` is set, then `dest` will be updated to `revision` if
+ set, otherwise to `branch`, otherwise to the head of default.
+
+ If `mirrors` is set, will try and pull from the mirrors first before
+ `repo`."""
+
+ if mirrors:
+ for mirror in mirrors:
+ try:
+ return pull(mirror, dest, update_dest=update_dest, **kwargs)
+ except:
+ log.exception("Problem pulling from mirror %s", mirror)
+ continue
+ else:
+ log.info("Pulling from mirrors failed; falling back to %s", repo)
+
+ # Convert repo to an absolute path if it's a local repository
+ repo = _make_absolute(repo)
+ cmd = ['hg', 'pull']
+ # Don't pass -r to "hg pull", except when it's a valid HG revision.
+ # Pulling using tag names is dangerous: it uses the local .hgtags, so if
+ # the tag has moved on the remote side you won't pull the new revision the
+ # remote tag refers to.
+ pull_kwargs = kwargs.copy()
+ if 'revision' in pull_kwargs and \
+ not is_hg_cset(pull_kwargs['revision']):
+ del pull_kwargs['revision']
+
+ cmd.extend(common_args(**pull_kwargs))
+
+ cmd.append(repo)
+ run_cmd(cmd, cwd=dest)
+
+ if update_dest:
+ branch = None
+ if 'branch' in kwargs and kwargs['branch']:
+ branch = kwargs['branch']
+ revision = None
+ if 'revision' in kwargs and kwargs['revision']:
+ revision = kwargs['revision']
+ return update(dest, branch=branch, revision=revision)
+
+# Defines the places of attributes in the tuples returned by `out'
+REVISION, BRANCH = 0, 1
+
+
+def out(src, remote, **kwargs):
+ """Check for outgoing changesets present in a repo"""
+ cmd = ['hg', '-q', 'out', '--template', '{node} {branches}\n']
+ cmd.extend(common_args(**kwargs))
+ cmd.append(remote)
+ if os.path.exists(src):
+ try:
+ revs = []
+ for line in get_output(cmd, cwd=src).rstrip().split("\n"):
+ try:
+ rev, branch = line.split()
+ # Mercurial displays no branch at all if the revision is on
+ # "default"
+ except ValueError:
+ rev = line.rstrip()
+ branch = "default"
+ revs.append((rev, branch))
+ return revs
+ except subprocess.CalledProcessError, inst:
+ # In some situations, some versions of Mercurial return "1"
+ # if no changes are found, so we need to ignore this return code
+ if inst.returncode == 1:
+ return []
+ raise
+
+
+def push(src, remote, push_new_branches=True, force=False, **kwargs):
+ cmd = ['hg', 'push']
+ cmd.extend(common_args(**kwargs))
+ if force:
+ cmd.append('-f')
+ if push_new_branches:
+ cmd.append('--new-branch')
+ cmd.append(remote)
+ run_cmd(cmd, cwd=src)
+
+
+def mercurial(repo, dest, branch=None, revision=None, update_dest=True,
+ shareBase=DefaultShareBase, allowUnsharedLocalClones=False,
+ clone_by_rev=False, mirrors=None, bundles=None, autoPurge=False):
+ """Makes sure that `dest` is has `revision` or `branch` checked out from
+ `repo`.
+
+ Do what it takes to make that happen, including possibly clobbering
+ dest.
+
+ If allowUnsharedLocalClones is True and we're trying to use the share
+ extension but fail, then we will be able to clone from the shared repo to
+ our destination. If this is False, the default, then if we don't have the
+ share extension we will just clone from the remote repository.
+
+ If `clone_by_rev` is True, use 'hg clone -r <rev>' instead of 'hg clone'.
+ This is slower, but useful when cloning repos with lots of heads.
+
+ If `mirrors` is set, will try and use the mirrors before `repo`.
+
+ If `bundles` is set, will try and download the bundle first and
+ unbundle it instead of doing a full clone. If successful, will pull in
+ new revisions from mirrors or the master repo. If unbundling fails, will
+ fall back to doing a regular clone from mirrors or the master repo.
+ """
+ dest = os.path.abspath(dest)
+ if shareBase is DefaultShareBase:
+ shareBase = os.environ.get("HG_SHARE_BASE_DIR", None)
+
+ log.info("Reporting hg version in use")
+ cmd = ['hg', '-q', 'version']
+ run_cmd(cmd, cwd='.')
+
+ if shareBase:
+ # Check that 'hg share' works
+ try:
+ log.info("Checking if share extension works")
+ output = get_output(['hg', 'help', 'share'], dont_log=True)
+ if 'no commands defined' in output:
+ # Share extension is enabled, but not functional
+ log.info("Disabling sharing since share extension doesn't seem to work (1)")
+ shareBase = None
+ elif 'unknown command' in output:
+ # Share extension is disabled
+ log.info("Disabling sharing since share extension doesn't seem to work (2)")
+ shareBase = None
+ except subprocess.CalledProcessError:
+ # The command failed, so disable sharing
+ log.info("Disabling sharing since share extension doesn't seem to work (3)")
+ shareBase = None
+
+ # Check that our default path is correct
+ if os.path.exists(os.path.join(dest, '.hg')):
+ hgpath = path(dest, "default")
+
+ # Make sure that our default path is correct
+ if hgpath != _make_absolute(repo):
+ log.info("hg path isn't correct (%s should be %s); clobbering",
+ hgpath, _make_absolute(repo))
+ remove_path(dest)
+
+ # If the working directory already exists and isn't using share we update
+ # the working directory directly from the repo, ignoring the sharing
+ # settings
+ if os.path.exists(dest):
+ if not os.path.exists(os.path.join(dest, ".hg")):
+ log.warning("%s doesn't appear to be a valid hg directory; clobbering", dest)
+ remove_path(dest)
+ elif not os.path.exists(os.path.join(dest, ".hg", "sharedpath")):
+ try:
+ if autoPurge:
+ purge(dest)
+ return pull(repo, dest, update_dest=update_dest, branch=branch,
+ revision=revision,
+ mirrors=mirrors)
+ except subprocess.CalledProcessError:
+ log.warning("Error pulling changes into %s from %s; clobbering", dest, repo)
+ log.debug("Exception:", exc_info=True)
+ remove_path(dest)
+
+ # If that fails for any reason, and sharing is requested, we'll try to
+ # update the shared repository, and then update the working directory from
+ # that.
+ if shareBase:
+ sharedRepo = os.path.join(shareBase, get_repo_path(repo))
+ dest_sharedPath = os.path.join(dest, '.hg', 'sharedpath')
+
+ if os.path.exists(sharedRepo):
+ hgpath = path(sharedRepo, "default")
+
+ # Make sure that our default path is correct
+ if hgpath != _make_absolute(repo):
+ log.info("hg path isn't correct (%s should be %s); clobbering",
+ hgpath, _make_absolute(repo))
+ # we need to clobber both the shared checkout and the dest,
+ # since hgrc needs to be in both places
+ remove_path(sharedRepo)
+ remove_path(dest)
+
+ if os.path.exists(dest_sharedPath):
+ # Make sure that the sharedpath points to sharedRepo
+ dest_sharedPath_data = os.path.normpath(
+ open(dest_sharedPath).read())
+ norm_sharedRepo = os.path.normpath(os.path.join(sharedRepo, '.hg'))
+ if dest_sharedPath_data != norm_sharedRepo:
+ # Clobber!
+ log.info("We're currently shared from %s, but are being requested to pull from %s (%s); clobbering",
+ dest_sharedPath_data, repo, norm_sharedRepo)
+ remove_path(dest)
+
+ try:
+ log.info("Updating shared repo")
+ mercurial(repo, sharedRepo, branch=branch, revision=revision,
+ update_dest=False, shareBase=None, clone_by_rev=clone_by_rev,
+ mirrors=mirrors, bundles=bundles, autoPurge=False)
+ if os.path.exists(dest):
+ if autoPurge:
+ purge(dest)
+ return update(dest, branch=branch, revision=revision)
+
+ try:
+ log.info("Trying to share %s to %s", sharedRepo, dest)
+ return share(sharedRepo, dest, branch=branch, revision=revision)
+ except subprocess.CalledProcessError:
+ if not allowUnsharedLocalClones:
+ # Re-raise the exception so it gets caught below.
+ # We'll then clobber dest, and clone from original repo
+ raise
+
+ log.warning("Error calling hg share from %s to %s;"
+ "falling back to normal clone from shared repo",
+ sharedRepo, dest)
+ # Do a full local clone first, and then update to the
+ # revision we want
+ # This lets us use hardlinks for the local clone if the OS
+ # supports it
+ clone(sharedRepo, dest, update_dest=False,
+ mirrors=mirrors, bundles=bundles)
+ return update(dest, branch=branch, revision=revision)
+ except subprocess.CalledProcessError:
+ log.warning(
+ "Error updating %s from sharedRepo (%s): ", dest, sharedRepo)
+ log.debug("Exception:", exc_info=True)
+ remove_path(dest)
+ # end if shareBase
+
+ if not os.path.exists(os.path.dirname(dest)):
+ os.makedirs(os.path.dirname(dest))
+
+ # Share isn't available or has failed, clone directly from the source
+ return clone(repo, dest, branch, revision,
+ update_dest=update_dest, mirrors=mirrors,
+ bundles=bundles, clone_by_rev=clone_by_rev)
+
+
+def apply_and_push(localrepo, remote, changer, max_attempts=10,
+ ssh_username=None, ssh_key=None, force=False):
+ """This function calls `changer' to make changes to the repo, and tries
+ its hardest to get them to the origin repo. `changer' must be a
+ callable object that receives two arguments: the directory of the local
+ repository, and the attempt number. This function will push ALL
+ changesets missing from remote."""
+ assert callable(changer)
+ branch = get_branch(localrepo)
+ changer(localrepo, 1)
+ for n in range(1, max_attempts + 1):
+ new_revs = []
+ try:
+ new_revs = out(src=localrepo, remote=remote,
+ ssh_username=ssh_username,
+ ssh_key=ssh_key)
+ if len(new_revs) < 1:
+ raise HgUtilError("No revs to push")
+ push(src=localrepo, remote=remote, ssh_username=ssh_username,
+ ssh_key=ssh_key, force=force)
+ return
+ except subprocess.CalledProcessError, e:
+ log.debug("Hit error when trying to push: %s" % str(e))
+ if n == max_attempts:
+ log.debug("Tried %d times, giving up" % max_attempts)
+ for r in reversed(new_revs):
+ run_cmd(['hg', '--config', 'extensions.mq=', 'strip', '-n',
+ r[REVISION]], cwd=localrepo)
+ raise HgUtilError("Failed to push")
+ pull(remote, localrepo, update_dest=False,
+ ssh_username=ssh_username, ssh_key=ssh_key)
+ # After we successfully rebase or strip away heads the push is
+ # is attempted again at the start of the loop
+ try:
+ run_cmd(['hg', '--config', 'ui.merge=internal:merge',
+ 'rebase'], cwd=localrepo)
+ except subprocess.CalledProcessError, e:
+ log.debug("Failed to rebase: %s" % str(e))
+ update(localrepo, branch=branch)
+ for r in reversed(new_revs):
+ run_cmd(['hg', '--config', 'extensions.mq=', 'strip', '-n',
+ r[REVISION]], cwd=localrepo)
+ changer(localrepo, n + 1)
+
+
+def share(source, dest, branch=None, revision=None):
+ """Creates a new working directory in "dest" that shares history with
+ "source" using Mercurial's share extension"""
+ run_cmd(['hg', 'share', '-U', source, dest])
+ return update(dest, branch=branch, revision=revision)
+
+
+def cleanOutgoingRevs(reponame, remote, username, sshKey):
+ outgoingRevs = retry(out, kwargs=dict(src=reponame, remote=remote,
+ ssh_username=username,
+ ssh_key=sshKey))
+ for r in reversed(outgoingRevs):
+ run_cmd(['hg', '--config', 'extensions.mq=', 'strip', '-n',
+ r[REVISION]], cwd=reponame)
+
+
+def path(src, name='default'):
+ """Returns the remote path associated with "name" """
+ try:
+ return get_output(['hg', 'path', name], cwd=src).strip()
+ except subprocess.CalledProcessError:
+ return None
+
+
+def init(dest):
+ """Initializes an empty repo in `dest`"""
+ run_cmd(['hg', 'init', dest])
+
+
+def unbundle(bundle, dest):
+ """Unbundles the bundle located at `bundle` into `dest`.
+
+ `bundle` can be a local file or remote url."""
+ try:
+ get_output(['hg', 'unbundle', bundle], cwd=dest, include_stderr=True)
+ return True
+ except subprocess.CalledProcessError:
+ return False
+
+
+def adjust_paths(dest, **paths):
+ """Adjusts paths in `dest`/.hg/hgrc so that names in `paths` are set to
+ paths[name].
+
+ Note that any comments in the hgrc will be lost if changes are made to the
+ file."""
+ hgrc = os.path.join(dest, '.hg', 'hgrc')
+ config = RawConfigParser()
+ config.read(hgrc)
+
+ if not config.has_section('paths'):
+ config.add_section('paths')
+
+ changed = False
+ for path_name, path_value in paths.items():
+ if (not config.has_option('paths', path_name) or
+ config.get('paths', path_name) != path_value):
+ changed = True
+ config.set('paths', path_name, path_value)
+
+ if changed:
+ config.write(open(hgrc, 'w'))
+
+
+def commit(dest, msg, user=None):
+ cmd = ['hg', 'commit', '-m', msg]
+ if user:
+ cmd.extend(['-u', user])
+ run_cmd(cmd, cwd=dest)
+ return get_revision(dest)
+
+
+def tag(dest, tags, user=None, msg=None, rev=None, force=None):
+ cmd = ['hg', 'tag']
+ if user:
+ cmd.extend(['-u', user])
+ if msg:
+ cmd.extend(['-m', msg])
+ if rev:
+ cmd.extend(['-r', rev])
+ if force:
+ cmd.append('-f')
+ cmd.extend(tags)
+ run_cmd(cmd, cwd=dest)
+ return get_revision(dest)
diff --git a/build/valgrind/__init__.py b/build/valgrind/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/build/valgrind/__init__.py
diff --git a/build/valgrind/cross-architecture.sup b/build/valgrind/cross-architecture.sup
index a02221db9..1e9d7ab35 100644
--- a/build/valgrind/cross-architecture.sup
+++ b/build/valgrind/cross-architecture.sup
@@ -5,89 +5,28 @@
####################
{
- PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793534 and see bug 793549.)
+ PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793534.)
Memcheck:Leak
...
fun:_ZL9SaveToEnvPKc
...
}
{
- PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793534 and see bug 793549.)
+ PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793549.)
Memcheck:Leak
...
fun:_ZL13SaveWordToEnvPKcRK19nsACString_internal
...
}
{
- See bug 793535
- Memcheck:Leak
- fun:calloc
- fun:_dlerror_run
- fun:dlsym
- ...
-}
-{
- See bug 793611
- Memcheck:Leak
- fun:memalign
- fun:tls_get_addr_tail
- fun:__tls_get_addr
- ...
-}
-{
- See bug 793611
- Memcheck:Leak
- fun:memalign
- fun:tls_get_addr_tail
- fun:___tls_get_addr
- ...
-}
-
-#################
-# Other leaks #
-#################
-
-{
- Bug 793532
+ PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 944133.)
Memcheck:Leak
- fun:malloc
- fun:_ZN8JSObject25allocateSlowArrayElementsEP9JSContext
...
-}
-{
- Bug 793533 (all 64-bit systems)
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
- fun:_ZN3xpc18CreateGlobalObjectEP9JSContextP7JSClassP12nsIPrincipalbPP8JSObjectPP13JSCompartment
+ fun:_ZN13CrashReporter14SetRestartArgsEiPPc
...
}
{
- Bug 793533 (all 64-bit systems)
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
- fun:_ZN3xpc18CreateGlobalObjectEP9JSContextP7JSClassP12nsIPrincipalm
- ...
-}
-{
- Bug 793536 (all 64-bit systems)
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
- fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEm
- ...
-}
-{
- Bug 793536 (all 32-bit systems)
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
- fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEj
- ...
-}
-{
- Bug 793548
+ PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793548.)
Memcheck:Leak
fun:malloc
...
@@ -96,82 +35,54 @@
...
}
{
- Bug 793608
- Memcheck:Leak
- ...
- fun:gaih_inet
- fun:getaddrinfo
- fun:PR_GetAddrInfoByName
- fun:_ZN14nsHostResolver10ThreadFuncEPv
- fun:_pt_root
- fun:start_thread
- fun:clone
-}
-{
- Bug 793608 variant
+ We purposely leak the StatisticsReporter object
Memcheck:Leak
fun:malloc
- fun:__libc_res_nsend
- fun:__libc_res_nquery
- fun:__libc_res_nquerydomain
- fun:__libc_res_nsearch
- obj:*
+ fun:moz_xmalloc
+ fun:operator new
+ fun:_Z21XRE_CreateStatsObjectv
...
}
+
+####################################
+# Leaks in third party libraries #
+####################################
+
{
- Bug 793608 variant 2
- Memcheck:Leak
- fun:malloc
- fun:make_request
- fun:__check_pf
- fun:getaddrinfo
- fun:PR_GetAddrInfoByName
- fun:_ZN14nsHostResolver10ThreadFuncEPv
- fun:_pt_root
- fun:start_thread
- fun:clone
-}
-{
- Bug 793615
+ See bug 793535
Memcheck:Leak
- fun:malloc
- fun:sqlite3MemMalloc
+ fun:calloc
+ fun:_dlerror_run
+ fun:dlsym
...
}
{
- Bug 794350
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
- fun:_ZN11MessageLoopC1ENS_4TypeE
- fun:_ZN4base6Thread10ThreadMainEv
- fun:_ZL10ThreadFuncPv
- fun:start_thread
- fun:clone
-}
-{
- Bug 794354
+ See bug 793611
Memcheck:Leak
- ...
- fun:_ZN7mozilla12safebrowsing10Classifier12ApplyUpdatesEP8nsTArrayIPNS0_11TableUpdateE24nsTArrayDefaultAllocatorE
- fun:_ZN30nsUrlClassifierDBServiceWorker11ApplyUpdateEv
- fun:_ZN30nsUrlClassifierDBServiceWorker12FinishUpdateEv
+ fun:memalign
+ fun:tls_get_addr_tail
+ fun:__tls_get_addr
...
}
{
- Bug 794358
+ See bug 793611
Memcheck:Leak
- fun:malloc
- ...
- fun:PK11_InitPin
- fun:_ZN11nsPK11Token12InitPasswordEPKt
+ fun:memalign
+ fun:tls_get_addr_tail
+ fun:___tls_get_addr
...
}
+
+#################
+# Other leaks #
+#################
+
{
Bug 794369
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
+ ...
fun:_ZN20mozJSComponentLoader10LoadModuleERN7mozilla12FileLocationE
...
}
@@ -180,6 +91,7 @@
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
+ ...
fun:_ZN22nsComponentManagerImpl15RegisterFactoryERK4nsIDPKcS4_P10nsIFactory
...
}
@@ -188,14 +100,7 @@
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
- fun:_ZN22nsComponentManagerImpl16RegisterCIDEntryEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
...
-}
-{
- Bug 794372
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
fun:_ZN22nsComponentManagerImpl22RegisterCIDEntryLockedEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
...
}
@@ -204,104 +109,16 @@
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
- fun:_ZN22nsComponentManagerImpl17ManifestComponentERNS_25ManifestProcessingContextEiPKPc
- ...
-}
-{
- Bug 803386
- Memcheck:Free
- fun:_ZdlPv
- fun:_ZN16SkMallocPixelRefD0Ev
- fun:_ZNK8SkRefCnt16internal_disposeEv
- fun:_ZN8SkBitmap10freePixelsEv
- fun:_ZN8SkBitmapD1Ev
- fun:_ZN7mozilla3gfx5ScaleEPhiiiS1_iiiNS0_13SurfaceFormatE
- ...
-}
-{
- Bug 812421 (all 32-bit systems)
- Memcheck:Leak
- fun:malloc
- fun:_ZN3JSC19ExecutableAllocator10createPoolEj
- fun:_ZN3JSC19ExecutableAllocator11poolForSizeEj
- ...
-}
-{
- Bug 812421 (all 64-bit systems)
- Memcheck:Leak
- fun:malloc
- fun:_ZN3JSC19ExecutableAllocator10createPoolEm
- fun:_ZN3JSC19ExecutableAllocator11poolForSizeEm
- ...
-}
-{
- Bug 812422
- Memcheck:Leak
- fun:malloc
- fun:moz_xmalloc
- fun:_Z22NS_NewComputedDOMStylePN7mozilla3dom7ElementERK18nsAString_internalP12nsIPresShellN18nsComputedDOMStyle9StyleTypeE
- fun:_ZN14nsGlobalWindow22GetComputedStyleHelperEP13nsIDOMElementRK18nsAString_internalbPP25nsIDOMCSSStyleDeclaration
...
-}
-{
- Bug 812423
- Memcheck:Leak
- fun:malloc
- fun:_ZN2js15ArgumentsObject6createI18CopyStackFrameArgsEEPS0_P9JSContextN2JS6HandleIP8JSScriptEENS7_IP10JSFunctionEEjRT_
- fun:_ZN2js15ArgumentsObject14createExpectedEP9JSContextPNS_10StackFrameE
- ...
-}
-{
- Bug 812423
- Memcheck:Leak
- fun:malloc
- fun:_ZN2js15ArgumentsObject6createI13CopyFrameArgsEEPS0_P9JSContextN2JS6HandleIP8JSScriptEENS7_IP10JSFunctionEEjRT_
- fun:_ZN2js15ArgumentsObject14createExpectedEP9JSContextNS_16AbstractFramePtrE
- ...
-}
-{
- Bug 823782
- Memcheck:Leak
- fun:malloc
- ...
- fun:_ZN2js6ctypes7LibraryL7DeclareEP9JSContextjPN2JS5ValueE
- ...
-}
-{
- Bug 823782
- Memcheck:Leak
- fun:malloc
- fun:_ZN2js6ctypes5CData6CreateEP9JSContextN2JS6HandleIP8JSObjectEES8_Pvb
- ...
-}
-{
- Bug 823782
- Memcheck:Leak
- fun:malloc
- ...
- fun:_ZN2js6ctypes10StructTypeL6CreateEP9JSContextjPN2JS5ValueE
- ...
-}
-{
- Bug 823782
- Memcheck:Leak
- fun:malloc
- fun:_ZN2js6ctypes9Int64Base9ConstructEP9JSContextN2JS6HandleIP8JSObjectEEmb
- ...
-}
-{
- Bug 824323
- Memcheck:Leak
- fun:malloc
- ...
- fun:_ZN7mozilla3dom7workers13WorkerPrivate9DoRunLoopEP9JSContext
+ fun:_ZN22nsComponentManagerImpl17ManifestComponentERNS_25ManifestProcessingContextEiPKPc
...
}
{
- Bug 874658
+ Bug 1017112
Memcheck:Leak
fun:malloc
...
- fun:_Z31mozilla_sampler_register_threadPKc
+ fun:PK11_InitPin
+ fun:_ZN11nsPK11Token12InitPasswordEPKDs
...
}
diff --git a/build/valgrind/i386-redhat-linux-gnu.sup b/build/valgrind/i386-redhat-linux-gnu.sup
index 414afc6c5..c1d39cd24 100644
--- a/build/valgrind/i386-redhat-linux-gnu.sup
+++ b/build/valgrind/i386-redhat-linux-gnu.sup
@@ -49,12 +49,15 @@
obj:/lib/libgobject-2.0.so.0.2200.5
...
}
+
+###################################
+# Leaks in short lived precesses #
+###################################
+
{
- Bug 850134
+ Bug 984196
Memcheck:Leak
- fun:realloc
- fun:_ZN2js6VectorIyLj0ENS_15TempAllocPolicyEE13growStorageByEj
- fun:_ZN2js8SCOutput5writeEy
- fun:_ZN2js8SCOutput9writePairEjj
+ ...
+ fun:glxtest
...
}
diff --git a/build/valgrind/mach_commands.py b/build/valgrind/mach_commands.py
new file mode 100644
index 000000000..a0e0769c9
--- /dev/null
+++ b/build/valgrind/mach_commands.py
@@ -0,0 +1,166 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import print_function, unicode_literals
+
+import os
+import re
+import subprocess
+
+from mach.decorators import (
+ Command,
+ CommandArgument,
+ CommandProvider,
+)
+from mozbuild.base import (
+ MachCommandBase,
+ MachCommandConditions as conditions,
+)
+
+
+def is_valgrind_build(cls):
+ '''Must be a build with --enable-valgrind and --disable-jemalloc.'''
+ defines = cls.config_environment.defines
+ return 'MOZ_VALGRIND' in defines and 'MOZ_MEMORY' not in defines
+
+
+@CommandProvider
+class MachCommands(MachCommandBase):
+ '''
+ Run Valgrind tests.
+ '''
+ def __init__(self, context):
+ MachCommandBase.__init__(self, context)
+
+ @Command('valgrind-test', category='testing',
+ conditions=[conditions.is_firefox, is_valgrind_build],
+ description='Run the Valgrind test job (memory-related errors).')
+ @CommandArgument('--suppressions', default=[], action='append',
+ metavar='FILENAME',
+ help='Specify a suppression file for Valgrind to use. Use '
+ '--suppression multiple times to specify multiple suppression '
+ 'files.')
+ def valgrind_test(self, suppressions):
+ import json
+ import sys
+ import tempfile
+
+ from mozbuild.base import MozbuildObject
+ from mozfile import TemporaryDirectory
+ from mozhttpd import MozHttpd
+ from mozprofile import FirefoxProfile, Preferences
+ from mozprofile.permissions import ServerLocations
+ from mozrunner import FirefoxRunner
+ from mozrunner.utils import findInPath
+ from valgrind.output_handler import OutputHandler
+
+ build_dir = os.path.join(self.topsrcdir, 'build')
+
+ # XXX: currently we just use the PGO inputs for Valgrind runs. This may
+ # change in the future.
+ httpd = MozHttpd(docroot=os.path.join(build_dir, 'pgo'))
+ httpd.start(block=False)
+
+ with TemporaryDirectory() as profilePath:
+ #TODO: refactor this into mozprofile
+ prefpath = os.path.join(self.topsrcdir, 'testing', 'profiles', 'prefs_general.js')
+ prefs = {}
+ prefs.update(Preferences.read_prefs(prefpath))
+ interpolation = { 'server': '%s:%d' % httpd.httpd.server_address,
+ 'OOP': 'false'}
+ prefs = json.loads(json.dumps(prefs) % interpolation)
+ for pref in prefs:
+ prefs[pref] = Preferences.cast(prefs[pref])
+
+ quitter = os.path.join(self.distdir, 'xpi-stage', 'quitter')
+
+ locations = ServerLocations()
+ locations.add_host(host='127.0.0.1',
+ port=httpd.httpd.server_port,
+ options='primary')
+
+ profile = FirefoxProfile(profile=profilePath,
+ preferences=prefs,
+ addons=[quitter],
+ locations=locations)
+
+ firefox_args = [httpd.get_url()]
+
+ env = os.environ.copy()
+ env['G_SLICE'] = 'always-malloc'
+ env['MOZ_CC_RUN_DURING_SHUTDOWN'] = '1'
+ env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
+ env['XPCOM_DEBUG_BREAK'] = 'warn'
+
+ outputHandler = OutputHandler()
+ kp_kwargs = {'processOutputLine': [outputHandler]}
+
+ valgrind = 'valgrind'
+ if not os.path.exists(valgrind):
+ valgrind = findInPath(valgrind)
+
+ valgrind_args = [
+ valgrind,
+ '--smc-check=all-non-file',
+ '--vex-iropt-register-updates=allregs-at-mem-access',
+ '--gen-suppressions=all',
+ '--num-callers=36',
+ '--leak-check=full',
+ '--show-possibly-lost=no',
+ '--track-origins=yes',
+ '--trace-children=yes',
+ ]
+
+ for s in suppressions:
+ valgrind_args.append('--suppressions=' + s)
+
+ supps_dir = os.path.join(build_dir, 'valgrind')
+ supps_file1 = os.path.join(supps_dir, 'cross-architecture.sup')
+ valgrind_args.append('--suppressions=' + supps_file1)
+
+ # MACHTYPE is an odd bash-only environment variable that doesn't
+ # show up in os.environ, so we have to get it another way.
+ machtype = subprocess.check_output(['bash', '-c', 'echo $MACHTYPE']).rstrip()
+ supps_file2 = os.path.join(supps_dir, machtype + '.sup')
+ if os.path.isfile(supps_file2):
+ valgrind_args.append('--suppressions=' + supps_file2)
+
+ exitcode = None
+ timeout = 1100
+ try:
+ runner = FirefoxRunner(profile=profile,
+ binary=self.get_binary_path(),
+ cmdargs=firefox_args,
+ env=env,
+ process_args=kp_kwargs)
+ runner.start(debug_args=valgrind_args)
+ # This timeout is slightly less than the no-output timeout on
+ # TBPL, so we'll timeout here first and give an informative
+ # message.
+ exitcode = runner.wait(timeout=timeout)
+
+ finally:
+ errs = outputHandler.error_count
+ supps = outputHandler.suppression_count
+ if errs != supps:
+ status = 1 # turns the TBPL job orange
+ print('TEST-UNEXPECTED-FAIL | valgrind-test | error parsing: {} errors seen, but {} generated suppressions seen'.format(errs, supps))
+
+ elif errs == 0:
+ status = 0
+ print('TEST-PASS | valgrind-test | valgrind found no errors')
+ else:
+ status = 1 # turns the TBPL job orange
+ # We've already printed details of the errors.
+
+ if exitcode == None:
+ status = 2 # turns the TBPL job red
+ print('TEST-UNEXPECTED-FAIL | valgrind-test | Valgrind timed out (reached {} second limit)'.format(timeout))
+ elif exitcode != 0:
+ status = 2 # turns the TBPL job red
+ print('TEST-UNEXPECTED-FAIL | valgrind-test | non-zero exit code from Valgrind')
+
+ httpd.stop()
+
+ return status
diff --git a/build/valgrind/output_handler.py b/build/valgrind/output_handler.py
new file mode 100644
index 000000000..1d5d34f63
--- /dev/null
+++ b/build/valgrind/output_handler.py
@@ -0,0 +1,105 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import print_function, unicode_literals
+
+import re
+
+class OutputHandler(object):
+ '''
+ A class for handling Valgrind output.
+
+ Valgrind errors look like this:
+
+ ==60741== 40 (24 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 2,746 of 5,235
+ ==60741== at 0x4C26B43: calloc (vg_replace_malloc.c:593)
+ ==60741== by 0x63AEF65: PR_Calloc (prmem.c:443)
+ ==60741== by 0x69F236E: PORT_ZAlloc_Util (secport.c:117)
+ ==60741== by 0x69F1336: SECITEM_AllocItem_Util (secitem.c:28)
+ ==60741== by 0xA04280B: ffi_call_unix64 (in /builds/slave/m-in-l64-valgrind-000000000000/objdir/toolkit/library/libxul.so)
+ ==60741== by 0xA042443: ffi_call (ffi64.c:485)
+
+ For each such error, this class extracts most or all of the first (error
+ kind) line, plus the function name in each of the first few stack entries.
+ With this data it constructs and prints a TEST-UNEXPECTED-FAIL message that
+ TBPL will highlight.
+
+ It buffers these lines from which text is extracted so that the
+ TEST-UNEXPECTED-FAIL message can be printed before the full error.
+
+ Parsing the Valgrind output isn't ideal, and it may break in the future if
+ Valgrind changes the format of the messages, or introduces new error kinds.
+ To protect against this, we also count how many lines containing
+ "<insert_a_suppression_name_here>" are seen. Thanks to the use of
+ --gen-suppressions=yes, exactly one of these lines is present per error. If
+ the count of these lines doesn't match the error count found during
+ parsing, then the parsing has missed one or more errors and we can fail
+ appropriately.
+ '''
+
+ def __init__(self):
+ # The regexps in this list match all of Valgrind's errors. Note that
+ # Valgrind is English-only, so we don't have to worry about
+ # localization.
+ self.re_error = \
+ r'==\d+== (' + \
+ r'(Use of uninitialised value of size \d+)|' + \
+ r'(Conditional jump or move depends on uninitialised value\(s\))|' + \
+ r'(Syscall param .* contains uninitialised byte\(s\))|' + \
+ r'(Syscall param .* points to (unaddressable|uninitialised) byte\(s\))|' + \
+ r'((Unaddressable|Uninitialised) byte\(s\) found during client check request)|' + \
+ r'(Invalid free\(\) / delete / delete\[\] / realloc\(\))|' + \
+ r'(Mismatched free\(\) / delete / delete \[\])|' + \
+ r'(Invalid (read|write) of size \d+)|' + \
+ r'(Jump to the invalid address stated on the next line)|' + \
+ r'(Source and destination overlap in .*)|' + \
+ r'(.* bytes in .* blocks are .* lost)' + \
+ r')'
+ # Match identifer chars, plus ':' for namespaces, and '\?' in order to
+ # match "???" which Valgrind sometimes produces.
+ self.re_stack_entry = r'^==\d+==.*0x[A-Z0-9]+: ([A-Za-z0-9_:\?]+)'
+ self.re_suppression = r' *<insert_a_suppression_name_here>'
+ self.error_count = 0
+ self.suppression_count = 0
+ self.number_of_stack_entries_to_get = 0
+ self.curr_failure_msg = None
+ self.buffered_lines = None
+
+ def __call__(self, line):
+ if self.number_of_stack_entries_to_get == 0:
+ # Look for the start of a Valgrind error.
+ m = re.search(self.re_error, line)
+ if m:
+ self.error_count += 1
+ self.number_of_stack_entries_to_get = 4
+ self.curr_failure_msg = 'TEST-UNEXPECTED-FAIL | valgrind-test | ' + m.group(1) + " at "
+ self.buffered_lines = [line]
+ else:
+ print(line)
+
+ else:
+ # We've recently found a Valgrind error, and are now extracting
+ # details from the first few stack entries.
+ self.buffered_lines.append(line)
+ m = re.match(self.re_stack_entry, line)
+ if m:
+ self.curr_failure_msg += m.group(1)
+ else:
+ self.curr_failure_msg += '?!?'
+
+ self.number_of_stack_entries_to_get -= 1
+ if self.number_of_stack_entries_to_get != 0:
+ self.curr_failure_msg += ' / '
+ else:
+ # We've finished getting the first few stack entries. Print the
+ # failure message and the buffered lines, and then reset state.
+ print('\n' + self.curr_failure_msg + '\n')
+ for b in self.buffered_lines:
+ print(b)
+ self.curr_failure_msg = None
+ self.buffered_lines = None
+
+ if re.match(self.re_suppression, line):
+ self.suppression_count += 1
+
diff --git a/build/valgrind/x86_64-redhat-linux-gnu.sup b/build/valgrind/x86_64-redhat-linux-gnu.sup
index 13e72cee1..17c2ad472 100644
--- a/build/valgrind/x86_64-redhat-linux-gnu.sup
+++ b/build/valgrind/x86_64-redhat-linux-gnu.sup
@@ -50,11 +50,36 @@
...
}
{
- Bug 850134
+ Bug 966673
Memcheck:Leak
- fun:realloc
- fun:_ZN2js6VectorImLm0ENS_15TempAllocPolicyEE13growStorageByEm
- fun:_ZN2js8SCOutput5writeEm
- fun:_ZN2js8SCOutput9writePairEjj
+ fun:malloc
+ obj:/lib64/libresolv-2.12.so
+ ...
+ fun:gaih_inet
+ fun:getaddrinfo
+ fun:PR_GetAddrInfoByName
+ ...
+}
+{
+ Bug 979242
+ Memcheck:Leak
+ fun:calloc
+ fun:xcb_connect_to_fd
+ fun:xcb_connect_to_display_with_auth_info
+ fun:_XConnectXCB
+ fun:XOpenDisplay
+ fun:gdk_display_open
+ ...
+}
+
+###################################
+# Leaks in short lived precesses #
+###################################
+
+{
+ Bug 984196
+ Memcheck:Leak
+ ...
+ fun:glxtest
...
}
diff --git a/build/virtualenv/populate_virtualenv.py b/build/virtualenv/populate_virtualenv.py
deleted file mode 100644
index b03205234..000000000
--- a/build/virtualenv/populate_virtualenv.py
+++ /dev/null
@@ -1,385 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# This file contains code for populating the virtualenv environment for
-# Mozilla's build system. It is typically called as part of configure.
-
-from __future__ import print_function, unicode_literals, with_statement
-
-import distutils.sysconfig
-import os
-import shutil
-import subprocess
-import sys
-
-
-# Minimum version of Python required to build.
-MINIMUM_PYTHON_MAJOR = 2
-MINIMUM_PYTHON_MINOR = 7
-
-
-class VirtualenvManager(object):
- """Contains logic for managing virtualenvs for building the tree."""
-
- def __init__(self, topsrcdir, topobjdir, virtualenv_path, log_handle,
- manifest_path):
- """Create a new manager.
-
- Each manager is associated with a source directory, a path where you
- want the virtualenv to be created, and a handle to write output to.
- """
- assert os.path.isabs(manifest_path), "manifest_path must be an absolute path: %s" % (manifest_path)
- self.topsrcdir = topsrcdir
- self.topobjdir = topobjdir
- self.virtualenv_root = virtualenv_path
- self.log_handle = log_handle
- self.manifest_path = manifest_path
-
- @property
- def virtualenv_script_path(self):
- """Path to virtualenv's own populator script."""
- return os.path.join(self.topsrcdir, 'python', 'virtualenv',
- 'virtualenv.py')
-
- @property
- def python_path(self):
- if sys.platform in ('win32', 'cygwin'):
- return os.path.join(self.virtualenv_root, 'Scripts', 'python.exe')
-
- return os.path.join(self.virtualenv_root, 'bin', 'python')
-
- @property
- def activate_path(self):
- if sys.platform in ('win32', 'cygwin'):
- return os.path.join(self.virtualenv_root, 'Scripts',
- 'activate_this.py')
-
- return os.path.join(self.virtualenv_root, 'bin', 'activate_this.py')
-
- def up_to_date(self):
- """Returns whether the virtualenv is present and up to date."""
-
- deps = [self.manifest_path, __file__]
-
- # check if virtualenv exists
- if not os.path.exists(self.virtualenv_root) or \
- not os.path.exists(self.activate_path):
-
- return False
-
- # check modification times
- activate_mtime = os.path.getmtime(self.activate_path)
- dep_mtime = max(os.path.getmtime(p) for p in deps)
- if dep_mtime > activate_mtime:
- return False
-
- # recursively check sub packages.txt files
- submanifests = [i[1] for i in self.packages()
- if i[0] == 'packages.txt']
- for submanifest in submanifests:
- submanifest = os.path.join(self.topsrcdir, submanifest)
- submanager = VirtualenvManager(self.topsrcdir,
- self.topobjdir,
- self.virtualenv_root,
- self.log_handle,
- submanifest)
- if not submanager.up_to_date():
- return False
-
- return True
-
- def ensure(self):
- """Ensure the virtualenv is present and up to date.
-
- If the virtualenv is up to date, this does nothing. Otherwise, it
- creates and populates the virtualenv as necessary.
-
- This should be the main API used from this class as it is the
- highest-level.
- """
- if self.up_to_date():
- return self.virtualenv_root
- return self.build()
-
- def create(self):
- """Create a new, empty virtualenv.
-
- Receives the path to virtualenv's virtualenv.py script (which will be
- called out to), the path to create the virtualenv in, and a handle to
- write output to.
- """
- env = dict(os.environ)
- env.pop('PYTHONDONTWRITEBYTECODE', None)
-
- args = [sys.executable, self.virtualenv_script_path,
- '--system-site-packages', self.virtualenv_root]
-
- result = subprocess.call(args, stdout=self.log_handle,
- stderr=subprocess.STDOUT, env=env)
-
- if result:
- raise Exception('Error creating virtualenv.')
-
- return self.virtualenv_root
-
- def packages(self):
- with file(self.manifest_path, 'rU') as fh:
- packages = [line.rstrip().split(':')
- for line in fh]
- return packages
-
- def populate(self):
- """Populate the virtualenv.
-
- The manifest file consists of colon-delimited fields. The first field
- specifies the action. The remaining fields are arguments to that
- action. The following actions are supported:
-
- setup.py -- Invoke setup.py for a package. Expects the arguments:
- 1. relative path directory containing setup.py.
- 2. argument(s) to setup.py. e.g. "develop". Each program argument
- is delimited by a colon. Arguments with colons are not yet
- supported.
-
- filename.pth -- Adds the path given as argument to filename.pth under
- the virtualenv site packages directory.
-
- optional -- This denotes the action as optional. The requested action
- is attempted. If it fails, we issue a warning and go on. The
- initial "optional" field is stripped then the remaining line is
- processed like normal. e.g.
- "optional:setup.py:python/foo:built_ext:-i"
-
- copy -- Copies the given file in the virtualenv site packages
- directory.
-
- packages.txt -- Denotes that the specified path is a child manifest. It
- will be read and processed as if its contents were concatenated
- into the manifest being read.
-
- objdir -- Denotes a relative path in the object directory to add to the
- search path. e.g. "objdir:build" will add $topobjdir/build to the
- search path.
-
- Note that the Python interpreter running this function should be the
- one from the virtualenv. If it is the system Python or if the
- environment is not configured properly, packages could be installed
- into the wrong place. This is how virtualenv's work.
- """
-
- packages = self.packages()
-
- def handle_package(package):
- python_lib = distutils.sysconfig.get_python_lib()
- if package[0] == 'setup.py':
- assert len(package) >= 2
-
- self.call_setup(os.path.join(self.topsrcdir, package[1]),
- package[2:])
-
- return True
-
- if package[0] == 'copy':
- assert len(package) == 2
-
- src = os.path.join(self.topsrcdir, package[1])
- dst = os.path.join(python_lib, os.path.basename(package[1]))
-
- shutil.copy(src, dst)
-
- return True
-
- if package[0] == 'packages.txt':
- assert len(package) == 2
-
- src = os.path.join(self.topsrcdir, package[1])
- assert os.path.isfile(src), "'%s' does not exist" % src
- submanager = VirtualenvManager(self.topsrcdir,
- self.topobjdir,
- self.virtualenv_root,
- self.log_handle,
- src)
- submanager.populate()
-
- return True
-
- if package[0].endswith('.pth'):
- assert len(package) == 2
-
- path = os.path.join(self.topsrcdir, package[1])
-
- with open(os.path.join(python_lib, package[0]), 'a') as f:
- # This path is relative to the .pth file. Using a
- # relative path allows the srcdir/objdir combination
- # to be moved around (as long as the paths relative to
- # each other remain the same).
- f.write("%s\n" % os.path.relpath(path, python_lib))
-
- return True
-
- if package[0] == 'optional':
- try:
- handle_package(package[1:])
- return True
- except:
- print('Error processing command. Ignoring', \
- 'because optional. (%s)' % ':'.join(package),
- file=self.log_handle)
- return False
-
- if package[0] == 'objdir':
- assert len(package) == 2
- path = os.path.join(self.topobjdir, package[1])
-
- with open(os.path.join(python_lib, 'objdir.pth'), 'a') as f:
- f.write('%s\n' % path)
-
- return True
-
- raise Exception('Unknown action: %s' % package[0])
-
- # We always target the OS X deployment target that Python itself was
- # built with, regardless of what's in the current environment. If we
- # don't do # this, we may run into a Python bug. See
- # http://bugs.python.org/issue9516 and bug 659881.
- #
- # Note that this assumes that nothing compiled in the virtualenv is
- # shipped as part of a distribution. If we do ship anything, the
- # deployment target here may be different from what's targeted by the
- # shipping binaries and # virtualenv-produced binaries may fail to
- # work.
- #
- # We also ignore environment variables that may have been altered by
- # configure or a mozconfig activated in the current shell. We trust
- # Python is smart enough to find a proper compiler and to use the
- # proper compiler flags. If it isn't your Python is likely broken.
- IGNORE_ENV_VARIABLES = ('CC', 'CXX', 'CFLAGS', 'CXXFLAGS', 'LDFLAGS',
- 'PYTHONDONTWRITEBYTECODE')
-
- try:
- old_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
- sysconfig_target = \
- distutils.sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
-
- if sysconfig_target is not None:
- os.environ['MACOSX_DEPLOYMENT_TARGET'] = sysconfig_target
-
- old_env_variables = {}
- for k in IGNORE_ENV_VARIABLES:
- if k not in os.environ:
- continue
-
- old_env_variables[k] = os.environ[k]
- del os.environ[k]
-
- for package in packages:
- handle_package(package)
- finally:
- os.environ.pop('MACOSX_DEPLOYMENT_TARGET', None)
-
- if old_target is not None:
- os.environ['MACOSX_DEPLOYMENT_TARGET'] = old_target
-
- os.environ.update(old_env_variables)
-
- def call_setup(self, directory, arguments):
- """Calls setup.py in a directory."""
- setup = os.path.join(directory, 'setup.py')
-
- program = [sys.executable, setup]
- program.extend(arguments)
-
- # We probably could call the contents of this file inside the context
- # of this interpreter using execfile() or similar. However, if global
- # variables like sys.path are adjusted, this could cause all kinds of
- # havoc. While this may work, invoking a new process is safer.
-
- try:
- output = subprocess.check_output(program, cwd=directory, stderr=subprocess.STDOUT)
- print(output)
- except subprocess.CalledProcessError as e:
- if 'Python.h: No such file or directory' in e.output:
- print('WARNING: Python.h not found. Install Python development headers.')
- else:
- print(e.output)
-
- raise Exception('Error installing package: %s' % directory)
-
- def build(self):
- """Build a virtualenv per tree conventions.
-
- This returns the path of the created virtualenv.
- """
-
- self.create()
-
- # We need to populate the virtualenv using the Python executable in
- # the virtualenv for paths to be proper.
-
- args = [self.python_path, __file__, 'populate', self.topsrcdir,
- self.topobjdir, self.virtualenv_root]
-
- result = subprocess.call(args, stdout=self.log_handle,
- stderr=subprocess.STDOUT, cwd=self.topsrcdir)
-
- if result != 0:
- raise Exception('Error populating virtualenv.')
-
- os.utime(self.activate_path, None)
-
- return self.virtualenv_root
-
- def activate(self):
- """Activate the virtualenv in this Python context.
-
- If you run a random Python script and wish to "activate" the
- virtualenv, you can simply instantiate an instance of this class
- and call .ensure() and .activate() to make the virtualenv active.
- """
-
- execfile(self.activate_path, dict(__file__=self.activate_path))
-
-
-def verify_python_version(log_handle):
- """Ensure the current version of Python is sufficient."""
- major, minor = sys.version_info[:2]
-
- if major != MINIMUM_PYTHON_MAJOR or minor < MINIMUM_PYTHON_MINOR:
- log_handle.write('Python %d.%d or greater (but not Python 3) is '
- 'required to build. ' %
- (MINIMUM_PYTHON_MAJOR, MINIMUM_PYTHON_MINOR))
- log_handle.write('You are running Python %d.%d.\n' % (major, minor))
- sys.exit(1)
-
-
-if __name__ == '__main__':
- if len(sys.argv) < 4:
- print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/topobjdir /path/to/virtualenv')
- sys.exit(1)
-
- verify_python_version(sys.stdout)
-
- topsrcdir = sys.argv[1]
- topobjdir = sys.argv[2]
- virtualenv_path = sys.argv[3]
- populate = False
-
- # This should only be called internally.
- if sys.argv[1] == 'populate':
- populate = True
- topsrcdir = sys.argv[2]
- topobjdir = sys.argv[3]
- virtualenv_path = sys.argv[4]
-
- # path to default packages.txt
- manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
-
- manager = VirtualenvManager(topsrcdir, topobjdir, virtualenv_path,
- sys.stdout, manifest_path)
-
- if populate:
- manager.populate()
- else:
- manager.ensure()
-
diff --git a/build/virtualenv/packages.txt b/build/virtualenv_packages.txt
index 0768a25ae..523c5ba9d 100644
--- a/build/virtualenv/packages.txt
+++ b/build/virtualenv_packages.txt
@@ -1,6 +1,9 @@
-simplejson.pth:python/simplejson-2.1.1
+marionette_transport.pth:testing/marionette/transport
+marionette_driver.pth:testing/marionette/driver
marionette.pth:testing/marionette/client
blessings.pth:python/blessings
+configobj.pth:python/configobj
+jsmin.pth:python/jsmin
mach.pth:python/mach
mozbuild.pth:python/mozbuild
pymake.pth:build/pymake
@@ -8,11 +11,19 @@ optional:setup.py:python/psutil:build_ext:--inplace
optional:psutil.pth:python/psutil
which.pth:python/which
ply.pth:other-licenses/ply/
-codegen.pth:python/codegen/
mock.pth:python/mock-1.0.0
mozilla.pth:build
mozilla.pth:config
mozilla.pth:xpcom/typelib/xpt/tools
+mozilla.pth:dom/bindings
+mozilla.pth:dom/bindings/parser
+mozilla.pth:layout/tools/reftest
+moztreedocs.pth:tools/docs
copy:build/buildconfig.py
packages.txt:testing/mozbase/packages.txt
objdir:build
+gyp.pth:media/webrtc/trunk/tools/gyp/pylib
+pyasn1.pth:python/pyasn1
+bitstring.pth:python/bitstring
+redo.pth:python/redo
+requests.pth:python/requests
diff --git a/build/win32/Makefile.in b/build/win32/Makefile.in
index c6a7dc45e..3e61d725c 100644
--- a/build/win32/Makefile.in
+++ b/build/win32/Makefile.in
@@ -2,75 +2,26 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-NO_PROFILE_GUIDED_OPTIMIZE = 1
-
-ifdef ENABLE_TESTS
-
-USE_STATIC_LIBS = 1
-
-endif # ENABLE_TESTS
-
-MOZ_GLUE_LDFLAGS =
-
include $(topsrcdir)/config/rules.mk
ifdef WIN32_REDIST_DIR
-ifndef MOZ_DEBUG
-ifeq (1400,$(_MSC_VER))
REDIST_FILES = \
- Microsoft.VC80.CRT.manifest \
- msvcm80.dll \
- msvcp80.dll \
- msvcr80.dll \
+ $(MSVC_C_RUNTIME_DLL) \
+ $(MSVC_CXX_RUNTIME_DLL) \
+ $(MSVC_APPCRT_DLL) \
+ $(MSVC_DESKTOPCRT_DLL) \
$(NULL)
-endif
-ifeq (1500,$(_MSC_VER))
-REDIST_FILES = \
- Microsoft.VC90.CRT.manifest \
- msvcm90.dll \
- msvcp90.dll \
- msvcr90.dll \
- $(NULL)
-endif
-
-ifeq (1600,$(_MSC_VER))
-REDIST_FILES = \
- msvcp100.dll \
- msvcr100.dll \
- $(NULL)
-endif
-
-ifeq (1700,$(_MSC_VER))
-REDIST_FILES = \
- msvcp110.dll \
- msvcr110.dll \
- $(NULL)
-endif
-
-ifdef REDIST_FILES
libs-preqs = \
$(call mkdir_deps,$(FINAL_TARGET)) \
$(NULL)
libs:: $(libs-preqs)
- install --preserve-timestamps $(foreach f,$(REDIST_FILES),"$(WIN32_REDIST_DIR)"/$(f)) $(FINAL_TARGET)
-endif
+ install --preserve-timestamps $(foreach f,$(REDIST_FILES),'$(WIN32_REDIST_DIR)'/$(f)) $(FINAL_TARGET)
-endif # ! MOZ_DEBUG
endif # WIN32_REDIST_DIR
# run the binscope tool to make sure the binary and all libraries
# are using all available Windows OS-level security mechanisms
check::
- $(PYTHON) $(srcdir)/autobinscope.py $(DIST)/bin/$(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/crashreporter-symbols/
- $(PYTHON) $(srcdir)/autobinscope.py $(DIST)/bin/plugin-container.exe $(DIST)/crashreporter-symbols/
-
diff --git a/build/win32/autobinscope.py b/build/win32/autobinscope.py
index 4899e731a..8bb455990 100755
--- a/build/win32/autobinscope.py
+++ b/build/win32/autobinscope.py
@@ -46,8 +46,7 @@ except KeyError:
try:
proc = subprocess.Popen([binscope_path, "/target", binary_path,
"/output", log_file_path, "/sympath", symbol_path,
- "/c", "ATLVersionCheck", "/c", "ATLVulnCheck", "/c", "FunctionPointersCheck",
- "/c", "SharedSectionCheck", "/c", "APTCACheck", "/c", "NXCheck",
+ "/c", "ATLVersionCheck", "/c", "ATLVulnCheck", "/c", "SharedSectionCheck", "/c", "APTCACheck", "/c", "NXCheck",
"/c", "GSCheck", "/c", "GSFunctionSafeBuffersCheck", "/c", "GSFriendlyInitCheck",
"/c", "CompilerVersionCheck", "/c", "SafeSEHCheck", "/c", "SNCheck",
"/c", "DBCheck"], stdout=subprocess.PIPE)
diff --git a/build/win32/crashinject.cpp b/build/win32/crashinject.cpp
index 200d7d80f..472e15a12 100644
--- a/build/win32/crashinject.cpp
+++ b/build/win32/crashinject.cpp
@@ -27,11 +27,12 @@ int main(int argc, char** argv)
// find our DLL to inject
wchar_t filename[_MAX_PATH];
- if (GetModuleFileNameW(NULL, filename, sizeof(filename) / sizeof(wchar_t)) == 0)
+ if (GetModuleFileNameW(nullptr, filename,
+ sizeof(filename) / sizeof(wchar_t)) == 0)
return 1;
wchar_t* slash = wcsrchr(filename, L'\\');
- if (slash == NULL)
+ if (slash == nullptr)
return 1;
slash++;
@@ -41,7 +42,7 @@ int main(int argc, char** argv)
HANDLE targetProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,
FALSE,
pid);
- if (targetProc == NULL) {
+ if (targetProc == nullptr) {
fprintf(stderr, "Error %d opening target process\n", GetLastError());
return 1;
}
@@ -58,16 +59,16 @@ int main(int argc, char** argv)
*/
HMODULE hKernel32 = GetModuleHandleW(L"Kernel32");
// allocate some memory to hold the path in the remote process
- void* pLibRemote = VirtualAllocEx(targetProc, NULL, sizeof(filename),
+ void* pLibRemote = VirtualAllocEx(targetProc, nullptr, sizeof(filename),
MEM_COMMIT, PAGE_READWRITE);
- if (pLibRemote == NULL) {
+ if (pLibRemote == nullptr) {
fprintf(stderr, "Error %d in VirtualAllocEx\n", GetLastError());
CloseHandle(targetProc);
return 1;
}
if (!WriteProcessMemory(targetProc, pLibRemote, (void*)filename,
- sizeof(filename), NULL)) {
+ sizeof(filename), nullptr)) {
fprintf(stderr, "Error %d in WriteProcessMemory\n", GetLastError());
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
@@ -75,11 +76,11 @@ int main(int argc, char** argv)
}
// Now create a thread in the target process that will load our DLL
HANDLE hThread = CreateRemoteThread(
- targetProc, NULL, 0,
+ targetProc, nullptr, 0,
(LPTHREAD_START_ROUTINE)GetProcAddress(hKernel32,
"LoadLibraryW"),
- pLibRemote, 0, NULL);
- if (hThread == NULL) {
+ pLibRemote, 0, nullptr);
+ if (hThread == nullptr) {
fprintf(stderr, "Error %d in CreateRemoteThread\n", GetLastError());
VirtualFreeEx(targetProc, pLibRemote, sizeof(filename), MEM_RELEASE);
CloseHandle(targetProc);
diff --git a/build/win32/crashinjectdll/crashinjectdll.cpp b/build/win32/crashinjectdll/crashinjectdll.cpp
index 0d69a72d1..09ab9fdba 100644
--- a/build/win32/crashinjectdll/crashinjectdll.cpp
+++ b/build/win32/crashinjectdll/crashinjectdll.cpp
@@ -28,10 +28,10 @@ BOOL WINAPI DllMain(
// we have to crash on another thread because LoadLibrary() will
// catch memory access errors and return failure to the calling process
CreateThread(
- NULL, // default security attributes
+ nullptr, // default security attributes
0, // use default stack size
- CrashingThread , // thread function name
- NULL, // argument to thread function
+ CrashingThread, // thread function name
+ nullptr, // argument to thread function
0, // use default creation flags
&tid); // returns the thread identifier
return TRUE;
diff --git a/build/win32/crashinjectdll/moz.build b/build/win32/crashinjectdll/moz.build
index de3bb42f7..6670f6a43 100644
--- a/build/win32/crashinjectdll/moz.build
+++ b/build/win32/crashinjectdll/moz.build
@@ -4,9 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-CPP_SOURCES += [
+SOURCES += [
'crashinjectdll.cpp',
]
-LIBRARY_NAME = 'crashinjectdll'
+SharedLibrary('crashinjectdll')
+DEFFILE = SRCDIR + '/crashinjectdll.def'
+
+USE_STATIC_LIBS = True
diff --git a/build/win32/dumpenv4python.pl b/build/win32/dumpenv4python.pl
new file mode 100644
index 000000000..34a1135a1
--- /dev/null
+++ b/build/win32/dumpenv4python.pl
@@ -0,0 +1,19 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# See build/autoconf/hooks.m4
+
+use Data::Dumper;
+
+$Data::Dumper::Terse = 1;
+$Data::Dumper::Indent = 0;
+
+# We can't use perl hashes because Mozilla-Build's perl is 5.6, and perl
+# 5.6's Data::Dumper doesn't have Pair to change ' => ' into ' : '.
+@data = (
+ ['env', [map { [$_, $ENV{$_}] } keys %ENV]],
+ ['args', \@ARGV],
+);
+
+print Dumper \@data;
diff --git a/build/win32/moz.build b/build/win32/moz.build
index c02c976ea..0d14f247d 100644
--- a/build/win32/moz.build
+++ b/build/win32/moz.build
@@ -10,7 +10,10 @@ if CONFIG['_MSC_VER'] and CONFIG['OS_TEST'] != 'x86_64':
TEST_DIRS += ['crashinjectdll']
if CONFIG['ENABLE_TESTS']:
- PROGRAM = 'crashinject'
- CPP_SOURCES += [
+ Program('crashinject')
+ SOURCES += [
'crashinject.cpp',
]
+ USE_STATIC_LIBS = True
+
+NO_PGO = True
diff --git a/build/win32/mozconfig.vs2010 b/build/win32/mozconfig.vs2010
index ac644796c..5120f5d0b 100644
--- a/build/win32/mozconfig.vs2010
+++ b/build/win32/mozconfig.vs2010
@@ -4,7 +4,7 @@ export LIB=/d/msvs10/vc/lib:/d/msvs10/vc/atlmfc/lib:/d/sdks/v7.0/lib:/d/msvs8/VC
export PATH="/d/msvs10/VSTSDB/Deploy:/d/msvs10/Common7/IDE/:/d/msvs10/VC/BIN:/d/msvs10/Common7/Tools:/d/msvs10/VC/VCPackages:${PATH}"
export WIN32_REDIST_DIR=/d/msvs10/VC/redist/x86/Microsoft.VC100.CRT
-. $topsrcdir/build/mozconfig.vs2010-common
+. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH
diff --git a/build/win32/mozconfig.vs2010-win64 b/build/win32/mozconfig.vs2010-win64
index ba61c2429..8a7fc211a 100644
--- a/build/win32/mozconfig.vs2010-win64
+++ b/build/win32/mozconfig.vs2010-win64
@@ -22,7 +22,10 @@ export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPAT
## paths: win8 sdk x86 (32-bit) tools, msvc 10 (32-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}"
-. $topsrcdir/build/mozconfig.vs2010-common
+## WindowsSDKDir ##
+export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
+
+. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH
diff --git a/build/win32/mozconfig.vs2013-win64 b/build/win32/mozconfig.vs2013-win64
new file mode 100644
index 000000000..0adf6cc05
--- /dev/null
+++ b/build/win32/mozconfig.vs2013-win64
@@ -0,0 +1,28 @@
+_VSPATH="/c/tools/vs2013"
+export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x86/Microsoft.VC120.CRT
+
+## moz tools location for 64-bit builders ##
+export MOZ_TOOLS=C:/mozilla-build/moztools
+
+## includes: win8.1 sdk includes, winrt headers for metro, msvc std library, directx sdk for d3d9 ##
+export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
+
+## libs: win8.1 sdk x86 (32-bit) libs, msvc (32-bit) std library, msvc atl libs, directx sdk (32-bit) for d3d9 ##
+export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/Lib/winv6.3/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
+export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/Lib/winv6.3/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
+
+## paths: win8.1 sdk x86 (32-bit) tools, msvc (64-bit compiling 32-bit) build toolchain, moz tools ##
+export PATH="/c/Program Files (x86)/Windows Kits/8.1/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64_x86:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}"
+
+## WindowsSDKDir ##
+export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.1/"
+
+. $topsrcdir/build/mozconfig.vs-common
+
+mk_export_correct_style LIB
+mk_export_correct_style LIBPATH
+mk_export_correct_style PATH
+mk_export_correct_style INCLUDE
+mk_export_correct_style WIN32_REDIST_DIR
+
+mk_add_options "export MOZ_TOOLS=$MOZ_TOOLS"
diff --git a/build/win32/procmem.py b/build/win32/procmem.py
index f9383802e..8376d07ea 100644
--- a/build/win32/procmem.py
+++ b/build/win32/procmem.py
@@ -1,48 +1,48 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import os, sys, ctypes, ctypes.wintypes
-
-class VM_COUNTERS(ctypes.Structure):
- _fields_ = [("PeakVirtualSize", ctypes.wintypes.ULONG),
- ("VirtualSize", ctypes.wintypes.ULONG),
- ("PageFaultCount", ctypes.wintypes.ULONG),
- ("PeakWorkingSetSize", ctypes.wintypes.ULONG),
- ("WorkingSetSize", ctypes.wintypes.ULONG),
- ("QuotaPeakPagedPoolUsage", ctypes.wintypes.ULONG),
- ("QuotaPagedPoolUsage", ctypes.wintypes.ULONG),
- ("QuotaPeakNonPagedPoolUsage", ctypes.wintypes.ULONG),
- ("QuotaNonPagedPoolUsage", ctypes.wintypes.ULONG),
- ("PagefileUsage", ctypes.wintypes.ULONG),
- ("PeakPagefileUsage", ctypes.wintypes.ULONG)
- ]
-
-def get_vmsize(handle):
- """
- Return (peak_virtual_size, virtual_size) for the process |handle|.
- """
- ProcessVmCounters = 3
- vmc = VM_COUNTERS()
- if ctypes.windll.ntdll.NtQueryInformationProcess(int(handle),
- ProcessVmCounters,
- ctypes.byref(vmc),
- ctypes.sizeof(vmc),
- None) == 0:
- return (vmc.PeakVirtualSize, vmc.VirtualSize)
-
- return (-1, -1)
-
-if __name__ == '__main__':
- PROCESS_QUERY_INFORMATION = 0x0400
- for pid in sys.argv[1:]:
- handle = ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_INFORMATION,
- 0, # no inherit
- int(pid))
- if handle:
- print "Process %s:" % pid
- vsize, peak_vsize = get_vmsize(handle)
- print "peak vsize: %d" % peak_vsize
- ctypes.windll.kernel32.CloseHandle(handle)
- else:
- print "Couldn't open process %s" % pid
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os, sys, ctypes, ctypes.wintypes
+
+class VM_COUNTERS(ctypes.Structure):
+ _fields_ = [("PeakVirtualSize", ctypes.wintypes.ULONG),
+ ("VirtualSize", ctypes.wintypes.ULONG),
+ ("PageFaultCount", ctypes.wintypes.ULONG),
+ ("PeakWorkingSetSize", ctypes.wintypes.ULONG),
+ ("WorkingSetSize", ctypes.wintypes.ULONG),
+ ("QuotaPeakPagedPoolUsage", ctypes.wintypes.ULONG),
+ ("QuotaPagedPoolUsage", ctypes.wintypes.ULONG),
+ ("QuotaPeakNonPagedPoolUsage", ctypes.wintypes.ULONG),
+ ("QuotaNonPagedPoolUsage", ctypes.wintypes.ULONG),
+ ("PagefileUsage", ctypes.wintypes.ULONG),
+ ("PeakPagefileUsage", ctypes.wintypes.ULONG)
+ ]
+
+def get_vmsize(handle):
+ """
+ Return (peak_virtual_size, virtual_size) for the process |handle|.
+ """
+ ProcessVmCounters = 3
+ vmc = VM_COUNTERS()
+ if ctypes.windll.ntdll.NtQueryInformationProcess(int(handle),
+ ProcessVmCounters,
+ ctypes.byref(vmc),
+ ctypes.sizeof(vmc),
+ None) == 0:
+ return (vmc.PeakVirtualSize, vmc.VirtualSize)
+
+ return (-1, -1)
+
+if __name__ == '__main__':
+ PROCESS_QUERY_INFORMATION = 0x0400
+ for pid in sys.argv[1:]:
+ handle = ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_INFORMATION,
+ 0, # no inherit
+ int(pid))
+ if handle:
+ print "Process %s:" % pid
+ vsize, peak_vsize = get_vmsize(handle)
+ print "peak vsize: %d" % peak_vsize
+ ctypes.windll.kernel32.CloseHandle(handle)
+ else:
+ print "Couldn't open process %s" % pid
diff --git a/build/win32/vmwarerecordinghelper/Makefile.in b/build/win32/vmwarerecordinghelper/Makefile.in
deleted file mode 100644
index 2a601343e..000000000
--- a/build/win32/vmwarerecordinghelper/Makefile.in
+++ /dev/null
@@ -1,19 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-DEFFILE = $(srcdir)/$(LIBRARY_NAME).def
-
-FORCE_SHARED_LIB = 1
-USE_STATIC_LIBS = 1
-
-MOZ_GLUE_LDFLAGS =
-
-include $(topsrcdir)/config/rules.mk
diff --git a/build/win32/vmwarerecordinghelper/moz.build b/build/win32/vmwarerecordinghelper/moz.build
index 64c273474..61e40fe8b 100644
--- a/build/win32/vmwarerecordinghelper/moz.build
+++ b/build/win32/vmwarerecordinghelper/moz.build
@@ -4,9 +4,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-CPP_SOURCES += [
+SOURCES += [
'vmwarerecordinghelper.cpp',
]
-LIBRARY_NAME = 'vmwarerecordinghelper'
+SharedLibrary('vmwarerecordinghelper')
+DEFFILE = '%s/%s.def' % (SRCDIR, LIBRARY_NAME)
+
+USE_STATIC_LIBS = True
diff --git a/build/win64/mozconfig.vs2010 b/build/win64/mozconfig.vs2010
index c9d925169..6862fdb63 100644
--- a/build/win64/mozconfig.vs2010
+++ b/build/win64/mozconfig.vs2010
@@ -19,6 +19,9 @@ export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPAT
## paths: win8 sdk x64 (64-bit) tools, msvc 10 (64-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}"
+## WindowsSDKDir ##
+export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
+
# Use 32bit linker for PGO crash bug.
# https://connect.microsoft.com/VisualStudio/feedback/details/686117/
if [ -f /c/PROGRA~2/MICROS~2.0/VC/BIN/x86_amd64/link.exe ]; then
@@ -28,7 +31,7 @@ else
export LD=c:/tools/msvs10/VC/BIN/x86_amd64/link.exe
fi
-. $topsrcdir/build/mozconfig.vs2010-common
+. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH
diff --git a/build/win64/mozconfig.vs2013 b/build/win64/mozconfig.vs2013
new file mode 100644
index 000000000..52fa311b0
--- /dev/null
+++ b/build/win64/mozconfig.vs2013
@@ -0,0 +1,23 @@
+_VSPATH="/c/tools/vs2013"
+export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x64/Microsoft.VC120.CRT
+
+## includes: win8.1 sdk includes, winrt headers for metro, msvc std library, directx sdk for d3d9 ##
+export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
+
+## libs: win8.1 sdk x64 (64-bit) libs, msvc (64-bit) std library, msvc atl libs, directx sdk (64-bit) for d3d9 ##
+export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/Lib/winv6.3/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
+export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.1/Lib/winv6.3/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
+
+## paths: win8.1 sdk x64 (64-bit) tools, msvc (64-bit) build toolchain, moz tools ##
+export PATH="/c/Program Files (x86)/Windows Kits/8.1/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}"
+
+## WindowsSDKDir ##
+export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.1/"
+
+. $topsrcdir/build/mozconfig.vs-common
+
+mk_export_correct_style LIB
+mk_export_correct_style LIBPATH
+mk_export_correct_style PATH
+mk_export_correct_style INCLUDE
+mk_export_correct_style WIN32_REDIST_DIR
diff --git a/build/xpccheck.py b/build/xpccheck.py
deleted file mode 100644
index 718343982..000000000
--- a/build/xpccheck.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-'''A generic script to verify all test files are in the
-corresponding .ini file.
-
-Usage: xpccheck.py <directory> [<directory> ...]
-'''
-
-import sys
-import os
-from glob import glob
-import manifestparser
-
-def getIniTests(testdir):
- mp = manifestparser.ManifestParser(strict=False)
- mp.read(os.path.join(testdir, 'xpcshell.ini'))
- return mp.tests
-
-def verifyDirectory(initests, directory):
- files = glob(os.path.join(os.path.abspath(directory), "test_*"))
- for f in files:
- if (not os.path.isfile(f)):
- continue
-
- name = os.path.basename(f)
- if name.endswith('.in'):
- name = name[:-3]
-
- if not name.endswith('.js'):
- continue
-
- found = False
- for test in initests:
- if os.path.join(os.path.abspath(directory), name) == test['path']:
- found = True
- break
-
- if not found:
- print >>sys.stderr, "TEST-UNEXPECTED-FAIL | xpccheck | test %s is missing from test manifest %s!" % (name, os.path.join(directory, 'xpcshell.ini'))
- sys.exit(1)
-
-def verifyIniFile(initests, directory):
- files = glob(os.path.join(os.path.abspath(directory), "test_*"))
- for test in initests:
- name = test['path'].split('/')[-1]
-
- found = False
- for f in files:
-
- fname = f.split('/')[-1]
- if fname.endswith('.in'):
- fname = '.in'.join(fname.split('.in')[:-1])
-
- if os.path.join(os.path.abspath(directory), fname) == test['path']:
- found = True
- break
-
- if not found:
- print >>sys.stderr, "TEST-UNEXPECTED-FAIL | xpccheck | found %s in xpcshell.ini and not in directory '%s'" % (name, directory)
- sys.exit(1)
-
-if __name__ == '__main__':
- if len(sys.argv) < 3:
- print >>sys.stderr, "Usage: xpccheck.py <topsrcdir> <directory> [<directory> ...]"
- sys.exit(1)
-
- topsrcdir = sys.argv[1]
- for d in sys.argv[2:]:
- # xpcshell-unpack is a copy of xpcshell sibling directory and in the Makefile
- # we copy all files (including xpcshell.ini from the sibling directory.
- if d.endswith('toolkit/mozapps/extensions/test/xpcshell-unpack'):
- continue
-
- initests = getIniTests(d)
- verifyDirectory(initests, d)
- verifyIniFile(initests, d)