Scrub double-conversion and add quick wrapper

This commit is contained in:
Justine Tunney 2022-06-26 04:58:44 -07:00
parent b1de862e16
commit 5cd0e876bd
46 changed files with 322 additions and 804 deletions

View file

@ -1277,6 +1277,12 @@ void __sanitizer_annotate_contiguous_container(char *beg, char *end,
__asan_poison(new_mid, end - new_mid, kAsanHeapOverrun);
}
void __asan_before_dynamic_init(const char *module_name) {
}
void __asan_after_dynamic_init(void) {
}
void __asan_install_malloc_hooks(void) {
HOOK(hook_free, __asan_free);
HOOK(hook_malloc, __asan_malloc);

View file

@ -196,18 +196,6 @@ __asan_version_mismatch_check_v8:
pop %rdi
.init.end 303,_init_asan
__asan_before_dynamic_init:
push %rbp
mov %rsp,%rbp
ud2
.endfn __asan_before_dynamic_init,globl
__asan_after_dynamic_init:
push %rbp
mov %rsp,%rbp
ud2
.endfn __asan_after_dynamic_init,globl
__asan_load1:
push %rbp
mov %rsp,%rbp

View file

@ -16,11 +16,14 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/fmt.h"
#include "libc/macros.internal.h"
#include "libc/runtime/fenv.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
#include "third_party/double-conversion/wrapper.h"
#include "third_party/gdtoa/gdtoa.h"
#define HEX(d) (union Pun){d}.i
@ -401,3 +404,14 @@ TEST(strtod, testTowardzero) {
free(p);
}
}
BENCH(strtod, bench) {
char buf[128];
EZBENCH2("strtod", donothing, strtod("-1.79769313486231e+308", 0));
EZBENCH2("StringToDouble", donothing,
StringToDouble("-1.79769313486231e+308", 22, 0));
EZBENCH2("snprintf %g", donothing,
snprintf(buf, 128, "%g", -1.79769313486231e+308));
EZBENCH2("DoubleToEcmascript", donothing,
DoubleToEcmascript(buf, -1.79769313486231e+308));
}

View file

@ -38,7 +38,8 @@ TEST_LIBC_TINYMATH_DIRECTDEPS = \
LIBC_TINYMATH \
LIBC_UNICODE \
LIBC_X \
THIRD_PARTY_GDTOA
THIRD_PARTY_GDTOA \
THIRD_PARTY_DOUBLECONVERSION
TEST_LIBC_TINYMATH_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_TINYMATH_DIRECTDEPS),$($(x))))

View file

@ -1,31 +0,0 @@
.sconsign.dblite
*~
*.o
*.obj
msvc/Release/
msvc/Debug/
*.suo
*.opensdf
*.sdf
*.user
*.a
*.so
*.so.*
*.dylib
/run_tests
Makefile
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
*.cmake
*.kdev4
DartConfiguration.tcl
bazel-*
.cache

View file

@ -1,26 +0,0 @@
Copyright 2006-2011, the V8 project authors. 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.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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.

View file

