aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildfile32
-rw-r--r--std-core.mxx67
-rw-r--r--std-detect.hxx15
-rw-r--r--std-regex.mxx55
-rw-r--r--std-threading.mxx60
5 files changed, 195 insertions, 34 deletions
diff --git a/buildfile b/buildfile
index 630e684..f301ef1 100644
--- a/buildfile
+++ b/buildfile
@@ -39,10 +39,12 @@ else
# Use the naming scheme expected by -fprebuilt-module-path=. Can also be
# specified with -fmodule-file=.
#
- core = std.core.pcm
- io = std.io.pcm
+ core = std.core.pcm
+ io = std.io.pcm
+ regex = std.regex.pcm
+ threading = std.threading.pcm
- liba{std-modules}: bmia{$core $io}
+ liba{std-modules}: bmia{$core $io $regex $threading}
export_target = $out_root/liba{std-modules}
}
@@ -53,17 +55,19 @@ else
#
# @@ Currently VC looks in Release regardless of /MD or /MDd.
#
- dir = release/
- core = $dir/std.core.ifc
- io = $dir/std.io.ifc
+ dir = release/
+ core = $dir/std.core.ifc
+ io = $dir/std.io.ifc
+ regex = $dir/std.regex.ifc
+ threading = $dir/std.threading.ifc
- bmia{$core $io}: fsdir{$dir}
+ bmia{$core $io $regex $threading}: fsdir{$dir}
# VC expects to find std.lib next to the .ifc's. Make it the real one
# while std-modules -- a dummy.
#
./: $dir/liba{std}
- $dir/liba{std}: bmia{$core $io}
+ $dir/liba{std}: bmia{$core $io $regex $threading}
liba{std-modules}: cxx{dummy.cxx}
# @@ Doesn't work if installed so we don't bother installing it. But we
@@ -87,11 +91,15 @@ else
if ($cxx.target.class != "windows")
cxx.libs += -lpthread
- bmia{$core}: mxx{std-core}
- bmia{$io}: mxx{std-io} bmia{$core}
+ bmia{$core}: mxx{std-core}
+ bmia{$io}: mxx{std-io} bmia{$core}
+ bmia{$regex}: mxx{std-regex} bmia{$core} bmia{$io}
+ bmia{$threading}: mxx{std-threading} bmia{$core}
- mxx{std-core}@./: cc.module_name = std.core
- mxx{std-io}@./: cc.module_name = std.io
+ mxx{std-core}@./: cc.module_name = std.core
+ mxx{std-io}@./: cc.module_name = std.io
+ mxx{std-regex}@./: cc.module_name = std.regex
+ mxx{std-threading}@./: cc.module_name = std.threading
# Install into the libstd-modules/ subdirectory of, say, /usr/include/.
#
diff --git a/std-core.mxx b/std-core.mxx
index 27f9f1e..47514f0 100644
--- a/std-core.mxx
+++ b/std-core.mxx
@@ -3,44 +3,43 @@
// license : MIT; see accompanying LICENSE file
// For some standard library implementations we need to pre-include certain
-// headers to prevent their exporting. And to detect a standard library we
-// need to include a certain header first.
-//
-#if defined(__clang__)
-# if __has_include(<__config>) // libc++ _LIBCPP_VERSION
-# include <__config>
-# elif __has_include(<bits/c++config.h>) // libstdc++ __GLIBCXX__
-# include <bits/c++config.h>
-# endif
-#elif defined(__GNUC__)
-# include <bits/c++config.h> // libstdc++ __GLIBCXX__
-#endif
+// headers to prevent their exporting.
+
+#include "std-detect.hxx"
#if defined(_MSC_VER)
+/*
+# include <io.h>
+# include <time.h>
+# include <stdlib.h>
+# include <string.h>
+# include <locale.h> // struct tm;
+*/
#elif defined(__GLIBCXX__)
-# include <ext/atomicity.h> // Names with internal linkage.
+# include <time.h>
+# include <errno.h>
+# include <strings.h>
+# include <sys/types.h>
+# include <ext/atomicity.h> // Names with internal linkage.
#elif defined(_LIBCPP_VERSION)
-#else
-# error unknown standard library implementation
#endif
export module std.core;
export
{
-#include <cstddef>
-
// These are defined in <bits/c++config.h> which we have pre-included.
//
#ifdef __GLIBCXX__
namespace std
{
- typedef std::size_t size_t;
- typedef std::ptrdiff_t ptrdiff_t;
- typedef std::nullptr_t nullptr_t;
+ typedef __SIZE_TYPE__ size_t;
+ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+ typedef decltype(nullptr) nullptr_t;
}
#endif
+#include <cstddef>
#include <cstdint>
#include <cstdlib>
@@ -49,12 +48,23 @@ export
#include <exception>
#include <stdexcept>
+#include <system_error>
+
+#include <new>
+#include <memory>
+
+#include <limits>
+#include <ctime>
+#include <atomic>
+#include <chrono>
+#include <bitset>
}
export
{
#include <iterator>
#include <algorithm>
+#include <functional>
#include <string>
#include <cstring> // @@ Not in the proposal.
@@ -65,13 +75,18 @@ export
#include <map>
#include <unordered_set>
#include <unordered_map>
+#include <stack>
}
#if defined(_MSC_VER) || defined(__clang__)
export
{
#include <cctype>
+#include <locale>
+#include <clocale>
+
#include <iosfwd>
+#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
@@ -95,6 +110,14 @@ _GLIBCXX_END_NAMESPACE_VERSION
}
#endif
}
-
-
#endif
+
+// std.threading
+//
+export
+{
+#include <mutex>
+#include <shared_mutex>
+#include <condition_variable>
+#include <thread>
+}
diff --git a/std-detect.hxx b/std-detect.hxx
new file mode 100644
index 0000000..b2998b5
--- /dev/null
+++ b/std-detect.hxx
@@ -0,0 +1,15 @@
+// To detect the standard library we need to include a certain header first.
+//
+#if defined(__clang__)
+# if __has_include(<__config>) // libc++ _LIBCPP_VERSION
+# include <__config>
+# elif __has_include(<bits/c++config.h>) // libstdc++ __GLIBCXX__
+# include <bits/c++config.h>
+# endif
+#elif defined(__GNUC__)
+# include <bits/c++config.h> // libstdc++ __GLIBCXX__
+#endif
+
+#if !defined(_MSC_VER) && !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION)
+# error unknown standard library implementation
+#endif
diff --git a/std-regex.mxx b/std-regex.mxx
new file mode 100644
index 0000000..40cfc36
--- /dev/null
+++ b/std-regex.mxx
@@ -0,0 +1,55 @@
+// file : std-regex.mxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+// Pre-includes.
+//
+#include "std-detect.hxx"
+
+#if defined(_MSC_VER)
+# include <algorithm>
+# include <iterator>
+# include <locale>
+# include <stdexcept>
+# include <string>
+# include <utility>
+# include <vector>
+
+# include <wchar.h>
+# include <limits.h>
+# include <stdlib.h>
+# include <string.h>
+#elif defined(__GLIBCXX__)
+# define _GLIBCXX_ALGORITHM
+# define _GLIBCXX_BITSET
+# define _GLIBCXX_IOSFWD
+# define _GLIBCXX_ITERATOR
+# define _GLIBCXX_LOCALE
+# define _GLIBCXX_MEMORY
+# define _GLIBCXX_SSTREAM
+# define _GLIBCXX_STACK
+# define _GLIBCXX_STDEXCEPT
+# define _GLIBCXX_STRING
+# define _GLIBCXX_UTILITY
+# define _GLIBCXX_VECTOR
+# define _GLIBCXX_MAP
+# define _GLIBCXX_CSTRING
+
+# define _GLIBCXX_STD_FUNCTION_H // <bits/std_function.h>
+# define _ALIGNED_BUFFER_H // <ext/aligned_buffer.h>
+
+# include <debug/assertions.h> // Missing include.
+#elif defined(_LIBCPP_VERSION)
+#endif
+
+export module std.regex;
+
+#ifdef __GLIBCXX__
+import std.core;
+import std.io;
+#endif
+
+export
+{
+#include <regex>
+}
diff --git a/std-threading.mxx b/std-threading.mxx
new file mode 100644
index 0000000..ab397cc
--- /dev/null
+++ b/std-threading.mxx
@@ -0,0 +1,60 @@
+// file : std-threading.mxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+export module std.threading; // Dummy.
+
+#if 0
+// Pre-includes.
+//
+#include "std-detect.hxx"
+
+#if defined(_MSC_VER)
+#error TODO
+#elif defined(__GLIBCXX__)
+
+// <mutex>
+# define _GLIBCXX_TUPLE
+# define _GLIBCXX_CHRONO
+# define __EXCEPTION__ // <exception>
+# define _GLIBCXX_TYPE_TRAITS
+# define _GLIBCXX_SYSTEM_ERROR
+# define _GLIBCXX_STD_FUNCTION_H // <bits/std_function.h>
+# define _FUNCTEXCEPT_H
+# define _MOVE_H
+
+// <shared_mutex>
+# include <cerrno> // Missing include.
+
+// <condition_variable>
+# define _CONCURRENCE_H // <ext/concurrence.h>
+# define _ALLOC_TRAITS_H // <bits/alloc_traits.h>
+# define _ALLOCATOR_H // <bits/allocator.h>
+# define _UNIQUE_PTR_H // <bits/unique_ptr.h>
+# define _SHARED_PTR_H // <bits/shared_ptr.h>
+# define _CXXABI_FORCED_H // <bits/cxxabi_forced.h>
+# include <bits/exception_defines.h> // Missing include.
+
+// <thread>
+# define _GLIBCXX_MEMORY
+# define _FUNCTIONAL_HASH_H // <bits/functional_hash.h>
+# define _GLIBCXX_INVOKE_H // <bits/invoke.h>
+
+# include <bits/gthr.h>
+#elif defined(_LIBCPP_VERSION)
+#endif
+
+export module std.threading;
+
+#ifdef __GLIBCXX__
+import std.core;
+#endif
+
+export
+{
+#include <mutex>
+#include <shared_mutex>
+#include <condition_variable>
+#include <thread>
+}
+#endif