rename from soi.h to soi, including macros
This commit is contained in:
parent
44aa8d060a
commit
d8a3ccc553
|
@ -10,13 +10,13 @@ You can debug any expressions using the macro dbg().
|
||||||
|
|
||||||
You can set the following environment variables to customize the behaviour.
|
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.
|
`SOI_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`.
|
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
|
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
|
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
|
## Template
|
||||||
Using this header is as simple as:
|
Using this header is as simple as:
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
//
|
//
|
||||||
// The global operator<< overload hs been removed
|
// The global operator<< overload hs been removed
|
||||||
|
|
||||||
#ifndef SOI_H_PRETTY_PRINT
|
#ifndef SOI_PRETTY_PRINT
|
||||||
#define SOI_H_PRETTY_PRINT
|
#define SOI_PRETTY_PRINT
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
@ -441,4 +441,4 @@ namespace std
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif // SOI_H_PRETTY_PRINT
|
#endif // SOI_PRETTY_PRINT
|
|
@ -7,8 +7,8 @@
|
||||||
// initialize with dbg_init() to enable colorized output
|
// initialize with dbg_init() to enable colorized output
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef SOI_H_DBG
|
#ifndef SOI_DBG
|
||||||
#define SOI_H_DBG
|
#define SOI_DBG
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -178,7 +178,7 @@ bool tty_supports_colors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int has_environment_color_overwrite() {
|
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"))
|
if (!std::strcmp(color_enabled, "1"))
|
||||||
return 1;
|
return 1;
|
||||||
if (!std::strcmp(color_enabled, "0"))
|
if (!std::strcmp(color_enabled, "0"))
|
||||||
|
@ -279,7 +279,7 @@ T&& identity(T&& t) {
|
||||||
|
|
||||||
} // end namespace dbg_macro
|
} // end namespace dbg_macro
|
||||||
|
|
||||||
#ifdef SOI_H_RELEASE
|
#ifdef SOI_RELEASE
|
||||||
#define dbg(...) dbg_macro::identity(__VA_ARGS__)
|
#define dbg(...) dbg_macro::identity(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define dbg(...) \
|
#define dbg(...) \
|
||||||
|
@ -291,4 +291,4 @@ T&& identity(T&& t) {
|
||||||
#__VA_ARGS__)
|
#__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // SOI_H_DBG
|
#endif // SOI_DBG
|
|
@ -6,8 +6,8 @@
|
||||||
// pretty printing with c++
|
// pretty printing with c++
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef SOI_H_PRETTY
|
#ifndef SOI_PRETTY
|
||||||
#define SOI_H_PRETTY
|
#define SOI_PRETTY
|
||||||
|
|
||||||
#include "prettyprint.hpp"
|
#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
|
|
@ -28,7 +28,7 @@
|
||||||
#include <valarray>
|
#include <valarray>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "soi-dbg.hpp"
|
#include "bits/soi-dbg.hpp"
|
||||||
|
|
||||||
namespace soi_h {
|
namespace soi_h {
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void noninteractive_check_eof() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_check_for_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"))
|
if (!std::strcmp(eofcheck_enabled, "1"))
|
||||||
return true;
|
return true;
|
||||||
if (!std::strcmp(eofcheck_enabled, "0"))
|
if (!std::strcmp(eofcheck_enabled, "0"))
|
||||||
|
@ -96,7 +96,7 @@ soi_h_initializer soi_h_initializer_{false};
|
||||||
|
|
||||||
} // end namespace soi_h
|
} // end namespace soi_h
|
||||||
|
|
||||||
#include "soi-deprecate.hpp"
|
#include "bits/soi-deprecate.hpp"
|
||||||
|
|
||||||
#define int int64_t
|
#define int int64_t
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
Loading…
Reference in New Issue