@ -1,158 +0,0 @@
2022-01-10:
Fix quiet NANs on MIPS* and PA-RISC architectures.
Update version number.
2021-12-22:
Add support of Synopsys ARC64 architecture.
Reintroduce macros, if DOUBLE_CONVERSION_NON_PREFIXED_MACROS is set.
2021-12-04:
Update version number.
2021-10-04:
Consistently use semicolons after DOUBLE_CONVERSION_ASSERT.
2021-07-16:
Fix spelling.
2021-05-19:
Loongarch is a RISC-style command system architecture.
Add support for loongarch architecture.
2020-02-16:
Add support for quiet and signaling NaNs to ieee header.
2019-10-31:
Add support for xtensa architecture.
Add support for nios2 architecture.
2019-10-12:
Really add support for microblaze. A previous commit was lacking
the necessary line.
2019-09-02:
Add support for e2k architecture. Thanks to Michael Shigorin.
2019-08-01:
Add min exponent width option in double-to-string conversion.
2019-06-22:
Remove redundant parenthesis.
2019-06-11:
Changed all macros to use DOUBLE_CONVERSION_ as prefix.
Renamed ALLOW_CASE_INSENSIBILITY to ALLOW_CASE_INSENSITIVITY,
the old name is still available but officially deprecated.
Created and exposed new intermediate function StrtodTrimmed().
2019-05-25:
Fix `0x` for string->double conversion when Hex Floats are allowed.
Avoid integer overflow when exponents for hex floats were too big.
Update version number.
2019-04-22:
Fixed warning in gcc4.9. Thanks to Scott McCaskill
(https://github.com/usefulcat) for the patch.
2019-04-16:
Merged changes to install libraries in the correct place when
using 64-bit libraries.
Contributed by Jason Zaman <jasonzaman@gmail.com> and (independently)
Dan Church (https://github.com/h3xx)
2019-03-11:
Use relative includes in the library. This shouldn't have any visible effect
for consumers of the library.
Update version number.
2019-03-06:
Fix typo in test.
Update version number.
2019-03-03:
Fix separator characters when they they don't fit into 8 bits.
Update version number.
2019-02-16:
Check correctly for _MSC_VER.
Patch by Ben Boeckel
2019-01-17:
Allow the library to be compiled for Emscripten.
Patch by Tim Paine.
2018-09-15:
Update version numbers. This also updates the shared-library version number.
2018-09-09:
Fix bug where large hex literals would lose their minus sign.
Added support for separator characters (which adds a new optional
argument). Thus increasing the version number to 3.1.0
Added support for hexadecimal float literals.
Support for more architectures.
2017-12-06:
Renamed `DISALLOW_COPY_AND_ASSIGN` and `DISALLOW_IMPLICIT_CONSTRUCTORS`
macros to `DC_DISALLOW_COPY_AND_ASSIGN` and
`DC_DISALLOW_IMPLICIT_CONSTRUCTORS` to make it easier to integrate the
library with other libraries that have similar macros.
2017-08-05:
Tagged v3.0.0.
Due to the directory rename switching to a new version number.
The API for the library itself hasn't changed.
2017-03-04:
Avoid negative shift. Fixes #41.
2016-11-17:
Support RISC-V.
2016-09-10:
Add fPIC flag on x86_64 if the compiler supports it. Fixes #34.
2015 and 2016:
Lots of improvements to the build system.
2015:
Warning fixes.
2015-05-19:
Rename 'src' directory to 'double-conversion'.
2014-03-08:
Update version number for cmake.
Support shared libraries with cmake.
Add build instructions to the README.
2014-01-12:
Tagged v2.0.1.
Fix compilation for ARMv8 64bit (used wrong define).
Improved SConstruct file. Thanks to Milan Bouchet-Valat and Elan Ruusamäe.
Fixed lots of warnings (especially on Windows). Thanks to Greg Smith.
2013-11-09:
Tagged v2.0.0.
String-to-Double|Float: ALLOW_LEADING_SPACES and similar flags now include
new-lines, tabs and all Unicode whitespace characters.
2013-11-09:
Tagged v1.1.2.
Add support for ARM 64 and OsX ppc.
Rewrite tests so they pass under Visual Studio.
Add CMake build system support.
Fix warnings.
2012-06-10:
Tagged v1.1.1.
Null terminate exponent buffer (only an issue when asserts are enabled).
Support more architectures.
2012-02-05:
Merged in Single-branch with single-precision support.
Tagged v1.1 (based on b28450f33e1db493948a535d8f84e88fa211bd10).
2012-02-05:
Tagged v1.0 (based on eda0196e9ac8fcdf59e92cb62885ee0af5391969).

View file

@ -1,55 +0,0 @@
https://github.com/google/double-conversion
This project (double-conversion) provides binary-decimal and decimal-binary
routines for IEEE doubles.
The library consists of efficient conversion routines that have been extracted
from the V8 JavaScript engine. The code has been refactored and improved so that
it can be used more easily in other projects.
There is extensive documentation in `double-conversion/string-to-double.h` and
`double-conversion/double-to-string.h`. Other examples can be found in
`test/cctest/test-conversions.cc`.
Building
========
This library can be built with [scons][0] or [cmake][1].
The checked-in Makefile simply forwards to scons, and provides a
shortcut to run all tests:
make
make test
Scons
-----
The easiest way to install this library is to use `scons`. It builds
the static and shared library, and is set up to install those at the
correct locations:
scons install
Use the `DESTDIR` option to change the target directory:
scons DESTDIR=alternative_directory install
Cmake
-----
To use cmake run `cmake .` in the root directory. This overwrites the
existing Makefile.
Use `-DBUILD_SHARED_LIBS=ON` to enable the compilation of shared libraries.
Note that this disables static libraries. There is currently no way to
build both libraries at the same time with cmake.
Use `-DBUILD_TESTING=ON` to build the test executable.
cmake . -DBUILD_TESTING=ON
make
test/cctest/cctest
[0]: http://www.scons.org/
[1]: https://cmake.org/

View file

@ -24,13 +24,16 @@
// 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.
#include "third_party/libcxx/cmath"
#include "third_party/double-conversion/bignum-dtoa.h"
#include "third_party/double-conversion/bignum.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/libcxx/cmath"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_
#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -24,12 +24,16 @@
// 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.
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/cstring"
#include "third_party/double-conversion/bignum.h"
#include "third_party/double-conversion/utils.h"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/cstring"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_BIGNUM_H_
#define DOUBLE_CONVERSION_BIGNUM_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -24,14 +24,17 @@
// 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.
#include "third_party/double-conversion/cached-powers.h"
#include "third_party/double-conversion/utils.h"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/cmath"
#include "third_party/libcxx/cstdarg"
// clang-format off
#include "third_party/double-conversion/utils.h"
#include "third_party/double-conversion/cached-powers.h"
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_
#define DOUBLE_CONVERSION_CACHED_POWERS_H_
#include "third_party/double-conversion/diy-fp.h"
// clang-format off
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_DIY_FP_H_
#define DOUBLE_CONVERSION_DIY_FP_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -1,34 +1,5 @@
// Copyright 2012 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
#include "third_party/double-conversion/string-to-double.h"
#include "third_party/double-conversion/double-to-string.h"
#include "third_party/double-conversion/string-to-double.h"
#endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_

View file

@ -4,14 +4,23 @@
PKGS += THIRD_PARTY_DOUBLECONVERSION
THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS += THIRD_PARTY_DOUBLECONVERSION_A
THIRD_PARTY_DOUBLECONVERSION = $(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \
THIRD_PARTY_DOUBLECONVERSION = \
$(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \
$(THIRD_PARTY_DOUBLECONVERSION_A)
THIRD_PARTY_DOUBLECONVERSION_A = o/$(MODE)/third_party/double-conversion/libdouble-conversion.a
THIRD_PARTY_DOUBLECONVERSION_A = \
o/$(MODE)/third_party/double-conversion/libdouble-conversion.a
THIRD_PARTY_DOUBLECONVERSION_A_FILES := $(wildcard third_party/double-conversion/*)
THIRD_PARTY_DOUBLECONVERSION_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_DOUBLECONVERSION_A_FILES))
THIRD_PARTY_DOUBLECONVERSION_A_SRCS_CC = $(filter %.cc,$(THIRD_PARTY_DOUBLECONVERSION_A_FILES))
THIRD_PARTY_DOUBLECONVERSION_A_HDRS = $(filter %.h,$(THIRD_PARTY_DOUBLECONVERSION_A_FILES))
THIRD_PARTY_DOUBLECONVERSION_A_SRCS = \
$(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_C) \
$(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_CC)
THIRD_PARTY_DOUBLECONVERSION_TEST_COMS = \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@ -44,6 +53,7 @@ THIRD_PARTY_DOUBLECONVERSION_TEST_A_HDRS = \
third_party/double-conversion/test/gay-shortest-single.h
THIRD_PARTY_DOUBLECONVERSION_A_OBJS = \
$(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_C:%.c=o/$(MODE)/%.o) \
$(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_CC:%.cc=o/$(MODE)/%.o)
THIRD_PARTY_DOUBLECONVERSION_A_CHECKS = \
@ -86,12 +96,6 @@ $(THIRD_PARTY_DOUBLECONVERSION_A_OBJS): \
-ffunction-sections \
-fdata-sections
$(THIRD_PARTY_DOUBLECONVERSION_TEST_A_OBJS): \
OVERRIDE_CXXFLAGS += \
-DSTACK_FRAME_UNLIMITED \
-ffunction-sections \
-fdata-sections
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com.dbg: \
$(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \
$(THIRD_PARTY_DOUBLECONVERSION_A) \
@ -114,6 +118,8 @@ THIRD_PARTY_DOUBLECONVERSION_TEST_NAMES = \
THIRD_PARTY_DOUBLECONVERSION_TEST_RUNS = \
$(THIRD_PARTY_DOUBLECONVERSION_TEST_NAMES:%=o/$(MODE)/third_party/double-conversion/%.runs)
# TODO(jart): find some way to run these under runitd
o/$(MODE)/third_party/double-conversion/test-strtod.runs: \
o/$(MODE)/third_party/double-conversion/double-conversion-tester.com
@$(COMPILE) -ACHECK -tT$@ $< test-strtod

View file

@ -24,18 +24,21 @@
// 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.
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/cmath"
#include "third_party/double-conversion/double-to-string.h"
#include "third_party/double-conversion/bignum-dtoa.h"
#include "third_party/double-conversion/double-to-string.h"
#include "third_party/double-conversion/fast-dtoa.h"
#include "third_party/double-conversion/fixed-dtoa.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/utils.h"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/cmath"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2012 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
#define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -24,12 +24,16 @@
// 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.
#include "third_party/double-conversion/fast-dtoa.h"
#include "third_party/double-conversion/cached-powers.h"
#include "third_party/double-conversion/diy-fp.h"
#include "third_party/double-conversion/fast-dtoa.h"
#include "third_party/double-conversion/ieee.h"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_FAST_DTOA_H_
#define DOUBLE_CONVERSION_FAST_DTOA_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -24,11 +24,15 @@
// 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.
#include "third_party/libcxx/cmath"
#include "third_party/double-conversion/fixed-dtoa.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/libcxx/cmath"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_
#define DOUBLE_CONVERSION_FIXED_DTOA_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2012 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_DOUBLE_H_
#define DOUBLE_CONVERSION_DOUBLE_H_
#include "third_party/double-conversion/diy-fp.h"
// clang-format off
namespace double_conversion {

View file

@ -24,16 +24,19 @@
// 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.
#include "third_party/libcxx/climits"
#include "third_party/libcxx/locale"
#include "third_party/libcxx/cmath"
#include "third_party/double-conversion/string-to-double.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/string-to-double.h"
#include "third_party/double-conversion/strtod.h"
#include "third_party/double-conversion/utils.h"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/cmath"
#include "third_party/libcxx/locale"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
#ifdef _MSC_VER
# if _MSC_VER >= 1900

View file

@ -24,14 +24,18 @@
// 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.
#include "third_party/libcxx/climits"
#include "third_party/libcxx/cstdarg"
#include "third_party/double-conversion/bignum.h"
#include "third_party/double-conversion/cached-powers.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/strtod.h"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/cstdarg"
// clang-format off
asm(".ident\t\"\\n\\n\
double-conversion (BSD-3 License)\\n\
Copyright 2006-2012 the V8 project authors\"");
asm(".include \"libc/disclaimer.inc\"");
namespace double_conversion {

View file

@ -1,34 +1,8 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_STRTOD_H_
#define DOUBLE_CONVERSION_STRTOD_H_
#include "third_party/double-conversion/utils.h"
// clang-format off
namespace double_conversion {

View file

@ -24,11 +24,11 @@
// 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.
#include "third_party/double-conversion/test/cctest.h"
#include "libc/isystem/stdio.h"
#include "libc/isystem/stdlib.h"
#include "libc/isystem/string.h"
#include "third_party/double-conversion/test/cctest.h"
// clang-format off
CcTest* CcTest::last_ = NULL;

View file

@ -1,4 +1,4 @@
// Copyright 2008 the V8 project authors. All rights reserved.
// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -24,14 +24,12 @@
// 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.
#ifndef CCTEST_H_
#define CCTEST_H_
#include "libc/isystem/stdio.h"
#include "libc/isystem/string.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
#ifndef TEST
#define TEST(Name) \

View file

@ -24,13 +24,11 @@
// 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.
#ifndef V8_CHECKS_H_
#define V8_CHECKS_H_
#include "libc/isystem/string.h"
#include "third_party/double-conversion/test/flags.h"
// clang-format off
extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
void API_Fatal(const char* location, const char* format, ...);

View file

@ -1,3 +1,4 @@
// clang-format off
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View file

@ -1,3 +1,4 @@
// clang-format off
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View file

@ -1,3 +1,4 @@
// clang-format off
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View file

@ -1,3 +1,4 @@
// clang-format off
// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are

View file

@ -24,18 +24,16 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/double-conversion/bignum-dtoa.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/test/gay-fixed.h"
#include "third_party/double-conversion/test/gay-precision.h"
#include "third_party/double-conversion/test/gay-shortest.h"
#include "third_party/double-conversion/test/gay-shortest-single.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/gay-shortest.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
using namespace double_conversion;

View file

@ -24,14 +24,12 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "libc/isystem/string.h"
#include "third_party/double-conversion/bignum.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
using namespace double_conversion;

View file

@ -24,13 +24,12 @@
// 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.
#include "libc/isystem/string.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/double-conversion.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
// DoubleToString is already tested in test-dtoa.cc.

View file

@ -24,12 +24,11 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/diy-fp.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
using namespace double_conversion;

View file

@ -24,17 +24,15 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/double-conversion/double-conversion.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/test/gay-fixed.h"
#include "third_party/double-conversion/test/gay-precision.h"
#include "third_party/double-conversion/test/gay-shortest.h"
#include "third_party/double-conversion/test/gay-shortest-single.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/gay-shortest.h"
// clang-format off
using namespace double_conversion;

View file

@ -24,17 +24,16 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/diy-fp.h"
#include "third_party/double-conversion/fast-dtoa.h"
#include "third_party/double-conversion/test/gay-precision.h"
#include "third_party/double-conversion/test/gay-shortest.h"
#include "third_party/double-conversion/test/gay-shortest-single.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/test/gay-precision.h"
#include "third_party/double-conversion/test/gay-shortest-single.h"
#include "third_party/double-conversion/test/gay-shortest.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
using namespace double_conversion;

View file

@ -24,15 +24,13 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/fixed-dtoa.h"
#include "third_party/double-conversion/test/gay-fixed.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/test/gay-fixed.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
using namespace double_conversion;

View file

@ -24,14 +24,13 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/libcxx/limits"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/diy-fp.h"
#include "third_party/double-conversion/utils.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/utils.h"
#include "third_party/libcxx/limits"
// clang-format off
using namespace double_conversion;

View file

@ -24,15 +24,14 @@
// 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.
#include "libc/isystem/stdlib.h"
#include "third_party/double-conversion/bignum.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/diy-fp.h"
#include "third_party/double-conversion/ieee.h"
#include "third_party/double-conversion/strtod.h"
#include "third_party/double-conversion/test/cctest.h"
#include "third_party/double-conversion/utils.h"
// clang-format off
using namespace double_conversion;

View file

@ -1,40 +1,19 @@
// Copyright 2010 the V8 project authors. 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// 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.
// -*- c++ -*-
#ifndef DOUBLE_CONVERSION_UTILS_H_
#define DOUBLE_CONVERSION_UTILS_H_
#include "libc/assert.h"
#include "libc/limits.h"
#include "libc/literal.h"
#include "third_party/libcxx/cassert"
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/cstring"
// clang-format off
#define DOUBLE_CONVERSION_UNREACHABLE() unreachable
// Use DOUBLE_CONVERSION_NON_PREFIXED_MACROS to get unprefixed macros as was
// the case in double-conversion releases prior to 3.1.6
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/cstring"
#include "third_party/libcxx/cassert"
#ifndef DOUBLE_CONVERSION_ASSERT
#define DOUBLE_CONVERSION_ASSERT(condition) \
assert(condition)
@ -162,25 +141,6 @@ int main(int argc, char** argv) {
#define CORRECT_DOUBLE_OPERATIONS DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#endif
#if defined(_WIN32) && !defined(__MINGW32__)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t; // NOLINT
typedef unsigned short uint16_t; // NOLINT
typedef int int32_t;
typedef unsigned int uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
// intptr_t and friends are defined in crtdefs.h through stdio.h.
#else
#include "libc/limits.h"
#include "libc/literal.h"
#endif
typedef uint16_t uc16;
// The following macro works on both 32 and 64-bit platforms.

View file

@ -0,0 +1,50 @@
/*-*-mode:c++;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8-*-│
vi: set net ft=c++ ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/str/str.h"
#include "third_party/double-conversion/double-conversion.h"
#include "third_party/double-conversion/wrapper.h"
namespace double_conversion {
extern "C" {
char* DoubleToEcmascript(char buf[128], double x) {
StringBuilder b(buf, 128);
const DoubleToStringConverter& dc =
DoubleToStringConverter::EcmaScriptConverter();
dc.ToShortest(x, &b);
return b.Finalize();
}
double StringToDouble(const char* s, size_t n, int* out_processed) {
if (n == -1) n = strlen(s);
int flags = StringToDoubleConverter::ALLOW_CASE_INSENSITIVITY |
StringToDoubleConverter::ALLOW_LEADING_SPACES |
StringToDoubleConverter::ALLOW_TRAILING_JUNK |
StringToDoubleConverter::ALLOW_TRAILING_SPACES;
StringToDoubleConverter converter(flags, 0.0, 1.0, "Infinity", "NaN");
int processed;
double res = converter.StringToDouble(s, n, &processed);
if (out_processed) {
*out_processed = processed;
}
return res;
}
} // extern "C"
} // namespace double_conversion

11
third_party/double-conversion/wrapper.h vendored Normal file
View file

@ -0,0 +1,11 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_DOUBLE_CONVERSION_WRAPPER_H_
#define COSMOPOLITAN_THIRD_PARTY_DOUBLE_CONVERSION_WRAPPER_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
char *DoubleToEcmascript(char[128], double);
double StringToDouble(const char *, size_t, int *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_THIRD_PARTY_DOUBLE_CONVERSION_WRAPPER_H_ */