
There is one buffer (256 bytes) between CNC and C library. It is used
as a ring.
Buffer size = 256 bytes
+--------------------------------------------------+
+-->│ 1st output │ 2nd output │ ... │ │ --+
│ +--------------------------------------------------+ │
│ │
+----------------------------------------------------------+
When any data can not be output because comparing process has not been
completed (i.e. the buffer is full), the C library waits until it can
be output. EW_DATA may be returned late because NC program is sent to
CNC via buffers. That is, the return code of an output process may be
one of it several times before.
Moreover, return codes of several output before the last one may be
returned by "Stop output NC program to be compared(cnc_vrfend)".
[Example]
The following program compares the next NC program and "O1234" which
is already registered in CNC.
O1234 ;
M3 S1200 ;
G0 Z0 ;
G0 X0 Y0 ;
G1 F500 X120. Y-30. ;
M30 ;
#include <data.h>
#include <fwindow.h>
short example( void )
{
char *prg[] = {
"¥n",
"O1234¥n",
"M3 S1200¥n",
"G0 Z0¥n",
"G0 X0 Y0¥n",
"G1 F500 X120. Y-30.¥n",
"M30¥n",
"%"
} ;
short ret, idx ;
ret = cnc_vrfstart() ;
if ( ret ) return ( ret ) ;
for ( idx = 0 ; idx < sizeof(prg)/sizeof(char *) ; idx++ ) {
ret = cnc_verify( prg[idx], strlen( prg[idx] ) ) ;
if ( ret ) {
cnc_vrfend() ;
return ( ret ) ;
}
}
ret = cnc_vrfend() ;
return ( ret ) ;
}