Skip to content

Commit

Permalink
Squashed 'vendor/double-conversion/' content from commit 9ed0dec
Browse files Browse the repository at this point in the history
git-subtree-dir: vendor/double-conversion
git-subtree-split: 9ed0dec708a18f0bbdf1a1edaee1b6b86be2043a
  • Loading branch information
tensh committed May 31, 2017
0 parents commit d6e2c10
Show file tree
Hide file tree
Showing 63 changed files with 327,413 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.sconsign.dblite
*.o
*.obj
msvc/Release/
msvc/Debug/
*.suo
*.opensdf
*.sdf
*.user
14 changes: 14 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Below is a list of people and organizations that have contributed
# to the double-conversion project. Names should be added to the
# list like so:
#
# Name/Organization <email address>

Google Inc.
Mozilla Foundation

Jeff Muizelaar <[email protected]>
Mike Hommey <[email protected]>
Martin Olsson <[email protected]>
Kent Williams <[email protected]>
Elan Ruusamäe <[email protected]>
72 changes: 72 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Bazel(http://bazel.io) BUILD file

licenses(["notice"])

cc_library(
name = "double-conversion",
srcs = [
"double-conversion/bignum.cc",
"double-conversion/bignum-dtoa.cc",
"double-conversion/cached-powers.cc",
"double-conversion/diy-fp.cc",
"double-conversion/double-conversion.cc",
"double-conversion/fast-dtoa.cc",
"double-conversion/fixed-dtoa.cc",
"double-conversion/strtod.cc",
"double-conversion/utils.h",
],
hdrs = [
"double-conversion/bignum.h",
"double-conversion/bignum-dtoa.h",
"double-conversion/cached-powers.h",
"double-conversion/diy-fp.h",
"double-conversion/double-conversion.h",
"double-conversion/fast-dtoa.h",
"double-conversion/fixed-dtoa.h",
"double-conversion/ieee.h",
"double-conversion/strtod.h",
],
linkopts = [
"-lm",
],
visibility = ["//visibility:public"],
)

cc_test(
name = "cctest",
srcs = [
"test/cctest/cctest.cc",
"test/cctest/cctest.h",
"test/cctest/checks.h",
"test/cctest/gay-fixed.cc",
"test/cctest/gay-fixed.h",
"test/cctest/gay-precision.cc",
"test/cctest/gay-precision.h",
"test/cctest/gay-shortest.cc",
"test/cctest/gay-shortest.h",
"test/cctest/gay-shortest-single.cc",
"test/cctest/gay-shortest-single.h",
"test/cctest/test-bignum.cc",
"test/cctest/test-bignum-dtoa.cc",
"test/cctest/test-conversions.cc",
"test/cctest/test-diy-fp.cc",
"test/cctest/test-dtoa.cc",
"test/cctest/test-fast-dtoa.cc",
"test/cctest/test-fixed-dtoa.cc",
"test/cctest/test-ieee.cc",
"test/cctest/test-strtod.cc",
],
args = [
"test-bignum",
"test-bignum-dtoa",
"test-conversions",
"test-diy-fp",
"test-dtoa",
"test-fast-dtoa",
"test-fixed-dtoa",
"test-ieee",
"test-strtod",
],
visibility = ["//visibility:public"],
deps = [":double-conversion"],
)
70 changes: 70 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
cmake_minimum_required(VERSION 2.8.12)
project(double-conversion)

include(GNUInstallDirs)

# pick a version #
set(double-conversion_VERSION 2.0.1)
set(double-conversion_SOVERSION_MAJOR 1)
set(double-conversion_SOVERSION_MINOR 0)
set(double-conversion_SOVERSION_PATCH 0)
set(double-conversion_SOVERSION
${double-conversion_SOVERSION_MAJOR}.${double-conversion_SOVERSION_MINOR}.${double-conversion_SOVERSION_PATCH})

# set suffix for CMake files used for packaging
if(WIN32 AND NOT CYGWIN)
set(INSTALL_CMAKE_DIR CMake)
else()
set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/double-conversion)
endif()

