User's Manual

PMAC User Manual
Closing the Servo Loop 115
int argc;
char *argv[];
{
m = 0;
x = 0;
if (argc > 1) {
infile = fopen(strcat(strcpy(buf,argv[1]),".lod"),"r");
if (infile != NULL) {
outfile = fopen(strcat(strcpy(buf,argv[1]),".pmc"),"wb");
setvbuf(outfile,bufr,_IOFBF,32767);
while(fgets(buf,80,infile)!=NULL&&strncmp(buf,"_DATA P",7)!=0);
sscanf(buf+8,"%4x",&y);
while(fgets(buf,80,infile)!=NULL&&strncmp(buf,"_END",4)!=0) {
n = 0;
l = strlen(buf);
while (l > n+5) {
switch (m) {
case 0:
fprintf(outfile,"WP$%04X",y); y += 5;
default:
fprintf(outfile,",$%c%c%c%c%c%c",buf[n],buf[n+1],buf[n+2],
buf[n+3],buf[n+4],buf[n+5]);
}
n += 7;
m += 1;
if (m==5) {
m = 0;
fprintf(outfile,"\r\n");
}
}
}
if (m>0) fprintf(outfile,"\r\n");
}
}
}