Changeset 7311 for trunk/psModules/src/concepts/pmConceptsStandard.c
- Timestamp:
- Jun 2, 2006, 3:02:08 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r7281 r7311 69 69 sscanf(concept->data.V, "%d %d %f", &big, &medium, &small) != 3) 70 70 { 71 psError(PS_ERR_ IO, true, "Cannot interpret FPA.RA: %s\n", concept->data.V);71 psError(PS_ERR_UNKNOWN, true, "Cannot interpret FPA.RA: %s\n", concept->data.V); 72 72 break; 73 73 } … … 80 80 break; 81 81 default: 82 psError(PS_ERR_ IO, true, "%s concept is of an unexpected type: %x\n", pattern->name, concept->type);82 psError(PS_ERR_UNKNOWN, true, "%s concept is of an unexpected type: %x\n", pattern->name, concept->type); 83 83 return NULL; 84 84 } … … 171 171 assert(pattern); 172 172 173 psRegion *trimsec = ps Alloc(sizeof(psRegion)); // Make space for a psRegion (usually passed by value)173 psRegion *trimsec = psRegionAlloc(0, 0, 0, 0); 174 174 175 175 if (concept->type != PS_DATA_STRING) { 176 psError(PS_ERR_IO, true, "CELL.TRIMSEC after read is not of type STR (%x)\n", concept->type); 177 *trimsec = psRegionSet(0.0, 0.0, 0.0, 0.0); 176 psError(PS_ERR_UNKNOWN, true, "CELL.TRIMSEC after read is not of type STR (%x)\n", concept->type); 178 177 } else { 179 178 *trimsec = psRegionFromString(concept->data.V); … … 231 230 } 232 231 default: 233 psError(PS_ERR_ IO, true, "CELL.BIASSEC after read is not of type STRING or LIST --- assuming "232 psError(PS_ERR_UNKNOWN, true, "CELL.BIASSEC after read is not of type STRING or LIST --- assuming " 234 233 "blank.\n"); 235 234 } … … 259 258 (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 && 260 259 sscanf(binString, "%*d,%d", &binning) != 1)) { 261 psError(PS_ERR_ IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString);260 psError(PS_ERR_UNKNOWN, true, "Unable to parse string to get %s: %s\n", pattern->name, binString); 262 261 } 263 262 } … … 269 268 TYPE_CASE(binning, concept, S32); 270 269 default: 271 psError(PS_ERR_ IO, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name,270 psError(PS_ERR_UNKNOWN, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name, 272 271 concept->type); 273 272 } … … 290 289 psString sys = concept->data.V; // The time system string 291 290 if (concept->type != PS_DATA_STRING || strlen(sys) <= 0) { 292 psError(PS_ERR_ IO, true, "Can't interpret CELL.TIMESYS --- assuming UTC.\n");291 psError(PS_ERR_UNKNOWN, true, "Can't interpret CELL.TIMESYS --- assuming UTC.\n"); 293 292 } else if (strcasecmp(sys, "TAI") == 0) { 294 293 timeSys = PS_TIME_TAI; … … 300 299 timeSys = PS_TIME_TT; 301 300 } else { 302 psError(PS_ERR_ IO, true, "Can't interpret CELL.TIMESYS --- assuming UTC.\n");301 psError(PS_ERR_UNKNOWN, true, "Can't interpret CELL.TIMESYS --- assuming UTC.\n"); 303 302 } 304 303 … … 334 333 // Get format 335 334 psMetadata *formats = psMetadataLookupMD(&mdok, cameraFormat, "FORMATS"); 336 if (!mdok || !formats) 335 if (!mdok || !formats) { 336 psError(PS_ERR_UNKNOWN, false, "Unable to find FORMATS in camera configuration.\n"); 337 337 return NULL; 338 } 338 339 339 340 psString timeFormat = psMetadataLookupStr(&mdok, formats, "CELL.TIME"); 340 if (!mdok || !timeFormat || !strlen(timeFormat)) 341 if (!mdok || !timeFormat || !strlen(timeFormat)) { 342 psError(PS_ERR_UNKNOWN, false, "Unable to find CELL.TIME in FORMATS.\n"); 341 343 return NULL; 344 } 342 345 343 346 // Parse the time format … … 385 388 psMetadataItem *timeItem = psListGet(dateTime, PS_LIST_HEAD + 1); // Item containing the time 386 389 if (dateItem->type != PS_DATA_STRING) { 387 psError(PS_ERR_ IO, true, "Date is not of type STR.\n");390 psError(PS_ERR_UNKNOWN, true, "Date is not of type STR.\n"); 388 391 return NULL; 389 392 } … … 392 395 if (sscanf(dateString, "%d-%d-%d", &year, &month, &day) != 3 && 393 396 sscanf(dateString, "%d/%d/%d", &year, &month, &day) != 3) { 394 psError(PS_ERR_ IO, true, "Unable to read date: %s\n", dateString);397 psError(PS_ERR_UNKNOWN, true, "Unable to read date: %s\n", dateString); 395 398 return NULL; 396 399 } … … 408 411 year = temp; 409 412 } 410 if (pre2000Time || year < 2000) { 411 year += 2000; 412 } 413 if (year < 100) { 414 if (pre2000Time) { 415 year += 1900; 416 } else { 417 year += 2000; 418 } 419 } 420 sprintf(dateString,"%04d-%02d-%02d", year, month, day); 421 413 422 psString timeString = NULL; // The string with the time 414 423 if (timeItem->type == PS_DATA_STRING) { … … 427 436 TYPE_CASE(seconds, timeItem, F64); 428 437 default: 429 psError(PS_ERR_ IO, true, "Time is not of an expected type: %x\n", timeItem->type);438 psError(PS_ERR_UNKNOWN, true, "Time is not of an expected type: %x\n", timeItem->type); 430 439 return NULL; 431 440 } … … 440 449 psStringAppend(&dateTimeString, "%sT%s", dateString, timeString); 441 450 time = psTimeFromISO(dateTimeString, timeSys); 451 psFree(dateTimeString); 442 452 break; 443 453 } … … 463 473 time = psTimeFromMJD(timeValue); 464 474 } else { 465 psError(PS_ERR_IO, true, "Not sure how to parse CELL.TIME (%f) --- trying JD\n", timeValue); 475 psError(PS_ERR_UNKNOWN, true, "Not sure how to parse CELL.TIME (%f) --- trying JD\n", 476 timeValue); 466 477 time = psTimeFromJD(timeValue); 467 478 } … … 475 486 time = psTimeFromMJD(timeValue); 476 487 } else { 477 psError(PS_ERR_IO, true, "Not sure how to parse CELL.TIME (%f) --- trying JD\n", timeValue); 488 psError(PS_ERR_UNKNOWN, true, "Not sure how to parse CELL.TIME (%f) --- trying JD\n", 489 timeValue); 478 490 time = psTimeFromJD(timeValue); 479 491 } … … 481 493 } 482 494 default: 483 psError(PS_ERR_ IO, true, "Unable to parse CELL.TIME.\n");495 psError(PS_ERR_UNKNOWN, true, "Unable to parse CELL.TIME.\n"); 484 496 return NULL; 485 497 } … … 526 538 TYPE_CASE(offset, concept, S32); 527 539 default: 528 psError(PS_ERR_ IO, true, "Concept %s is not of integer type, as expected.\n", pattern->name);540 psError(PS_ERR_UNKNOWN, true, "Concept %s is not of integer type, as expected.\n", pattern->name); 529 541 return NULL; 530 542 } … … 724 736 // XXX: Couldn't be bothered doing these right now 725 737 if (pre2000Time) { 726 psError(PS_ERR_ IO, true, "Don't you realise it's the twenty-first century?\n");738 psError(PS_ERR_UNKNOWN, true, "Don't you realise it's the twenty-first century?\n"); 727 739 return NULL; 728 740 } 729 741 if (backwardsTime) { 730 psError(PS_ERR_ IO, true, "You want it BACKWARDS? Not right now, thanks.\n");742 psError(PS_ERR_UNKNOWN, true, "You want it BACKWARDS? Not right now, thanks.\n"); 731 743 return NULL; 732 744 } 733 745 if (usaTime) { 734 psError(PS_ERR_ IO, true, "USA? No OK --- yet.\n");746 psError(PS_ERR_UNKNOWN, true, "USA? No OK.\n"); 735 747 return NULL; 736 748 } … … 778 790 779 791 if (concept->type != PS_TYPE_S32) { 780 psError(PS_ERR_ IO, true, "Concept %s is not of type S32, as expected.\n", concept->name);792 psError(PS_ERR_UNKNOWN, true, "Concept %s is not of type S32, as expected.\n", concept->name); 781 793 return NULL; 782 794 }
Note:
See TracChangeset
for help on using the changeset viewer.