# Add src subdirectory
add_subdirectory(double-conversion)

#
# set up testing if requested
option(BUILD_TESTING "Build test programs" OFF)
if(BUILD_TESTING)
enable_testing()
include(CTest)
add_subdirectory(test)
endif()

#
# mention the library target as export library
export(TARGETS double-conversion
FILE "${PROJECT_BINARY_DIR}/double-conversionLibraryDepends.cmake")

#
# set this build as an importable package
export(PACKAGE double-conversion)

#
# make a cmake file -- in this case, all that needs defining
# is double-conversion_INCLUDE_DIRS
configure_file(double-conversionBuildTreeSettings.cmake.in
"${PROJECT_BINARY_DIR}/double-conversionBuildTreeSettings.cmake"
@ONLY)

#
# sets up config to be used by CMake find_package
configure_file(double-conversionConfig.cmake.in
"${PROJECT_BINARY_DIR}/double-conversionConfig.cmake"
@ONLY)
#
# Export version # checked by find_package
configure_file(double-conversionConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/double-conversionConfigVersion.cmake"
@ONLY)
#
# install config files for find_package
install(FILES
"${PROJECT_BINARY_DIR}/double-conversionConfig.cmake"
"${PROJECT_BINARY_DIR}/double-conversionConfigVersion.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)


#
# generates install cmake files to find libraries in installation.
install(EXPORT double-conversionLibraryDepends DESTINATION
"${INSTALL_CMAKE_DIR}" COMPONENT dev)
26 changes: 26 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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.
37 changes: 37 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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).
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
all:
scons debug=1

test:
./run_tests --list | tr -d '<' | xargs ./run_tests

.PHONY: test all
54 changes: 54 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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/double-conversion.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 --list | tr -d '<' | xargs test/cctest/cctest

[0]: http://www.scons.org
[1]: http://www.cmake.org
46 changes: 46 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# vim:ft=python
import os

double_conversion_sources = ['double-conversion/' + x for x in SConscript('double-conversion/SConscript')]
double_conversion_test_sources = ['test/cctest/' + x for x in SConscript('test/cctest/SConscript')]

DESTDIR = ARGUMENTS.get('DESTDIR', '')
prefix = ARGUMENTS.get('prefix', '/usr/local')
lib = ARGUMENTS.get('libsuffix', 'lib')
libdir = os.path.join(DESTDIR + prefix, lib)

env = Environment(CPPPATH='#', LIBS=['m', 'stdc++'],
CXXFLAGS=ARGUMENTS.get('CXXFLAGS', ''))
debug = ARGUMENTS.get('debug', 0)
optimize = ARGUMENTS.get('optimize', 0)
env.Replace(CXX = ARGUMENTS.get('CXX', 'g++'))

# for shared lib, requires scons 2.3.0
env['SHLIBVERSION'] = '1.0.0'

CCFLAGS = []
if int(debug):
CCFLAGS.append(ARGUMENTS.get('CXXFLAGS', '-g -Wall -Wshadow -Werror'))
if int(optimize):
CCFLAGS.append(ARGUMENTS.get('CXXFLAGS', '-O3'))

env.Append(CCFLAGS = " ".join(CCFLAGS))

double_conversion_shared_objects = [
env.SharedObject(src) for src in double_conversion_sources]
double_conversion_static_objects = [
env.StaticObject(src) for src in double_conversion_sources]

library_name = 'double-conversion'

static_lib = env.StaticLibrary(library_name, double_conversion_static_objects)
static_lib_pic = env.StaticLibrary(library_name + '_pic', double_conversion_shared_objects)
shared_lib = env.SharedLibrary(library_name, double_conversion_shared_objects)

env.Program('run_tests', double_conversion_test_sources, LIBS=[static_lib])

env.InstallVersionedLib(libdir, shared_lib)
env.Install(libdir, static_lib)
env.Install(libdir, static_lib_pic)

env.Alias('install', libdir)
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Bazel (http://bazel.io/) WORKSPACE file for double-conversion.
Loading

0 comments on commit d6e2c10

Please sign in to comment.