/*PunResult do single line of output for the punch results and punch line intensity commands */ #include #include "cddefines.h" /* the number of emission lines across one line of printout */ #define LINEWIDTH 6 #include "punrlttype.h" #include "printe82.h" #include "punresult.h" void PunResult(FILE * io, /* 4 char + null string */ char *chLab, long int LineWL, double xInten, char *chFunction)/* null terminated string saying what to do */ { static char chLabSave[LINEWIDTH][5]; long int i; static long int LineSave[LINEWIDTH], ipLine; static double xIntenSave[LINEWIDTH]; # ifdef DEBUG_FUN fputs( "<+>PunResult()\n", debug_fp ); # endif /* if LineWidth is changed then change format in write too */ if( strcmp(chFunction,"Start") == 0 ) { ipLine = 0; } else if( strcmp(chFunction,"Line ") == 0 ) { /* save results in array so that they can be printed when done */ LineSave[ipLine] = LineWL; strcpy( chLabSave[ipLine], chLab ); xIntenSave[ipLine] = xInten; /* now increment the counter and then check if we have filled the line, * and so should print it */ ++ipLine; if( ipLine == LINEWIDTH ) { if( strcmp(PunRltType.chPunRltType,"array ") == 0 ) { /* usual array 6 wide */ for( i=0; i < ipLine; i++ ) { fprintf( io, " %4.4s", chLabSave[i] ); fprintf( io, "%6ld", LineSave[i] ); fprintf( io,PrintEfmt("%10.3e", xIntenSave[i]) ); } fprintf( io, " \n" ); } else if( strcmp(PunRltType.chPunRltType,"column") == 0 ) { /* single column for input into data base */ for( i=0; i < ipLine; i++ ) { fprintf( io, " %4.4s", chLabSave[i] ); fprintf( io, "%6ld", LineSave[i] ); fprintf( io,PrintEfmt("%10.3e", xIntenSave[i] )); fprintf( io, "\n" ); } } else { fprintf( ioQQQ, " PunResult called with insane chPunRltType=%6.6s\n", PunRltType.chPunRltType ); } ipLine = 0; } } else if( strcmp(chFunction,"Flush") == 0 ) { if( ipLine > 0 ) { /* this is an option to print many emission lines across an output line, * the array option, or a single column of numbers, the column option * that appears on the "punch results" and "punch intensity" commands */ if( strcmp(PunRltType.chPunRltType,"array ") == 0 ) { /* usual array 6 wide */ for( i=0; i < ipLine; i++ ) { fprintf( io, " %4.4s", chLabSave[i] ); fprintf( io, "%6ld", LineSave[i] ); fprintf( io,PrintEfmt("%10.3e", xIntenSave[i]) ); } fprintf( io, " \n" ); } else if( strcmp(PunRltType.chPunRltType,"column") == 0 ) { /* single column for input into data base */ for( i=0; i < ipLine; i++ ) { fprintf( io, " %4.4s", chLabSave[i] ); fprintf( io, "%6ld", LineSave[i] ); fprintf( io,PrintEfmt("%10.3e", xIntenSave[i] )); fprintf( io, "\n" ); } } else { fprintf( ioQQQ, " PunResult called with insane chPunRltType=%6.6s\n", PunRltType.chPunRltType ); } } } else { fprintf( ioQQQ, " PunResult called with insane request=%5.5s\n", chFunction ); puts( "[Stop in result]" ); exit(1); } # ifdef DEBUG_FUN fputs( " <->PunResult()\n", debug_fp ); # endif return; }