Allow comments in parentheses. Some GCode generators

and machine controller implementations prefer this.
This commit is contained in:
Markus Hitter 2010-09-05 17:20:55 +02:00
parent 446b2223cc
commit 7f57634e8c
2 changed files with 13 additions and 7 deletions

15
gcode.c
View File

@ -210,7 +210,7 @@ void scan_char(uint8_t c) {
}
// skip comments
if (next_target.seen_comment == 0) {
if (next_target.seen_semi_comment == 0 && next_target.seen_parens_comment == 0) {
// new field?
if ((c >= 'A' && c <= 'Z') || c == '*') {
last_field = c;
@ -262,9 +262,12 @@ void scan_char(uint8_t c) {
// comments
case ';':
next_target.seen_comment = 1;
next_target.seen_semi_comment = 1;
// option_bitfield |= OPTION_COMMENT;
break;
case '(':
next_target.seen_parens_comment = 1;
break;
// now for some numeracy
case '-':
@ -288,7 +291,9 @@ void scan_char(uint8_t c) {
}
// everything else is ignored
}
}
} else if ( next_target.seen_parens_comment == 1 && c == ')')
next_target.seen_parens_comment = 0; // recognize stuff after a (comment)
#ifndef ASTERISK_IN_CHECKSUM_INCLUDED
if (next_target.seen_checksum == 0)
@ -348,8 +353,8 @@ void scan_char(uint8_t c) {
next_target.seen_E = next_target.seen_F = next_target.seen_G = \
next_target.seen_S = next_target.seen_P = next_target.seen_N = \
next_target.seen_M = next_target.seen_checksum = \
next_target.seen_comment = next_target.checksum_read = \
next_target.checksum_calculated = 0;
next_target.seen_semi_comment = next_target.seen_parens_comment = \
next_target.checksum_read = next_target.checksum_calculated = 0;
last_field = 0;
read_digit.sign = read_digit.mantissa = read_digit.exponent = 0;
}

View File

@ -36,8 +36,9 @@ typedef struct {
uint8_t seen_P :1;
uint8_t seen_N :1;
uint8_t seen_checksum :1;
uint8_t seen_comment :1;
uint8_t seen_checksum :1;
uint8_t seen_semi_comment :1;
uint8_t seen_parens_comment :1;
uint8_t option_relative :1;
uint8_t option_inches :1;