From d8a3ccc553ce616be5a77dde1294528d6524ad03 Mon Sep 17 00:00:00 2001 From: Johannes Kapfhammer Date: Sun, 6 Oct 2019 17:16:19 +0200 Subject: [PATCH] rename from soi.h to soi, including macros --- README.md | 8 ++++---- include/{ => bits}/prettyprint.hpp | 8 ++++---- include/{ => bits}/soi-dbg.hpp | 14 +++++++------- include/{ => bits}/soi-deprecate.hpp | 0 include/{ => bits}/soi-pretty.hpp | 6 +++--- include/soi | 6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-) rename include/{ => bits}/prettyprint.hpp (99%) rename include/{ => bits}/soi-dbg.hpp (97%) rename include/{ => bits}/soi-deprecate.hpp (100%) rename include/{ => bits}/soi-pretty.hpp (97%) diff --git a/README.md b/README.md index ba9bbb6..0c94b40 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ You can debug any expressions using the macro dbg(). You can set the following environment variables to customize the behaviour. -`SOI_H_COLOR`: By default, colored output is shown in case a terminal is connected. -You can force colors with `SOI_H_COLOR=1` and shut them off with `SOI_H_COLOR=0`. +`SOI_COLOR`: By default, colored output is shown in case a terminal is connected. +You can force colors with `SOI_COLOR=1` and shut them off with `SOI_COLOR=0`. -`SOI_H_EOFCHECK`: By default, it is *not* checked, whether you have read all the +`SOI_EOFCHECK`: By default, it is *not* checked, whether you have read all the input. In case you pipe the input from a file or want to issue a proper EOF character (Control D under linux or Control Z under Windows), you can enable -this check using `SOI_H_COLOR=1`. +this check using `SOI_EOFCHECK=1`. ## Template Using this header is as simple as: diff --git a/include/prettyprint.hpp b/include/bits/prettyprint.hpp similarity index 99% rename from include/prettyprint.hpp rename to include/bits/prettyprint.hpp index 5c8d127..a480c97 100644 --- a/include/prettyprint.hpp +++ b/include/bits/prettyprint.hpp @@ -7,8 +7,8 @@ // // The global operator<< overload hs been removed -#ifndef SOI_H_PRETTY_PRINT -#define SOI_H_PRETTY_PRINT +#ifndef SOI_PRETTY_PRINT +#define SOI_PRETTY_PRINT #include #include @@ -88,7 +88,7 @@ namespace pretty_print struct delimiters { using type = delimiters_values; - static const type values; + static const type values; }; @@ -441,4 +441,4 @@ namespace std } */ -#endif // SOI_H_PRETTY_PRINT +#endif // SOI_PRETTY_PRINT diff --git a/include/soi-dbg.hpp b/include/bits/soi-dbg.hpp similarity index 97% rename from include/soi-dbg.hpp rename to include/bits/soi-dbg.hpp index a24b149..bafd1a2 100644 --- a/include/soi-dbg.hpp +++ b/include/bits/soi-dbg.hpp @@ -7,8 +7,8 @@ // initialize with dbg_init() to enable colorized output // -#ifndef SOI_H_DBG -#define SOI_H_DBG +#ifndef SOI_DBG +#define SOI_DBG #include #include @@ -165,7 +165,7 @@ sanitized_type_name() { t[11] == 'g'; return static_string_no_std(is_debug, is_std, t); } - + // ---------------------------------------------------------------------------- // colorized output @@ -178,7 +178,7 @@ bool tty_supports_colors() { } int has_environment_color_overwrite() { - if (const char* color_enabled = std::getenv("SOI_H_COLOR")) { + if (const char* color_enabled = std::getenv("SOI_COLOR")) { if (!std::strcmp(color_enabled, "1")) return 1; if (!std::strcmp(color_enabled, "0")) @@ -261,7 +261,7 @@ auto dbg_print(const char (&msg)[N], char const* file, int line, char const* function_name, - char const* expression) -> decltype(msg) { + char const* expression) -> decltype(msg) { std::cerr << ANSI_DEBUG << "[" << file << ":" << line << " (" << function_name << ")] " << ANSI_RESET @@ -279,7 +279,7 @@ T&& identity(T&& t) { } // end namespace dbg_macro -#ifdef SOI_H_RELEASE +#ifdef SOI_RELEASE #define dbg(...) dbg_macro::identity(__VA_ARGS__) #else #define dbg(...) \ @@ -291,4 +291,4 @@ T&& identity(T&& t) { #__VA_ARGS__) #endif -#endif // SOI_H_DBG +#endif // SOI_DBG diff --git a/include/soi-deprecate.hpp b/include/bits/soi-deprecate.hpp similarity index 100% rename from include/soi-deprecate.hpp rename to include/bits/soi-deprecate.hpp diff --git a/include/soi-pretty.hpp b/include/bits/soi-pretty.hpp similarity index 97% rename from include/soi-pretty.hpp rename to include/bits/soi-pretty.hpp index a2266f3..116bdf5 100644 --- a/include/soi-pretty.hpp +++ b/include/bits/soi-pretty.hpp @@ -6,8 +6,8 @@ // pretty printing with c++ // -#ifndef SOI_H_PRETTY -#define SOI_H_PRETTY +#ifndef SOI_PRETTY +#define SOI_PRETTY #include "prettyprint.hpp" @@ -73,4 +73,4 @@ pretty_print(std::basic_ostream & stream, const T& x) { } -#endif // SOI_H_PRETTY +#endif // SOI_PRETTY diff --git a/include/soi b/include/soi index 1836aec..2c6aa5a 100644 --- a/include/soi +++ b/include/soi @@ -28,7 +28,7 @@ #include #include -#include "soi-dbg.hpp" +#include "bits/soi-dbg.hpp" namespace soi_h { @@ -56,7 +56,7 @@ void noninteractive_check_eof() { } bool should_check_for_eof() { - if (const char* eofcheck_enabled = std::getenv("SOI_H_EOFCHECK")) { + if (const char* eofcheck_enabled = std::getenv("SOI_EOFCHECK")) { if (!std::strcmp(eofcheck_enabled, "1")) return true; if (!std::strcmp(eofcheck_enabled, "0")) @@ -96,7 +96,7 @@ soi_h_initializer soi_h_initializer_{false}; } // end namespace soi_h -#include "soi-deprecate.hpp" +#include "bits/soi-deprecate.hpp" #define int int64_t using namespace std;