#include /* module hardsav9 */ #include #include #include #include #include #include #include #include #include #include #include #include #include /**************************************************************************/ savepal(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("palette.723","wb"))) { warn("COULD NOT OPEN PALETTE.723"); goto abort; } if(fail=isave(pal,48)) /* write color intensities */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savscale(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("scales.723","wb"))) /* open file */ { warn("COULD NOT OPEN SCALES.723"); goto abort; } if(fail=isave(scale,32)) goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savemisc(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("misc.723","wb"))) /* open file */ { warn("COULD NOT OPEN MISC.723"); goto abort; } if(fail=isave(counter,80)) goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ saveiden(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("idens.723","wb"))) { warn("COULD NOT OPEN IDENS.723"); goto abort; } if(fail=save(password,10)) /* write password */ goto duck; if(fail=save(idents,100)) /* write identities */ goto duck; if(fail=usave(prohibs,200)) /* prohibitied commands */ goto duck; if(fail=save(codec,4)) /* write over-ride code */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savpreset(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("presets.723","wb"))) { warn("COULD NOT OPEN PRESETS.723"); goto abort; } if(fail=isave(prepow,10)) /* write forward power */ goto duck; if(fail=isave(prebeam,10)) /* write beam voltage */ goto duck; if(fail=isave(predriv,10)) /* write drive power */ goto duck; if(fail=isave(prebal,10)) /* write drive balance */ goto duck; if(fail=isave(prepha,10)) /* write drive phase */ goto duck; if(fail=isave(preoff,10)) /* write feed-forward offset */ goto duck; if(fail=isave(pregain,10)) /* write feed-forward gain */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savelim(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("limits.723","wb"))) /* open file */ { warn("COULD NOT OPEN LIMITS.723"); goto abort; } if(fail=isave(lolim,64)) /* write lower meter limits */ goto duck; if(fail=isave(hilim,64)) /* write upper meter limits */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savdname(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("dnames.723","wb"))) /* open file */ { warn("COULD NOT OPEN DNAMES.723"); goto abort; } if(fail=save(dname,320)) /* write status titles */ goto duck; if(fail=save(dname1,160)) /* write high states */ goto duck; if(fail=save(dname2,160)) /* write low states */ goto duck; if(fail=save(dname3,16)) /* write warning status */ goto duck; if(fail=save(dname4,16)) /* write warning status */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savcname(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("cnames.723","wb"))) /* open file */ { warn("COULD NOT OPEN CNAMES.723"); goto abort; } if(fail=save(cname,160)) /* write command names */ goto duck; if(fail=save(cname1,16)) /* write assertion levels */ goto duck; if(fail=save(cname2,16)) /* write boot levels */ goto duck; if(fail=save(cname3,16)) /* write durations */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /**************************************************************************/ savefunc(void) /* update hard drive */ { int fail; if(fail=!(stream=fopen("funcs.723","wb"))) { warn("COULD NOT OPEN FUNCS.723"); goto abort; } if(fail=save(func,960)) /* write function keys */ goto duck; duck: fclose(stream); /* close file */ abort: return(fail); } /*****************************************************************************/ save(char *data, unsigned int n) /* write n bytes to hard drive file */ { int fail=0; unsigned int nwrit; /* hard drive byte counter */ nwrit=fwrite(data,1,n,stream); if(n!=nwrit) { brief("UNDESIRED NUMBER OF CHARS WRITTEN"); fail=1; } return(fail); } /*****************************************************************************/ usave(unsigned char *data, unsigned int n) /* write n bytes to hard drive file */ { int fail=0; unsigned int nwrit; /* hard drive byte counter */ nwrit=fwrite(data,1,n,stream); if(n!=nwrit) { brief("UNDESIRED NUMBER OF CHARS WRITTEN"); fail=1; } return(fail); } /*****************************************************************************/ isave(int *data,unsigned int n) /* write n words to hard drive file */ { int fail=0; unsigned int nwrit; /* hard drive word counter */ nwrit=fwrite(data,2,n,stream); if(n!=nwrit) { brief("UNDESIRED NUMBER OF CHARS WRITTEN"); fail=1; } return(fail); } /*****************************************************************************/ lsave(long *data,unsigned int n)/* write n long numbers to hard drive file */ { int fail=0; unsigned int nwrit; /* hard drive counter */ nwrit=fwrite(data,4,n,stream); if(n!=nwrit) { brief("UNDESIRED NUMBER OF CHARS WRITTEN"); fail=1; } return(fail); }