mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fixed an issue with vsprintf and on demand buffer allocation.
Improved the GCodeReader to support spaces before the G-code.
This commit is contained in:
parent
9d98a27b98
commit
998157fc9b
3 changed files with 32 additions and 47 deletions
|
@ -28,38 +28,6 @@ void GCodeReader::parse(const std::string &gcode, callback_t callback)
|
|||
this->parse_line(line, callback);
|
||||
}
|
||||
|
||||
static inline bool is_whitespace(char c)
|
||||
{
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
|
||||
static inline bool is_end_of_line(char c)
|
||||
{
|
||||
return c == '\r' || c == '\n' || c == 0;
|
||||
}
|
||||
|
||||
static inline bool is_end_of_gcode_line(char c)
|
||||
{
|
||||
return c == ';' || is_end_of_line(c);
|
||||
}
|
||||
|
||||
static inline bool is_end_of_word(char c)
|
||||
{
|
||||
return is_whitespace(c) || is_end_of_gcode_line(c);
|
||||
}
|
||||
|
||||
static inline const char* skip_whitespaces(const char *c)
|
||||
{
|
||||
for (; is_whitespace(*c); ++ c);
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline const char* skip_word(const char *c)
|
||||
{
|
||||
for (; ! is_end_of_word(*c); ++ c);
|
||||
return c;
|
||||
}
|
||||
|
||||
const char* GCodeReader::parse_line_internal(const char *ptr, GCodeLine &gline, std::pair<const char*, const char*> &command)
|
||||
{
|
||||
PROFILE_FUNC();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue