IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 28, 2008, 10:32:57 AM (18 years ago)
Author:
Paul Price
Message:

Fixing parsing of arguments and recipe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackArguments.c

    r16704 r16709  
    8585
    8686// Get a string value from the command-line and add it to the target
    87 static bool valueArgStr(pmConfig *config,      // Configuration
    88                         psMetadata *arguments, // Command-line arguments
     87static bool valueArgStr(psMetadata *arguments, // Command-line arguments
    8988                        const char *argName, // Argument name in the command-line arguments
    9089                        const char *mdName, // Name for value in the metadata
     
    9796    }
    9897    return false;
     98}
     99
     100// Get a string value from the command-line or recipe and add it to the target
     101static bool valueArgRecipeStr(psMetadata *arguments, // Command-line arguments
     102                              psMetadata *recipe, // Recipe
     103                              const char *argName, // Argument name in the command-line arguments
     104                              const char *mdName, // Name for value in the metadata and recipe
     105                              psMetadata *target // Target metadata to which to add value
     106                              )
     107{
     108    psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest
     109    if (!value) {
     110        value = psMetadataLookupStr(NULL, recipe, mdName);
     111        if (!value) {
     112            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unable to find %s in recipe %s",
     113                    mdName, PPSTACK_RECIPE);
     114            return false;
     115        }
     116    }
     117    return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value);
    99118}
    100119
     
    152171                     "Root name of the output image list", argv[2]);
    153172
    154     valueArgStr(config, arguments, "-stats", "STATS", config->arguments);
     173    valueArgStr(arguments, "-stats", "STATS", config->arguments);
    155174
    156175    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // Recipe for ppSim
     
    172191    VALUE_ARG_RECIPE_FLOAT("-psf-radius",  "PSF.RADIUS",    F32);
    173192    VALUE_ARG_RECIPE_INT("-psf-order",     "PSF.ORDER",     S32, 0);
    174     valueArgStr(config, arguments, "-psf-model", "PSF.MODEL", config->arguments);
     193    valueArgStr(arguments, "-psf-model", "PSF.MODEL", config->arguments);
    175194
    176195    if (psMetadataLookupBool(NULL, arguments, "-photometry") ||
     
    192211    }
    193212
    194     valueArgStr(config, arguments, "-temp-image",  "TEMP.IMAGE",  config->arguments);
    195     valueArgStr(config, arguments, "-temp-mask",   "TEMP.MASK",   config->arguments);
    196     valueArgStr(config, arguments, "-temp-weight", "TEMP.WEIGHT", config->arguments);
     213    valueArgRecipeStr(arguments, recipe, "-temp-image",  "TEMP.IMAGE",  config->arguments);
     214    valueArgRecipeStr(arguments, recipe, "-temp-mask",   "TEMP.MASK",   config->arguments);
     215    valueArgRecipeStr(arguments, recipe, "-temp-weight", "TEMP.WEIGHT", config->arguments);
    197216
    198217    if (psMetadataLookupBool(NULL, arguments, "-temp-delete") ||
Note: See TracChangeset for help on using the changeset viewer.