IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2006, 4:16:34 PM (20 years ago)
Author:
Paul Price
Message:

Adding back the DEPEND menu handling for the DEFAULTS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsRead.c

    r7429 r7450  
    179179    PS_ASSERT_PTR_NON_NULL(target, false);
    180180
     181    psTrace(__func__, 3, "Reading concepts from defaults...\n");
     182
    181183    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    182184    if (!hdu) {
     
    199201        psString name = specItem->name; // The concept name
    200202        psMetadataItem *conceptItem = psMetadataLookup(defaults, name); // The concept, or NULL
     203        psTrace(__func__, 10, "%s: %x\n", name, conceptItem);
     204        if (conceptItem && conceptItem->type == PS_DATA_METADATA) {
     205            psTrace(__func__, 5, "%s is of type METADATA.\n", name);
     206            // Check for DEPEND
     207            psMetadata *dependMenu = conceptItem->data.V; // The DEPEND menu
     208            psString depend = NULL; // The CONCEPT.DEPEND
     209            psStringAppend(&depend, "%s.DEPEND", name);
     210            const char *dependConcept = psMetadataLookupStr(&mdok, defaults, depend); // The concept name
     211            if (!mdok || !dependConcept || strlen(dependConcept) == 0) {
     212                psError(PS_ERR_IO, true, "Unable to parse %s: couldn't find %s in DEFAULTS.\n", name,
     213                        depend);
     214                psFree(depend);
     215                continue;
     216            }
     217            psFree(depend);
     218            // Now look up the depend value
     219            psMetadataItem *dependValue = NULL; // The value of the concept we're looking up
     220            if (cell) {
     221                dependValue = psMetadataLookup(cell->concepts, dependConcept);
     222            }
     223            if (chip && !dependValue) {
     224                dependValue = psMetadataLookup(chip->concepts, dependConcept);
     225            }
     226            if (fpa && !dependValue) {
     227                dependValue = psMetadataLookup(chip->concepts, dependConcept);
     228            }
     229            if (!dependValue) {
     230                psError(PS_ERR_IO, true, "Unable to find %s to resolve %s in DEFAULTS.\n",
     231                        dependConcept, name);
     232                continue;
     233            }
     234            if (dependValue->type != PS_DATA_STRING) {
     235                psError(PS_ERR_BAD_PARAMETER_TYPE, true, "%s is required to resolve %s in DEFAULTS, "
     236                        "but it is not of type STRING.\n", dependConcept, name);
     237                continue;
     238            }
     239            const char *dependKey = dependValue->data.V; // The key to the DEPEND menu
     240            psTrace(__func__, 7, "%s.DEPEND resolves to %s....\n", name, dependKey);
     241
     242            conceptItem = psMetadataLookup(dependMenu, dependKey);
     243            // Now we can parse this as we would ordinarily
     244        }
    201245        if (conceptItem && !conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell)) {
    202246            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from DEFAULTS.\n", name);
Note: See TracChangeset for help on using the changeset viewer.