|
| HelpPass () |
|
virtual void | help () |
|
void | escape_tex (std::string &tex) |
|
void | write_tex (FILE *f, std::string cmd, std::string title, std::string text) |
|
void | escape_html (std::string &html) |
|
void | write_html (FILE *idxf, std::string cmd, std::string title, std::string text) |
|
virtual void | execute (std::vector< std::string > args, RTLIL::Design *) |
|
pre_post_exec_state_t | pre_execute () |
|
void | post_execute (pre_post_exec_state_t state) |
|
void | cmd_log_args (const std::vector< std::string > &args) |
|
void | cmd_error (const std::vector< std::string > &args, size_t argidx, std::string msg) |
|
void | extra_args (std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true) |
|
virtual void | run_register () |
|
|
static void | call (RTLIL::Design *design, std::string command) |
|
static void | call (RTLIL::Design *design, std::vector< std::string > args) |
|
static void | call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::string command) |
|
static void | call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::vector< std::string > args) |
|
static void | call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::string command) |
|
static void | call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::vector< std::string > args) |
|
static void | init_register () |
|
static void | done_register () |
|
Definition at line 519 of file register.cc.
Definition at line 520 of file register.cc.
520 :
Pass(
"help",
"display help messages") { }
Pass(std::string name, std::string short_help="** document me **")
Definition at line 146 of file register.cc.
148 std::vector<std::string>
args;
150 std::string cmd_buf = command;
151 std::string tok =
next_token(cmd_buf,
" \t\r\n");
153 if (tok.empty() || tok[0] ==
'#')
157 cmd_buf = command.substr(command.find(
'!') + 1);
158 while (!cmd_buf.empty() && (cmd_buf.back() ==
' ' || cmd_buf.back() ==
'\t' ||
159 cmd_buf.back() ==
'\r' || cmd_buf.back() ==
'\n'))
160 cmd_buf.resize(cmd_buf.size()-1);
161 log_header(
"Shell command: %s\n", cmd_buf.c_str());
164 log_cmd_error(
"Shell command returned error code %d.\n", retCode);
168 while (!tok.empty()) {
171 if (tok.back() ==
';') {
172 int num_semikolon = 0;
173 while (!tok.empty() && tok.back() ==
';')
174 tok.resize(tok.size()-1), num_semikolon++;
179 if (num_semikolon == 2)
180 call(design,
"clean");
181 if (num_semikolon == 3)
182 call(design,
"clean -purge");
static std::string next_token(bool pass_newline=false)
void log_header(const char *format,...)
int run_command(const std::string &command, std::function< void(const std::string &)> process_line)
void log_cmd_error(const char *format,...)
static void call(RTLIL::Design *design, std::string command)
void Pass::call |
( |
RTLIL::Design * |
design, |
|
|
std::vector< std::string > |
args |
|
) |
| |
|
staticinherited |
Definition at line 191 of file register.cc.
193 if (
args.size() == 0 ||
args[0][0] ==
'#')
198 for (
size_t i = 0; i <
args.size(); i++)
199 log(
"%s%s", i ?
" " :
"",
args[i].c_str());
204 log_cmd_error(
"No such command: %s (type 'help' for a command overview)\n",
args[0].c_str());
std::vector< RTLIL::Selection > selection_stack
const char * create_prompt(RTLIL::Design *design, int recursion_counter)
void log_cmd_error(const char *format,...)
void log(const char *format,...)
std::map< std::string, Pass * > pass_register
Definition at line 240 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
Definition at line 253 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
Definition at line 216 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
Definition at line 228 of file register.cc.
std::vector< RTLIL::Selection > selection_stack
std::string selected_active_module
static void call(RTLIL::Design *design, std::string command)
void Pass::cmd_error |
( |
const std::vector< std::string > & |
args, |
|
|
size_t |
argidx, |
|
|
std::string |
msg |
|
) |
| |
|
inherited |
Definition at line 110 of file register.cc.
112 std::string command_text;
115 for (
size_t i = 0; i <
args.size(); i++) {
117 error_pos +=
args[i].size() + 1;
118 command_text = command_text + (command_text.empty() ?
"" :
" ") +
args[i];
121 log(
"\nSyntax error in command `%s':\n", command_text.c_str());
125 msg.c_str(), command_text.c_str(), error_pos,
"");
void log_cmd_error(const char *format,...)
void log(const char *format,...)
void Pass::cmd_log_args |
( |
const std::vector< std::string > & |
args | ) |
|
|
inherited |
Definition at line 100 of file register.cc.
102 if (
args.size() <= 1)
104 log(
"Full command line:");
105 for (
size_t i = 0; i <
args.size(); i++)
void log(const char *format,...)
void Pass::done_register |
( |
| ) |
|
|
staticinherited |
Definition at line 62 of file register.cc.
std::map< std::string, Frontend * > frontend_register
#define log_assert(_assert_expr_)
std::map< std::string, Pass * > pass_register
std::map< std::string, Backend * > backend_register
void HelpPass::escape_html |
( |
std::string & |
html | ) |
|
|
inline |
Definition at line 550 of file register.cc.
553 while ((pos = html.find_first_of(
"<>&", pos)) != std::string::npos)
556 html.replace(pos, 1,
"<");
560 html.replace(pos, 1,
">");
564 html.replace(pos, 1,
"&");
void HelpPass::escape_tex |
( |
std::string & |
tex | ) |
|
|
inline |
Definition at line 529 of file register.cc.
532 while ((pos = tex.find(
'_', pos)) != std::string::npos) {
533 tex.replace(pos, 1,
"\\_");
virtual void HelpPass::execute |
( |
std::vector< std::string > |
args, |
|
|
RTLIL::Design * |
|
|
) |
| |
|
inlinevirtual |
Implements Pass.
Definition at line 587 of file register.cc.
589 if (
args.size() == 1) {
592 log(
" %-20s %s\n", it.first.c_str(), it.second->short_help.c_str());
594 log(
"Type 'help <command>' for more information on a command.\n");
599 if (
args.size() == 2) {
600 if (
args[1] ==
"-all") {
601 for (
auto &it : pass_register) {
603 log(
"%s -- %s\n", it.first.c_str(), it.second->short_help.c_str());
604 for (
size_t i = 0; i < it.first.size() + it.second->short_help.size() + 6; i++)
611 else if (
args[1] ==
"-write-tex-command-reference-manual") {
612 FILE *f = fopen(
"command-reference-manual.tex",
"wt");
613 fprintf(f,
"%% Generated using the yosys 'help -write-tex-command-reference-manual' command.\n\n");
614 for (
auto &it : pass_register) {
615 std::ostringstream buf;
619 write_tex(f, it.first, it.second->short_help, buf.str());
624 else if (
args[1] ==
"-write-web-command-reference-manual") {
625 FILE *f = fopen(
"templates/cmd_index.in",
"wt");
626 for (
auto &it : pass_register) {
627 std::ostringstream buf;
631 write_html(f, it.first, it.second->short_help, buf.str());
635 else if (pass_register.count(
args[1]) == 0)
636 log(
"No such command: %s\n",
args[1].c_str());
638 pass_register.at(
args[1])->help();
void write_html(FILE *idxf, std::string cmd, std::string title, std::string text)
std::vector< std::ostream * > log_streams
void log(const char *format,...)
std::map< std::string, Pass * > pass_register
void write_tex(FILE *f, std::string cmd, std::string title, std::string text)
void Pass::extra_args |
( |
std::vector< std::string > |
args, |
|
|
size_t |
argidx, |
|
|
RTLIL::Design * |
design, |
|
|
bool |
select = true |
|
) |
| |
|
inherited |
Definition at line 128 of file register.cc.
130 for (; argidx <
args.size(); argidx++)
132 std::string arg =
args[argidx];
134 if (arg.substr(0, 1) ==
"-")
135 cmd_error(
args, argidx,
"Unknown option or option in arguments.");
void cmd_error(const std::vector< std::string > &args, size_t argidx, std::string msg)
void handle_extra_select_args(Pass *pass, std::vector< std::string > args, size_t argidx, size_t args_size, RTLIL::Design *design)
virtual void HelpPass::help |
( |
| ) |
|
|
inlinevirtual |
Reimplemented from Pass.
Definition at line 521 of file register.cc.
524 log(
" help ............. list all commands\n");
525 log(
" help <command> ... print help message for given command\n");
526 log(
" help -all ........ print complete command reference\n");
void log(const char *format,...)
void Pass::init_register |
( |
| ) |
|
|
staticinherited |
Definition at line 54 of file register.cc.
virtual void run_register()
Definition at line 74 of file register.cc.
76 pre_post_exec_state_t state;
void Pass::run_register |
( |
| ) |
|
|
virtualinherited |
Reimplemented in Backend, and Frontend.
Definition at line 48 of file register.cc.
#define log_assert(_assert_expr_)
std::map< std::string, Pass * > pass_register
void HelpPass::write_html |
( |
FILE * |
idxf, |
|
|
std::string |
cmd, |
|
|
std::string |
title, |
|
|
std::string |
text |
|
) |
| |
|
inline |
Definition at line 569 of file register.cc.
571 FILE *f = fopen(
stringf(
"cmd_%s.in", cmd.c_str()).c_str(),
"wt");
572 fprintf(idxf,
"<li><a href=\"cmd_%s.html\"> ", cmd.c_str());
578 fprintf(idxf,
"%s</a> <span>%s</span></a>\n", cmd.c_str(), title.c_str());
580 fprintf(f,
"@cmd_header %s@\n", cmd.c_str());
581 fprintf(f,
"<h1>%s - %s</h1>\n", cmd.c_str(), title.c_str());
582 fprintf(f,
"<pre>%s</pre>\n", text.c_str());
583 fprintf(f,
"@footer@\n");
std::string stringf(const char *fmt,...)
void escape_html(std::string &html)
void HelpPass::write_tex |
( |
FILE * |
f, |
|
|
std::string |
cmd, |
|
|
std::string |
title, |
|
|
std::string |
text |
|
) |
| |
|
inline |
Definition at line 537 of file register.cc.
539 size_t begin = text.find_first_not_of(
"\n"), end = text.find_last_not_of(
"\n");
540 if (begin != std::string::npos && end != std::string::npos && begin < end)
541 text = text.substr(begin, end-begin+1);
542 std::string cmd_unescaped = cmd;
545 fprintf(f,
"\\section{%s -- %s}\n", cmd.c_str(), title.c_str());
546 fprintf(f,
"\\label{cmd:%s}\n", cmd_unescaped.c_str());
547 fprintf(f,
"\\begin{lstlisting}[numbers=left,frame=single]\n");
548 fprintf(f,
"%s\n\\end{lstlisting}\n\n", text.c_str());
void escape_tex(std::string &tex)
Pass* Pass::next_queued_pass |
|
inherited |
std::string Pass::pass_name |
|
inherited |
std::string Pass::short_help |
|
inherited |
The documentation for this struct was generated from the following file: