change type casting for vpr macro

This commit is contained in:
tangxifan 2020-01-23 14:57:53 -07:00
parent 26e6c4012f
commit e69aa5ba30
5 changed files with 8 additions and 9 deletions

View File

@ -106,7 +106,7 @@ class Shell {
void set_command_execute_function(const ShellCommandId& cmd_id,
std::function<void()> exec_func);
void set_command_execute_function(const ShellCommandId& cmd_id,
std::function<int(int, const char**)> exec_func);
std::function<int(int, char**)> exec_func);
void set_command_dependency(const ShellCommandId& cmd_id,
const std::vector<ShellCommandId> cmd_dependency);
ShellCommandClassId add_command_class(const char* name);
@ -167,7 +167,7 @@ class Shell {
vtr::vector<ShellCommandId, std::function<void(const T&)>> command_short_const_execute_functions_;
vtr::vector<ShellCommandId, std::function<void(T&)>> command_short_execute_functions_;
vtr::vector<ShellCommandId, std::function<void()>> command_builtin_execute_functions_;
vtr::vector<ShellCommandId, std::function<int(int, const char**)>> command_macro_execute_functions_;
vtr::vector<ShellCommandId, std::function<int(int, char**)>> command_macro_execute_functions_;
/* Type of execute functions for each command.
* This is supposed to be an internal data ONLY

View File

@ -194,7 +194,7 @@ void Shell<T>::set_command_execute_function(const ShellCommandId& cmd_id,
template<class T>
void Shell<T>::set_command_execute_function(const ShellCommandId& cmd_id,
std::function<int(int, const char**)> exec_func) {
std::function<int(int, char**)> exec_func) {
VTR_ASSERT(true == valid_command_id(cmd_id));
command_execute_function_types_[cmd_id] = MACRO;
command_macro_execute_functions_[cmd_id] = exec_func;
@ -376,7 +376,7 @@ void Shell<T>::execute_command(const char* cmd_line,
strcpy(argv[itok], tokens[itok].c_str());
}
/* Execute the marco function */
command_macro_execute_functions_[cmd_id](tokens.size(), (const char**)argv);
command_macro_execute_functions_[cmd_id](tokens.size(), argv);
/* Free the argv */
for (size_t itok = 0; itok < tokens.size(); ++itok) {
free(argv[itok]);

View File

@ -28,7 +28,7 @@ void shell_execute_print(ShellContext& context) {
}
static
int shell_execute_print_macro(int argc, const char** argv) {
int shell_execute_print_macro(int argc, char** argv) {
VTR_LOG("Number of arguments: %d\n", argc);
VTR_LOG("Detailed arguments:\n");
for (int iarg = 0; iarg < argc; ++iarg) {
@ -116,7 +116,6 @@ int main(int argc, char** argv) {
shell.set_command_class(shell_cmd_print_macro_id, arith_cmd_class);
shell.set_command_execute_function(shell_cmd_print_macro_id, shell_execute_print_macro);
/* Add a new class of commands */
ShellCommandClassId basic_cmd_class = shell.add_command_class("Basic");

View File

@ -37,7 +37,7 @@ namespace vpr {
* 3. Place-and-route and timing analysis
* 4. Clean up
*/
int vpr(int argc, const char** argv) {
int vpr(int argc, char** argv) {
vtr::ScopedFinishTimer t("The entire flow of VPR");
t_options Options = t_options();
@ -48,7 +48,7 @@ int vpr(int argc, const char** argv) {
vpr_install_signal_handler();
/* Read options, architecture, and circuit netlist */
vpr_init(argc, argv, &Options, &vpr_setup, &Arch);
vpr_init(argc, (const char**)argv, &Options, &vpr_setup, &Arch);
if (Options.show_version) {
return SUCCESS_EXIT_CODE;

View File

@ -4,7 +4,7 @@
/* Begin namespace vpr */
namespace vpr {
int vpr(int argc, const char** argv);
int vpr(int argc, char** argv);
} /* End namespace vpr */