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 -#include -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace process { -namespace detail { - -/** - * Converts the command line to an array of C strings. - * - * Converts the command line's list of arguments to the format expected - * by the \a argv parameter in the POSIX execve() system call. - * - * This operation is only available on POSIX systems. - * - * \return The first argument of the pair is an integer that indicates - * how many strings are stored in the second argument. The - * second argument is a NULL-terminated, dynamically allocated - * array of dynamically allocated strings holding the arguments - * to the executable. The caller is responsible of freeing them. - */ -template -inline std::pair collection_to_posix_argv(const Arguments &args) -{ - std::size_t nargs = args.size(); - BOOST_ASSERT(nargs > 0); - - char **argv = new char*[nargs + 1]; - typename Arguments::size_type i = 0; - for (typename Arguments::const_iterator it = args.begin(); it != args.end(); ++it) - { - argv[i] = new char[it->size() + 1]; - std::strncpy(argv[i], it->c_str(), it->size() + 1); - ++i; - } - argv[nargs] = 0; - - return std::pair(nargs, argv); -} - -/** - * Converts an environment to a char** table as used by execve(). - * - * Converts the environment's contents to the format used by the - * execve() system call. The returned char** array is allocated - * in dynamic memory; the caller must free it when not used any - * more. Each entry is also allocated in dynamic memory and is a - * NULL-terminated string of the form var=value; these must also be - * released by the caller. - * - * \return A dynamically allocated char** array that represents - * the environment's content. Each array entry is a - * NULL-terminated string of the form var=value. - */ -inline char **environment_to_envp(const environment &env) -{ - char **envp = new char*[env.size() + 1]; - - environment::size_type i = 0; - for (environment::const_iterator it = env.begin(); it != env.end(); ++it) - { - std::string s = it->first + "=" + it->second; - envp[i] = new char[s.size() + 1]; - std::strncpy(envp[i], s.c_str(), s.size() + 1); - ++i; - } - envp[i] = 0; - - return envp; -} - -/** - * Holds a mapping between native file descriptors and their corresponding - * pipes to set up communication between the parent and the %child process. - */ -typedef std::map info_map; - -/** - * Helper class to configure a POSIX %child. - * - * This helper class is used to hold all the attributes that configure a - * new POSIX %child process and to centralize all the actions needed to - * make them effective. - * - * All its fields are public for simplicity. It is only intended for - * internal use and it is heavily coupled with the Context - * implementations. - */ -struct posix_setup -{ - /** - * The work directory. - * - * This string specifies the directory in which the %child process - * starts execution. It cannot be empty. - */ - std::string work_directory; - - /** - * The chroot directory, if any. - * - * Specifies the directory in which the %child process is chrooted - * before execution. Empty if this feature is not desired. - */ - std::string chroot; - - /** - * The user credentials. - * - * UID that specifies the user credentials to use to run the %child - * process. Defaults to the current UID. - */ - uid_t uid; - - /** - * The effective user credentials. - * - * EUID that specifies the effective user credentials to use to run - * the %child process. Defaults to the current EUID. - */ - uid_t euid; - - /** - * The group credentials. - * - * GID that specifies the group credentials to use to run the %child - * process. Defaults to the current GID. - */ - gid_t gid; - - /** - * The effective group credentials. - * - * EGID that specifies the effective group credentials to use to run - * the %child process. Defaults to the current EGID. - */ - gid_t egid; - - /** - * Creates a new properties set. - * - * Creates a new object that has sensible default values for all the - * properties. - */ - posix_setup() - : uid(::getuid()), - euid(::geteuid()), - gid(::getgid()), - egid(::getegid()) - { - } - - /** - * Sets up the execution environment. - * - * Modifies the current execution environment (that of the %child) so - * that the properties become effective. - * - * \throw boost::system::system_error If any error ocurred during - * environment configuration. The child process should abort - * execution if this happens because its start conditions - * cannot be met. - */ - void operator()() const - { - if (!chroot.empty() && ::chroot(chroot.c_str()) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_setup: chroot(2) failed")); - - if (gid != ::getgid() && ::setgid(gid) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_setup: setgid(2) failed")); - - if (egid != ::getegid() && ::setegid(egid) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_setup: setegid(2) failed")); - - if (uid != ::getuid() && ::setuid(uid) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_setup: setuid(2) failed")); - - if (euid != ::geteuid() && ::seteuid(euid) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_setup: seteuid(2) failed")); - - BOOST_ASSERT(!work_directory.empty()); - if (::chdir(work_directory.c_str()) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_setup: chdir(2) failed")); - } -}; - -/** - * Configures child process' input streams. - * - * Sets up the current process' input streams to behave according to the - * information in the \a info map. \a closeflags is modified to reflect - * those descriptors that should not be closed because they where modified - * by the function. - * - * Modifies the current execution environment, so this should only be run - * on the child process after the fork(2) has happened. - * - * \throw boost::system::system_error If any error occurs during the - * configuration. - */ -inline void setup_input(info_map &info, bool *closeflags, int maxdescs) -{ - for (info_map::iterator it = info.begin(); it != info.end(); ++it) - { - int d = it->first; - stream_info &si = it->second; - - BOOST_ASSERT(d < maxdescs); - closeflags[d] = false; - - switch (si.type_) - { - case stream_info::use_file: - { - int fd = ::open(si.file_.c_str(), O_RDONLY); - if (fd == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::setup_input: open(2) of " + si.file_ + " failed")); - if (fd != d) - { - file_handle h(fd); - h.posix_remap(d); - h.release(); - } - break; - } - case stream_info::use_handle: - { - if (si.handle_.get() != d) - si.handle_.posix_remap(d); - break; - } - case stream_info::use_pipe: - { - si.pipe_->wend().close(); - if (d != si.pipe_->rend().get()) - si.pipe_->rend().posix_remap(d); - break; - } - default: - { - BOOST_ASSERT(si.type_ == stream_info::inherit); - break; - } - } - } -} - -/** - * Configures child process' output streams. - * - * Sets up the current process' output streams to behave according to the - * information in the \a info map. \a closeflags is modified to reflect - * those descriptors that should not be closed because they where - * modified by the function. - * - * Modifies the current execution environment, so this should only be run - * on the child process after the fork(2) has happened. - * - * \throw boost::system::system_error If any error occurs during the - * configuration. - */ -inline void setup_output(info_map &info, bool *closeflags, int maxdescs) -{ - for (info_map::iterator it = info.begin(); it != info.end(); ++it) - { - int d = it->first; - stream_info &si = it->second; - - BOOST_ASSERT(d < maxdescs); - closeflags[d] = false; - - switch (si.type_) - { - case stream_info::redirect: - { - break; - } - case stream_info::use_file: - { - int fd = ::open(si.file_.c_str(), O_WRONLY); - if (fd == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::setup_output: open(2) of " + si.file_ + " failed")); - if (fd != d) - { - file_handle h(fd); - h.posix_remap(d); - h.release(); - } - break; - } - case stream_info::use_handle: - { - if (si.handle_.get() != d) - si.handle_.posix_remap(d); - break; - } - case stream_info::use_pipe: - { - si.pipe_->rend().close(); - if (d != si.pipe_->wend().get()) - si.pipe_->wend().posix_remap(d); - break; - } - default: - { - BOOST_ASSERT(si.type_ == stream_info::inherit); - break; - } - } - } - - for (info_map::const_iterator it = info.begin(); it != info.end(); ++it) - { - int d = it->first; - const stream_info &si = it->second; - - if (si.type_ == stream_info::redirect) - file_handle::posix_dup(si.desc_to_, d).release(); - } -} - -/** - * Starts a new child process in a POSIX operating system. - * - * This helper functions is provided to simplify the Context's task when - * it comes to starting up a new process in a POSIX operating system. - * The function hides all the details of the fork/exec pair of calls as - * well as all the setup of communication pipes and execution environment. - * - * \param exe The executable to spawn the child process. - * \param args The arguments for the executable. - * \param env The environment variables that the new child process - * receives. - * \param infoin A map describing all input file descriptors to be - * redirected. - * \param infoout A map describing all output file descriptors to be - * redirected. - * \param setup A helper object used to configure the child's execution - * environment. - * \return The new process' PID. The caller is responsible of creating - * an appropriate Child representation for it. - */ -template -inline pid_t posix_start(const Executable &exe, const Arguments &args, const environment &env, info_map &infoin, info_map &infoout, const posix_setup &setup) -{ - pid_t pid = ::fork(); - if (pid == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_start: fork(2) failed")); - else if (pid == 0) - { -#if defined(F_MAXFD) - int maxdescs = ::fcntl(-1, F_MAXFD, 0); - if (maxdescs == -1) - maxdescs = ::sysconf(_SC_OPEN_MAX); -#else - int maxdescs = ::sysconf(_SC_OPEN_MAX); -#endif - if (maxdescs == -1) - maxdescs = 1024; - try - { - boost::scoped_array closeflags(new bool[maxdescs]); - for (int i = 0; i < maxdescs; ++i) - closeflags[i] = true; - - setup_input(infoin, closeflags.get(), maxdescs); - setup_output(infoout, closeflags.get(), maxdescs); - - for (int i = 0; i < maxdescs; ++i) - { - if (closeflags[i]) - ::close(i); - } - - setup(); - } - catch (const boost::system::system_error &e) - { - ::write(STDERR_FILENO, e.what(), std::strlen(e.what())); - ::write(STDERR_FILENO, "\n", 1); - std::exit(EXIT_FAILURE); - } - - std::pair argcv = collection_to_posix_argv(args); - char **envp = environment_to_envp(env); - - ::execve(exe.c_str(), argcv.second, envp); - boost::system::system_error e(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_start: execve(2) failed"); - - for (std::size_t i = 0; i < argcv.first; ++i) - delete[] argcv.second[i]; - delete[] argcv.second; - - for (std::size_t i = 0; i < env.size(); ++i) - delete[] envp[i]; - delete[] envp; - - ::write(STDERR_FILENO, e.what(), std::strlen(e.what())); - ::write(STDERR_FILENO, "\n", 1); - std::exit(EXIT_FAILURE); - } - - BOOST_ASSERT(pid > 0); - - for (info_map::iterator it = infoin.begin(); it != infoin.end(); ++it) - { - stream_info &si = it->second; - if (si.type_ == stream_info::use_pipe) - si.pipe_->rend().close(); - } - - for (info_map::iterator it = infoout.begin(); it != infoout.end(); ++it) - { - stream_info &si = it->second; - if (si.type_ == stream_info::use_pipe) - si.pipe_->wend().close(); - } - - return pid; -} - -/** - * Locates a communication pipe and returns one of its endpoints. - * - * Given a \a info map, and a file descriptor \a desc, searches for its - * communicataion pipe in the map and returns one of its endpoints as - * indicated by the \a out flag. This is intended to be used by a - * parent process after a fork(2) call. - * - * \pre If the info map contains the given descriptor, it is configured - * to use a pipe. - * \post The info map does not contain the given descriptor. - * \return If the file descriptor is found in the map, returns the pipe's - * read end if out is true; otherwise its write end. If the - * descriptor is not found returns an invalid file handle. - */ -inline file_handle posix_info_locate_pipe(info_map &info, int desc, bool out) -{ - file_handle fh; - - info_map::iterator it = info.find(desc); - if (it != info.end()) - { - stream_info &si = it->second; - if (si.type_ == stream_info::use_pipe) - { - fh = out ? si.pipe_->rend().release() : si.pipe_->wend().release(); - BOOST_ASSERT(fh.valid()); - } - info.erase(it); - } - - return fh; -} - -} -} -} - -#endif diff --git a/boost/process/detail/stream_info.hpp b/boost/process/detail/stream_info.hpp deleted file mode 100644 index 89f4b361d..000000000 --- a/boost/process/detail/stream_info.hpp +++ /dev/null @@ -1,176 +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/stream_info.hpp - * - * Provides the definition of the stream_info structure. - */ - -#ifndef BOOST_PROCESS_DETAIL_STREAM_INFO_HPP -#define BOOST_PROCESS_DETAIL_STREAM_INFO_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -#elif defined(BOOST_WINDOWS_API) -#else -# error "Unsupported platform." -#endif - -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace process { -namespace detail { - -/** - * Configuration data for a file descriptor. - * - * This convenience structure provides a compact way to pass information - * around on how to configure a file descriptor. It is a lower-level - * representation of stream_behavior, as it can hold the same information - * but in a way that can be used by the underlying operating system. - */ -struct stream_info -{ - /** - * Supported stream types. - */ - enum type - { - /** - * Matches stream_behavior::close. - */ - close, - - /** - * Matches stream_behavior::inherit. - */ - inherit, - - /** - * Matches stream_behavior::redirect_to_stdout and - * stream_behavior::posix_redirect. - */ - redirect, - - /** - * Matches stream_behavior::silence. - */ - use_file, - - /** - * TODO: Matches nothing yet ... - */ - use_handle, - - /** - * Matches stream_behavior::capture. - */ - use_pipe - }; - - /** - * Stream type. - */ - type type_; - - /** - * Descriptor to use when stream type is set to \a redirect. - */ - int desc_to_; - - /** - * File to use when stream type is set to \a use_file. - */ - std::string file_; - - /** - * Handle to use when stream type is set to \a use_handle. - */ - file_handle handle_; - - /** - * Pipe to use when stream type is set to \a use_pipe. - */ - boost::optional pipe_; - - /** - * Constructs a new stream_info object. - */ - stream_info(const stream_behavior &sb, bool out) - { - switch (sb.type_) - { - case stream_behavior::close: - { - type_ = close; - break; - } - case stream_behavior::inherit: - { - type_ = inherit; - break; - } - case stream_behavior::redirect_to_stdout: - { - type_ = redirect; -#if defined(BOOST_POSIX_API) - desc_to_ = STDOUT_FILENO; -#elif defined(BOOST_WINDOWS_API) - desc_to_ = 1; -#endif - break; - } -#if defined(BOOST_POSIX_API) - case stream_behavior::posix_redirect: - { - type_ = redirect; - desc_to_ = sb.desc_to_; - break; - } -#endif - case stream_behavior::silence: - { - type_ = use_file; -#if defined(BOOST_POSIX_API) - file_ = out ? "/dev/null" : "/dev/zero"; -#elif defined(BOOST_WINDOWS_API) - file_ = "NUL"; -#endif - break; - } - case stream_behavior::capture: - { - type_ = use_pipe; - pipe_ = pipe(); - break; - } - default: - { - BOOST_ASSERT(false); - } - } - } -}; - -} -} -} - -#endif diff --git a/boost/process/detail/systembuf.hpp b/boost/process/detail/systembuf.hpp deleted file mode 100644 index 332e864f2..000000000 --- a/boost/process/detail/systembuf.hpp +++ /dev/null @@ -1,231 +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/systembuf.hpp - * - * Includes the declaration of the systembuf class. This file is for - * internal usage only and must not be included by the library user. - */ - -#ifndef BOOST_PROCESS_DETAIL_SYSTEMBUF_HPP -#define BOOST_PROCESS_DETAIL_SYSTEMBUF_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -# include -#elif defined(BOOST_WINDOWS_API) -# include -#else -# error "Unsupported platform." -#endif - -#include -#include -#include -#include -#include - -namespace boost { -namespace process { - -class postream; - -namespace detail { - -/** - * std::streambuf implementation for system file handles. - * - * systembuf provides a std::streambuf implementation for system file - * handles. Contrarywise to file_handle, this class does \b not take - * ownership of the native file handle; this should be taken care of - * somewhere else. - * - * This class follows the expected semantics of a std::streambuf object. - * However, it is not copyable to avoid introducing inconsistences with - * the on-disk file and the in-memory buffers. - */ -class systembuf : public std::streambuf, public boost::noncopyable -{ - friend class ::boost::process::postream; - -public: -#if defined(BOOST_PROCESS_DOXYGEN) - /** - * Opaque name for the native handle type. - */ - typedef NativeHandleType handle_type; -#elif defined(BOOST_POSIX_API) - typedef int handle_type; -#elif defined(BOOST_WINDOWS_API) - typedef HANDLE handle_type; -#endif - - /** - * Constructs a new systembuf for the given file handle. - * - * This constructor creates a new systembuf object that reads or - * writes data from/to the \a h native file handle. This handle - * is \b not owned by the created systembuf object; the code - * should take care of it externally. - * - * This class buffers input and output; the buffer size may be - * tuned through the \a bufsize parameter, which defaults to 8192 - * bytes. - * - * \see pistream and postream - */ - explicit systembuf(handle_type h, std::size_t bufsize = 8192) - : handle_(h), - bufsize_(bufsize), - read_buf_(new char[bufsize]), - write_buf_(new char[bufsize]) - { -#if defined(BOOST_POSIX_API) - BOOST_ASSERT(handle_ >= 0); -#elif defined(BOOST_WINDOWS_API) - BOOST_ASSERT(handle_ != INVALID_HANDLE_VALUE); -#endif - BOOST_ASSERT(bufsize_ > 0); - - setp(write_buf_.get(), write_buf_.get() + bufsize_); - } - -protected: - /** - * Reads new data from the native file handle. - * - * This operation is called by input methods when there is no more - * data in the input buffer. The function fills the buffer with new - * data, if available. - * - * \pre All input positions are exhausted (gptr() >= egptr()). - * \post The input buffer has new data, if available. - * \returns traits_type::eof() if a read error occurrs or there are - * no more data to be read. Otherwise returns - * traits_type::to_int_type(*gptr()). - */ - virtual int_type underflow() - { - BOOST_ASSERT(gptr() >= egptr()); - - bool ok; -#if defined(BOOST_POSIX_API) - ssize_t cnt = ::read(handle_, read_buf_.get(), bufsize_); - ok = (cnt != -1 && cnt != 0); -#elif defined(BOOST_WINDOWS_API) - DWORD cnt; - BOOL res = ::ReadFile(handle_, read_buf_.get(), bufsize_, &cnt, NULL); - ok = (res && cnt > 0); -#endif - - if (!ok) - return traits_type::eof(); - else - { - setg(read_buf_.get(), read_buf_.get(), read_buf_.get() + cnt); - return traits_type::to_int_type(*gptr()); - } - } - - /** - * Makes room in the write buffer for additional data. - * - * This operation is called by output methods when there is no more - * space in the output buffer to hold a new element. The function - * first flushes the buffer's contents to disk and then clears it to - * leave room for more characters. The given \a c character is - * stored at the beginning of the new space. - * - * \pre All output positions are exhausted (pptr() >= epptr()). - * \post The output buffer has more space if no errors occurred - * during the write to disk. - * \post *(pptr() - 1) is \a c. - * \returns traits_type::eof() if a write error occurrs. Otherwise - * returns traits_type::not_eof(c). - */ - virtual int_type overflow(int c) - { - BOOST_ASSERT(pptr() >= epptr()); - - if (sync() == -1) - return traits_type::eof(); - - if (!traits_type::eq_int_type(c, traits_type::eof())) - { - traits_type::assign(*pptr(), c); - pbump(1); - } - - return traits_type::not_eof(c); - } - - /** - * Flushes the output buffer to disk. - * - * Synchronizes the systembuf buffers with the contents of the file - * associated to this object through the native file handle. The - * output buffer is flushed to disk and cleared to leave new room - * for more data. - * - * \returns 0 on success, -1 if an error occurred. - */ - virtual int sync() - { -#if defined(BOOST_POSIX_API) - ssize_t cnt = pptr() - pbase(); -#elif defined(BOOST_WINDOWS_API) - long cnt = pptr() - pbase(); -#endif - - bool ok; -#if defined(BOOST_POSIX_API) - ok = ::write(handle_, pbase(), cnt) == cnt; -#elif defined(BOOST_WINDOWS_API) - DWORD rcnt; - BOOL res = ::WriteFile(handle_, pbase(), cnt, &rcnt, NULL); - ok = (res && static_cast(rcnt) == cnt); -#endif - - if (ok) - pbump(-cnt); - return ok ? 0 : -1; - } - -private: - /** - * Native file handle used by the systembuf object. - */ - handle_type handle_; - - /** - * Internal buffer size used during read and write operations. - */ - std::size_t bufsize_; - - /** - * Internal buffer used during read operations. - */ - boost::scoped_array read_buf_; - - /** - * Internal buffer used during write operations. - */ - boost::scoped_array write_buf_; -}; - -} -} -} - -#endif diff --git a/boost/process/detail/win32_ops.hpp b/boost/process/detail/win32_ops.hpp deleted file mode 100644 index d84de9b71..000000000 --- a/boost/process/detail/win32_ops.hpp +++ /dev/null @@ -1,355 +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/win32_ops.hpp - * - * Provides some convenience functions to start processes under - * Windows-compatible operating systems. - */ - -#ifndef BOOST_PROCESS_DETAIL_WIN32_OPS_HPP -#define BOOST_PROCESS_DETAIL_WIN32_OPS_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace process { -namespace detail { - -/** - * Converts the command line to a plain string. Converts the command line's - * list of arguments to the format expected by the \a lpCommandLine parameter - * in the CreateProcess() system call. - * - * This operation is only available on Windows systems. - * - * \return A dynamically allocated string holding the command line - * to be passed to the executable. It is returned in a - * shared_array object to ensure its release at some point. - */ -template -inline boost::shared_array collection_to_win32_cmdline(const Arguments &args) -{ - typedef std::vector arguments_t; - arguments_t args2; - typename Arguments::size_type i = 0; - std::size_t size = 0; - for (typename Arguments::const_iterator it = args.begin(); it != args.end(); ++it) - { - std::string arg = *it; - - std::string::size_type pos = 0; - while ( (pos = arg.find('"', pos)) != std::string::npos) - { - arg.replace(pos, 1, "\\\""); - pos += 2; - } - - if (arg.find(' ') != std::string::npos) - arg = '\"' + arg + '\"'; - - if (i++ != args.size() - 1) - arg += ' '; - - args2.push_back(arg); - size += arg.size() + 1; - } - - boost::shared_array cmdline(new char[size]); - cmdline.get()[0] = '\0'; - for (arguments_t::size_type i = 0; i < args.size(); ++i) -#if defined(__CYGWIN__) - ::strncat(cmdline.get(), args2[i].c_str(), args2[i].size()); -#else - ::strcat_s(cmdline.get(), size, args2[i].c_str()); -#endif - - return cmdline; -} - -/** - * Converts an environment to a string used by CreateProcess(). - * - * Converts the environment's contents to the format used by the - * CreateProcess() system call. The returned char* string is - * allocated in dynamic memory; the caller must free it when not - * used any more. This is enforced by the use of a shared pointer. - * - * \return A dynamically allocated char* string that represents - * the environment's content. This string is of the form - * var1=value1\\0var2=value2\\0\\0. - */ -inline boost::shared_array environment_to_win32_strings(const environment &env) -{ - boost::shared_array envp; - - if (env.empty()) - { - envp.reset(new char[2]); - ::ZeroMemory(envp.get(), 2); - } - else - { - std::string s; - for (environment::const_iterator it = env.begin(); it != env.end(); ++it) - { - s += it->first + "=" + it->second; - s.push_back(0); - } - - envp.reset(new char[s.size() + 1]); -#if defined(__CYGWIN__) - ::memcpy(envp.get(), s.c_str(), s.size() + 1); -#else - ::memcpy_s(envp.get(), s.size() + 1, s.c_str(), s.size() + 1); -#endif - } - - return envp; -} - -/** - * Helper class to configure a Win32 %child. - * - * This helper class is used to hold all the attributes that configure a - * new Win32 %child process. - * - * All its fields are public for simplicity. It is only intended for - * internal use and it is heavily coupled with the Context - * implementations. - */ -struct win32_setup -{ - /** - * The work directory. - * - * This string specifies the directory in which the %child process - * starts execution. It cannot be empty. - */ - std::string work_directory; - - /** - * The process startup properties. - * - * This Win32-specific object holds a list of properties that describe - * how the new process should be started. The \a STARTF_USESTDHANDLES - * flag should not be set in it because it is automatically configured - * by win32_start(). - */ - STARTUPINFOA *startupinfo; -}; - -/** - * Starts a new child process in a Win32 operating system. - * - * This helper functions is provided to simplify the Context's task when - * it comes to starting up a new process in a Win32 operating system. - * - * \param exe The executable to spawn the child process. - * \param args The arguments for the executable. - * \param env The environment variables that the new child process - * receives. - * \param infoin Information that describes stdin's behavior. - * \param infoout Information that describes stdout's behavior. - * \param infoerr Information that describes stderr's behavior. - * \param setup A helper object holding extra child information. - * \return The new process' information as returned by the CreateProcess() - * system call. The caller is responsible of creating an - * appropriate Child representation for it. - * \pre \a setup.startupinfo_ cannot have the \a STARTF_USESTDHANDLES set - * in the \a dwFlags field. - */ -template -inline PROCESS_INFORMATION win32_start(const Executable &exe, const Arguments &args, const environment &env, stream_info &infoin, stream_info &infoout, stream_info &infoerr, const win32_setup &setup) -{ - file_handle chin, chout, cherr; - - BOOST_ASSERT(setup.startupinfo->cb >= sizeof(STARTUPINFOA)); - BOOST_ASSERT(!(setup.startupinfo->dwFlags & STARTF_USESTDHANDLES)); - - boost::scoped_ptr si(new STARTUPINFOA); - ::CopyMemory(si.get(), setup.startupinfo, sizeof(*setup.startupinfo)); - si->dwFlags |= STARTF_USESTDHANDLES; - - switch (infoin.type_) - { - case stream_info::close: - { - break; - } - case stream_info::inherit: - { - chin = file_handle::win32_std(STD_INPUT_HANDLE, true); - break; - } - case stream_info::use_file: - { - HANDLE h = ::CreateFileA(infoin.file_.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - 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::win32_start: CreateFile failed")); - chin = file_handle(h); - break; - } - case stream_info::use_handle: - { - chin = infoin.handle_; - chin.win32_set_inheritable(true); - break; - } - case stream_info::use_pipe: - { - infoin.pipe_->rend().win32_set_inheritable(true); - chin = infoin.pipe_->rend(); - break; - } - default: - { - BOOST_ASSERT(false); - break; - } - } - - si->hStdInput = chin.valid() ? chin.get() : INVALID_HANDLE_VALUE; - - switch (infoout.type_) - { - case stream_info::close: - { - break; - } - case stream_info::inherit: - { - chout = file_handle::win32_std(STD_OUTPUT_HANDLE, true); - break; - } - case stream_info::use_file: - { - HANDLE h = ::CreateFileA(infoout.file_.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - 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::win32_start: CreateFile failed")); - chout = file_handle(h); - break; - } - case stream_info::use_handle: - { - chout = infoout.handle_; - chout.win32_set_inheritable(true); - break; - } - case stream_info::use_pipe: - { - infoout.pipe_->wend().win32_set_inheritable(true); - chout = infoout.pipe_->wend(); - break; - } - default: - { - BOOST_ASSERT(false); - break; - } - } - - si->hStdOutput = chout.valid() ? chout.get() : INVALID_HANDLE_VALUE; - - switch (infoerr.type_) - { - case stream_info::close: - { - break; - } - case stream_info::inherit: - { - cherr = file_handle::win32_std(STD_ERROR_HANDLE, true); - break; - } - case stream_info::redirect: - { - BOOST_ASSERT(infoerr.desc_to_ == 1); - BOOST_ASSERT(chout.valid()); - cherr = file_handle::win32_dup(chout.get(), true); - break; - } - case stream_info::use_file: - { - HANDLE h = ::CreateFileA(infoerr.file_.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - 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::win32_start: CreateFile failed")); - cherr = file_handle(h); - break; - } - case stream_info::use_handle: - { - cherr = infoerr.handle_; - cherr.win32_set_inheritable(true); - break; - } - case stream_info::use_pipe: - { - infoerr.pipe_->wend().win32_set_inheritable(true); - cherr = infoerr.pipe_->wend(); - break; - } - default: - { - BOOST_ASSERT(false); - break; - } - } - - si->hStdError = cherr.valid() ? cherr.get() : INVALID_HANDLE_VALUE; - - PROCESS_INFORMATION pi; - ::ZeroMemory(&pi, sizeof(pi)); - - boost::shared_array cmdline = collection_to_win32_cmdline(args); - - boost::scoped_array executable(new char[exe.size() + 1]); -#if defined(__CYGWIN__) - ::strcpy(executable.get(), exe.c_str()); -#else - ::strcpy_s(executable.get(), exe.size() + 1, exe.c_str()); -#endif - - boost::scoped_array workdir(new char[setup.work_directory.size() + 1]); -#if defined(__CYGWIN__) - ::strcpy(workdir.get(), setup.work_directory.c_str()); -#else - ::strcpy_s(workdir.get(), setup.work_directory.size() + 1, setup.work_directory.c_str()); -#endif - - boost::shared_array envstrs = environment_to_win32_strings(env); - - if (!::CreateProcessA(executable.get()[0] ? executable.get() : NULL, cmdline.get(), NULL, NULL, TRUE, CREATE_NO_WINDOW, envstrs.get(), workdir.get(), si.get(), &pi)) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateProcess failed")); - - return pi; -} - -} -} -} - -#endif diff --git a/boost/process/environment.hpp b/boost/process/environment.hpp deleted file mode 100644 index be73ed390..000000000 --- a/boost/process/environment.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/environment.hpp - * - * Includes the declaration of the environment class. - */ - -#ifndef BOOST_PROCESS_ENVIRONMENT_HPP -#define BOOST_PROCESS_ENVIRONMENT_HPP - -#include -#include - -namespace boost { -namespace process { - -/** - * Representation of a process' environment variables. - * - * The environment is a map that stablishes an unidirectional - * association between variable names and their values and is - * represented by a string to string map. - * - * Variables may be defined to the empty string. Be aware that doing so - * is not portable: POSIX systems will treat such variables as being - * defined to the empty value, but Windows systems are not able to - * distinguish them from undefined variables. - * - * Neither POSIX nor Windows systems support a variable with no name. - * - * It is worthy to note that the environment is sorted alphabetically. - * This is provided for-free by the map container used to implement this - * type, and this behavior is required by Windows systems. - */ -typedef std::map environment; - -} -} - -#endif diff --git a/boost/process/operations.hpp b/boost/process/operations.hpp deleted file mode 100644 index f11d3b423..000000000 --- a/boost/process/operations.hpp +++ /dev/null @@ -1,583 +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/operations.hpp - * - * Provides miscellaneous free functions. - */ - -#ifndef BOOST_PROCESS_OPERATIONS_HPP -#define BOOST_PROCESS_OPERATIONS_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -# include -# include -# if defined(__CYGWIN__) -# include -# include -# endif -#elif defined(BOOST_WINDOWS_API) -# include -# include -# include -#else -# error "Unsupported platform." -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Locates the executable program \a file in all the directory components - * specified in \a path. If \a path is empty, the value of the PATH - * environment variable is used. - * - * The path variable is interpreted following the same conventions used - * to parse the PATH environment variable in the underlying platform. - * - * \throw boost::filesystem::filesystem_error If the file cannot be found - * in the path. - */ -inline std::string find_executable_in_path(const std::string &file, std::string path = "") -{ -#if defined(BOOST_POSIX_API) - BOOST_ASSERT(file.find('/') == std::string::npos); -#elif defined(BOOST_WINDOWS_API) - BOOST_ASSERT(file.find_first_of("\\/") == std::string::npos); -#endif - - std::string result; - -#if defined(BOOST_POSIX_API) - if (path.empty()) - { - const char *envpath = ::getenv("PATH"); -// if (!envpath) - // boost::throw_exception(boost::filesystem::filesystem_error("boost::process::find_executable_in_path: retrieving PATH failed", file, boost::system::errc::make_error_code(boost::system::errc::no_such_file_or_directory))); - - path = envpath; - } - BOOST_ASSERT(!path.empty()); - -#if defined(__CYGWIN__) - if (!::cygwin_posix_path_list_p(path.c_str())) - { - int size = ::cygwin_win32_to_posix_path_list_buf_size(path.c_str()); - boost::scoped_array cygpath(new char[size]); - ::cygwin_win32_to_posix_path_list(path.c_str(), cygpath.get()); - path = cygpath.get(); - } -#endif - - std::string::size_type pos1 = 0, pos2; - do - { - pos2 = path.find(':', pos1); - std::string dir = (pos2 != std::string::npos) ? path.substr(pos1, pos2 - pos1) : path.substr(pos1); - std::string f = dir + (boost::algorithm::ends_with(dir, "/") ? "" : "/") + file; - if (!::access(f.c_str(), X_OK)) - result = f; - pos1 = pos2 + 1; - } while (pos2 != std::string::npos && result.empty()); -#elif defined(BOOST_WINDOWS_API) - const char *exts[] = { "", ".exe", ".com", ".bat", NULL }; - const char **ext = exts; - while (*ext) - { - char buf[MAX_PATH]; - char *dummy; - DWORD size = ::SearchPathA(path.empty() ? NULL : path.c_str(), file.c_str(), *ext, MAX_PATH, buf, &dummy); - BOOST_ASSERT(size < MAX_PATH); - if (size > 0) - { - result = buf; - break; - } - ++ext; - } -#endif - - // if (result.empty()) -// boost::throw_exception(boost::filesystem::filesystem_error("boost::process::find_executable_in_path: file not found", file, boost::system::errc::make_error_code(boost::system::errc::no_such_file_or_directory))); - - return result; -} - -/** - * Extracts the program name from a given executable. - * - * \return The program name. On Windows the program name - * is returned without a file extension. - */ -inline std::string executable_to_progname(const std::string &exe) -{ - std::string::size_type begin = 0; - std::string::size_type end = std::string::npos; - -#if defined(BOOST_POSIX_API) - std::string::size_type slash = exe.rfind('/'); -#elif defined(BOOST_WINDOWS_API) - std::string::size_type slash = exe.find_last_of("/\\"); -#endif - if (slash != std::string::npos) - begin = slash + 1; - -#if defined(BOOST_WINDOWS_API) - if (exe.size() > 4 && - (boost::algorithm::iends_with(exe, ".exe") || boost::algorithm::iends_with(exe, ".com") || boost::algorithm::iends_with(exe, ".bat"))) - end = exe.size() - 4; -#endif - - return exe.substr(begin, end - begin); -} - -/** - * Starts a new child process. - * - * Launches a new process based on the binary image specified by the - * executable, the set of arguments to be passed to it and several - * parameters that describe the execution context. - * - * \remark Blocking remarks: This function may block if the device - * holding the executable blocks when loading the image. This might - * happen if, e.g., the binary is being loaded from a network share. - * - * \return A handle to the new child process. - */ -template -inline child launch(const Executable &exe, const Arguments &args, const Context &ctx) -{ - detail::file_handle fhstdin, fhstdout, fhstderr; - - BOOST_ASSERT(!args.empty()); - BOOST_ASSERT(!ctx.work_directory.empty()); - -#if defined(BOOST_POSIX_API) - detail::info_map infoin, infoout; - - if (ctx.stdin_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stdin_behavior, false); - infoin.insert(detail::info_map::value_type(STDIN_FILENO, si)); - } - - if (ctx.stdout_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stdout_behavior, true); - infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si)); - } - - if (ctx.stderr_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stderr_behavior, true); - infoout.insert(detail::info_map::value_type(STDERR_FILENO, si)); - } - - detail::posix_setup s; - s.work_directory = ctx.work_directory; - - child::id_type pid = detail::posix_start(exe, args, ctx.environment, infoin, infoout, s); - - if (ctx.stdin_behavior.get_type() == stream_behavior::capture) - { - fhstdin = detail::posix_info_locate_pipe(infoin, STDIN_FILENO, false); - BOOST_ASSERT(fhstdin.valid()); - } - - if (ctx.stdout_behavior.get_type() == stream_behavior::capture) - { - fhstdout = detail::posix_info_locate_pipe(infoout, STDOUT_FILENO, true); - BOOST_ASSERT(fhstdout.valid()); - } - - if (ctx.stderr_behavior.get_type() == stream_behavior::capture) - { - fhstderr = detail::posix_info_locate_pipe(infoout, STDERR_FILENO, true); - BOOST_ASSERT(fhstderr.valid()); - } - - return child(pid, fhstdin, fhstdout, fhstderr); -#elif defined(BOOST_WINDOWS_API) - detail::stream_info behin = detail::stream_info(ctx.stdin_behavior, false); - if (behin.type_ == detail::stream_info::use_pipe) - fhstdin = behin.pipe_->wend(); - detail::stream_info behout = detail::stream_info(ctx.stdout_behavior, true); - if (behout.type_ == detail::stream_info::use_pipe) - fhstdout = behout.pipe_->rend(); - detail::stream_info beherr = detail::stream_info(ctx.stderr_behavior, true); - if (beherr.type_ == detail::stream_info::use_pipe) - fhstderr = beherr.pipe_->rend(); - - STARTUPINFOA si; - ::ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - - detail::win32_setup s; - s.work_directory = ctx.work_directory; - s.startupinfo = &si; - - PROCESS_INFORMATION pi = detail::win32_start(exe, args, ctx.environment, behin, behout, beherr, s); - - if (!::CloseHandle(pi.hThread)) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::launch: CloseHandle failed")); - - return child(pi.dwProcessId, fhstdin, fhstdout, fhstderr, detail::file_handle(pi.hProcess)); -#endif -} - -/** - * Launches a shell-based command. - * - * Executes the given command through the default system shell. The - * command is subject to pattern expansion, redirection and pipelining. - * The shell is launched as described by the parameters in the execution - * context. - * - * This function behaves similarly to the system(3) system call. In a - * POSIX system, the command is fed to /bin/sh whereas under a Windows - * system, it is fed to cmd.exe. It is difficult to write portable - * commands as the first parameter, but this function comes in handy in - * multiple situations. - */ -template -inline child launch_shell(const std::string &command, const Context &ctx) -{ - std::string exe; - std::vector args; - -#if defined(BOOST_POSIX_API) - exe = "/bin/sh"; - args.push_back("sh"); - args.push_back("-c"); - args.push_back(command); -#elif defined(BOOST_WINDOWS_API) - char sysdir[MAX_PATH]; - UINT size = ::GetSystemDirectoryA(sysdir, sizeof(sysdir)); - if (!size) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::launch_shell: GetWindowsDirectory failed")); - BOOST_ASSERT(size < MAX_PATH); - - exe = std::string(sysdir) + (sysdir[size - 1] != '\\' ? "\\cmd.exe" : "cmd.exe"); - args.push_back("cmd"); - args.push_back("/c"); - args.push_back(command); -#endif - - return launch(exe, args, ctx); -} - -/** - * Launches a pipelined set of child processes. - * - * Given a collection of pipeline_entry objects describing how to launch - * a set of child processes, spawns them all and connects their inputs and - * outputs in a way that permits pipelined communication. - * - * \pre Let 1..N be the processes in the collection: the input behavior of - * the 2..N processes must be set to close_stream(). - * \pre Let 1..N be the processes in the collection: the output behavior of - * the 1..N-1 processes must be set to close_stream(). - * \remark Blocking remarks: This function may block if the device holding - * the executable of one of the entries blocks when loading the - * image. This might happen if, e.g., the binary is being loaded - * from a network share. - * \return A set of Child objects that represent all the processes spawned - * by this call. You should use wait_children() to wait for their - * termination. - */ -template -inline children launch_pipeline(const Entries &entries) -{ - BOOST_ASSERT(entries.size() >= 2); - - children cs; - detail::file_handle fhinvalid; - - boost::scoped_array pipes(new detail::pipe[entries.size() - 1]); - -#if defined(BOOST_POSIX_API) - { - typename Entries::size_type i = 0; - const typename Entries::value_type::context_type &ctx = entries[i].context; - - detail::info_map infoin, infoout; - - if (ctx.stdin_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stdin_behavior, false); - infoin.insert(detail::info_map::value_type(STDIN_FILENO, si)); - } - - BOOST_ASSERT(ctx.stdout_behavior.get_type() == stream_behavior::close); - detail::stream_info si2(close_stream(), true); - si2.type_ = detail::stream_info::use_handle; - si2.handle_ = pipes[i].wend().release(); - infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si2)); - - if (ctx.stderr_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stderr_behavior, true); - infoout.insert(detail::info_map::value_type(STDERR_FILENO, si)); - } - - detail::posix_setup s; - s.work_directory = ctx.work_directory; - - pid_t pid = detail::posix_start(entries[i].executable, entries[i].arguments, ctx.environment, infoin, infoout, s); - - detail::file_handle fhstdin; - - if (ctx.stdin_behavior.get_type() == stream_behavior::capture) - { - fhstdin = detail::posix_info_locate_pipe(infoin, STDIN_FILENO, false); - BOOST_ASSERT(fhstdin.valid()); - } - - cs.push_back(child(pid, fhstdin, fhinvalid, fhinvalid)); - } - - for (typename Entries::size_type i = 1; i < entries.size() - 1; ++i) - { - const typename Entries::value_type::context_type &ctx = entries[i].context; - detail::info_map infoin, infoout; - - BOOST_ASSERT(ctx.stdin_behavior.get_type() == stream_behavior::close); - detail::stream_info si1(close_stream(), false); - si1.type_ = detail::stream_info::use_handle; - si1.handle_ = pipes[i - 1].rend().release(); - infoin.insert(detail::info_map::value_type(STDIN_FILENO, si1)); - - BOOST_ASSERT(ctx.stdout_behavior.get_type() == stream_behavior::close); - detail::stream_info si2(close_stream(), true); - si2.type_ = detail::stream_info::use_handle; - si2.handle_ = pipes[i].wend().release(); - infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si2)); - - if (ctx.stderr_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stderr_behavior, true); - infoout.insert(detail::info_map::value_type(STDERR_FILENO, si)); - } - - detail::posix_setup s; - s.work_directory = ctx.work_directory; - - pid_t pid = detail::posix_start(entries[i].executable, entries[i].arguments, ctx.environment, infoin, infoout, s); - - cs.push_back(child(pid, fhinvalid, fhinvalid, fhinvalid)); - } - - { - typename Entries::size_type i = entries.size() - 1; - const typename Entries::value_type::context_type &ctx = entries[i].context; - - detail::info_map infoin, infoout; - - BOOST_ASSERT(ctx.stdin_behavior.get_type() == stream_behavior::close); - detail::stream_info si1(close_stream(), false); - si1.type_ = detail::stream_info::use_handle; - si1.handle_ = pipes[i - 1].rend().release(); - infoin.insert(detail::info_map::value_type(STDIN_FILENO, si1)); - - if (ctx.stdout_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stdout_behavior, true); - infoout.insert(detail::info_map::value_type(STDOUT_FILENO, si)); - } - - if (ctx.stderr_behavior.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(ctx.stderr_behavior, true); - infoout.insert(detail::info_map::value_type(STDERR_FILENO, si)); - } - - detail::posix_setup s; - s.work_directory = ctx.work_directory; - - pid_t pid = detail::posix_start(entries[i].executable, entries[i].arguments, ctx.environment, infoin, infoout, s); - - detail::file_handle fhstdout, fhstderr; - - if (ctx.stdout_behavior.get_type() == stream_behavior::capture) - { - fhstdout = detail::posix_info_locate_pipe(infoout, STDOUT_FILENO, true); - BOOST_ASSERT(fhstdout.valid()); - } - - if (ctx.stderr_behavior.get_type() == stream_behavior::capture) - { - fhstderr = detail::posix_info_locate_pipe(infoout, STDERR_FILENO, true); - BOOST_ASSERT(fhstderr.valid()); - } - - cs.push_back(child(pid, fhinvalid, fhstdout, fhstderr)); - } -#elif defined(BOOST_WINDOWS_API) - STARTUPINFOA si; - detail::win32_setup s; - s.startupinfo = &si; - - { - typename Entries::size_type i = 0; - const typename Entries::value_type::context_type &ctx = entries[i].context; - - detail::stream_info sii = detail::stream_info(ctx.stdin_behavior, false); - detail::file_handle fhstdin; - if (sii.type_ == detail::stream_info::use_pipe) - fhstdin = sii.pipe_->wend(); - - BOOST_ASSERT(ctx.stdout_behavior.get_type() == stream_behavior::close); - detail::stream_info sio(close_stream(), true); - sio.type_ = detail::stream_info::use_handle; - sio.handle_ = pipes[i].wend().release(); - - detail::stream_info sie(ctx.stderr_behavior, true); - - s.work_directory = ctx.work_directory; - - ::ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - PROCESS_INFORMATION pi = detail::win32_start(entries[i].executable, entries[i].arguments, ctx.environment, sii, sio, sie, s); - - if (!::CloseHandle(pi.hThread)) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::launch_pipeline: CloseHandle failed")); - - cs.push_back(child(pi.dwProcessId, fhstdin, fhinvalid, fhinvalid, detail::file_handle(pi.hProcess))); - } - - for (typename Entries::size_type i = 1; i < entries.size() - 1; ++i) - { - const typename Entries::value_type::context_type &ctx = entries[i].context; - - BOOST_ASSERT(ctx.stdin_behavior.get_type() == stream_behavior::close); - detail::stream_info sii(close_stream(), false); - sii.type_ = detail::stream_info::use_handle; - sii.handle_ = pipes[i - 1].rend().release(); - - detail::stream_info sio(close_stream(), true); - sio.type_ = detail::stream_info::use_handle; - sio.handle_ = pipes[i].wend().release(); - - detail::stream_info sie(ctx.stderr_behavior, true); - - s.work_directory = ctx.work_directory; - - ::ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - PROCESS_INFORMATION pi = detail::win32_start(entries[i].executable, entries[i].arguments, ctx.environment, sii, sio, sie, s); - - if (!::CloseHandle(pi.hThread)) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::launch_pipeline: CloseHandle failed")); - - cs.push_back(child(pi.dwProcessId, fhinvalid, fhinvalid, fhinvalid, detail::file_handle(pi.hProcess))); - } - - { - typename Entries::size_type i = entries.size() - 1; - const typename Entries::value_type::context_type &ctx = entries[i].context; - - BOOST_ASSERT(ctx.stdin_behavior.get_type() == stream_behavior::close); - detail::stream_info sii(close_stream(), false); - sii.type_ = detail::stream_info::use_handle; - sii.handle_ = pipes[i - 1].rend().release(); - - detail::file_handle fhstdout, fhstderr; - - detail::stream_info sio(ctx.stdout_behavior, true); - if (sio.type_ == detail::stream_info::use_pipe) - fhstdout = sio.pipe_->rend(); - detail::stream_info sie(ctx.stderr_behavior, true); - if (sie.type_ == detail::stream_info::use_pipe) - fhstderr = sie.pipe_->rend(); - - s.work_directory = ctx.work_directory; - - ::ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - PROCESS_INFORMATION pi = detail::win32_start(entries[i].executable, entries[i].arguments, ctx.environment, sii, sio, sie, s); - - if (!::CloseHandle(pi.hThread)) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::launch_pipeline: CloseHandle failed")); - - cs.push_back(child(pi.dwProcessId, fhinvalid, fhstdout, fhstderr, detail::file_handle(pi.hProcess))); - } -#endif - - return cs; -} - -/** - * Waits for a collection of children to terminate. - * - * Given a collection of Child objects (such as std::vector or - * the convenience children type), waits for the termination of all of - * them. - * - * \remark Blocking remarks: This call blocks if any of the children - * processes in the collection has not finalized execution and - * waits until it terminates. - * - * \return The exit status of the first process that returns an error - * code or, if all of them executed correctly, the exit status - * of the last process in the collection. - */ -template -inline status wait_children(Children &cs) -{ - BOOST_ASSERT(cs.size() >= 2); - - typename Children::iterator it = cs.begin(); - while (it != cs.end()) - { - const status s = it->wait(); - ++it; - if (it == cs.end()) - return s; - else if (!s.exited() || s.exit_status() != EXIT_SUCCESS) - { - while (it != cs.end()) - { - it->wait(); - ++it; - } - return s; - } - } - - BOOST_ASSERT(false); - return cs.begin()->wait(); -} - -} -} - -#endif diff --git a/boost/process/pistream.hpp b/boost/process/pistream.hpp deleted file mode 100644 index 958a222d8..000000000 --- a/boost/process/pistream.hpp +++ /dev/null @@ -1,116 +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/pistream.hpp - * - * Includes the declaration of the pistream class. - */ - -#ifndef BOOST_PROCESS_PISTREAM_HPP -#define BOOST_PROCESS_PISTREAM_HPP - -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Child process' output stream. - * - * The pistream class represents an output communication channel with the - * child process. The child process writes data to this stream and the - * parent process can read it through the pistream object. In other - * words, from the child's point of view, the communication channel is an - * output one, but from the parent's point of view it is an input one; - * hence the confusing pistream name. - * - * pistream objects cannot be copied because they own the file handle - * they use to communicate with the child and because they buffer data - * that flows through the communication channel. - * - * A pistream object behaves as a std::istream stream in all senses. - * The class is only provided because it must provide a method to let - * the caller explicitly close the communication channel. - * - * \remark Blocking remarks: Functions that read data from this - * stream can block if the associated file handle blocks during - * the read. As this class is used to communicate with child - * processes through anonymous pipes, the most typical blocking - * condition happens when the child has no more data to send to - * the pipe's system buffer. When this happens, the buffer - * eventually empties and the system blocks until the writer - * generates some data. - */ -class pistream : public std::istream, public boost::noncopyable -{ -public: - /** - * Creates a new process' output stream. - * - * Given a file handle, this constructor creates a new pistream - * object that owns the given file handle \a fh. Ownership of - * \a fh is transferred to the created pistream object. - * - * \pre \a fh is valid. - * \post \a fh is invalid. - * \post The new pistream object owns \a fh. - */ - explicit pistream(detail::file_handle &fh) - : std::istream(0), - handle_(fh), - systembuf_(handle_.get()) - { - rdbuf(&systembuf_); - } - - /** - * Returns the file handle managed by this stream. - * - * The file handle must not be copied. Copying invalidates - * the source file handle making the pistream unusable. - */ - detail::file_handle &handle() - { - return handle_; - } - - /** - * Closes the file handle managed by this stream. - * - * Explicitly closes the file handle managed by this stream. This - * function can be used by the user to tell the child process it's - * not willing to receive more data. - */ - void close() - { - handle_.close(); - } - -private: - /** - * The file handle managed by this stream. - */ - detail::file_handle handle_; - - /** - * The systembuf object used to manage this stream's data. - */ - detail::systembuf systembuf_; -}; - -} -} - -#endif diff --git a/boost/process/posix_child.hpp b/boost/process/posix_child.hpp deleted file mode 100644 index 62bdc3180..000000000 --- a/boost/process/posix_child.hpp +++ /dev/null @@ -1,178 +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/posix_child.hpp - * - * Includes the declaration of the posix_child class. - */ - -#ifndef BOOST_PROCESS_POSIX_CHILD_HPP -#define BOOST_PROCESS_POSIX_CHILD_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * POSIX implementation of the Child concept. - * - * The posix_child class implements the Child concept in a POSIX - * operating system. - * - * A POSIX child differs from a regular child (represented by a - * child object) in that it supports more than three communication - * channels with its parent. These channels are identified by regular - * file descriptors (integers). - * - * This class is built on top of the generic child so as to allow its - * trivial adoption. When a program is changed to use the POSIX-specific - * context (posix_context), it will most certainly need to migrate its - * use of the child class to posix_child. Doing so is only a matter of - * redefining the appropriate object and later using the required extra - * features: there should be no need to modify the existing code (e.g. - * method calls) in any other way. - */ -class posix_child : public child -{ -public: - /** - * Gets a reference to the child's input stream \a desc. - * - * Returns a reference to a postream object that represents one of - * the multiple input communication channels with the child process. - * The channel is identified by \a desc as seen from the child's - * point of view. The parent can use the returned stream to send - * data to the child. - * - * Giving this function the STDIN_FILENO constant (defined in - * unistd.h) is a synonym for the get_stdin() call inherited from - * child. - */ - postream &get_input(int desc) const - { - if (desc == STDIN_FILENO) - return posix_child::get_stdin(); - else - { - input_map_t::const_iterator it = input_map_.find(desc); - BOOST_ASSERT(it != input_map_.end()); - return *it->second; - } - } - - /** - * Gets a reference to the child's output stream \a desc. - * - * Returns a reference to a pistream object that represents one of - * the multiple output communication channels with the child process. - * The channel is identified by \a desc as seen from the child's - * point of view. The parent can use the returned stream to retrieve - * data from the child. - * - * Giving this function the STDOUT_FILENO or STDERR_FILENO constants - * (both defined in unistd.h) are synonyms for the get_stdout() and - * get_stderr() calls inherited from child, respectively. - */ - pistream &get_output(int desc) const - { - if (desc == STDOUT_FILENO) - return posix_child::get_stdout(); - else if (desc == STDERR_FILENO) - return posix_child::get_stderr(); - else - { - output_map_t::const_iterator it = output_map_.find(desc); - BOOST_ASSERT(it != output_map_.end()); - return *it->second; - } - } - - /** - * Constructs a new POSIX child object representing a just - * spawned child process. - * - * Creates a new child object that represents the just spawned process - * \a id. - * - * The \a infoin and \a infoout maps contain the pipes used to handle - * the redirections of the child process; at the moment, no other - * stream_info types are supported. If the launcher was asked to - * redirect any of the three standard flows, their pipes must be - * present in these maps. - */ - posix_child(id_type id, detail::info_map &infoin, detail::info_map &infoout) - : child(id, - detail::posix_info_locate_pipe(infoin, STDIN_FILENO, false), - detail::posix_info_locate_pipe(infoout, STDOUT_FILENO, true), - detail::posix_info_locate_pipe(infoout, STDERR_FILENO, true)) - { - for (detail::info_map::iterator it = infoin.begin(); it != infoin.end(); ++it) - { - detail::stream_info &si = it->second; - if (si.type_ == detail::stream_info::use_pipe) - { - BOOST_ASSERT(si.pipe_->wend().valid()); - boost::shared_ptr st(new postream(si.pipe_->wend())); - input_map_.insert(input_map_t::value_type(it->first, st)); - } - } - - for (detail::info_map::iterator it = infoout.begin(); it != infoout.end(); ++it) - { - detail::stream_info &si = it->second; - if (si.type_ == detail::stream_info::use_pipe) - { - BOOST_ASSERT(si.pipe_->rend().valid()); - boost::shared_ptr st(new pistream(si.pipe_->rend())); - output_map_.insert(output_map_t::value_type(it->first, st)); - } - } - } - -private: - /** - * Maps child's file descriptors to postream objects. - */ - typedef std::map > input_map_t; - - /** - * Contains all relationships between child's input file - * descriptors and their corresponding postream objects. - */ - input_map_t input_map_; - - /** - * Maps child's file descriptors to pistream objects. - */ - typedef std::map > output_map_t; - - /** - * Contains all relationships between child's output file - * descriptors and their corresponding pistream objects. - */ - output_map_t output_map_; -}; - -} -} - -#endif diff --git a/boost/process/posix_context.hpp b/boost/process/posix_context.hpp deleted file mode 100644 index 3ca4cf49f..000000000 --- a/boost/process/posix_context.hpp +++ /dev/null @@ -1,118 +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/posix_context.hpp - * - * Includes the declaration of the posix_context class. - */ - -#ifndef BOOST_PROCESS_POSIX_CONTEXT_HPP -#define BOOST_PROCESS_POSIX_CONTEXT_HPP - -#include -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Holds a mapping between native file descriptors and their corresponding - * pipes to set up communication between the parent and the %child process. - */ -typedef std::map behavior_map; - -template -class posix_basic_context : public basic_work_directory_context, public environment_context -{ -public: - /** - * Constructs a new POSIX-specific context. - * - * Constructs a new context. It is configured as follows: - * * All communcation channels with the child process are closed. - * * There are no channel mergings. - * * The initial work directory of the child processes is set to the - * current working directory. - * * The environment variables table is empty. - * * The credentials are the same as those of the current process. - */ - posix_basic_context() - : uid(::getuid()), - euid(::geteuid()), - gid(::getgid()), - egid(::getegid()) - { - } - - /** - * List of input streams that will be redirected. - */ - behavior_map input_behavior; - - /** - * List of output streams that will be redirected. - */ - behavior_map output_behavior; - - /** - * The user credentials. - * - * UID that specifies the user credentials to use to run the %child - * process. Defaults to the current UID. - */ - uid_t uid; - - /** - * The effective user credentials. - * - * EUID that specifies the effective user credentials to use to run - * the %child process. Defaults to the current EUID. - */ - uid_t euid; - - /** - * The group credentials. - * - * GID that specifies the group credentials to use to run the %child - * process. Defaults to the current GID. - */ - gid_t gid; - - /** - * The effective group credentials. - * - * EGID that specifies the effective group credentials to use to run - * the %child process. Defaults to the current EGID. - */ - gid_t egid; - - /** - * The chroot directory, if any. - * - * Specifies the directory in which the %child process is chrooted - * before execution. Empty if this feature is not desired. - */ - Path chroot; -}; - -/** - * Default instantiation of posix_basic_context. - */ -typedef posix_basic_context posix_context; - -} -} - -#endif diff --git a/boost/process/posix_operations.hpp b/boost/process/posix_operations.hpp deleted file mode 100644 index 78de54a91..000000000 --- a/boost/process/posix_operations.hpp +++ /dev/null @@ -1,81 +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/posix_operations.hpp - * - * Provides miscellaneous free functions specific to POSIX operating - * systems. - */ - -#ifndef BOOST_PROCESS_POSIX_OPERATIONS_HPP -#define BOOST_PROCESS_POSIX_OPERATIONS_HPP - -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Starts a new child process. - * - * Given an executable and the set of arguments passed to it, starts - * a new process with all the parameters configured in the context. - * The context can be reused afterwards to launch other different - * processes. - * - * \return A handle to the new child process. - */ -template -inline posix_child posix_launch(const Executable &exe, const Arguments &args, const Posix_Context &ctx) -{ - detail::info_map input_info; - for (behavior_map::const_iterator it = ctx.input_behavior.begin(); it != ctx.input_behavior.end(); ++it) - { - if (it->second.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(it->second, false); - input_info.insert(detail::info_map::value_type(it->first, si)); - } - } - - detail::info_map output_info; - for (behavior_map::const_iterator it = ctx.output_behavior.begin(); it != ctx.output_behavior.end(); ++it) - { - if (it->second.get_type() != stream_behavior::close) - { - detail::stream_info si = detail::stream_info(it->second, true); - output_info.insert(detail::info_map::value_type(it->first, si)); - } - } - - detail::posix_setup s; - s.work_directory = ctx.work_directory; - s.uid = ctx.uid; - s.euid = ctx.euid; - s.gid = ctx.gid; - s.egid = ctx.egid; - s.chroot = ctx.chroot; - - pid_t pid = detail::posix_start(exe, args, ctx.environment, input_info, output_info, s); - - return posix_child(pid, input_info, output_info); -} - -} -} - -#endif diff --git a/boost/process/posix_status.hpp b/boost/process/posix_status.hpp deleted file mode 100644 index eefb144eb..000000000 --- a/boost/process/posix_status.hpp +++ /dev/null @@ -1,128 +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/posix_status.hpp - * - * Includes the declaration of the posix_status class. - */ - -#ifndef BOOST_PROCESS_POSIX_STATUS_HPP -#define BOOST_PROCESS_POSIX_STATUS_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -#elif defined(BOOST_WINDOWS_API) -#else -# error "Unsupported platform." -#endif - -#include -#include - -namespace boost { -namespace process { - -/** - * Status returned by a finalized %child process on a POSIX system. - * - * This class represents the %status returned by a child process after it - * has terminated. It contains some methods not available in the status - * class that provide information only available in POSIX systems. - */ -class posix_status : public status -{ -public: - /** - * Creates a posix_status object from an existing status object. - * - * Creates a new status object representing the exit status of a - * child process. The construction is done based on an existing - * status object which already contains all the available - * information: this class only provides controlled access to it. - */ - posix_status(const status &s) - : status(s) - { - } - - /** - * Returns whether the process exited due to an external - * signal. - */ - bool signaled() const - { - return WIFSIGNALED(flags_); - } - - /** - * If signaled, returns the terminating signal code. - * - * If the process was signaled, returns the terminating signal code. - * - * \pre signaled() is true. - */ - int term_signal() const - { - BOOST_ASSERT(signaled()); - - return WTERMSIG(flags_); - } - - /** - * If signaled, returns whether the process dumped core. - * - * If the process was signaled, returns whether the process - * produced a core dump. - * - * \pre signaled() is true. - */ - bool dumped_core() const - { - BOOST_ASSERT(signaled()); - -#ifdef WCOREDUMP - return WCOREDUMP(flags_); -#else - return false; -#endif - } - - /** - * Returns whether the process was stopped by an external - * signal. - */ - bool stopped() const - { - return WIFSTOPPED(flags_); - } - - /** - * If stopped, returns the stop signal code. - * - * If the process was stopped, returns the stop signal code. - * - * \pre stopped() is true. - */ - int stop_signal() const - { - BOOST_ASSERT(stopped()); - - return WSTOPSIG(flags_); - } -}; - -} -} - -#endif diff --git a/boost/process/postream.hpp b/boost/process/postream.hpp deleted file mode 100644 index 3bb894377..000000000 --- a/boost/process/postream.hpp +++ /dev/null @@ -1,117 +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/postream.hpp - * - * Includes the declaration of the postream class. - */ - -#ifndef BOOST_PROCESS_POSTREAM_HPP -#define BOOST_PROCESS_POSTREAM_HPP - -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Child process' input stream. - * - * The postream class represents an input communication channel with the - * child process. The child process reads data from this stream and the - * parent process can write to it through the postream object. In other - * words, from the child's point of view, the communication channel is an - * input one, but from the parent's point of view it is an output one; - * hence the confusing postream name. - * - * postream objects cannot be copied because they own the file handle - * they use to communicate with the child and because they buffer data - * that flows through the communication channel. - * - * A postream object behaves as a std::ostream stream in all senses. - * The class is only provided because it must provide a method to let - * the caller explicitly close the communication channel. - * - * \remark Blocking remarks: Functions that write data to this - * stream can block if the associated file handle blocks during - * the write. As this class is used to communicate with child - * processes through anonymous pipes, the most typical blocking - * condition happens when the child is not processing the data - * in the pipe's system buffer. When this happens, the buffer - * eventually fills up and the system blocks until the reader - * consumes some data, leaving some new room. - */ -class postream : public std::ostream, public boost::noncopyable -{ -public: - /** - * Creates a new process' input stream. - * - * Given a file handle, this constructor creates a new postream - * object that owns the given file handle \a fh. Ownership of - * \a fh is transferred to the created postream object. - * - * \pre \a fh is valid. - * \post \a fh is invalid. - * \post The new postream object owns \a fh. - */ - explicit postream(detail::file_handle &fh) - : std::ostream(0), - handle_(fh), - systembuf_(handle_.get()) - { - rdbuf(&systembuf_); - } - - /** - * Returns the file handle managed by this stream. - * - * The file handle must not be copied. Copying invalidates - * the source file handle making the postream unusable. - */ - detail::file_handle &handle() - { - return handle_; - } - - /** - * Closes the file handle managed by this stream. - * - * Explicitly closes the file handle managed by this stream. This - * function can be used by the user to tell the child process there - * is no more data to send. - */ - void close() - { - systembuf_.sync(); - handle_.close(); - } - -private: - /** - * The file handle managed by this stream. - */ - detail::file_handle handle_; - - /** - * The systembuf object used to manage this stream's data. - */ - detail::systembuf systembuf_; -}; - -} -} - -#endif diff --git a/boost/process/process.hpp b/boost/process/process.hpp deleted file mode 100644 index 4a4825d25..000000000 --- a/boost/process/process.hpp +++ /dev/null @@ -1,130 +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/process.hpp - * - * Includes the declaration of the process class. - */ - -#ifndef BOOST_PROCESS_PROCESS_HPP -#define BOOST_PROCESS_PROCESS_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -# include -#elif defined(BOOST_WINDOWS_API) -# include -# include -#else -# error "Unsupported platform." -#endif - -#include -#include - -namespace boost { -namespace process { - -/** - * Generic implementation of the Process concept. - * - * The process class implements the Process concept in an operating system - * agnostic way. - */ -class process -{ -public: -#if defined(BOOST_PROCESS_DOXYGEN) - /** - * Opaque name for the native process' identifier type. - * - * Each operating system identifies processes using a specific type. - * The \a id_type type is used to transparently refer to a process - * regardless of the operating system in which this class is used. - * - * This type is guaranteed to be an integral type on all supported - * platforms. - */ - typedef NativeProcessId id_type; -#elif defined(BOOST_POSIX_API) - typedef pid_t id_type; -#elif defined(BOOST_WINDOWS_API) - typedef DWORD id_type; -#endif - - /** - * Constructs a new process object. - * - * Creates a new process object that represents a running process - * within the system. - */ - process(id_type id) - : id_(id) - { - } - - /** - * Returns the process' identifier. - */ - id_type get_id() const - { - return id_; - } - - /** - * Terminates the process execution. - * - * Forces the termination of the process execution. Some platforms - * allow processes to ignore some external termination notifications - * or to capture them for a proper exit cleanup. You can set the - * \a force flag to true in them to force their termination regardless - * of any exit handler. - * - * After this call, accessing this object can be dangerous because the - * process identifier may have been reused by a different process. It - * might still be valid, though, if the process has refused to die. - * - * \throw boost::system::system_error If the system call used to - * terminate the process fails. - */ - void terminate(bool force = false) const - { -#if defined(BOOST_POSIX_API) - if (::kill(id_, force ? SIGKILL : SIGTERM) == -1) - boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::process::terminate: kill(2) failed")); -#elif defined(BOOST_WINDOWS_API) - HANDLE h = ::OpenProcess(PROCESS_TERMINATE, FALSE, id_); - if (h == NULL) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: OpenProcess failed")); - if (!::TerminateProcess(h, EXIT_FAILURE)) - { - ::CloseHandle(h); - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: TerminateProcess failed")); - } - if (!::CloseHandle(h)) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: CloseHandle failed")); -#endif - } - -private: - /** - * The process' identifier. - */ - id_type id_; -}; - -} -} - -#endif diff --git a/boost/process/self.hpp b/boost/process/self.hpp deleted file mode 100644 index 8a5e85437..000000000 --- a/boost/process/self.hpp +++ /dev/null @@ -1,134 +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/self.hpp - * - * Includes the declaration of the self class. - */ - -#ifndef BOOST_PROCESS_SELF_HPP -#define BOOST_PROCESS_SELF_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -#elif defined(BOOST_WINDOWS_API) -# include -#else -# error "Unsupported platform." -#endif - -#include -#include -#include -#include -#include -#include - -#if defined(BOOST_POSIX_API) -extern "C" -{ - extern char **environ; -} -#endif - -namespace boost { -namespace process { - -/** - * Generic implementation of the Process concept. - * - * The self singleton provides access to the current process. - */ -class self : public process, boost::noncopyable -{ -public: - /** - * Returns the self instance representing the caller's process. - */ - static self &get_instance() - { - static self *instance = 0; - if (!instance) - instance = new self; - return *instance; - } - - /** - * Returns the current environment. - * - * Returns the current process' environment variables. Modifying the - * returned object has no effect on the current environment. - */ - static environment get_environment() - { - environment e; - -#if defined(BOOST_POSIX_API) - char **env = ::environ; - while (*env) - { - std::string s = *env; - std::string::size_type pos = s.find('='); - e.insert(boost::process::environment::value_type(s.substr(0, pos), s.substr(pos + 1))); - ++env; - } -#elif defined(BOOST_WINDOWS_API) -#ifdef GetEnvironmentStrings -#undef GetEnvironmentStrings -#endif - char *environ = ::GetEnvironmentStrings(); - if (!environ) - boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::self::get_environment: GetEnvironmentStrings failed")); - try - { - char *env = environ; - while (*env) - { - std::string s = env; - std::string::size_type pos = s.find('='); - e.insert(boost::process::environment::value_type(s.substr(0, pos), s.substr(pos + 1))); - env += s.size() + 1; - } - } - catch (...) - { - ::FreeEnvironmentStringsA(environ); - throw; - } - ::FreeEnvironmentStringsA(environ); -#endif - - return e; - } - -private: - /** - * Constructs a new self object. - * - * Creates a new self object that represents the current process. - */ - self() : -#if defined(BOOST_POSIX_API) - process(::getpid()) -#elif defined(BOOST_WINDOWS_API) - process(::GetCurrentProcessId()) -#endif - { - } -}; - -} -} - -#endif diff --git a/boost/process/status.hpp b/boost/process/status.hpp deleted file mode 100644 index 533757a3c..000000000 --- a/boost/process/status.hpp +++ /dev/null @@ -1,105 +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/status.hpp - * - * Includes the declaration of the status class. - */ - -#ifndef BOOST_PROCESS_STATUS_HPP -#define BOOST_PROCESS_STATUS_HPP - -#include - -#if defined(BOOST_POSIX_API) -# include -#elif defined(BOOST_WINDOWS_API) -#else -# error "Unsupported platform." -#endif - -#include - -namespace boost { -namespace process { - -class child; - -/** - * Status returned by a finalized %child process. - * - * This class represents the %status returned by a child process after it - * has terminated. It only provides that information available under all - * supported platforms. - * - * \see posix_status - */ -class status -{ - friend class child; - -public: - /** - * Returns whether the process exited gracefully or not. - */ - bool exited() const - { -#if defined(BOOST_POSIX_API) - return WIFEXITED(flags_); -#elif defined(BOOST_WINDOWS_API) - return true; -#endif - } - - /** - * If exited, returns the exit code. - * - * If the process exited, returns the exit code it returned. - * - * \pre exited() is true. - */ - int exit_status() const - { - BOOST_ASSERT(exited()); -#if defined(BOOST_POSIX_API) - return WEXITSTATUS(flags_); -#elif defined(BOOST_WINDOWS_API) - return flags_; -#endif - } - -protected: - /** - * Creates a status object based on exit information. - * - * Creates a new status object representing the exit status of a - * child process. - * - * \param flags In a POSIX system this parameter contains the - * flags returned by the ::waitpid() call. In a - * Windows system it contains the exit code only. - */ - status(int flags) - : flags_(flags) - { - } - - /** - * OS-specific codification of exit status. - */ - int flags_; -}; - -} -} - -#endif diff --git a/boost/process/stream_behavior.hpp b/boost/process/stream_behavior.hpp deleted file mode 100644 index 0681a7424..000000000 --- a/boost/process/stream_behavior.hpp +++ /dev/null @@ -1,234 +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/stream_behavior.hpp - * - * Includes the declaration of the stream_behavior class and associated - * free functions. - */ - -#ifndef BOOST_PROCESS_STREAM_BEHAVIOR_HPP -#define BOOST_PROCESS_STREAM_BEHAVIOR_HPP - -#include - -namespace boost { -namespace process { - -namespace detail { - struct stream_info; -} - -/** - * Describes the possible states for a communication stream. - */ -class stream_behavior -{ -public: - friend struct detail::stream_info; - friend stream_behavior capture_stream(); - friend stream_behavior close_stream(); - friend stream_behavior inherit_stream(); - friend stream_behavior redirect_stream_to_stdout(); - friend stream_behavior silence_stream(); -#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) - friend stream_behavior posix_redirect_stream(int to); -#endif - - /** - * Describes the possible states for a communication stream. - */ - enum type - { - /** - * The child's stream is connected to the parent by using an - * anonymous pipe so that they can send and receive data to/from - * each other. - */ - capture, - - /** - * The child's stream is closed upon startup so that it will not - * have any access to it. - */ - close, - - /** - * The child's stream is connected to the same stream used by the - * parent. In other words, the corresponding parent's stream is - * inherited. - */ - inherit, - - /** - * The child's stream is connected to child's standard output. - * This is typically used when configuring the standard error - * stream. - */ - redirect_to_stdout, - - /** - * The child's stream is redirected to a null device so that its - * input is always zero or its output is lost, depending on - * whether the stream is an input or an output one. It is - * important to notice that this is different from close because - * the child is still able to write data. If we closed, e.g. - * stdout, the child might not work at all! - */ - silence, - -#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) - /** - * The child redirects the stream's output to the provided file - * descriptor. This is a generalization of the portable - * redirect_to_stdout behavior. - */ - posix_redirect -#endif - }; - - /** - * Constructs a new stream behavior of type close. - * - * The public constructor creates a new stream behavior that defaults - * to the close behavior. In general, you will want to use the - * available free functions to construct a stream behavior (including - * the close one). - */ - stream_behavior() - : type_(stream_behavior::close) - { - } - - /** - * Returns this stream's behavior type. - */ - type get_type() const - { - return type_; - } - -private: - /** - * Constructs a new stream behavior of type \a t. - * - * Constructs a new stream behavior of type \a t. It is the - * responsibility of the caller to fill in any other attributes - * required by the specified type, if any. - */ - stream_behavior(type t) - : type_(t) - { - } - - /** - * This stream's behavior type. - */ - type type_; - -#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) - /** - * File descriptor the stream is redirected to. - */ - int desc_to_; -#endif -}; - -/** - * Creates a new stream_behavior of type stream_behavior::capture. - * - * Creates a new stream_behavior of type stream_behavior::capture, - * meaning that the child's stream is connected to the parent by using an - * anonymous pipe so that they can send and receive data to/from each - * other. - */ -inline stream_behavior capture_stream() -{ - return stream_behavior(stream_behavior::capture); -} - -/** - * Creates a new stream_behavior of type stream_behavior::close. - * - * Creates a new stream_behavior of type stream_behavior::close, - * meaning that the child's stream is closed upon startup so that it - * will not have any access to it. - */ -inline stream_behavior close_stream() -{ - return stream_behavior(stream_behavior::close); -} - -/** - * Creates a new stream_behavior of type stream_behavior::inherit. - * - * Creates a new stream_behavior of type stream_behavior::inherit, - * meaning that the child's stream is connected to the same stream used - * by the parent. In other words, the corresponding parent's stream is - * inherited. - */ -inline stream_behavior inherit_stream() -{ - return stream_behavior(stream_behavior::inherit); -} - -/** - * Creates a new stream_behavior of type - * stream_behavior::redirect_to_stdout. - * - * Creates a new stream_behavior of type - * stream_behavior::redirect_to_stdout, meaning that the child's stream is - * connected to child's standard output. This is typically used when - * configuring the standard error stream. - */ -inline stream_behavior redirect_stream_to_stdout() -{ - return stream_behavior(stream_behavior::redirect_to_stdout); -} - -/** - * Creates a new stream_behavior of type stream_behavior::silence. - * - * Creates a new stream_behavior of type stream_behavior::silence, - * meaning that the child's stream is redirected to a null device so that - * its input is always zero or its output is lost, depending on whether - * the stream is an input or an output one. It is important to notice - * that this is different from close because the child is still able to - * write data. If we closed, e.g. stdout, the child might not work at - * all! - */ -inline stream_behavior silence_stream() -{ - return stream_behavior(stream_behavior::silence); -} - -#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) -/** - * Creates a new stream_behavior of type stream_behavior::posix_redirect. - * - * Creates a new stream_behavior of type stream_behavior::posix_redirect, - * meaning that the child's stream is redirected to the \a to child's - * file descriptor. This is a generalization of the portable - * redirect_stream_to_stdout() behavior. - */ -inline stream_behavior posix_redirect_stream(int to) -{ - stream_behavior sb(stream_behavior::posix_redirect); - sb.desc_to_ = to; - return sb; -} -#endif - -} -} - -#endif diff --git a/boost/process/win32_child.hpp b/boost/process/win32_child.hpp deleted file mode 100644 index e4f0ed7e3..000000000 --- a/boost/process/win32_child.hpp +++ /dev/null @@ -1,128 +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/win32_child.hpp - * - * Includes the declaration of the win32_child class. - */ - -#ifndef BOOST_PROCESS_WIN32_CHILD_HPP -#define BOOST_PROCESS_WIN32_CHILD_HPP - -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Windows implementation of the Child concept. - * - * The win32_child class implements the Child concept in a Windows - * operating system. - * - * A Windows child differs from a regular %child (represented by a - * child object) in that it holds additional information about a process. - * Aside from the standard handle, it also includes a handle to the - * process' main thread, together with identifiers to both entities. - * - * This class is built on top of the generic child so as to allow its - * trivial adoption. When a program is changed to use the - * Windows-specific context (win32_context), it will most certainly need - * to migrate its use of the child class to win32_child. Doing so is only - * a matter of redefining the appropriate object and later using the - * required extra features: there should be no need to modify the existing - * code (e.g. method calls) in any other way. - */ -class win32_child : public child -{ -public: - /** - * Constructs a new Windows child object representing a just - * spawned %child process. - * - * Creates a new %child object that represents the process described by - * the \a pi structure. - * - * The \a fhstdin, \a fhstdout and \a fhstderr parameters hold the - * communication streams used to interact with the %child process if - * the launcher configured redirections. See the parent class' - * constructor for more details on these. - * - * \see child - */ - win32_child(const PROCESS_INFORMATION &pi, detail::file_handle fhstdin, detail::file_handle fhstdout, detail::file_handle fhstderr) - : child(pi.dwProcessId, fhstdin, fhstdout, fhstderr, pi.hProcess), - process_information_(pi), - thread_handle_(process_information_.hThread) - { - } - - /** - * Returns the process handle. - * - * Returns a process-specific handle that can be used to access the - * process. This is the value of the \a hProcess field in the - * PROCESS_INFORMATION structure returned by CreateProcess(). - * - * \see get_id() - */ - HANDLE get_handle() const - { - return process_information_.hProcess; - } - - /** - * Returns the primary thread's handle. - * - * Returns a handle to the primary thread of the new process. This is - * the value of the \a hThread field in the PROCESS_INFORMATION - * structure returned by CreateProcess(). - * - * \see get_primary_thread_id() - */ - HANDLE get_primary_thread_handle() const - { - return process_information_.hThread; - } - - /** - * Returns the primary thread's identifier. - * - * Returns a system-wide value that identifies the process's primary - * thread. This is the value of the \a dwThreadId field in the - * PROCESS_INFORMATION structure returned by CreateProcess(). - * - * \see get_primary_thread_handle() - */ - DWORD get_primary_thread_id() const - { - return process_information_.dwThreadId; - } - -private: - /** - * Windows-specific process information. - */ - PROCESS_INFORMATION process_information_; - - /** - * Thread handle owned by RAII object. - */ - detail::file_handle thread_handle_; -}; - -} -} - -#endif diff --git a/boost/process/win32_context.hpp b/boost/process/win32_context.hpp deleted file mode 100644 index 630fd305f..000000000 --- a/boost/process/win32_context.hpp +++ /dev/null @@ -1,61 +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/win_32context.hpp - * - * Includes the declaration of the win32_context class. - */ - -#ifndef BOOST_PROCESS_WIN32_CONTEXT_HPP -#define BOOST_PROCESS_WIN32_CONTEXT_HPP - -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Generic implementation of the Context concept. - * - * The context class implements the Context concept in an operating - * system agnostic way; it allows spawning new child processes using - * a single and common interface across different systems. - */ -template -class win32_basic_context : public basic_context -{ -public: - /** - * Initializes the Win32-specific process startup information with NULL. - */ - win32_basic_context() - : startupinfo(NULL) - { - } - - /** - * Win32-specific process startup information. - */ - STARTUPINFOA *startupinfo; -}; - -/** - * Default instantiation of win32_basic_context. - */ -typedef win32_basic_context win32_context; - -} -} - -#endif diff --git a/boost/process/win32_operations.hpp b/boost/process/win32_operations.hpp deleted file mode 100644 index 092e9a368..000000000 --- a/boost/process/win32_operations.hpp +++ /dev/null @@ -1,77 +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/win32_operations.hpp - * - * Provides miscellaneous free functions specific to Windows operating - * systems. - */ - -#ifndef BOOST_PROCESS_WIN32_OPERATIONS_HPP -#define BOOST_PROCESS_WIN32_OPERATIONS_HPP - -#include -#include -#include -#include -#include - -namespace boost { -namespace process { - -/** - * Starts a new child process. - * - * Given an executable and the set of arguments passed to it, starts - * a new process with all the parameters configured in the context. - * The context can be reused afterwards to launch other different - * processes. - * - * \return A handle to the new child process. - */ -template -inline win32_child win32_launch(const Executable &exe, const Arguments &args, const Win32_Context &ctx) -{ - detail::file_handle fhstdin, fhstdout, fhstderr; - - detail::stream_info behin = detail::stream_info(ctx.stdin_behavior, false); - if (behin.type_ == detail::stream_info::use_pipe) - fhstdin = behin.pipe_->wend(); - detail::stream_info behout = detail::stream_info(ctx.stdout_behavior, true); - if (behout.type_ == detail::stream_info::use_pipe) - fhstdout = behout.pipe_->rend(); - detail::stream_info beherr = detail::stream_info(ctx.stderr_behavior, true); - if (beherr.type_ == detail::stream_info::use_pipe) - fhstderr = beherr.pipe_->rend(); - - detail::win32_setup s; - s.work_directory = ctx.work_directory; - - STARTUPINFOA si; - if (!ctx.startupinfo) - { - ::ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - s.startupinfo = &si; - } - else - s.startupinfo = ctx.startupinfo; - - PROCESS_INFORMATION pi = detail::win32_start(exe, args, ctx.environment, behin, behout, beherr, s); - - return win32_child(pi, fhstdin, fhstdout, fhstderr); -} - -} -} - -#endif diff --git a/doc/Doxyfile b/doc/Doxyfile new file mode 100644 index 000000000..71ca04136 --- /dev/null +++ b/doc/Doxyfile @@ -0,0 +1,2364 @@ +# Doxyfile 1.8.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = Ethereum + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = PoC-8 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "The C++ Implementation of Ethereum" + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = gavcoin.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = ../libdevcore \ + ../libdevcrypto \ + ../libethcore \ + ../libethereum \ + ../libevmface \ + ../libevm \ + ../liblll \ + ../libsolidity \ + ../mix \ + ../libwhisper \ + ../libwebthree + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /