Changeset 18650
- Timestamp:
- Jul 21, 2008, 3:29:19 PM (18 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStack.c
r17258 r18650 26 26 (void) psTraceSetLevel("ppStack", 5); 27 27 28 if (!ppStackArguments (argc, argv, config)) {28 if (!ppStackArgumentsSetup(argc, argv, config)) { 29 29 psErrorStackPrint(stderr, "Error reading arguments.\n"); 30 30 exitValue = PS_EXIT_CONFIG_ERROR; … … 40 40 if (!ppStackCamera(config)) { 41 41 psErrorStackPrint(stderr, "Error setting up input files.\n"); 42 exitValue = PS_EXIT_CONFIG_ERROR; 43 goto die; 44 } 45 46 if (!ppStackArgumentsParse(config)) { 47 psErrorStackPrint(stderr, "Error reading arguments.\n"); 42 48 exitValue = PS_EXIT_CONFIG_ERROR; 43 49 goto die; -
trunk/ppStack/src/ppStack.h
r18382 r18650 7 7 #include <psmodules.h> 8 8 9 // Setup command-line arguments 10 bool ppStackArgumentsSetup(int argc, char *argv[], // Command-line arguments 11 pmConfig *config // Configuration 12 ); 13 9 14 // Parse command-line arguments 10 bool ppStackArguments(int argc, char *argv[], // Command-line arguments 11 pmConfig *config // Configuration 15 bool ppStackArgumentsParse(pmConfig *config // Configuration 12 16 ); 13 17 -
trunk/ppStack/src/ppStackArguments.c
r18559 r18650 40 40 // Get a float-point value from the command-line or recipe, and add it to the arguments 41 41 #define VALUE_ARG_RECIPE_FLOAT(ARGNAME, RECIPENAME, TYPE) { \ 42 ps##TYPE value = psMetadataLookup##TYPE(NULL, arguments, ARGNAME); \42 ps##TYPE value = psMetadataLookup##TYPE(NULL, config->arguments, ARGNAME); \ 43 43 if (isnan(value)) { \ 44 44 bool mdok; \ … … 55 55 // Get an integer value from the command-line or recipe, and add it to the arguments 56 56 #define VALUE_ARG_RECIPE_INT(ARGNAME, RECIPENAME, TYPE, UNSET) { \ 57 ps##TYPE value = psMetadataLookup##TYPE(NULL, arguments, ARGNAME); \57 ps##TYPE value = psMetadataLookup##TYPE(NULL, config->arguments, ARGNAME); \ 58 58 if (value == UNSET) { \ 59 59 bool mdok; \ … … 71 71 #define VALUE_ARG_RECIPE_MASK(ARGNAME, RECIPENAME) { \ 72 72 bool mdok; \ 73 const char *name = psMetadataLookupStr(&mdok, arguments, ARGNAME); \73 const char *name = psMetadataLookupStr(&mdok, config->arguments, ARGNAME); \ 74 74 if (!mdok || !name || strlen(name) == 0) { \ 75 75 name = psMetadataLookupStr(NULL, recipe, RECIPENAME); \ … … 86 86 // Get a statistic name from the command-line or recipe, and add the enum to the arguments 87 87 #define VALUE_ARG_RECIPE_STAT(ARGNAME, RECIPENAME) { \ 88 const char *stat = psMetadataLookupStr(NULL, arguments, ARGNAME); \88 const char *stat = psMetadataLookupStr(NULL, config->arguments, ARGNAME); \ 89 89 if (!stat) { \ 90 90 stat = psMetadataLookupStr(NULL, recipe, RECIPENAME); \ … … 132 132 } 133 133 134 bool ppStackArguments (int argc, char *argv[], pmConfig *config)134 bool ppStackArgumentsSetup(int argc, char *argv[], pmConfig *config) 135 135 { 136 136 assert(config); … … 139 139 pmConfigFileSetsMD(config->arguments, &argc, argv, "PPSTACK.SOURCES", "-sources", NULL); 140 140 141 psMetadata *arguments = psMetadataAlloc(); // Command-line arguments141 psMetadata *arguments = config->arguments; // Command-line arguments 142 142 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stamps", 0, "Stamps file with x,y,flux per line", NULL); 143 143 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL); … … 184 184 if (!inputs || numBad > 0) { 185 185 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to cleanly read MDC file with inputs."); 186 goto ERROR;186 return false; 187 187 } 188 188 psMetadataAddMetadata(config->arguments, PS_LIST_TAIL, "INPUTS", 0, … … 193 193 194 194 valueArgStr(arguments, "-stats", "STATS", config->arguments); 195 196 return true; 197 } 198 199 bool ppStackArgumentsParse(pmConfig *config) 200 { 201 assert(config); 202 203 psMetadata *arguments = config->arguments; // Command-line arguments 195 204 196 205 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // Recipe for ppSim
Note:
See TracChangeset
for help on using the changeset viewer.
