Changeset 1623

Show
Ignore:
Timestamp:
12/07/07 06:50:47 (9 months ago)
Author:
rporter
Message:

trunk/source/cddrive.cpp
trunk/source/cdinit.cpp
trunk/source/cloudy.cpp
trunk/source/parse.h
trunk/source/parse_punch.cpp

ClosePunchFiles? now accepts boolean saying whether this is final close, then ignore clobber options. It also checks that any FITS files are the right size and complains if they are not.

Location:
trunk/source
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/cddrive.cpp

    r1557 r1623  
    21222122        DEBUG_ENTRY( "cdClosePunchFiles()" ); 
    21232123 
    2124         ClosePunchFiles(); 
     2124        ClosePunchFiles( true ); 
    21252125        return; 
    21262126} 
  • trunk/source/cdinit.cpp

    r1557 r1623  
    254254 
    255255        /* close any open units */ 
    256         ClosePunchFiles(); 
     256        ClosePunchFiles( true ); 
    257257 
    258258        /* this routine must be called upon exit or machine will appear to "hang", 
  • trunk/source/cloudy.cpp

    r1557 r1623  
    300300        } 
    301301 
    302         ClosePunchFiles(); 
     302        ClosePunchFiles( false ); 
    303303 
    304304        /* this checks that various parts of the code worked properly */ 
  • trunk/source/parse.h

    r1576 r1623  
    3838void PunchFilesInit(void); 
    3939 
    40 /**close all open punch files */ 
    41 void ClosePunchFiles(void); 
     40/**close all open punch files  
     41\param lgFinal - close ALL files, regardless of "no clobber" status 
     42*/ 
     43void ClosePunchFiles( bool lgFinal ); 
    4244 
    4345/**ParseAge - parse the age command */ 
  • trunk/source/parse_punch.cpp

    r1618 r1623  
    25102510 * from cloudy before returning  
    25112511 * NB - KEEP THIS ROUTINE SYNCHED UP WITH THE PREVIOUS ONE, PunchFilesInit */ 
    2512 void ClosePunchFiles(void) 
     2512void ClosePunchFiles( bool lgFinal ) 
    25132513{ 
    25142514        long int i; 
     
    25212521        for( i=0; i < punch.npunch; i++ ) 
    25222522        { 
    2523                 if( punch.ipPnunit[i] != NULL && !lgNoClobber[i] ) 
    2524                 { 
     2523                /* if lgFinal is true, we close everything, no matter what.  
     2524                 * this means ignoring "no clobber" options */ 
     2525                if( punch.ipPnunit[i] != NULL && ( !lgNoClobber[i] || lgFinal ) ) 
     2526                { 
     2527                        /* Test that any FITS files are the right size! */  
     2528                        if( punch.lgFITS[i] ) 
     2529                        { 
     2530                                /* \todo 2 This overflows for file sizes larger (in bytes) than 
     2531                                 * a long int can represent (about 2GB on most 2007 systems)  */ 
     2532                                fseek(punch.ipPnunit[i], 0, SEEK_END); 
     2533                                long file_size = ftell(punch.ipPnunit[i]); 
     2534                                if( file_size%2880 ) 
     2535                                { 
     2536                                        fprintf( ioQQQ, " PROBLEM  FITS file is wrong size!\n" ); 
     2537                                } 
     2538                        } 
     2539 
    25252540                        fclose( punch.ipPnunit[i] ); 
    25262541                        punch.ipPnunit[i] = NULL;