now openfpga shell allow empty space at beginning and end of each line in script mode

This commit is contained in:
tangxifan 2020-04-07 20:46:45 -06:00
parent 0b1c8ac139
commit 33315f0521
2 changed files with 10 additions and 2 deletions

View File

@ -302,6 +302,14 @@ void Shell<T>::run_script_mode(const char* script_file_name, T& context) {
if (cmd_end_pos != std::string::npos) {
cmd_part = line.substr(0, cmd_end_pos);
}
/* Remove the space at the beginning of the line */
cmd_part.erase(cmd_part.begin(), std::find_if(cmd_part.begin(), cmd_part.end(), [](int ch) {
return !std::isspace(ch);
}));
/* Remove the space at the end of the line */
cmd_part.erase(std::find_if(cmd_part.rbegin(), cmd_part.rend(), [](int ch) {
return !std::isspace(ch);
}).base(), cmd_part.end());
/* Process the command only when the line is not empty */
if (!cmd_part.empty()) {
execute_command(cmd_part.c_str(), context);

View File

@ -28,8 +28,8 @@ lut_truth_table_fixup #--verbose
build_fabric --compress_routing --duplicate_grid_pin --verbose
# Repack the netlist to physical pbs
# This must be done before bitstream generator and testbench generation
# Strongly recommend it is done after all the fix-up have been applied
# This must be done before bitstream generator and testbench generation
# Strongly recommend it is done after all the fix-up have been applied
repack #--verbose
# Build the bitstream