Changeset 1621 for trunk/psLib/src/collections/psMetadata.c
- Timestamp:
- Aug 25, 2004, 10:21:41 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psMetadata.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psMetadata.c
r1546 r1621 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08- 14 02:55:46$14 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-25 20:21:25 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 /******************************************************************************/ 40 40 41 #define FITS_ERROR(STRING,PS_ERROR) \ 42 fits_get_errstatus(status, fitsErr); \ 43 psError( __func__, STRING, PS_ERROR, fitsErr); \ 44 status = 0; \ 41 #define FITS_ERROR(STRING,PS_ERROR) \ 42 fits_get_errstatus(status, fitsErr); \ 43 psError(__func__, STRING, PS_ERROR, fitsErr); \ 44 status = 0; \ 45 fits_close_file(fd, &status); \ 46 if(status){ \ 47 fits_get_errstatus(status, fitsErr); \ 48 psError(__func__, "Couldn't close FITS file. FITS error: %s", fitsErr); \ 49 } \ 50 status = 0; \ 45 51 return output; 46 52 … … 657 663 } 658 664 659 psMetadata* psMetadata FReadHeader(psMetadata* output, char *extName, int extNum, fitsfile * fd)665 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, int extNum, char *fileName) 660 666 { 661 667 bool tempBool; … … 672 678 int keyNum = 0; 673 679 psMetadataType metadataItemType; 674 675 if (fd == NULL) { 676 psError(__func__, "Null FITS file descriptor not allowed"); 680 fitsfile *fd = NULL; 681 682 if(fileName == NULL) { 683 psError(__func__, "Null fileName not allowed"); 684 return NULL; 685 } 686 687 fits_open_file(&fd, fileName, READONLY, &status); 688 if(fd == NULL || status != 0) { 689 FITS_ERROR("FITS error while opening file: %s %s", fileName); 677 690 return NULL; 678 691 } … … 685 698 return NULL; 686 699 } 700 687 701 // Allocate metadata if user didn't 688 702 if (output == NULL) { 689 703 output = psMetadataAlloc(); 690 704 } 705 691 706 // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one. 692 707 if (extName != NULL) { … … 704 719 FITS_ERROR("FITS error while reading key %d: %s", keyNum); 705 720 } 721 706 722 // Get each key name. Keywords start at one. 707 723 for (i = 1; i <= numKeys; i++) { … … 714 730 FITS_ERROR("FITS error while determining key %d type: %s", keyNum); 715 731 } else { 716 // Some keywords are still valid even though they don't have a type, like COMMENTS and 717 // HISTORY 732 // Some keywords are still valid if they don't have a type (like COMMENTS and HISTORY) 718 733 keyType = 'C'; 719 734 status = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
