From c09cd7512491cee1e82c1ad8128ce9fd4bc3f79b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Sep 2017 23:32:28 +0200 Subject: Initial modularization with both Clang and VC hacks Note: gave up on VC about half way though. --- libbutl/process.cxx | 74 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 18 deletions(-) (limited to 'libbutl/process.cxx') 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 +#ifndef __cpp_modules +#include +#endif + +#include #ifndef _WIN32 # include // setenv(), unsetenv() @@ -27,8 +31,7 @@ # include // _MAX_PATH # include // stat # include // stat(), S_IS* -# include // GetEnvironmentStringsA(), - // FreeEnvironmentStringsA() +# include // {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 -# include -# include // getenv(), __argv[] - -# include -# include #endif -#include +#include + +#ifndef __cpp_lib_modules +#include +#include +#include +#include +#include #include // ios_base::failure -#include -#include // size_t #include // strlen(), strchr() #include // move() #include -#include // casecmp() -#include // fdnull() +#ifdef _WIN32 +#include +#include +#include // getenv(), __argv[] +#endif +#endif + #include -#include +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 +#include + +#ifdef _WIN32 +#include +#endif +#endif using namespace std; @@ -69,8 +109,6 @@ using namespace butl::win32; namespace butl { - shared_mutex process_spawn_mutex; - // process // static process_path -- cgit v1.1