diff options
| author | Julian Blake Kongslie | 2022-11-05 12:51:39 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-11-05 12:51:39 -0700 |
| commit | 7884a2520f0a520114008bf727594f38bf58d308 (patch) | |
| tree | e8d7f2dc1fbc9bcf8ffad21f9fff7fc58c735c11 | |
| parent | Rename/remove some of the example programs (diff) | |
| download | biggolf-7884a2520f0a520114008bf727594f38bf58d308.tar.xz | |
Ignore leading/trailing whitespace and #comments in evt files
Diffstat (limited to '')
| -rw-r--r-- | io/model.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/io/model.cpp b/io/model.cpp index 81cf318..80986a6 100644 --- a/io/model.cpp +++ b/io/model.cpp | |||
| @@ -57,6 +57,12 @@ void iomodel::load_evt(std::istream &fh) { | |||
| 57 | // FIXME: add assertions | 57 | // FIXME: add assertions |
| 58 | // FIXME: add DMA | 58 | // FIXME: add DMA |
| 59 | for (std::string line; std::getline(fh, line); ) { | 59 | for (std::string line; std::getline(fh, line); ) { |
| 60 | auto hashpos = line.find('#'); | ||
| 61 | line = line.substr(0, hashpos); | ||
| 62 | if (auto nwspos = line.find_first_not_of(" \t"); nwspos != std::string::npos) | ||
| 63 | line = line.substr(nwspos); | ||
| 64 | if (auto nwspos = line.find_last_not_of(" \t"); nwspos != std::string::npos) | ||
| 65 | line = line.substr(0, nwspos + 1); | ||
| 60 | if (line.size() == 0) | 66 | if (line.size() == 0) |
| 61 | continue; | 67 | continue; |
| 62 | if (line[0] == '+') { | 68 | if (line[0] == '+') { |
