diff --git a/.gitignore b/.gitignore
index c18d5a01d..6fde7ca22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,3 +64,5 @@ profile
DerivedData
project.pbxproj
+
+evmjit
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..26c29d38d
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "evmjit"]
+ path = evmjit
+ url = https://github.com/ethereum/evmjit
+ branch = develop
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5763c9b85..db5ddb864 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ function(createDefaultCacheConfig)
set(VMTRACE OFF CACHE BOOL "VM tracing and run-time checks (useful for cross-implementation VM debugging)")
set(PARANOIA OFF CACHE BOOL "Additional run-time checks")
set(JSONRPC ON CACHE BOOL "Build with jsonprc. default on")
+ set(EVMJIT OFF CACHE BOOL "Build a just-in-time compiler for EVM code (requires LLVM)")
endfunction()
@@ -38,6 +39,10 @@ function(configureProject)
message(FATAL_ERROR "VM tracing requires debug.")
endif ()
endif ()
+
+ if (EVMJIT)
+ add_definitions(-DETH_EVMJIT)
+ endif()
endfunction()
@@ -84,7 +89,7 @@ cmake_policy(SET CMP0015 NEW)
createDefaultCacheConfig()
configureProject()
-message("-- VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}; JSONRPC: ${JSONRPC}")
+message("-- VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}; JSONRPC: ${JSONRPC}; EVMJIT: ${EVMJIT}")
# Default TARGET_PLATFORM to "linux".
@@ -107,6 +112,13 @@ include(EthExecutableHelper)
createBuildInfo()
+if (EVMJIT)
+ # Workaround for Ubuntu broken LLVM package
+ link_directories(/usr/lib/llvm-3.5/lib)
+
+ add_subdirectory(evmjit)
+endif()
+
add_subdirectory(libdevcore)
add_subdirectory(libevmcore)
add_subdirectory(liblll)
diff --git a/README.md b/README.md
index 8b5ff903d..cfa223a56 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
## Ethereum C++ Client.
+[![Build
+Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20master%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20master%20branch/builds/-1) master [![Build
+Status](http://build.ethdev.com/buildstatusimage?builder=Linux%20C%2B%2B%20develop%20branch)](http://build.ethdev.com/builders/Linux%20C%2B%2B%20develop%20branch/builds/-1) develop
+
By Gav Wood, 2014.
[![Build
diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp
index 671322332..dbcd0f493 100644
--- a/alethzero/MainWin.cpp
+++ b/alethzero/MainWin.cpp
@@ -106,6 +106,8 @@ static QString contentsOfQResource(std::string const& res)
}
Address c_config = Address("661005d2720d855f1d9976f88bb10c1a3398c77f");
+Address c_newConfig = Address("d5f9d8d94886e70b06e474c3fb14fd43e2f23970");
+Address c_nameReg = Address("ddd1cea741d548f90d86fb87a3ae6492e18c03a1");
Main::Main(QWidget *parent) :
QMainWindow(parent),
@@ -448,8 +450,29 @@ static Public stringToPublic(QString const& _a)
return Public();
}
+static Address g_newNameReg;
+
QString Main::pretty(dev::Address _a) const
{
+ static std::map
s_memos;
+
+ if (!s_memos.count(_a))
+ {
+ if (!g_newNameReg)
+ g_newNameReg = abiOut(ethereum()->call(c_newConfig, abiIn(1, (u256)1)));
+
+ if (g_newNameReg)
+ {
+ QString s = QString::fromStdString(toString(abiOut(ethereum()->call(g_newNameReg, abiIn(2, _a)))));
+ s_memos[_a] = s;
+ if (s.size())
+ return s;
+ }
+ }
+ else
+ if (s_memos[_a].size())
+ return s_memos[_a];
+
h256 n;
if (h160 nameReg = (u160)ethereum()->stateAt(c_config, 0))
@@ -469,19 +492,47 @@ QString Main::render(dev::Address _a) const
return QString::fromStdString(_a.abridged());
}
-Address Main::fromString(QString const& _a) const
+string32 fromString(std::string const& _s)
+{
+ string32 ret;
+ for (unsigned i = 0; i < 32 && i <= _s.size(); ++i)
+ ret[i] = i < _s.size() ? _s[i] : 0;
+ return ret;
+}
+
+Address Main::fromString(QString const& _n) const
{
- if (_a == "(Create Contract)")
+ if (_n == "(Create Contract)")
return Address();
- string sn = _a.toStdString();
+ static std::map s_memos;
+
+ if (!s_memos.count(_n))
+ {
+ if (!g_newNameReg)
+ g_newNameReg = abiOut(ethereum()->call(c_newConfig, abiIn(1, (u256)1)));
+
+ if (g_newNameReg)
+ {
+ Address a = abiOut(ethereum()->call(g_newNameReg, abiIn(0, ::fromString(_n.toStdString()))));
+ s_memos[_n] = a;
+ if (a)
+ return a;
+ }
+ }
+ else
+ if (s_memos[_n])
+ return s_memos[_n];
+
+ string sn = _n.toStdString();
if (sn.size() > 32)
sn.resize(32);
h256 n;
memcpy(n.data(), sn.data(), sn.size());
memset(n.data() + sn.size(), 0, 32 - sn.size());
- if (_a.size())
+ if (_n.size())
{
+
if (h160 nameReg = (u160)ethereum()->stateAt(c_config, 0))
if (h256 a = ethereum()->stateAt(nameReg, n))
return right160(a);
@@ -489,8 +540,9 @@ Address Main::fromString(QString const& _a) const
if (h256 a = ethereum()->stateAt(m_nameReg, n))
return right160(a);
}
- if (_a.size() == 40)
- return Address(fromHex(_a.toStdString()));
+
+ if (_n.size() == 40)
+ return Address(fromHex(_n.toStdString()));
else
return Address();
}
@@ -1112,7 +1164,7 @@ string Main::renderDiff(dev::eth::StateDiff const& _d) const
s << "
";
dev::eth::AccountDiff const& ad = i.second;
- s << "" << ad.lead() << "
" << " " << render(i.first).toStdString() << "";
+ s << "" << lead(ad.changeType()) << "
" << " " << render(i.first).toStdString() << "";
if (!ad.exist.to())
continue;
@@ -1133,7 +1185,7 @@ string Main::renderDiff(dev::eth::StateDiff const& _d) const
s << " (" << ad.code.from().size() << " bytes)";
}
- for (pair> const& i: ad.storage)
+ for (pair> const& i: ad.storage)
{
s << "
";
if (!i.second.from())
@@ -1350,7 +1402,7 @@ void Main::on_debugCurrent_triggered()
{
unsigned txi = item->data(Qt::UserRole + 1).toInt();
m_executiveState = ethereum()->state(txi + 1, h);
- m_currentExecution = unique_ptr(new Executive(m_executiveState, 0));
+ m_currentExecution = unique_ptr(new Executive(m_executiveState, ethereum()->blockChain(), 0));
Transaction t = m_executiveState.pending()[txi];
m_executiveState = m_executiveState.fromPending(txi);
auto r = t.rlp();
@@ -1803,7 +1855,7 @@ void Main::on_debug_clicked()
{
Secret s = i.secret();
m_executiveState = ethereum()->postState();
- m_currentExecution = unique_ptr(new Executive(m_executiveState, 0));
+ m_currentExecution = unique_ptr(new Executive(m_executiveState, ethereum()->blockChain(), 0));
Transaction t = isCreation() ?
Transaction(value(), gasPrice(), ui->gas->value(), m_data, m_executiveState.transactionsFrom(dev::toAddress(s)), s) :
Transaction(value(), gasPrice(), ui->gas->value(), fromString(ui->destination->currentText()), m_data, m_executiveState.transactionsFrom(dev::toAddress(s)), s);
diff --git a/boost/process.hpp b/boost/process.hpp
deleted file mode 100644
index 60511ef57..000000000
--- a/boost/process.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process.hpp
- *
- * Convenience header that includes all other Boost.Process public header
- * files. It is important to note that those headers that are specific to
- * a given platform are only included if the library is being used in that
- * same platform.
- */
-
-#ifndef BOOST_PROCESS_HPP
-#define BOOST_PROCESS_HPP
-
-#include
-
-#if defined(BOOST_POSIX_API)
-# include
-# include
-# include
-# include
-#elif defined(BOOST_WINDOWS_API)
-# include
-# include
-# include
-#else
-# error "Unsupported platform."
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#endif
diff --git a/boost/process/child.hpp b/boost/process/child.hpp
deleted file mode 100644
index 1419b7ea7..000000000
--- a/boost/process/child.hpp
+++ /dev/null
@@ -1,200 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process/child.hpp
- *
- * Includes the declaration of the child class.
- */
-
-#ifndef BOOST_PROCESS_CHILD_HPP
-#define BOOST_PROCESS_CHILD_HPP
-
-#include
-
-#if defined(BOOST_POSIX_API)
-# include
-# include
-# include
-#elif defined(BOOST_WINDOWS_API)
-# include
-#else
-# error "Unsupported platform."
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace boost {
-namespace process {
-
-/**
- * Generic implementation of the Child concept.
- *
- * The child class implements the Child concept in an operating system
- * agnostic way.
- */
-class child : public process
-{
-public:
- /**
- * Gets a reference to the child's standard input stream.
- *
- * Returns a reference to a postream object that represents the
- * standard input communication channel with the child process.
- */
- postream &get_stdin() const
- {
- BOOST_ASSERT(stdin_);
-
- return *stdin_;
- }
-
- /**
- * Gets a reference to the child's standard output stream.
- *
- * Returns a reference to a pistream object that represents the
- * standard output communication channel with the child process.
- */
- pistream &get_stdout() const
- {
- BOOST_ASSERT(stdout_);
-
- return *stdout_;
- }
-
- /**
- * Gets a reference to the child's standard error stream.
- *
- * Returns a reference to a pistream object that represents the
- * standard error communication channel with the child process.
- */
- pistream &get_stderr() const
- {
- BOOST_ASSERT(stderr_);
-
- return *stderr_;
- }
-
- /**
- * Blocks and waits for the child process to terminate.
- *
- * Returns a status object that represents the child process'
- * finalization condition. The child process object ceases to be
- * valid after this call.
- *
- * \remark Blocking remarks: This call blocks if the child
- * process has not finalized execution and waits until
- * it terminates.
- */
- status wait()
- {
-#if defined(BOOST_POSIX_API)
- int s;
- if (::waitpid(get_id(), &s, 0) == -1)
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::child::wait: waitpid(2) failed"));
- return status(s);
-#elif defined(BOOST_WINDOWS_API)
- ::WaitForSingleObject(process_handle_.get(), INFINITE);
- DWORD code;
- if (!::GetExitCodeProcess(process_handle_.get(), &code))
- boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::child::wait: GetExitCodeProcess failed"));
- return status(code);
-#endif
- }
-
- /**
- * Creates a new child object that represents the just spawned child
- * process \a id.
- *
- * The \a fhstdin, \a fhstdout and \a fhstderr file handles represent
- * the parent's handles used to communicate with the corresponding
- * data streams. They needn't be valid but their availability must
- * match the redirections configured by the launcher that spawned this
- * process.
- *
- * The \a fhprocess handle represents a handle to the child process.
- * It is only used on Windows as the implementation of wait() needs a
- * process handle.
- */
- child(id_type id, detail::file_handle fhstdin, detail::file_handle fhstdout, detail::file_handle fhstderr, detail::file_handle fhprocess = detail::file_handle())
- : process(id)
-#if defined(BOOST_WINDOWS_API)
- , process_handle_(fhprocess.release(), ::CloseHandle)
-#endif
- {
- if (fhstdin.valid())
- stdin_.reset(new postream(fhstdin));
- if (fhstdout.valid())
- stdout_.reset(new pistream(fhstdout));
- if (fhstderr.valid())
- stderr_.reset(new pistream(fhstderr));
- }
-
-private:
- /**
- * The standard input stream attached to the child process.
- *
- * This postream object holds the communication channel with the
- * child's process standard input. It is stored in a pointer because
- * this field is only valid when the user requested to redirect this
- * data stream.
- */
- boost::shared_ptr stdin_;
-
- /**
- * The standard output stream attached to the child process.
- *
- * This postream object holds the communication channel with the
- * child's process standard output. It is stored in a pointer because
- * this field is only valid when the user requested to redirect this
- * data stream.
- */
- boost::shared_ptr stdout_;
-
- /**
- * The standard error stream attached to the child process.
- *
- * This postream object holds the communication channel with the
- * child's process standard error. It is stored in a pointer because
- * this field is only valid when the user requested to redirect this
- * data stream.
- */
- boost::shared_ptr stderr_;
-
-#if defined(BOOST_WINDOWS_API)
- /**
- * Process handle owned by RAII object.
- */
- boost::shared_ptr process_handle_;
-#endif
-};
-
-/**
- * Collection of child objects.
- *
- * This convenience type represents a collection of child objects backed
- * by a vector.
- */
-typedef std::vector children;
-
-}
-}
-
-#endif
diff --git a/boost/process/config.hpp b/boost/process/config.hpp
deleted file mode 100644
index f240f86b5..000000000
--- a/boost/process/config.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process/config.hpp
- *
- * Defines macros that are used by the library's code to determine the
- * operating system it is running under and the features it supports.
- */
-
-#ifndef BOOST_PROCESS_CONFIG_HPP
-#define BOOST_PROCESS_CONFIG_HPP
-
-#include
-#include
-
-#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN)
-# if !defined(BOOST_PROCESS_POSIX_PATH_MAX)
-/**
- * The macro BOOST_PROCESS_POSIX_PATH_MAX is set to a positive integer
- * value which specifies the system's maximal supported path length.
- * By default it is set to 259. You should set the macro to PATH_MAX
- * which should be defined in limits.h provided by your operating system
- * if you experience problems when instantiating a context. The
- * constructor of basic_work_directory_context tries to find out
- * dynamically the maximal supported path length but uses
- * BOOST_PROCESS_POSIX_PATH_MAX if it fails.
- */
-# define BOOST_PROCESS_POSIX_PATH_MAX 259
-# endif
-#endif
-
-#endif
diff --git a/boost/process/context.hpp b/boost/process/context.hpp
deleted file mode 100644
index 51acd35bc..000000000
--- a/boost/process/context.hpp
+++ /dev/null
@@ -1,209 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process/context.hpp
- *
- * Includes the declaration of the context class and several accessory
- * base classes.
- */
-
-#ifndef BOOST_PROCESS_CONTEXT_HPP
-#define BOOST_PROCESS_CONTEXT_HPP
-
-#include
-
-#if defined(BOOST_POSIX_API)
-# include
-# include
-# include
-#elif defined(BOOST_WINDOWS_API)
-# include
-#else
-# error "Unsupported platform."
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace boost {
-namespace process {
-
-/**
- * Base context class that defines the child's work directory.
- *
- * Base context class that defines the necessary fields to configure a
- * child's work directory. This class is useless on its own because no
- * function in the library will accept it as a valid Context
- * implementation.
- */
-template
-class basic_work_directory_context
-{
-public:
- /**
- * Constructs a new work directory context.
- *
- * Constructs a new work directory context making the work directory
- * described by the new object point to the caller's current working
- * directory.
- */
- basic_work_directory_context()
- {
-#if defined(BOOST_POSIX_API)
- errno = 0;
- long size = ::pathconf(".", _PC_PATH_MAX);
- if (size == -1 && errno)
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::basic_work_directory_context::basic_work_directory_context: pathconf(2) failed"));
- else if (size == -1)
- size = BOOST_PROCESS_POSIX_PATH_MAX;
- boost::scoped_array cwd(new char[size]);
- if (!::getcwd(cwd.get(), size))
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::basic_work_directory_context::basic_work_directory_context: getcwd(2) failed"));
- work_directory = cwd.get();
-#elif defined(BOOST_WINDOWS_API)
- char cwd[MAX_PATH];
- if (!::GetCurrentDirectoryA(sizeof(cwd), cwd))
- boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::basic_work_directory_context::basic_work_directory_context: GetCurrentDirectory failed"));
- work_directory = cwd;
-#endif
- BOOST_ASSERT(!work_directory.empty());
- }
-
- /**
- * The process' initial work directory.
- *
- * The work directory is the directory in which the process starts
- * execution.
- */
- Path work_directory;
-};
-
-/**
- * Base context class that defines the child's environment.
- *
- * Base context class that defines the necessary fields to configure a
- * child's environment variables. This class is useless on its own
- * because no function in the library will accept it as a valid Context
- * implementation.
- */
-class environment_context
-{
-public:
- /**
- * The process' environment.
- *
- * Contains the list of environment variables, alongside with their
- * values, that will be passed to the spawned child process.
- */
- boost::process::environment environment;
-};
-
-/**
- * Process startup execution context.
- *
- * The context class groups all the parameters needed to configure a
- * process' environment during its creation.
- */
-template
-class basic_context : public basic_work_directory_context, public environment_context
-{
-public:
- /**
- * Child's stdin behavior.
- */
- stream_behavior stdin_behavior;
-
- /**
- * Child's stdout behavior.
- */
- stream_behavior stdout_behavior;
-
- /**
- * Child's stderr behavior.
- */
- stream_behavior stderr_behavior;
-};
-
-typedef basic_context context;
-
-/**
- * Represents a child process in a pipeline.
- *
- * This convenience class is a triplet that holds all the data required
- * to spawn a new child process in a pipeline.
- */
-template
-class basic_pipeline_entry
-{
-public:
- /**
- * The executable to launch.
- */
- Executable executable;
-
- /**
- * The set of arguments to pass to the executable.
- */
- Arguments arguments;
-
- /**
- * The child's execution context.
- */
- Context context;
-
- /**
- * The type of the Executable concept used in this template
- * instantiation.
- */
- typedef Executable executable_type;
-
- /**
- * The type of the Arguments concept used in this template
- * instantiation.
- */
- typedef Arguments arguments_type;
-
- /**
- * The type of the Context concept used in this template
- * instantiation.
- */
- typedef Context context_type;
-
- /**
- * Constructs a new pipeline_entry object.
- *
- * Given the executable, set of arguments and execution triplet,
- * constructs a new pipeline_entry object that holds the three
- * values.
- */
- basic_pipeline_entry(const Executable &exe, const Arguments &args, const Context &ctx)
- : executable(exe),
- arguments(args),
- context(ctx)
- {
- }
-};
-
-/**
- * Default instantiation of basic_pipeline_entry.
- */
-typedef basic_pipeline_entry, context> pipeline_entry;
-
-}
-}
-
-#endif
diff --git a/boost/process/detail/file_handle.hpp b/boost/process/detail/file_handle.hpp
deleted file mode 100644
index 33f21d9b6..000000000
--- a/boost/process/detail/file_handle.hpp
+++ /dev/null
@@ -1,406 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process/detail/file_handle.hpp
- *
- * Includes the declaration of the file_handle class. This file is for
- * internal usage only and must not be included by the library user.
- */
-
-#ifndef BOOST_PROCESS_DETAIL_FILE_HANDLE_HPP
-#define BOOST_PROCESS_DETAIL_FILE_HANDLE_HPP
-
-#include
-
-#if defined(BOOST_POSIX_API)
-# include
-# include
-#elif defined(BOOST_WINDOWS_API)
-# include
-#else
-# error "Unsupported platform."
-#endif
-
-#include
-#include
-#include
-
-namespace boost {
-namespace process {
-namespace detail {
-
-/**
- * Simple RAII model for system file handles.
- *
- * The \a file_handle class is a simple RAII model for native system file
- * handles. This class wraps one of such handles grabbing its ownership,
- * and automaticaly closes it upon destruction. It is basically used
- * inside the library to avoid leaking open file handles, shall an
- * unexpected execution trace occur.
- *
- * A \a file_handle object can be copied but doing so invalidates the
- * source object. There can only be a single valid \a file_handle object
- * for a given system file handle. This is similar to std::auto_ptr's
- * semantics.
- *
- * This class also provides some convenience methods to issue special file
- * operations under their respective platforms.
- */
-class file_handle
-{
-public:
-#if defined(BOOST_PROCESS_DOXYGEN)
- /**
- * Opaque name for the native handle type.
- *
- * Each operating system identifies file handles using a specific type.
- * The \a handle_type type is used to transparently refer to file
- * handles regarless of the operating system in which this class is
- * used.
- *
- * If this class is used on a POSIX system, \a NativeSystemHandle is
- * an integer type while it is a \a HANDLE on a Windows system.
- */
- typedef NativeSystemHandle handle_type;
-#elif defined(BOOST_POSIX_API)
- typedef int handle_type;
-#elif defined(BOOST_WINDOWS_API)
- typedef HANDLE handle_type;
-#endif
-
- /**
- * Constructs an invalid file handle.
- *
- * This constructor creates a new \a file_handle object that represents
- * an invalid file handle. An invalid file handle can be copied but
- * cannot be manipulated in any way (except checking for its validity).
- *
- * \see valid()
- */
- file_handle()
- : handle_(invalid_value())
- {
- }
-
- /**
- * Constructs a new file handle from a native file handle.
- *
- * This constructor creates a new \a file_handle object that takes
- * ownership of the given \a h native file handle. The user must not
- * close \a h on his own during the lifetime of the new object.
- * Ownership can be reclaimed using release().
- *
- * \pre The native file handle must be valid; a close operation must
- * succeed on it.
- * \see release()
- */
- file_handle(handle_type h)
- : handle_(h)
- {
- BOOST_ASSERT(handle_ != invalid_value());
- }
-
- /**
- * Copy constructor; invalidates the source handle.
- *
- * This copy constructor creates a new file handle from a given one.
- * Ownership of the native file handle is transferred to the new
- * object, effectively invalidating the source file handle. This
- * avoids having two live \a file_handle objects referring to the
- * same native file handle. The source file handle needs not be
- * valid in the name of simplicity.
- *
- * \post The source file handle is invalid.
- * \post The new file handle owns the source's native file handle.
- */
- file_handle(const file_handle &fh)
- : handle_(fh.handle_)
- {
- fh.handle_ = invalid_value();
- }
-
- /**
- * Releases resources if the handle is valid.
- *
- * If the file handle is valid, the destructor closes it.
- *
- * \see valid()
- */
- ~file_handle()
- {
- if (valid())
- close();
- }
-
- /**
- * Assignment operator; invalidates the source handle.
- *
- * This assignment operator transfers ownership of the RHS file
- * handle to the LHS one, effectively invalidating the source file
- * handle. This avoids having two live \a file_handle objects
- * referring to the same native file handle. The source file
- * handle needs not be valid in the name of simplicity.
- *
- * \post The RHS file handle is invalid.
- * \post The LHS file handle owns RHS' native file handle.
- * \return A reference to the LHS file handle.
- */
- file_handle &operator=(const file_handle &fh)
- {
- handle_ = fh.handle_;
- fh.handle_ = invalid_value();
- return *this;
- }
-
- /**
- * Checks whether the file handle is valid or not.
- *
- * Returns a boolean indicating whether the file handle is valid or
- * not. If the file handle is invalid, no other methods can be
- * executed other than the destructor.
- *
- * \return true if the file handle is valid; false otherwise.
- */
- bool valid() const
- {
- return handle_ != invalid_value();
- }
-
- /**
- * Closes the file handle.
- *
- * Explicitly closes the file handle, which must be valid. Upon
- * exit, the handle is not valid any more.
- *
- * \pre The file handle is valid.
- * \post The file handle is invalid.
- * \post The native file handle is closed.
- */
- void close()
- {
- BOOST_ASSERT(valid());
-
-#if defined(BOOST_POSIX_API)
- ::close(handle_);
-#elif defined(BOOST_WINDOWS_API)
- ::CloseHandle(handle_);
-#endif
-
- handle_ = invalid_value();
- }
-
- /**
- * Reclaims ownership of the native file handle.
- *
- * Explicitly reclaims ownership of the native file handle contained
- * in the \a file_handle object, returning the native file handle.
- * The caller is responsible of closing it later on.
- *
- * \pre The file handle is valid.
- * \post The file handle is invalid.
- * \return The native file handle.
- */
- handle_type release()
- {
- BOOST_ASSERT(valid());
-
- handle_type h = handle_;
- handle_ = invalid_value();
- return h;
- }
-
- /**
- * Gets the native file handle.
- *
- * Returns the native file handle for the \a file_handle object.
- * The caller can issue any operation on it except closing it.
- * If closing is required, release() shall be used.
- *
- * \pre The file handle is valid.
- * \post The file handle is valid.
- * \return The native file handle.
- */
- handle_type get() const
- {
- BOOST_ASSERT(valid());
-
- return handle_;
- }
-
-#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN)
- /**
- * Changes the native file handle to the given one.
- *
- * Given a new native file handle \a h, this operation assigns this
- * handle to the current object, closing its old native file handle.
- * In other words, it first calls dup2() to remap the old handle to
- * the new one and then closes the old handle.
- *
- * If \a h is open, it is automatically closed by dup2().
- *
- * This operation is only available in POSIX systems.
- *
- * \pre The file handle is valid.
- * \pre The native file handle \a h is valid; i.e., it must be
- * closeable.
- * \post The file handle's native file handle is \a h.
- * \throw boost::system::system_error If the internal remapping
- * operation fails.
- */
- void posix_remap(handle_type h)
- {
- BOOST_ASSERT(valid());
-
- if (::dup2(handle_, h) == -1)
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_remap: dup2(2) failed"));
-
- if (::close(handle_) == -1)
- {
- ::close(h);
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_remap: close(2) failed"));
- }
-
- handle_ = h;
- }
-
- /**
- * Duplicates an open native file handle.
- *
- * Given a native file handle \a h1, this routine duplicates it so
- * that it ends up being identified by the native file handle \a h2
- * and returns a new \a file_handle owning \a h2.
- *
- * This operation is only available in POSIX systems.
- *
- * \pre The native file handle \a h1 is open.
- * \pre The native file handle \a h2 is valid (non-negative).
- * \post The native file handle \a h1 is closed.
- * \post The native file handle \a h2 is the same as the old \a h1
- * from the operating system's point of view.
- * \return A new \a file_handle object that owns \a h2.
- * \throw boost::system::system_error If dup2() fails.
- */
- static file_handle posix_dup(int h1, int h2)
- {
- if (::dup2(h1, h2) == -1)
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_dup: dup2(2) failed"));
-
- return file_handle(h2);
- }
-#endif
-
-#if defined(BOOST_WINDOWS_API) || defined(BOOST_PROCESS_DOXYGEN)
- /**
- * Duplicates the \a h native file handle.
- *
- * Given a native file handle \a h, this routine constructs a new
- * \a file_handle object that owns a new duplicate of \a h. The
- * duplicate's inheritable flag is set to the value of \a inheritable.
- *
- * This operation is only available in Windows systems.
- *
- * \pre The native file handle \a h is valid.
- * \return A file handle owning a duplicate of \a h.
- * \throw boost::system::system_error If DuplicateHandle() fails.
- */
- static file_handle win32_dup(HANDLE h, bool inheritable)
- {
- HANDLE h2;
- if (!::DuplicateHandle(::GetCurrentProcess(), h, ::GetCurrentProcess(), &h2, 0, inheritable ? TRUE : FALSE, DUPLICATE_SAME_ACCESS))
- boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::file_handle::win32_dup: DuplicateHandle failed"));
-
- return file_handle(h2);
- }
-
- /**
- * Creates a new duplicate of a standard file handle.
- *
- * Constructs a new \a file_handle object that owns a duplicate of a
- * standard file handle. The \a d parameter specifies which standard
- * file handle to duplicate and can be one of \a STD_INPUT_HANDLE,
- * \a STD_OUTPUT_HANDLE or \a STD_ERROR_HANDLE. The duplicate's
- * inheritable flag is set to the value of \a inheritable.
- *
- * This operation is only available in Windows systems.
- *
- * \pre \a d refers to one of the standard handles as described above.
- * \return A file handle owning a duplicate of the standard handle
- * referred to by \a d.
- * \throw boost::system::system_error If GetStdHandle() or
- * DuplicateHandle() fails.
- */
- static file_handle win32_std(DWORD d, bool inheritable)
- {
- BOOST_ASSERT(d == STD_INPUT_HANDLE || d == STD_OUTPUT_HANDLE || d == STD_ERROR_HANDLE);
-
- HANDLE h = ::GetStdHandle(d);
- if (h == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::file_handle::win32_std: GetStdHandle failed"));
-
- return win32_dup(h, inheritable);
- }
-
- /**
- * Changes the file handle's inheritable flag.
- *
- * Changes the file handle's inheritable flag to \a i. It is not
- * necessary for the file handle's flag to be different than \a i.
- *
- * This operation is only available in Windows systems.
- *
- * \pre The file handle is valid.
- * \post The native file handle's inheritable flag is set to \a i.
- * \throw boost::system::system_error If the property change fails.
- */
- void win32_set_inheritable(bool i)
- {
- BOOST_ASSERT(valid());
-
- if (!::SetHandleInformation(handle_, HANDLE_FLAG_INHERIT, i ? HANDLE_FLAG_INHERIT : 0))
- boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::file_handle::win32_set_inheritable: SetHandleInformation failed"));
- }
-#endif
-
-private:
- /**
- * Internal handle value.
- *
- * This variable holds the native handle value for the file handle
- * hold by this object. It is interesting to note that this needs
- * to be mutable because the copy constructor and the assignment
- * operator invalidate the source object.
- */
- mutable handle_type handle_;
-
- /**
- * Constant function representing an invalid handle value.
- *
- * Returns the platform-specific handle value that represents an
- * invalid handle. This is a constant function rather than a regular
- * constant because, in the latter case, we cannot define it under
- * Windows due to the value being of a complex type.
- */
- static handle_type invalid_value()
- {
-#if defined(BOOST_POSIX_API)
- return -1;
-#elif defined(BOOST_WINDOWS_API)
- return INVALID_HANDLE_VALUE;
-#endif
- }
-};
-
-}
-}
-}
-
-#endif
diff --git a/boost/process/detail/pipe.hpp b/boost/process/detail/pipe.hpp
deleted file mode 100644
index 3c839c228..000000000
--- a/boost/process/detail/pipe.hpp
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process/detail/pipe.hpp
- *
- * Includes the declaration of the pipe class. This file is for
- * internal usage only and must not be included by the library user.
- */
-
-#ifndef BOOST_PROCESS_DETAIL_PIPE_HPP
-#define BOOST_PROCESS_DETAIL_PIPE_HPP
-
-#include
-
-#if defined(BOOST_POSIX_API)
-# include
-# include
-#elif defined(BOOST_WINDOWS_API)
-# if defined(BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE)
-# include
-# include
-# endif
-# include
-#else
-# error "Unsupported platform."
-#endif
-
-#include
-#include
-#include
-
-namespace boost {
-namespace process {
-namespace detail {
-
-/**
- * Simple RAII model for anonymous pipes.
- *
- * The pipe class is a simple RAII model for anonymous pipes. It
- * provides a portable constructor that allocates a new %pipe and creates
- * a pipe object that owns the two file handles associated to it: the
- * read end and the write end.
- *
- * These handles can be retrieved for modification according to
- * file_handle semantics. Optionally, their ownership can be transferred
- * to external \a file_handle objects which comes handy when the two
- * ends need to be used in different places (i.e. after a POSIX fork()
- * system call).
- *
- * Pipes can be copied following the same semantics as file handles.
- * In other words, copying a %pipe object invalidates the source one.
- *
- * \see file_handle
- */
-class pipe
-{
-public:
- /**
- * Creates a new %pipe.
- *
- * The default pipe constructor allocates a new anonymous %pipe
- * and assigns its ownership to the created pipe object. On Windows
- * when the macro BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE is defined
- * a named pipe is created. This is required if asynchronous I/O
- * should be used as asynchronous I/O is only supported by named
- * pipes on Windows.
- *
- * \throw boost::system::system_error If the anonymous %pipe
- * creation fails.
- */
- pipe()
- {
- file_handle::handle_type hs[2];
-
-#if defined(BOOST_POSIX_API)
- if (::pipe(hs) == -1)
- boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::pipe::pipe: pipe(2) failed"));
-#elif defined(BOOST_WINDOWS_API)
- SECURITY_ATTRIBUTES sa;
- ZeroMemory(&sa, sizeof(sa));
- sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = FALSE;
-
-# if defined(BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE)
- static unsigned int nextid = 0;
- std::string pipe = "\\\\.\\pipe\\boost_process_" + boost::lexical_cast(::GetCurrentProcessId()) + "_" + boost::lexical_cast(nextid++);
- hs[0] = ::CreateNamedPipeA(pipe.c_str(), PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, 0, 1, 8192, 8192, 0, &sa);
- if (hs[0] == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category(), "boost::process::detail::pipe::pipe: CreateNamedPipe failed"));
- hs[1] = ::CreateFileA(pipe.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
- if (hs[1] == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category(), "boost::process::detail::pipe::pipe: CreateFile failed"));
-
- OVERLAPPED overlapped;
- ZeroMemory(&overlapped, sizeof(overlapped));
- overlapped.hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
- if (!overlapped.hEvent)
- boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category(), "boost::process::detail::pipe::pipe: CreateEvent failed"));
- BOOL b = ::ConnectNamedPipe(hs[0], &overlapped);
- if (!b)
- {
- if (::GetLastError() == ERROR_IO_PENDING)
- {
- if (::WaitForSingleObject(overlapped.hEvent, INFINITE) == WAIT_FAILED)
- {
- ::CloseHandle(overlapped.hEvent);
- boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category(), "boost::process::detail::pipe::pipe: WaitForSingleObject failed"));
- }
- }
- else if (::GetLastError() != ERROR_PIPE_CONNECTED)
- {
- ::CloseHandle(overlapped.hEvent);
- boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category(), "boost::process::detail::pipe::pipe: ConnectNamedPipe failed"));
- }
- }
- ::CloseHandle(overlapped.hEvent);
-# else
- if (!::CreatePipe(&hs[0], &hs[1], &sa, 0))
- boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category(), "boost::process::detail::pipe::pipe: CreatePipe failed"));
-# endif
-#endif
-
- read_end_ = file_handle(hs[0]);
- write_end_ = file_handle(hs[1]);
- }
-
- /**
- * Returns the %pipe's read end file handle.
- *
- * Obtains a reference to the %pipe's read end file handle. Care
- * should be taken to not duplicate the returned object if ownership
- * shall remain to the %pipe.
- *
- * Duplicating the returned object invalidates its corresponding file
- * handle in the %pipe.
- *
- * \return A reference to the %pipe's read end file handle.
- */
- file_handle &rend()
- {
- return read_end_;
- }
-
- /**
- * Returns the %pipe's write end file handle.
- *
- * Obtains a reference to the %pipe's write end file handle. Care
- * should be taken to not duplicate the returned object if ownership
- * shall remain to the %pipe.
- *
- * Duplicating the returned object invalidates its corresponding file
- * handle in the %pipe.
- *
- * \return A reference to the %pipe's write end file handle.
- */
- file_handle &wend()
- {
- return write_end_;
- }
-
-private:
- /**
- * The %pipe's read end file handle.
- */
- file_handle read_end_;
-
- /**
- * The %pipe's write end file handle.
- */
- file_handle write_end_;
-};
-
-}
-}
-}
-
-#endif
diff --git a/boost/process/detail/posix_ops.hpp b/boost/process/detail/posix_ops.hpp
deleted file mode 100644
index 8c39e0ebf..000000000
--- a/boost/process/detail/posix_ops.hpp
+++ /dev/null
@@ -1,495 +0,0 @@
-//
-// Boost.Process
-// ~~~~~~~~~~~~~
-//
-// Copyright (c) 2006, 2007 Julio M. Merino Vidal
-// Copyright (c) 2008, 2009 Boris Schaeling
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-/**
- * \file boost/process/detail/posix_ops.hpp
- *
- * Provides some convenience functions to start processes under POSIX
- * operating systems.
- */
-
-#ifndef BOOST_PROCESS_DETAIL_POSIX_OPS_HPP
-#define BOOST_PROCESS_DETAIL_POSIX_OPS_HPP
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include