diff --git a/libethsupport/CryptoHeaders.h b/libethsupport/CryptoHeaders.h
new file mode 100644
index 000000000..4ff63f1d7
--- /dev/null
+++ b/libethsupport/CryptoHeaders.h
@@ -0,0 +1,36 @@
+/*
+ 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 .
+*/
+/** @file CryptoHeaders.h
+ * @author Tim Hughes
+ * @date 2014
+ */
+#pragma once
+
+// need to leave this one disabled
+#pragma GCC diagnostic ignored "-Wunused-function"
+
+#pragma warning(push)
+#pragma warning(disable:4100 4244)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include
+#include
+#include
+#include
+#pragma warning(pop)
+#pragma GCC diagnostic pop
diff --git a/libethsupport/Exceptions.h b/libethsupport/Exceptions.h
new file mode 100644
index 000000000..18ddfe5e8
--- /dev/null
+++ b/libethsupport/Exceptions.h
@@ -0,0 +1,48 @@
+/*
+ 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 .
+*/
+/** @file Exceptions.h
+ * @author Gav Wood
+ * @date 2014
+ */
+
+#pragma once
+
+#include
+#include "CommonIO.h"
+#include "CommonData.h"
+#include "FixedHash.h"
+
+namespace eth
+{
+
+class Exception: public std::exception
+{
+public:
+ virtual std::string description() const { return typeid(*this).name(); }
+ virtual char const* what() const noexcept { return typeid(*this).name(); }
+};
+
+class BadHexCharacter: public Exception {};
+
+class RLPException: public Exception {};
+class BadCast: public RLPException {};
+class BadRLP: public RLPException {};
+class NoNetworking: public Exception {};
+class NoUPnPDevice: public Exception {};
+class RootNotFound: public Exception {};
+
+}
diff --git a/libethsupport/vector_ref.h b/libethsupport/vector_ref.h
new file mode 100644
index 000000000..fde47e661
--- /dev/null
+++ b/libethsupport/vector_ref.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+
+#pragma warning(push)
+#pragma warning(disable: 4100 4267)
+#include
+#pragma warning(pop)
+
+namespace eth
+{
+
+template
+class vector_ref
+{
+public:
+ typedef _T value_type;
+ typedef _T element_type;
+ typedef typename std::conditional::value, typename std::remove_const<_T>::type, _T>::type mutable_value_type;
+
+ vector_ref(): m_data(nullptr), m_count(0) {}
+ vector_ref(_T* _data, size_t _count): m_data(_data), m_count(_count) {}
+ vector_ref(std::string* _data): m_data((_T*)_data->data()), m_count(_data->size() / sizeof(_T)) {}
+ vector_ref(typename std::conditional::value, std::vector::type> const*, std::vector<_T>*>::type _data): m_data(_data->data()), m_count(_data->size()) {}
+ vector_ref(typename std::conditional::value, std::string const&, std::string&>::type _data): m_data((_T*)_data.data()), m_count(_data.size() / sizeof(_T)) {}
+ vector_ref(leveldb::Slice const& _s): m_data(_s.data()), m_count(_s.size() / sizeof(_T)) {}
+
+ explicit operator bool() const { return m_data && m_count; }
+
+ bool contentsEqual(std::vector const& _c) const { return _c.size() == m_count && !memcmp(_c.data(), m_data, m_count); }
+ std::vector toVector() const { return std::vector(m_data, m_data + m_count); }
+ std::vector toBytes() const { return std::vector((unsigned char const*)m_data, m_data + m_count * sizeof(_T)); }
+ std::string toString() const { return std::string((char const*)m_data, ((char const*)m_data) + m_count); }
+ template operator vector_ref<_T2>() const { assert(m_count * sizeof(_T) / sizeof(_T2) * sizeof(_T2) / sizeof(_T) == m_count); return vector_ref<_T2>((_T2*)m_data, m_count * sizeof(_T) / sizeof(_T2)); }
+
+ _T* data() const { return m_data; }
+ size_t count() const { return m_count; }
+ size_t size() const { return m_count; }
+ bool empty() const { return !m_count; }
+ vector_ref<_T> next() const { return vector_ref<_T>(m_data + m_count, m_count); }
+ vector_ref<_T> cropped(size_t _begin, size_t _count = ~size_t(0)) const { if (m_data && _begin + std::max(size_t(0), _count) <= m_count) return vector_ref<_T>(m_data + _begin, _count == ~size_t(0) ? m_count - _begin : _count); else return vector_ref<_T>(); }
+ void retarget(_T const* _d, size_t _s) { m_data = _d; m_count = _s; }
+ void retarget(std::vector<_T> const& _t) { m_data = _t.data(); m_count = _t.size(); }
+
+ _T* begin() { return m_data; }
+ _T* end() { return m_data + m_count; }
+ _T const* begin() const { return m_data; }
+ _T const* end() const { return m_data + m_count; }
+
+ _T& operator[](size_t _i) { assert(m_data); assert(_i < m_count); return m_data[_i]; }
+ _T const& operator[](size_t _i) const { assert(m_data); assert(_i < m_count); return m_data[_i]; }
+
+ bool operator==(vector_ref<_T> const& _cmp) const { return m_data == _cmp.m_data && m_count == _cmp.m_count; }
+ bool operator!=(vector_ref<_T> const& _cmp) const { return !operator==(); }
+
+ operator leveldb::Slice() const { return leveldb::Slice((char const*)m_data, m_count * sizeof(_T)); }
+
+ void reset() { m_data = nullptr; m_count = 0; }
+
+private:
+ _T* m_data;
+ size_t m_count;
+};
+
+template vector_ref<_T const> ref(_T const& _t) { return vector_ref<_T const>(&_t, 1); }
+template vector_ref<_T> ref(_T& _t) { return vector_ref<_T>(&_t, 1); }
+template vector_ref<_T const> ref(std::vector<_T> const& _t) { return vector_ref<_T const>(&_t); }
+template vector_ref<_T> ref(std::vector<_T>& _t) { return vector_ref<_T>(&_t); }
+
+}
diff --git a/liblll/Assembly.cpp b/liblll/Assembly.cpp
index 317a92fc8..a84913762 100644
--- a/liblll/Assembly.cpp
+++ b/liblll/Assembly.cpp
@@ -40,9 +40,19 @@ void Assembly::append(Assembly const& _a)
ostream& Assembly::streamOut(ostream& _out) const
{
- for (auto const& i: m_items)
- {
- }
+ for (AssemblyItem const& i: m_items)
+ switch (i.m_type)
+ {
+ case Operation:
+ _out << c_instructionInfo.at((Instruction)(byte)i.m_data).name << endl;
+ break;
+ case Push:
+ _out << i.m_data << endl;
+ break;
+/* case PushString:
+ _out << i.m_data << endl;
+ break;*/
+ }
return _out;
}
diff --git a/liblll/Assembly.h b/liblll/Assembly.h
index cbce3ca82..ca3beaf5b 100644
--- a/liblll/Assembly.h
+++ b/liblll/Assembly.h
@@ -46,6 +46,8 @@ public:
AssemblyItemType type() const { return m_type; }
u256 data() const { return m_data; }
+ std::ostream& streamOut(std::ostream& _out) const;
+
private:
AssemblyItemType m_type;
u256 m_data;
diff --git a/liblll/Exceptions.h b/liblll/Exceptions.h
new file mode 100644
index 000000000..79b7cd520
--- /dev/null
+++ b/liblll/Exceptions.h
@@ -0,0 +1,44 @@
+/*
+ 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 .
+*/
+/** @file Exceptions.h
+ * @author Gav Wood
+ * @date 2014
+ */
+
+#pragma once
+
+#include
+
+namespace eth
+{
+
+/// Compile a Low-level Lisp-like Language program into EVM-code.
+class CompilerException: public Exception {};
+class InvalidOperation: public CompilerException {};
+class IntegerOutOfRange: public CompilerException {};
+class StringTooLong: public CompilerException {};
+class EmptyList: public CompilerException {};
+class DataNotExecutable: public CompilerException {};
+class IncorrectParameterCount: public CompilerException {};
+class InvalidDeposit: public CompilerException {};
+class InvalidName: public CompilerException {};
+class InvalidMacroArgs: public CompilerException {};
+class InvalidLiteral: public CompilerException {};
+class BareSymbol: public CompilerException {};
+class ExpectedLiteral: public CompilerException {};
+
+}