54 auto format = [](
const char *str,
size_t width ) {
55 std::string *res =
new std::string(
"");
57 std::string chunk = std::string(str).substr(0, width);
58 auto newline = chunk.find(
'\n');
59 if (newline != std::string::npos) {
60 *res += chunk.substr(0, newline + 1);
62 }
else if (strlen(str) < width) {
67 auto lastspace = chunk.rfind(
' ');
68 if (lastspace != std::string::npos) {
69 *res += chunk.substr(0, lastspace) +
"\n";
77 }
while (strlen(str) > 0);
81 auto formatPragma = [format](
const Pragma *p, std::ostream &o) {
82 o << std::endl << std::string(80,
'-') << std::endl;
83 auto d = format(p->_description, 80 - (strlen(p->_name) + 3));
84 auto h = format(p->_help, 80);
85 o << p->_name <<
": " << d->c_str() << std::endl
87 << h->c_str() << std::endl;
92 o <<
"Supported pragmas:" << std::endl;
93 for (
auto &p : _supported_pragmas) formatPragma(p, o);
96 << std::string(80,
'*') << std::endl
97 <<
"Barefoot internal pragmas" << std::endl;
98 for (
auto &p : _internal_pragmas) formatPragma(p, o);