Changeset 23746
- Timestamp:
- Apr 8, 2009, 12:16:56 PM (17 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 2 edited
-
camera/pmFPAfile.c (modified) (2 diffs)
-
concepts/pmConcepts.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfile.c
r23487 r23746 205 205 } 206 206 if (strstr(newName, "{CHIP.NAME}")) { 207 const char *name = NULL; // Name of chip 207 208 pmChip *chip = pmFPAviewThisChip(view, fpa); 208 209 if (chip) { 209 char *name = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 210 if (name) { 211 psStringSubstitute(&newName, name, "{CHIP.NAME}"); 212 } 213 } 210 name = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 211 psAssert(name, "All chips should have a name"); 212 } else { 213 name = "fpa"; 214 } 215 psStringSubstitute(&newName, name, "{CHIP.NAME}"); 216 214 217 } 215 218 if (strstr(newName, "{CHIP.ID}")) { … … 255 258 } 256 259 if (strstr(newName, "{CELL.NAME}")) { 260 const char *name = NULL; // Name of cell 257 261 pmCell *cell = pmFPAviewThisCell(view, fpa); 258 262 if (cell) { 259 char *name = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); 260 if (name) { 261 psStringSubstitute(&newName, name, "{CELL.NAME}"); 262 } 263 } 263 name = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); 264 psAssert(name, "All cells should have a name"); 265 } else { 266 name = "chip"; 267 } 268 psStringSubstitute(&newName, name, "{CELL.NAME}"); 264 269 } 265 270 if (strstr(newName, "{CELL.N}")) { -
trunk/psModules/src/concepts/pmConcepts.c
r22699 r23746 421 421 422 422 // Interpolate the concept. Generalises the FPA/Chip/Cell 423 #define CONCEPT_INTERPOLATE(SOURCE, NAME ) \423 #define CONCEPT_INTERPOLATE(SOURCE, NAME, DEFAULT) \ 424 424 if (strncmp(concept, NAME, strlen(NAME)) == 0) { \ 425 if (!(SOURCE)) { \ 426 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Cannot interpolate %s because %s not provided", \ 427 concept, NAME); \ 428 psFree(string); \ 429 return NULL; \ 430 } \ 431 psMetadataItem *item = psMetadataLookup((SOURCE)->concepts, concept); /* Item with concept */ \ 432 if (!item) { \ 433 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't find concept %s in %s", concept, NAME); \ 434 psFree(string); \ 435 return NULL; \ 436 } \ 437 \ 438 psString value = psMetadataItemParseString(item); /* Value of concept */ \ 439 if (!value) { \ 440 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s", concept); \ 441 psFree(string); \ 442 return NULL; \ 425 psString value = NULL; /* Value of concept */ \ 426 if (SOURCE) { \ 427 psMetadataItem *item = psMetadataLookup((SOURCE)->concepts, concept); /* Item with concept */ \ 428 if (!item) { \ 429 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't find concept %s in %s", concept, NAME); \ 430 psFree(string); \ 431 return NULL; \ 432 } \ 433 \ 434 psString value = psMetadataItemParseString(item); /* Value of concept */ \ 435 if (!value) { \ 436 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s", concept); \ 437 psFree(string); \ 438 return NULL; \ 439 } \ 440 } else { \ 441 if (!(DEFAULT)) { \ 442 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to determine concept %s", concept); \ 443 psFree(string); \ 444 return NULL; \ 445 } \ 446 value = psStringCopy(DEFAULT); \ 443 447 } \ 444 448 \ … … 483 487 psTrace("psModules.concepts", 7, "Interpolating concept %s", concept); 484 488 485 CONCEPT_INTERPOLATE(fpa, "FPA" );486 CONCEPT_INTERPOLATE(chip, "CHIP" );487 CONCEPT_INTERPOLATE(cell, "CELL" );489 CONCEPT_INTERPOLATE(fpa, "FPA", NULL); 490 CONCEPT_INTERPOLATE(chip, "CHIP", "fpa"); 491 CONCEPT_INTERPOLATE(cell, "CELL", "chip"); 488 492 489 493 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised concept: %s", concept);
Note:
See TracChangeset
for help on using the changeset viewer.
