aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-08-08 21:11:36 +0800
committerGitHub <noreply@github.com>2016-08-08 21:11:36 +0800
commitc3ed550eb6040596681107560d682f102c458de7 (patch)
treebe5a7f120bef5073754171df4167f334c8fce7c3
parent53a5e99c1341bb868f3d7cf5a07675872b941ce8 (diff)
parentccd78d05d6221b5eb47514b30f7e5c5aa7169365 (diff)
downloaddexon-solidity-c3ed550eb6040596681107560d682f102c458de7.tar.gz
dexon-solidity-c3ed550eb6040596681107560d682f102c458de7.tar.zst
dexon-solidity-c3ed550eb6040596681107560d682f102c458de7.zip
Merge pull request #834 from chriseth/devcorecleanup
Some cleanup regarding libdevcore. Also rename to avoid conflicts.
-rw-r--r--cmake/UseDev.cmake4
-rw-r--r--cmake/UseSolidity.cmake2
-rw-r--r--libdevcore/Base64.cpp146
-rw-r--r--libdevcore/Base64.h42
-rw-r--r--libdevcore/CMakeLists.txt2
-rw-r--r--libdevcore/Common.cpp27
-rw-r--r--libdevcore/Common.h1
-rw-r--r--libdevcore/FixedHash.cpp50
-rw-r--r--libdevcore/FixedHash.h19
-rw-r--r--libevmasm/Assembly.h4
-rw-r--r--libevmasm/CMakeLists.txt2
-rw-r--r--libsolidity/CMakeLists.txt2
-rwxr-xr-xscripts/travis-emscripten/build_emscripten.sh2
13 files changed, 7 insertions, 296 deletions
diff --git a/cmake/UseDev.cmake b/cmake/UseDev.cmake
index 1f4c9a2d..4461a8a0 100644
--- a/cmake/UseDev.cmake
+++ b/cmake/UseDev.cmake
@@ -22,9 +22,9 @@ function(eth_apply TARGET REQUIRED SUBMODULE)
endif()
- if (${SUBMODULE} STREQUAL "devcore")
+ if (${SUBMODULE} STREQUAL "soldevcore")
eth_use(${TARGET} ${REQUIRED} Dev::base)
- target_link_libraries(${TARGET} devcore)
+ target_link_libraries(${TARGET} soldevcore)
endif()
endfunction()
diff --git a/cmake/UseSolidity.cmake b/cmake/UseSolidity.cmake
index 46e2cac9..8db2f848 100644
--- a/cmake/UseSolidity.cmake
+++ b/cmake/UseSolidity.cmake
@@ -25,7 +25,7 @@ function(eth_apply TARGET REQUIRED SUBMODULE)
endif()
if (${SUBMODULE} STREQUAL "solidity" OR ${SUBMODULE} STREQUAL "")
- eth_use(${TARGET} ${REQUIRED} Dev::devcore Solidity::evmasm)
+ eth_use(${TARGET} ${REQUIRED} Dev::soldevcore Solidity::evmasm)
target_link_libraries(${TARGET} ${Solidity_SOLIDITY_LIBRARIES})
endif()
diff --git a/libdevcore/Base64.cpp b/libdevcore/Base64.cpp
deleted file mode 100644
index 8ee2b29f..00000000
--- a/libdevcore/Base64.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- base64.cpp and base64.h
-
- Copyright (C) 2004-2008 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-/// Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c
-/// Originally by René Nyffenegger, modified by some other guy and then devified by Gav Wood.
-
-#include "Base64.h"
-
-using namespace std;
-using namespace dev;
-
-static inline bool is_base64(byte c)
-{
- return (isalnum(c) || (c == '+') || (c == '/'));
-}
-
-static inline byte find_base64_char_index(byte c)
-{
- if ('A' <= c && c <= 'Z') return c - 'A';
- else if ('a' <= c && c <= 'z') return c - 'a' + 1 + find_base64_char_index('Z');
- else if ('0' <= c && c <= '9') return c - '0' + 1 + find_base64_char_index('z');
- else if (c == '+') return 1 + find_base64_char_index('9');
- else if (c == '/') return 1 + find_base64_char_index('+');
- else return 1 + find_base64_char_index('/');
-}
-
-string dev::toBase64(bytesConstRef _in)
-{
- static const char base64_chars[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
-
- string ret;
- int i = 0;
- int j = 0;
- byte char_array_3[3];
- byte char_array_4[4];
-
- auto buf = _in.data();
- auto bufLen = _in.size();
-
- while (bufLen--)
- {
- char_array_3[i++] = *(buf++);
- if (i == 3)
- {
- char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
- char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
- char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
- char_array_4[3] = char_array_3[2] & 0x3f;
-
- for (i = 0; i < 4; i++)
- ret += base64_chars[char_array_4[i]];
- i = 0;
- }
- }
-
- if (i)
- {
- for (j = i; j < 3; j++)
- char_array_3[j] = '\0';
-
- char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
- char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
- char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
- char_array_4[3] = char_array_3[2] & 0x3f;
-
- for (j = 0; j < i + 1; j++)
- ret += base64_chars[char_array_4[j]];
-
- while (i++ < 3)
- ret += '=';
- }
-
- return ret;
-}
-
-bytes dev::fromBase64(string const& encoded_string)
-{
- auto in_len = encoded_string.size();
- int i = 0;
- int j = 0;
- int in_ = 0;
- byte char_array_3[3];
- byte char_array_4[4];
- bytes ret;
-
- while (in_len-- && encoded_string[in_] != '=' && is_base64(encoded_string[in_]))
- {
- char_array_4[i++] = encoded_string[in_]; in_++;
- if (i == 4)
- {
- for (i = 0; i < 4; i++)
- char_array_4[i] = find_base64_char_index(char_array_4[i]);
-
- char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
- char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
- char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
-
- for (i = 0; (i < 3); i++)
- ret.push_back(char_array_3[i]);
- i = 0;
- }
- }
-
- if (i)
- {
- for (j = i; j < 4; j++)
- char_array_4[j] = 0;
-
- for (j = 0; j < 4; j++)
- char_array_4[j] = find_base64_char_index(char_array_4[j]);
-
- char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
- char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
- char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
-
- for (j = 0; j < i - 1; j++)
- ret.push_back(char_array_3[j]);
- }
-
- return ret;
-}
diff --git a/libdevcore/Base64.h b/libdevcore/Base64.h
deleted file mode 100644
index d5481570..00000000
--- a/libdevcore/Base64.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- base64.cpp and base64.h
-
- Copyright (C) 2004-2008 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-/// Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c
-/// Originally by René Nyffenegger.
-/// DEVified by Gav Wood.
-#pragma once
-
-#include <string>
-#include "Common.h"
-#include "FixedHash.h"
-
-namespace dev
-{
-
-std::string toBase64(bytesConstRef _in);
-bytes fromBase64(std::string const& _in);
-
-
-}
diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt
index 2af99dff..c4f886a6 100644
--- a/libdevcore/CMakeLists.txt
+++ b/libdevcore/CMakeLists.txt
@@ -9,6 +9,6 @@ file(GLOB HEADERS "*.h")
include_directories(..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-eth_use(${EXECUTABLE} REQUIRED Jsoncpp Dev::base)
+eth_use(${EXECUTABLE} REQUIRED Dev::base)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
diff --git a/libdevcore/Common.cpp b/libdevcore/Common.cpp
deleted file mode 100644
index 579e0f62..00000000
--- a/libdevcore/Common.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- This file is part of cpp-ethereum.
-
- cpp-ethereum 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.
-
- cpp-ethereum 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 cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
-*/
-/** @file Common.cpp
- * @author Gav Wood <i@gavwood.com>
- * @date 2014
- */
-
-#include "Common.h"
-
-namespace dev
-{
-const u256 Invalid256 = ~(u256)0;
-}
diff --git a/libdevcore/Common.h b/libdevcore/Common.h
index 7d301833..8bc5f58f 100644
--- a/libdevcore/Common.h
+++ b/libdevcore/Common.h
@@ -156,7 +156,6 @@ using string32 = std::array<char, 32>;
// Null/Invalid values for convenience.
static const bytes NullBytes;
-extern const u256 Invalid256;
/// Interprets @a _u as a two's complement signed number and returns the resulting s256.
inline s256 u2s(u256 _u)
diff --git a/libdevcore/FixedHash.cpp b/libdevcore/FixedHash.cpp
deleted file mode 100644
index 420e2bb1..00000000
--- a/libdevcore/FixedHash.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- This file is part of cpp-ethereum.
-
- cpp-ethereum 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.
-
- cpp-ethereum 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 cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
-*/
-/** @file FixedHash.cpp
- * @author Gav Wood <i@gavwood.com>
- * @date 2014
- */
-
-#include "FixedHash.h"
-#include <ctime>
-#include <boost/algorithm/string.hpp>
-
-using namespace std;
-using namespace dev;
-
-boost::random_device dev::s_fixedHashEngine;
-
-h128 dev::fromUUID(std::string const& _uuid)
-{
- try
- {
- return h128(boost::replace_all_copy(_uuid, "-", ""));
- }
- catch (...)
- {
- return h128();
- }
-}
-
-std::string dev::toUUID(h128 const& _uuid)
-{
- std::string ret = toHex(_uuid.ref());
- for (unsigned i: {20, 16, 12, 8})
- ret.insert(ret.begin() + i, '-');
- return ret;
-}
-
diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h
index cf79bab0..a23aecc6 100644
--- a/libdevcore/FixedHash.h
+++ b/libdevcore/FixedHash.h
@@ -26,8 +26,6 @@
#include <array>
#include <cstdint>
#include <algorithm>
-#include <boost/random/random_device.hpp>
-#include <boost/random/uniform_int_distribution.hpp>
#include <boost/functional/hash.hpp>
#include "CommonData.h"
@@ -38,8 +36,6 @@ namespace dev
template <unsigned N> struct StaticLog2 { enum { result = 1 + StaticLog2<N/2>::result }; };
template <> struct StaticLog2<1> { enum { result = 0 }; };
-extern boost::random_device s_fixedHashEngine;
-
/// Fixed-size raw-byte array container type, with an API optimised for storing hashes.
/// Transparently converts to/from the corresponding arithmetic type; this will
/// assume the data contained in the hash is big-endian.
@@ -150,17 +146,6 @@ public:
/// @returns a constant reference to the object's data as an STL array.
std::array<byte, N> const& asArray() const { return m_data; }
- /// Populate with random data.
- template <class Engine>
- void randomize(Engine& _eng)
- {
- for (auto& i: m_data)
- i = (uint8_t)boost::random::uniform_int_distribution<uint16_t>(0, 255)(_eng);
- }
-
- /// @returns a random valued object.
- static FixedHash random() { FixedHash ret; ret.randomize(s_fixedHashEngine); return ret; }
-
struct hash
{
/// Make a hash of the object's data.
@@ -279,10 +264,6 @@ inline h160 left160(h256 const& _t)
return ret;
}
-h128 fromUUID(std::string const& _uuid);
-
-std::string toUUID(h128 const& _uuid);
-
inline std::string toString(h256s const& _bs)
{
std::ostringstream out;
diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h
index d48fa99c..af28e220 100644
--- a/libevmasm/Assembly.h
+++ b/libevmasm/Assembly.h
@@ -33,10 +33,6 @@
#include "Exceptions.h"
#include <json/json.h>
-namespace Json
-{
-class Value;
-}
namespace dev
{
namespace eth
diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt
index e33301ea..61162eee 100644
--- a/libevmasm/CMakeLists.txt
+++ b/libevmasm/CMakeLists.txt
@@ -8,6 +8,6 @@ file(GLOB HEADERS "*.h")
include_directories(BEFORE ..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-eth_use(${EXECUTABLE} REQUIRED Dev::devcore)
+eth_use(${EXECUTABLE} REQUIRED Jsoncpp Dev::soldevcore)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt
index dc06b0c8..56aea829 100644
--- a/libsolidity/CMakeLists.txt
+++ b/libsolidity/CMakeLists.txt
@@ -15,7 +15,7 @@ file(GLOB HEADERS "*/*.h")
include_directories(BEFORE ..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-eth_use(${EXECUTABLE} REQUIRED Dev::devcore Solidity::evmasm)
+eth_use(${EXECUTABLE} REQUIRED Dev::soldevcore Solidity::evmasm)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh
index 2b5e409f..bb118ba6 100755
--- a/scripts/travis-emscripten/build_emscripten.sh
+++ b/scripts/travis-emscripten/build_emscripten.sh
@@ -116,7 +116,7 @@ emcmake cmake \
-DJSONCPP_INCLUDE_DIR="$WORKSPACE"/jsoncpp/include/ \
-DCRYPTOPP_LIBRARY="$WORKSPACE"/cryptopp/src/libcryptlib.a \
-DCRYPTOPP_INCLUDE_DIR="$WORKSPACE"/cryptopp/src/ \
- -DDev_DEVCORE_LIBRARY="$WORKSPACE"/solidity/build/libdevcore/libdevcore.a \
+ -DDev_DEVCORE_LIBRARY="$WORKSPACE"/solidity/build/libdevcore/libsoldevcore.a \
-DEth_EVMASM_LIBRARY="$WORKSPACE"/solidity/build/libevmasm/libevmasm.a \
-DETH_STATIC=1 -DTESTS=0 \
..