openfpga shell will stay in interactive mode after executing a script

This commit is contained in:
tangxifan 2020-01-27 17:56:24 -07:00
parent 5ecb771673
commit df056f5d70
3 changed files with 13 additions and 7 deletions

View File

@ -115,7 +115,7 @@ class Shell {
bool valid_command_class_id(const ShellCommandClassId& cmd_class_id) const; bool valid_command_class_id(const ShellCommandClassId& cmd_class_id) const;
public: /* Public executors */ public: /* Public executors */
/* Start the interactive mode, where users will type-in command by command */ /* Start the interactive mode, where users will type-in command by command */
void run_interactive_mode(T& context); void run_interactive_mode(T& context, const bool& quiet_mode = false);
/* Start the script mode, where users provide a file which includes all the commands to run */ /* Start the script mode, where users provide a file which includes all the commands to run */
void run_script_mode(const char* script_file_name, T& context); void run_script_mode(const char* script_file_name, T& context);
/* Print all the commands by their classes. This is actually the help desk */ /* Print all the commands by their classes. This is actually the help desk */

View File

@ -239,13 +239,15 @@ ShellCommandClassId Shell<T>::add_command_class(const char* name) {
* Public executors * Public executors
***********************************************************************/ ***********************************************************************/
template <class T> template <class T>
void Shell<T>::run_interactive_mode(T& context) { void Shell<T>::run_interactive_mode(T& context, const bool& quiet_mode) {
VTR_LOG("Start interactive mode of %s...\n", if (false == quiet_mode) {
name().c_str()); VTR_LOG("Start interactive mode of %s...\n",
name().c_str());
/* Print the title of the shell */ /* Print the title of the shell */
if (!title().empty()) { if (!title().empty()) {
VTR_LOG("%s\n", title().c_str()); VTR_LOG("%s\n", title().c_str());
}
} }
/* Wait for users input and execute the command */ /* Wait for users input and execute the command */
@ -306,6 +308,9 @@ void Shell<T>::run_script_mode(const char* script_file_name, T& context) {
} }
} }
fp.close(); fp.close();
/* Return to interactive mode, stay tuned */
run_interactive_mode(context, true);
} }
template <class T> template <class T>

View File

@ -143,6 +143,7 @@ void build_vpr_physical_pb_type_annotation(const DeviceContext& vpr_device_ctx,
/* Not found, error out! */ /* Not found, error out! */
VTR_LOG_ERROR("Unable to find the pb_type '%s' in VPR architecture definition!\n", VTR_LOG_ERROR("Unable to find the pb_type '%s' in VPR architecture definition!\n",
target_pb_type_names.back().c_str()); target_pb_type_names.back().c_str());
break;
} }
/* Found, we update the annotation by assigning the physical mode */ /* Found, we update the annotation by assigning the physical mode */