/* Routine to test the extra bytes at the end of file */ void test_end(fitsfile *infits, FILE *out) { int status = 0; LONGLONG headstart, datastart, dataend; int hdutype; /* check whether there are any HDU left */ fits_movrel_hdu(infits,1, &hdutype, &status); if (!status) { wrtout(out,"< End-of-File >"); sprintf(errmes, "There are extraneous HDU(s) beyond the end of last HDU."); wrterr(out,errmes,2); wrtout(out," "); return; } if (status != END_OF_FILE) { wrtserr(out,"Bad HDU? ",&status,2); return; } status = 0; fits_clear_errmsg(); if(ffghadll(infits, &headstart, &datastart, &dataend, &status)) wrtferr(out, "",&status,1); /* try to move to the last byte of this extension. */ if (ffmbyt(infits, dataend - 1,0,&status)) { sprintf(errmes, "Error trying to read last byte of the file at byte %ld.", (long) dataend); wrterr(out,errmes,2); wrtout(out,"< End-of-File >"); wrtout(out," "); return; } /* try to move to what would be the first byte of the next extension. If successfull, we have a problem... */ ffmbyt(infits, dataend,0,&status); if(status == 0) { wrtout(out,"< End-of-File >"); sprintf(errmes, "File has extra byte(s) after last HDU at byte %ld.", (long) dataend); wrterr(out,errmes,2); wrtout(out," "); } return; }
zysdc() { struct scblk *pHEADV = GET_DATA_OFFSET(HEADV,struct scblk *); return; // announce name and copyright if (!dcdone && !(spitflag & NOBRAG)) { dcdone = 1; // Only do once per run write( STDERRFD, "LINUX SPITBOL", 13); #if RUNTIME write( STDERRFD, " Runtime", 8); #endif // RUNTIME write( STDERRFD, " Release ", 10); write( STDERRFD, pHEADV->str, pHEADV->len ); write( STDERRFD, pID1->str, pID1->len ); wrterr( cprtmsg ); } return NORMAL_RETURN; }
/* prompt() - used to give user usage info in command line versions. * */ void prompt() { #if RUNTIME wrterr("usage: spitrun [options] file[.spx] [program arguments]"); #else /* RUNTIME */ #if SAVEFILE wrterr("usage: spitbol [options] files[.spt or .spx] [args to HOST(2)]"); #else /* SAVEFILE */ wrterr("usage: spitbol [options] files[.spt] [args to HOST(2)]"); #endif /* SAVEFILE */ #endif /* RUNTIME */ #if RUNTIME #if MSDOS | OS2 wrterr("options (use - or / to specify): (# is a decimal number)"); #elif WINNT wrterr("options (use - or / to specify): (# is a decimal number)"); #else /* MSDOS | OS2 | WINNT */ wrterr("options: (# is a decimal number)"); #endif /* MSDOS | OS2 | WINNT */ wrterr("-u \"string\" data string available to program"); #if SUN3 wrterr("-v skip O/S vadvise calls"); #endif /* SUN */ wrterr("-#=file associate file with I/O channel #"); #else /* RUNTIME */ wrterr("source files are concatenated, filename '-' is standard input/output"); #if BCC16 wrterr("# is a decimal number. Append \"k\" for kilobytes."); #else /* BCC16 */ wrterr("# is a decimal number. Append \"k\" for kilobytes, \"m\" for megabytes."); #endif /* BCC16 */ #if MSDOS | OS2 wrterr("options (use - or / to specify): (# is a decimal number)"); #elif WINNT wrterr("options (use - or / to specify):"); #else /* MSDOS | OS2 | WINNT */ wrterr("options:"); #endif /* MSDOS | OS2 | WINNT */ #if BCC16 wrterr("-i# #bytes heap size"); #else /* BCC16 */ wrterr("-d# #bytes max heap -i# #bytes initial heap size & enlarge amount"); #endif wrterr("-m# #bytes max object size -s# #bytes stack size"); wrterr("-c compiler statistics -x execution statistics"); wrterr("-a same as -lcx -l normal listing"); wrterr("-p listing with wide titles -z listing with form feeds"); wrterr("-o=file[.lst] listing file -h suppress version ID/date in listing"); wrterr("-g# lines per page -t# line width in characters"); wrterr("-b suppress signon message -e errors to list file only"); wrterr("-k run with compilation error -n suppress execution"); wrterr("-f no case-folding -u \"string\" data passed to HOST(0)"); #if SUN3 wrterr("-v skip O/S vadvise calls"); #endif /* SUN3 */ #if EXECFILE & SAVEFILE #if MSDOS | OS2 | WINNT wrterr("-w write execution (.exe) file -y write save (.spx) file"); #else /* MSDOS | OS2 | WINNT */ wrterr("-w write load (.out) module -y write save (.spx) file"); #endif /* MSDOS | OS2 | WINNT */ #endif /* EXECFILE & SAVEFILE */ #if SAVEFILE & !EXECFILE wrterr("-y write save (.spx) file"); #endif /* SAVEFILE & !EXECFILE */ wrterr("-r INPUT from source file following END statement"); wrterr("-T=file write TERMINAL output to file"); wrterr("-#=file[options] associate file with I/O channel #"); #if VAX wrterr("option defaults: -d1m -i16k -m64k -s8k -g60 -t120"); #endif /* VAX */ #if HIGHC | INTEL | BCC32 | VCC | OS2 | SUN4 | LINUX | WINNT wrterr("option defaults: -d64m -i128k -m4m -s128k -g60 -t120"); #endif /* HIGHC | INTEL | OS2 | SUN4 | LINUX */ #if BCC16 wrterr("option defaults: -i56k -m9000 -s2830 -g60 -t120"); #endif /* BCC16 */ #if !HIGHC & !INTEL & !VAX & !BCC16 & !OS2 & !SUN4 & !LINUX & !WINNT wrterr("option defaults: -d64m -i128k -m64k -s128k -g60 -t120"); #endif /* !HIGHC & !INTEL & !VAX & !BCC16 & !OS2 */ #endif /* RUNTIME */ wrterr(""); wrterr("SPITBOL is not a public domain program. For licensing information contact:"); wrterr("Catspaw, Inc., P.O. Box 1123, Salida, CO 81201 USA 719-539-3884 FAX:539-4830"); wrterr("e-mail: [email protected] http://www.SNOBOL4.com"); __exit(0); }
/* Stub out all exception handling. Alternately, link in Borland's noxx.cpp module. */ void __ErrorMessage(const char *msg) { wrterr(msg);}