We used to paraphrase Obiwan and whisper "use the source, Luke" whenever
a question comes up about proper file syntax. I didn't have time to dig
through the source code for the gcode parser in EMC/EMC2, but I did have
time to search the NIST document describing the RS274NGC gcode and the
NIST Stand Alone Interpreter (SAI) for it. Here's what I found:
"The RS274/NGC language has no indicator for the start of a program. The
Interpreter, however, deals with files. A single program may be in a
single file, or a program may be spread across several files. A file may
demarcated with percents in the following way. The first non-blank line
of a file may contain nothing but a percent sign, "%", possibly
surrounded by white space, and later in the file (normally at the end of
the file) there may be a similar line. Demarcating a file with percents
is optional if the file has an M2 or M30 in it, but is required if not.
An error will be signalled if a file has a percent line at the beginning
but not at the end. The useful contents of a file demarcated by percents
stop after the second percent line. Anything after that is ignored.
The RS274/NGC language has two commands (M2 or M30), either of which
ends a program. A program may end before the end of a file. Lines of a
file that occur after the end of a program are not to be executed. The
SAI does not even read them. "
I leave to you the exercise of checking the source code for compliance
with these statements!
Regards,
Kent
|