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:
bubnikv 2018-01-03 20:53:39 +01:00
parent 9d98a27b98
commit 998157fc9b
3 changed files with 32 additions and 47 deletions

View file

@ -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();