9 std::string
esc_str(std::string
const & s)
14 if (f&&i>=
'0'&&i<
'8') {
21 if (i==
'\\') {t +=
"\\\\";
continue;}
22 if (i==
'"') {t +=
"\\\"";
continue;}
23 if (isprint(i)) {t += i;
continue;}
24 if (i==
'\n') {t +=
"\\n";
continue;}
25 if (i==
'\r') {t +=
"\\r";
continue;}
26 if (i==
'\t') {t +=
"\\t";
continue;}
27 int r = (
unsigned char) i;
29 if (r>64) t += char(
'0'+r/64);
30 if (r>8) t += char(
'0'+r%64/8);
47 std::ostream &
msg(
int l)
50 static std::ostream null_stream(0);
51 return msg_level>=l ? std::cerr : null_stream;
58 void error(std::string
const & m)
60 msg(0) <<
"Error: " << m <<
'\n';
std::ostream & warn
stream for warning messages
std::ostream & msg(int l)
message output stream
std::ostream & info
stream for informative messages
std::string esc_str(std::string const &s)
Produce an escaped string that, when double quoted, produces the original.
void error(std::string const &m)
throw an Error with given message string
int msg_level
level below which messages are shown
std::ostream & debug
stream for debug messages