Skip to content

Commit

Permalink
Add module interface unit
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielaE committed Apr 17, 2021
1 parent b5c8cea commit 9d29eff
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions src/fmt.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
module;
#ifndef FMT_MODULE_NAME
#define FMT_MODULE_NAME fmt
#endif
// put all implementation-provided headers into the global module fragment
// to prevent attachment to this module
#include <cctype>
#include <cerrno>
#include <climits>
#include <cmath>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cwchar>

#include <algorithm>
#include <chrono>
#include <exception>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <locale>
#include <memory>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>

#if _MSC_VER
# include <intrin.h> // _BitScanReverse[64], _BitScanForward[64], _umul128
#endif
#ifdef _WIN32
# include <io.h>
#endif

// os.h
#ifdef FMT_WITH_OS
#include <cstdlib>
#include <clocale>
#if __has_include(<winapifamily.h>)
#include <winapifamily.h>
#endif
#if __has_include(<fcntl.h>)
#include <fcntl.h>
#endif
#endif

export module FMT_MODULE_NAME;

#define FMT_MODULE_EXPORT export
#define FMT_MODULE_EXPORT_BEGIN export {
#define FMT_MODULE_EXPORT_END }

#define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 1

// all library-provided declarations and definitions
// must be in the module purview to be exported
#include "fmt/format.h"
#include "fmt/args.h"
#include "fmt/color.h"
#include "fmt/compile.h"
#include "fmt/locale.h"
#include "fmt/ostream.h"
#include "fmt/ranges.h"
#include "fmt/chrono.h"
#include "fmt/printf.h"

#ifdef FMT_MODULE_WITH_OS
#include "fmt/os.h"
#endif

module : private;

#include "format.cc"
#ifdef FMT_MODULE_WITH_OS
#include "os.cc"
#endif

0 comments on commit 9d29eff

Please sign in to comment.