Changeset 5789 for trunk/archive/scripts/src/phase2/pmFPARead.c
- Timestamp:
- Dec 13, 2005, 6:30:21 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/phase2/pmFPARead.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/phase2/pmFPARead.c
r5786 r5789 219 219 220 220 // Translate a name from the configuration file, containing something like "%a_%d" to a real value 221 psString p_pmFPATranslateName( psString name, // The name to translate222 pmCell *cell // The cell for which to translate221 psString p_pmFPATranslateName(const psString name, // The name to translate 222 const pmCell *cell // The cell for which to translate 223 223 ) 224 224 { … … 338 338 } 339 339 340 // Get filename and extension out of "somefile.fits:ext" 341 psString p_pmFPATranslateFileExt(psString *extName, // Extension name, to be returned 342 const psString name, // The string to be translated and then parsed 343 const pmCell *cell // The cell 344 ) 345 { 346 psString filenameExt = p_pmFPATranslateName(name, cell); 347 const char *colon = strchr(filenameExt, ':'); // Pointer to a colon in the filename-extn 348 psString filename = NULL; // The filename 349 if (extName && *extName) { 350 psFree(*extName); 351 } 352 if (extName) { 353 *extName = NULL; 354 } 355 356 if (colon) { 357 filename = psStringNCopy(filenameExt, strlen(filenameExt) - strlen(colon)); 358 if (strlen(colon) > 1) { 359 if (extName) { 360 *extName = psStringCopy(colon + 1); 361 } 362 } 363 } else { 364 filename = psMemIncrRefCounter(filenameExt); 365 } 366 367 return filename; 368 } 369 340 370 // Read a mask into the FPA 341 371 bool pmFPAReadMask(pmFPA *fpa, // FPA to read into … … 386 416 if (strcasecmp(sourceType, "FILE") == 0) { 387 417 // Source is a file (with optional extension, e.g., "myMaskFile.fits:thisExt" 388 psString filenameExt = p_pmFPATranslateName(name, cell); 389 char *colon = strchr(filenameExt, ':'); // Pointer to a colon in the filename-extn 390 psString filename = NULL; // The filename 391 psString extname = NULL;// The extenstion name 392 if (colon) { 393 filename = psStringNCopy(filenameExt, strlen(filenameExt) - strlen(colon)); 394 if (strlen(colon) > 1) { 395 extname = psStringCopy(colon + 1); 396 } 397 } else { 398 filename = psMemIncrRefCounter(filenameExt); 399 } 418 psString extname = NULL; // Extension name 419 psString filename = p_pmFPATranslateFileExt(&extname, name, cell); // The filename 400 420 401 421 psFree(maskSource); … … 410 430 psFree(filename); 411 431 psFree(extname); 412 psFree(filenameExt);413 432 } else if (strncasecmp(sourceType, "EXT", 3) == 0) { 414 433 // Source is an extension in the original file … … 536 555 if (strcasecmp(sourceType, "FILE") == 0) { 537 556 // Source is a file (with optional extension, e.g., "myWeightFile.fits:thisExt" 538 psString filenameExt = p_pmFPATranslateName(name, cell); 539 char *colon = strchr(filenameExt, ':'); // Pointer to a colon in the filename-extn 540 psString filename = NULL; // The filename 541 psString extname = NULL;// The extenstion name 542 if (colon) { 543 filename = psStringNCopy(filenameExt, strlen(filenameExt) - strlen(colon)); 544 if (strlen(colon) > 1) { 545 extname = psStringCopy(colon + 1); 546 } 547 } else { 548 filename = psMemIncrRefCounter(filenameExt); 549 } 557 psString extname = NULL; // Extension name 558 psString filename = p_pmFPATranslateFileExt(&extname, name, cell); // The filename 550 559 551 560 psFree(weightSource); … … 560 569 psFree(filename); 561 570 psFree(extname); 562 psFree(filenameExt);563 571 } else if (strncasecmp(sourceType, "EXT", 3) == 0) { 564 572 // Source is an extension in the original file
Note:
See TracChangeset
for help on using the changeset viewer.
