rename from soi.h to soi, including macros

This commit is contained in:
Johannes Kapfhammer 2019-10-06 17:16:19 +02:00
parent 44aa8d060a
commit d8a3ccc553
6 changed files with 21 additions and 21 deletions

View File

@ -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:

View File

@ -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 <cstddef>
#include <iterator>
@ -88,7 +88,7 @@ namespace pretty_print
struct delimiters
{
using type = delimiters_values<TChar>;
static const type values;
static const type values;
};
@ -441,4 +441,4 @@ namespace std
}
*/
#endif // SOI_H_PRETTY_PRINT
#endif // SOI_PRETTY_PRINT

View File

@ -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 <cstddef>
#include <stdexcept>
@ -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

View File

@ -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<TChar, TCharTraits> & stream, const T& x) {
}
#endif // SOI_H_PRETTY
#endif // SOI_PRETTY

View File

@ -28,7 +28,7 @@
#include <valarray>
#include <vector>
#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;