diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-09-22 23:32:28 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-09-22 23:32:28 +0200 |
commit | c09cd7512491cee1e82c1ad8128ce9fd4bc3f79b (patch) | |
tree | a659ed768d849130ab5780a11b7f791a463a1a91 /libbutl/process.cxx | |
parent | 2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff) |
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'libbutl/process.cxx')
-rw-r--r-- | libbutl/process.cxx | 74 |
1 files changed, 56 insertions, 18 deletions
diff --git a/libbutl/process.cxx b/libbutl/process.cxx index dce8d6b..e65018a 100644 --- a/libbutl/process.cxx +++ b/libbutl/process.cxx @@ -2,7 +2,11 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <libbutl/process.hxx> +#ifndef __cpp_modules +#include <libbutl/process.mxx> +#endif + +#include <errno.h> #ifndef _WIN32 # include <stdlib.h> // setenv(), unsetenv() @@ -27,8 +31,7 @@ # include <stdlib.h> // _MAX_PATH # include <sys/types.h> // stat # include <sys/stat.h> // stat(), S_IS* -# include <processenv.h> // GetEnvironmentStringsA(), - // FreeEnvironmentStringsA() +# include <processenv.h> // {Get,Free}EnvironmentStringsA() # ifdef _MSC_VER // Unlikely to be fixed in newer versions. # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) @@ -37,29 +40,66 @@ # define STDOUT_FILENO 1 # define STDERR_FILENO 2 # endif // _MSC_VER - -# include <map> -# include <chrono> -# include <cstdlib> // getenv(), __argv[] - -# include <libbutl/timestamp.hxx> -# include <libbutl/small-vector.hxx> #endif -#include <errno.h> +#include <cassert> + +#ifndef __cpp_lib_modules +#include <string> +#include <vector> +#include <cstdint> +#include <cstddef> +#include <system_error> #include <ios> // ios_base::failure -#include <cassert> -#include <cstddef> // size_t #include <cstring> // strlen(), strchr() #include <utility> // move() #include <ostream> -#include <libbutl/utility.hxx> // casecmp() -#include <libbutl/fdstream.hxx> // fdnull() +#ifdef _WIN32 +#include <map> +#include <chrono> +#include <cstdlib> // getenv(), __argv[] +#endif +#endif + #include <libbutl/process-details.hxx> -#include <iostream> +namespace butl +{ + shared_mutex process_spawn_mutex; // Out of module purview. +} + +#ifdef __cpp_modules +module butl.process; + +// Only imports additional to interface. +#ifdef __clang__ +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.optional; +import butl.fdstream; +import butl.vector_view; +import butl.small_vector; +#endif + +import butl.utility; // casecmp() +import butl.fdstream; // fdnull() +#ifdef _WIN32 +import butl.timestamp; +#endif + +#else +#include <libbutl/utility.mxx> +#include <libbutl/fdstream.mxx> + +#ifdef _WIN32 +#include <libbutl/timestamp.mxx> +#endif +#endif using namespace std; @@ -69,8 +109,6 @@ using namespace butl::win32; namespace butl { - shared_mutex process_spawn_mutex; - // process // static process_path |