MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / GetFilePosition

Method GetFilePosition

src/GCodes/GCodeBuffer/StringParser.cpp:1197–1217  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
1197FilePosition 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
1219const char *_ecv_array StringParser::DataStart() const noexcept
1220{

Callers 1

THROWSFunction · 0.45

Calls 4

DoingFileMethod · 0.80
UsingSbcInterfaceMethod · 0.80
FileBytesCachedMethod · 0.80
GetPreviousMethod · 0.45

Tested by

no test coverage detected