Get the file position at the start of the current command. This is called to get the file position within the current job file so that we can save the position in the DDAs to facilitate pause and resume. It is also called to get the position within a macro file when executing a while loop in that file.
| 1195 | // This is called to get the file position within the current job file so that we can save the position in the DDAs to facilitate pause and resume. |
| 1196 | // It is also called to get the position within a macro file when executing a while loop in that file. |
| 1197 | FilePosition StringParser::GetFilePosition() const noexcept |
| 1198 | { |
| 1199 | #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES |
| 1200 | const GCodeMachineState *ms = gb.machineState; |
| 1201 | while (ms->waitingForAcknowledgement && ms->GetPrevious() != nullptr) |
| 1202 | { |
| 1203 | ms = _ecv_not_null(ms->GetPrevious()); |
| 1204 | } |
| 1205 | |
| 1206 | if (ms->DoingFile() |
| 1207 | # if HAS_SBC_INTERFACE |
| 1208 | && !reprap.UsingSbcInterface() |
| 1209 | # endif |
| 1210 | ) |
| 1211 | { |
| 1212 | const FileData &file = ms->fileState; |
| 1213 | return file.GetPosition() - gb.fileInput->FileBytesCached(file) - commandLength + commandStart; |
| 1214 | } |
| 1215 | #endif |
| 1216 | return noFilePosition; |
| 1217 | } |
| 1218 | |
| 1219 | const char *_ecv_array StringParser::DataStart() const noexcept |
| 1220 | { |
no test coverage detected