Changeset 23746 for trunk/psModules/src/concepts/pmConcepts.c
- Timestamp:
- Apr 8, 2009, 12:16:56 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConcepts.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
