Changeset 1355
- Timestamp:
- Jul 30, 2004, 2:48:20 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 3 edited
-
astronomy/psMetadata.c (modified) (2 diffs)
-
collections/psMetadata.c (modified) (2 diffs)
-
types/psMetadata.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psMetadata.c
r1352 r1355 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-07-31 00: 17:01$13 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-07-31 00:48:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 568 568 psMetadata *psMetadataReadHeader( psMetadata *output, const char *extname, int extnum, const char *filename ) 569 569 { 570 char line[ MAX_VAL_SIZE ]; 571 char keyName[ MAX_VAL_SIZE ]; 572 char keyValue[ MAX_VAL_SIZE ]; 573 char keyComment[ MAX_VAL_SIZE ]; 574 int status = 0; 575 extnumCtr = 1; 576 FILE *fd = NULL; 577 578 if ( filename == NULL ) { 579 psError( __func__, "Null file name not allowed" ); 580 return NULL; 581 } 582 583 if ( extname == NULL && extnum == 0 ) { 584 psError( __func__, "Null extname AND extnum = 0 not allowed" ); 585 return NULL; 586 } else if ( extname && extnum ) { 587 psError( __func__, "Both extname AND extnum arguments should not have valid values." ); 588 return NULL; 589 } 590 591 fd = fopen( filename, "r" ); 592 if ( fd == NULL ) { 593 psError( __func__, "Null FITS file descriptor not allowed" ); 594 return NULL; 595 } 596 597 // Allocate metadata if user didn't 598 if ( output == NULL ) { 599 output = psMetadataAlloc(); 600 psError( __func__, "Failed to allocate metadata" ); 601 return NULL; 602 } 603 604 // Move to user designated HDU number or HDU name in text file. HDU numbers starts at one. 605 /* TODO if(extname == NULL) { 606 return output; 570 /* char line[ MAX_VAL_SIZE ]; 571 char keyName[ MAX_VAL_SIZE ]; 572 char keyValue[ MAX_VAL_SIZE ]; 573 char keyComment[ MAX_VAL_SIZE ]; 574 int status = 0; 575 extnumCtr = 1; 576 FILE *fd = NULL; 577 578 if ( filename == NULL ) { 579 psError( __func__, "Null file name not allowed" ); 580 return NULL; 607 581 } 608 } else if(extnum > 0) { 609 return output; 582 583 if ( extname == NULL && extnum == 0 ) { 584 psError( __func__, "Null extname AND extnum = 0 not allowed" ); 585 return NULL; 586 } else if ( extname && extnum ) { 587 psError( __func__, "Both extname AND extnum arguments should not have valid values." ); 588 return NULL; 610 589 } 611 } 612 613 614 line = fgets(line, MAX_LINE_SIZE+1, fp); 615 while(line != NULL) { 616 617 if(!strncmp("END", line, 3)){ 618 extnumCtr++; 590 591 fd = fopen( filename, "r" ); 592 if ( fd == NULL ) { 593 psError( __func__, "Null FITS file descriptor not allowed" ); 594 return NULL; 595 } 596 597 // Allocate metadata if user didn't 598 if ( output == NULL ) { 599 output = psMetadataAlloc(); 600 psError( __func__, "Failed to allocate metadata" ); 601 return NULL; 602 } 603 604 // Move to user designated HDU number or HDU name in text file. HDU numbers starts at one. 605 TODO if(extname == NULL) { 606 return output; 607 } 608 } else if(extnum > 0) { 609 return output; 610 } 611 } 612 613 614 line = fgets(line, MAX_LINE_SIZE+1, fp); 615 while(line != NULL) { 616 617 if(!strncmp("END", line, 3)){ 618 extnumCtr++; 619 } 620 621 if(extnumCtr == extnum) { 622 623 // Put text into metadata 624 if(!strncmp("COMMENT", line, 7)){ 625 // COMMENT keywords have no "=" sign 626 //TODO 627 } else if (strchr(line, '\'') != NULL){ 628 629 // Output and logging keywords have tic (') characters 630 keyName = strtok(line, "="); 631 keyValue = strtok(NULL, "'"); 632 keyValue = strtok(NULL, "'"); 633 keyComment = strtok(NULL, "XXX"); 634 635 636 } else 637 638 // Everything else is considered to be the standard name and value 639 keyName = strtok(line, "="); 640 keyValue = strtok(NULL, "/"); 641 keyComment = strtok(NULL, "XXX"); 642 } 643 644 645 } 646 647 // Read next line 648 line = fgets(line, MAX_LINE_SIZE+1, fp); 619 649 } 620 621 if(extnumCtr == extnum) { 622 623 // Put text into metadata 624 if(!strncmp("COMMENT", line, 7)){ 625 // COMMENT keywords have no "=" sign 626 //TODO 627 } else if (strchr(line, '\'') != NULL){ 628 629 // Output and logging keywords have tic (') characters 630 keyName = strtok(line, "="); 631 keyValue = strtok(NULL, "'"); 632 keyValue = strtok(NULL, "'"); 633 keyComment = strtok(NULL, "XXX"); 634 635 636 } else 637 638 // Everything else is considered to be the standard name and value 639 keyName = strtok(line, "="); 640 keyValue = strtok(NULL, "/"); 641 keyComment = strtok(NULL, "XXX"); 642 } 643 644 645 } 646 647 // Read next line 648 line = fgets(line, MAX_LINE_SIZE+1, fp); 649 } 650 651 */ 650 651 */ 652 652 return output; 653 653 } -
trunk/psLib/src/collections/psMetadata.c
r1352 r1355 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-07-31 00: 17:01$13 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-07-31 00:48:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 568 568 psMetadata *psMetadataReadHeader( psMetadata *output, const char *extname, int extnum, const char *filename ) 569 569 { 570 char line[ MAX_VAL_SIZE ]; 571 char keyName[ MAX_VAL_SIZE ]; 572 char keyValue[ MAX_VAL_SIZE ]; 573 char keyComment[ MAX_VAL_SIZE ]; 574 int status = 0; 575 extnumCtr = 1; 576 FILE *fd = NULL; 577 578 if ( filename == NULL ) { 579 psError( __func__, "Null file name not allowed" ); 580 return NULL; 581 } 582 583 if ( extname == NULL && extnum == 0 ) { 584 psError( __func__, "Null extname AND extnum = 0 not allowed" ); 585 return NULL; 586 } else if ( extname && extnum ) { 587 psError( __func__, "Both extname AND extnum arguments should not have valid values." ); 588 return NULL; 589 } 590 591 fd = fopen( filename, "r" ); 592 if ( fd == NULL ) { 593 psError( __func__, "Null FITS file descriptor not allowed" ); 594 return NULL; 595 } 596 597 // Allocate metadata if user didn't 598 if ( output == NULL ) { 599 output = psMetadataAlloc(); 600 psError( __func__, "Failed to allocate metadata" ); 601 return NULL; 602 } 603 604 // Move to user designated HDU number or HDU name in text file. HDU numbers starts at one. 605 /* TODO if(extname == NULL) { 606 return output; 570 /* char line[ MAX_VAL_SIZE ]; 571 char keyName[ MAX_VAL_SIZE ]; 572 char keyValue[ MAX_VAL_SIZE ]; 573 char keyComment[ MAX_VAL_SIZE ]; 574 int status = 0; 575 extnumCtr = 1; 576 FILE *fd = NULL; 577 578 if ( filename == NULL ) { 579 psError( __func__, "Null file name not allowed" ); 580 return NULL; 607 581 } 608 } else if(extnum > 0) { 609 return output; 582 583 if ( extname == NULL && extnum == 0 ) { 584 psError( __func__, "Null extname AND extnum = 0 not allowed" ); 585 return NULL; 586 } else if ( extname && extnum ) { 587 psError( __func__, "Both extname AND extnum arguments should not have valid values." ); 588 return NULL; 610 589 } 611 } 612 613 614 line = fgets(line, MAX_LINE_SIZE+1, fp); 615 while(line != NULL) { 616 617 if(!strncmp("END", line, 3)){ 618 extnumCtr++; 590 591 fd = fopen( filename, "r" ); 592 if ( fd == NULL ) { 593 psError( __func__, "Null FITS file descriptor not allowed" ); 594 return NULL; 595 } 596 597 // Allocate metadata if user didn't 598 if ( output == NULL ) { 599 output = psMetadataAlloc(); 600 psError( __func__, "Failed to allocate metadata" ); 601 return NULL; 602 } 603 604 // Move to user designated HDU number or HDU name in text file. HDU numbers starts at one. 605 TODO if(extname == NULL) { 606 return output; 607 } 608 } else if(extnum > 0) { 609 return output; 610 } 611 } 612 613 614 line = fgets(line, MAX_LINE_SIZE+1, fp); 615 while(line != NULL) { 616 617 if(!strncmp("END", line, 3)){ 618 extnumCtr++; 619 } 620 621 if(extnumCtr == extnum) { 622 623 // Put text into metadata 624 if(!strncmp("COMMENT", line, 7)){ 625 // COMMENT keywords have no "=" sign 626 //TODO 627 } else if (strchr(line, '\'') != NULL){ 628 629 // Output and logging keywords have tic (') characters 630 keyName = strtok(line, "="); 631 keyValue = strtok(NULL, "'"); 632 keyValue = strtok(NULL, "'"); 633 keyComment = strtok(NULL, "XXX"); 634 635 636 } else 637 638 // Everything else is considered to be the standard name and value 639 keyName = strtok(line, "="); 640 keyValue = strtok(NULL, "/"); 641 keyComment = strtok(NULL, "XXX"); 642 } 643 644 645 } 646 647 // Read next line 648 line = fgets(line, MAX_LINE_SIZE+1, fp); 619 649 } 620 621 if(extnumCtr == extnum) { 622 623 // Put text into metadata 624 if(!strncmp("COMMENT", line, 7)){ 625 // COMMENT keywords have no "=" sign 626 //TODO 627 } else if (strchr(line, '\'') != NULL){ 628 629 // Output and logging keywords have tic (') characters 630 keyName = strtok(line, "="); 631 keyValue = strtok(NULL, "'"); 632 keyValue = strtok(NULL, "'"); 633 keyComment = strtok(NULL, "XXX"); 634 635 636 } else 637 638 // Everything else is considered to be the standard name and value 639 keyName = strtok(line, "="); 640 keyValue = strtok(NULL, "/"); 641 keyComment = strtok(NULL, "XXX"); 642 } 643 644 645 } 646 647 // Read next line 648 line = fgets(line, MAX_LINE_SIZE+1, fp); 649 } 650 651 */ 650 651 */ 652 652 return output; 653 653 } -
trunk/psLib/src/types/psMetadata.c
r1352 r1355 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-07-31 00: 17:01$13 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-07-31 00:48:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 568 568 psMetadata *psMetadataReadHeader( psMetadata *output, const char *extname, int extnum, const char *filename ) 569 569 { 570 char line[ MAX_VAL_SIZE ]; 571 char keyName[ MAX_VAL_SIZE ]; 572 char keyValue[ MAX_VAL_SIZE ]; 573 char keyComment[ MAX_VAL_SIZE ]; 574 int status = 0; 575 extnumCtr = 1; 576 FILE *fd = NULL; 577 578 if ( filename == NULL ) { 579 psError( __func__, "Null file name not allowed" ); 580 return NULL; 581 } 582 583 if ( extname == NULL && extnum == 0 ) { 584 psError( __func__, "Null extname AND extnum = 0 not allowed" ); 585 return NULL; 586 } else if ( extname && extnum ) { 587 psError( __func__, "Both extname AND extnum arguments should not have valid values." ); 588 return NULL; 589 } 590 591 fd = fopen( filename, "r" ); 592 if ( fd == NULL ) { 593 psError( __func__, "Null FITS file descriptor not allowed" ); 594 return NULL; 595 } 596 597 // Allocate metadata if user didn't 598 if ( output == NULL ) { 599 output = psMetadataAlloc(); 600 psError( __func__, "Failed to allocate metadata" ); 601 return NULL; 602 } 603 604 // Move to user designated HDU number or HDU name in text file. HDU numbers starts at one. 605 /* TODO if(extname == NULL) { 606 return output; 570 /* char line[ MAX_VAL_SIZE ]; 571 char keyName[ MAX_VAL_SIZE ]; 572 char keyValue[ MAX_VAL_SIZE ]; 573 char keyComment[ MAX_VAL_SIZE ]; 574 int status = 0; 575 extnumCtr = 1; 576 FILE *fd = NULL; 577 578 if ( filename == NULL ) { 579 psError( __func__, "Null file name not allowed" ); 580 return NULL; 607 581 } 608 } else if(extnum > 0) { 609 return output; 582 583 if ( extname == NULL && extnum == 0 ) { 584 psError( __func__, "Null extname AND extnum = 0 not allowed" ); 585 return NULL; 586 } else if ( extname && extnum ) { 587 psError( __func__, "Both extname AND extnum arguments should not have valid values." ); 588 return NULL; 610 589 } 611 } 612 613 614 line = fgets(line, MAX_LINE_SIZE+1, fp); 615 while(line != NULL) { 616 617 if(!strncmp("END", line, 3)){ 618 extnumCtr++; 590 591 fd = fopen( filename, "r" ); 592 if ( fd == NULL ) { 593 psError( __func__, "Null FITS file descriptor not allowed" ); 594 return NULL; 595 } 596 597 // Allocate metadata if user didn't 598 if ( output == NULL ) { 599 output = psMetadataAlloc(); 600 psError( __func__, "Failed to allocate metadata" ); 601 return NULL; 602 } 603 604 // Move to user designated HDU number or HDU name in text file. HDU numbers starts at one. 605 TODO if(extname == NULL) { 606 return output; 607 } 608 } else if(extnum > 0) { 609 return output; 610 } 611 } 612 613 614 line = fgets(line, MAX_LINE_SIZE+1, fp); 615 while(line != NULL) { 616 617 if(!strncmp("END", line, 3)){ 618 extnumCtr++; 619 } 620 621 if(extnumCtr == extnum) { 622 623 // Put text into metadata 624 if(!strncmp("COMMENT", line, 7)){ 625 // COMMENT keywords have no "=" sign 626 //TODO 627 } else if (strchr(line, '\'') != NULL){ 628 629 // Output and logging keywords have tic (') characters 630 keyName = strtok(line, "="); 631 keyValue = strtok(NULL, "'"); 632 keyValue = strtok(NULL, "'"); 633 keyComment = strtok(NULL, "XXX"); 634 635 636 } else 637 638 // Everything else is considered to be the standard name and value 639 keyName = strtok(line, "="); 640 keyValue = strtok(NULL, "/"); 641 keyComment = strtok(NULL, "XXX"); 642 } 643 644 645 } 646 647 // Read next line 648 line = fgets(line, MAX_LINE_SIZE+1, fp); 619 649 } 620 621 if(extnumCtr == extnum) { 622 623 // Put text into metadata 624 if(!strncmp("COMMENT", line, 7)){ 625 // COMMENT keywords have no "=" sign 626 //TODO 627 } else if (strchr(line, '\'') != NULL){ 628 629 // Output and logging keywords have tic (') characters 630 keyName = strtok(line, "="); 631 keyValue = strtok(NULL, "'"); 632 keyValue = strtok(NULL, "'"); 633 keyComment = strtok(NULL, "XXX"); 634 635 636 } else 637 638 // Everything else is considered to be the standard name and value 639 keyName = strtok(line, "="); 640 keyValue = strtok(NULL, "/"); 641 keyComment = strtok(NULL, "XXX"); 642 } 643 644 645 } 646 647 // Read next line 648 line = fgets(line, MAX_LINE_SIZE+1, fp); 649 } 650 651 */ 650 651 */ 652 652 return output; 653 653 }
Note:
See TracChangeset
for help on using the changeset viewer.
