- Timestamp:
- May 7, 2013, 12:01:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130419/pswarp/src/pswarpParseCamera.c
r35521 r35527 13 13 #include "pswarp.h" 14 14 15 // Define an input file 16 static pmFPAfile *defineInputFile(pmConfig *config,// Configuration 17 pmFPAfile *bind, // File to which to bind, or NULL 18 char *filerule, // Name of file rule 19 char *argname, // Argument name 20 pmFPAfileType fileType // Type of file 21 ) 22 { 23 bool status; 24 25 pmFPAfile *file = NULL; 26 // look for the file on the argument list 27 if (bind) { 28 file = pmFPAfileBindFromArgs(&status, bind, config, filerule, argname); 29 } else { 30 file = pmFPAfileDefineFromArgs(&status, config, filerule, argname); 31 } 32 if (!status) { 33 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 34 return false; 35 } 36 if (!file) { 37 // look for the file on the RUN metadata 38 file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return 39 if (!status) { 40 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 41 return NULL; 42 } 43 } 44 45 if (!file) { 46 return NULL; 47 } 48 49 if (file->type != fileType) { 50 psError(PSWARP_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 51 return NULL; 52 } 53 54 return file; 55 } 15 static bool foundAstrom = false; 16 static bool foundVariance = false; 17 static bool foundBackground = false; 56 18 57 19 bool pswarpParseCamera(pmConfig *config) 58 20 { 59 21 psAssert(config, "Require configuration"); 60 bool mdok; // Status of MD lookup 22 bool status; // Status of MD lookup 23 24 // *** parse the input information (either from -file or from -input) 25 26 // if INPUTS exists, we have a metadata file to provide input, variance, mask, etc 27 psMetadata *inputFile = psMetadataLookupPtr(&status, config->arguments, "INPUTS"); 28 if (inputFile) { 29 if (!pswarpParseMultiInput (config, inputFile)) { 30 psError(PSWARP_ERR_CONFIG, false, "failed to parse multi-input file"); 31 return false; 32 } 33 } else { 34 if (!pswarpParseSingleInput (config)) { 35 psError(PSWARP_ERR_CONFIG, false, "failed to parse multi-input file"); 36 return false; 37 } 38 } 39 40 // *** parse the output information (output target, output astrometry [skycell]) 41 42 // The input skycell is a required argument: it defines the output image 43 pmConfig *skyConfig = NULL; 44 pmFPAfile *skycell = NULL; 45 46 skycell = pmFPAfileDefineNewConfig(&status, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 47 if (!status || !skycell) { 48 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL"); 49 return false; 50 } 51 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell", skyConfig->cameraName); 52 psFree(skyConfig); 53 54 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE); 55 if (!recipe) { 56 psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE); 57 return false; 58 } 59 60 // The output skycell 61 pmFPAfile *output = pmFPAfileDefineOutputForFormat(config, NULL, "PSWARP.OUTPUT", skycell->cameraName, skycell->formatName); 62 if (!output) { 63 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT"); 64 return false; 65 } 66 output->save = true; 67 68 pmFPAfile *outMask = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSWARP.OUTPUT.MASK", skycell->cameraName, skycell->formatName); 69 if (!outMask) { 70 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.MASK"); 71 return false; 72 } 73 outMask->save = true; 74 75 // only create an output variance in we supply an input variance 76 if (foundVariance) { 77 pmFPAfile *outVariance = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSWARP.OUTPUT.VARIANCE", skycell->cameraName, skycell->formatName); 78 if (!outVariance) { 79 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.VARIANCE"); 80 return false; 81 } 82 outVariance->save = true; 83 } 84 85 // XXX we assume input sources come from the input astrom description, but this need not be true (we could define an input sources file) 86 if (foundAstrom && psMetadataLookupBool(&status, recipe, "SOURCES")) { 87 pmFPAfile *outSources = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSWARP.OUTPUT.SOURCES", skycell->cameraName, skycell->formatName); 88 if (!outSources) { 89 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.SOURCES"); 90 return false; 91 } 92 outSources->save = true; 93 } 94 95 // only create an output background if an input background is supplied 96 if (foundBackground && psMetadataLookupBool(&status, recipe, "BACKGROUND.MODEL")) { 97 pmFPAfile *outBackground = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT.BKGMODEL"); 98 outBackground->xBin = psMetadataLookupS32(&status, recipe, "BKG.XGRID"); 99 outBackground->yBin = psMetadataLookupS32(&status, recipe, "BKG.YGRID"); 100 101 if (!outBackground) { 102 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.BKGMODEL"); 103 return false; 104 } 105 outBackground->save = true; 106 } 107 108 if (psMetadataLookupBool(&status, recipe, "PSF")) { 109 // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by psphotDefineFiles 110 pmFPAfile *psphotInput = pmFPAfileDefineOutputForFormat(config, NULL, "PSPHOT.INPUT", skycell->cameraName, skycell->formatName); 111 if (!psphotInput) { 112 psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT")); 113 return false; 114 } 115 psphotInput->src = psMemIncrRefCounter(output->fpa); 116 117 // specify the number of psphot input images (psphotReadout loops over all input images) 118 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1); 119 120 // the input sources (read from the input astrometry file) are transformed (in pswarpLoop) to the readout->analysis 121 // entries of the output file PSWARP.OUTPUT.SOURCES, associated with the main output pmFPAfile PSWARP.OUTPUT 122 123 // the PSPHOT.INPUT.CMF is used to supply those sources to psphot (specifically psphotLoadPSFSources). 124 125 // pmFPAfile *psphotInSources = pmFPAfileDefineSkycell(config, output->fpa, "PSPHOT.INPUT.CMF"); 126 pmFPAfile *psphotInSources = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSPHOT.INPUT.CMF", skycell->cameraName, skycell->formatName); 127 if (!psphotInSources) { 128 psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT.CMF")); 129 return false; 130 } 131 132 // Ensure psphot defines an output file for the PSF. 133 psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE); // Recipe 134 if (!psphotRecipe) { 135 psError(PSWARP_ERR_CONFIG, false, "Unable to find %s recipe.", PSPHOT_RECIPE); 136 return false; 137 } 138 psMetadataAddBool(psphotRecipe, PS_LIST_TAIL, "SAVE.PSF", PS_META_REPLACE, "Save PSF?", true); 139 140 // Define associated psphot input/output files 141 if (!psphotDefineFiles(config, psphotInput)) { 142 psError(PSWARP_ERR_CONFIG, false, 143 "Unable to define the additional input/output files for psphot"); 144 return false; 145 } 146 147 // Turn off writing the sources we find as part of deriving the PSF --- they might clobber the ones we 148 // get from transforming the input coordinates. 149 pmFPAfile *psphotSources = psMetadataLookupPtr(NULL, config->files, "PSPHOT.OUTPUT"); 150 assert(psphotSources); 151 psphotSources->save = false; 152 } 153 154 psTrace("pswarp", 1, "Done with pswarpParseCamera...\n"); 155 return true; 156 } 157 158 bool pswarpParseSingleInput (pmConfig *config) { 61 159 62 160 // The input image(s) is required: it defines the camera 63 pmFPAfile *input = defineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE);161 pmFPAfile *input = pswarpDefineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE); 64 162 if (!input) { 65 163 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.INPUT"); … … 77 175 } 78 176 } 79 if (astrom && (astrom->type != PM_FPA_FILE_CMF) && (astrom->type != PM_FPA_FILE_WCS)) { 80 psLogMsg("pswarp", PS_LOG_INFO, "%s is neither CMF nor WCS", "PSWARP.ASTROM"); 177 if (astrom) { 178 if ((astrom->type != PM_FPA_FILE_CMF) && (astrom->type != PM_FPA_FILE_WCS)) { 179 psLogMsg("pswarp", PS_LOG_INFO, "%s is neither CMF nor WCS", "PSWARP.ASTROM"); 180 // XXX raise an error here?? 181 } else { 182 foundAstrom = true; 183 } 81 184 } 82 185 psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header"); 83 186 84 187 // Define the input mask file(s) 85 pmFPAfile *inMask = defineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK);188 pmFPAfile *inMask = pswarpDefineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK); 86 189 if (!inMask) { 87 190 psLogMsg("pswarp", PS_LOG_INFO, "No mask supplied"); … … 89 192 90 193 // Define the input variance file(s) 91 pmFPAfile *inVariance = defineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE", 92 PM_FPA_FILE_VARIANCE); 93 if (!inVariance) { 194 pmFPAfile *inVariance = pswarpDefineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE", PM_FPA_FILE_VARIANCE); 195 if (inVariance) { 196 foundVariance = true; 197 } else { 94 198 psLogMsg("pswarp", PS_LOG_INFO, "No variance supplied"); 95 199 } 96 200 97 pmFPAfile *inBackground = defineInputFile(config, NULL, "PSWARP.BKGMODEL", "BACKGROUND", 98 PM_FPA_FILE_IMAGE); 99 if (!inBackground) { 201 pmFPAfile *inBackground = pswarpDefineInputFile(config, NULL, "PSWARP.BKGMODEL", "BACKGROUND", PM_FPA_FILE_IMAGE); 202 if (inBackground) { 203 foundBackground = true; 204 } else { 100 205 psLogMsg("pswarp", PS_LOG_INFO, "No background models supplied"); 101 206 } 102 103 // The input skycell is a required argument: it defines the output image104 pmConfig *skyConfig = NULL;105 pmFPAfile *skycell = NULL;106 107 # define USE_PSWARP_DEFINE_SKYCELL 0108 # if (USE_PSWARP_DEFINE_SKYCELL)109 // XXX this function is no longer needed; drop110 status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");111 # else112 skycell = pmFPAfileDefineNewConfig(&status, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");113 # endif114 115 if (!status || !skycell) {116 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL");117 return false;118 }119 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell", skyConfig->cameraName);120 psFree(skyConfig);121 122 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);123 if (!recipe) {124 psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);125 return false;126 }127 128 // The output skycell129 // XXX The output needs to be in a more generic format, not just skycell.130 // I need to understand how badly things depend on SKYCELL being a special format131 // (is it just pswarp, or is it everything downstream as well??)132 // XXX for a test, generate a generic output (based on output target astrometry)133 // XXX pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT");134 pmFPAfile *output = pmFPAfileDefineOutputForFormat(config, NULL, "PSWARP.OUTPUT", skycell->cameraName, skycell->formatName);135 if (!output) {136 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT");137 return false;138 }139 output->save = true;140 141 // pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK");142 pmFPAfile *outMask = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSWARP.OUTPUT.MASK", skycell->cameraName, skycell->formatName);143 if (!outMask) {144 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.MASK");145 return false;146 }147 outMask->save = true;148 149 if (inVariance) {150 // pmFPAfile *outVariance = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.VARIANCE");151 pmFPAfile *outVariance = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSWARP.OUTPUT.VARIANCE", skycell->cameraName, skycell->formatName);152 if (!outVariance) {153 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.VARIANCE");154 return false;155 }156 outVariance->save = true;157 }158 159 if (astrom && psMetadataLookupBool(&mdok, recipe, "SOURCES")) {160 // pmFPAfile *outSources = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.SOURCES");161 pmFPAfile *outSources = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSWARP.OUTPUT.SOURCES", skycell->cameraName, skycell->formatName);162 if (!outSources) {163 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.SOURCES");164 return false;165 }166 outSources->save = true;167 }168 169 if (inBackground && psMetadataLookupBool(&mdok, recipe, "BACKGROUND.MODEL")) {170 pmFPAfile *outBackground = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT.BKGMODEL");171 outBackground->xBin = psMetadataLookupS32(&mdok, recipe, "BKG.XGRID");172 outBackground->yBin = psMetadataLookupS32(&mdok, recipe, "BKG.YGRID");173 174 if (!outBackground) {175 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.BKGMODEL");176 return false;177 }178 outBackground->save = true;179 }180 181 if (psMetadataLookupBool(&mdok, recipe, "PSF")) {182 // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by183 // psphotDefineFiles184 // XXX old : pmFPAfile *psphotInput = pmFPAfileDefineSkycell(config, NULL, "PSPHOT.INPUT");185 pmFPAfile *psphotInput = pmFPAfileDefineOutputForFormat(config, NULL, "PSPHOT.INPUT", skycell->cameraName, skycell->formatName);186 if (!psphotInput) {187 psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT"));188 return false;189 }190 psphotInput->src = psMemIncrRefCounter(output->fpa);191 192 // specify the number of psphot input images (psphotReadout loops over all input images)193 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);194 195 // the input sources (read from the input astrometry file) are transformed (in pswarpLoop) to the readout->analysis196 // entries of the output file PSWARP.OUTPUT.SOURCES, associated with the main output pmFPAfile PSWARP.OUTPUT197 198 // the PSPHOT.INPUT.CMF is used to supply those sources to psphot (specifically psphotLoadPSFSources).199 200 // pmFPAfile *psphotInSources = pmFPAfileDefineSkycell(config, output->fpa, "PSPHOT.INPUT.CMF");201 pmFPAfile *psphotInSources = pmFPAfileDefineOutputForFormat(config, output->fpa, "PSPHOT.INPUT.CMF", skycell->cameraName, skycell->formatName);202 if (!psphotInSources) {203 psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT.CMF"));204 return false;205 }206 207 // Ensure psphot defines an output file for the PSF.208 psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE); // Recipe209 if (!psphotRecipe) {210 psError(PSWARP_ERR_CONFIG, false, "Unable to find %s recipe.", PSPHOT_RECIPE);211 return false;212 }213 psMetadataAddBool(psphotRecipe, PS_LIST_TAIL, "SAVE.PSF", PS_META_REPLACE, "Save PSF?", true);214 215 // Define associated psphot input/output files216 if (!psphotDefineFiles(config, psphotInput)) {217 psError(PSWARP_ERR_CONFIG, false,218 "Unable to define the additional input/output files for psphot");219 return false;220 }221 222 // Turn off writing the sources we find as part of deriving the PSF --- they might clobber the ones we223 // get from transforming the input coordinates.224 pmFPAfile *psphotSources = psMetadataLookupPtr(NULL, config->files, "PSPHOT.OUTPUT");225 assert(psphotSources);226 psphotSources->save = false;227 }228 207 229 208 // Chip selection: turn on only the chips specified 230 char *chipLine = psMetadataLookupStr(& mdok, config->arguments, "CHIP_SELECTIONS");231 if ( mdok) {209 char *chipLine = psMetadataLookupStr(&status, config->arguments, "CHIP_SELECTIONS"); 210 if (status) { 232 211 psArray *chips = psStringSplitArray (chipLine, ",", false); 233 212 if (chips->n > 0) { … … 244 223 } 245 224 246 ps Trace("pswarp", 1, "Done with pswarpParseCamera...\n");225 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NUM_INPUTS", PS_META_REPLACE, "input file sets", 1); 247 226 return true; 248 227 } 228 229 // read input file information from a metadata file 230 // XXX for now, in the multi-input format, we disable PSF, BACKGROUND, and CHIP_SELECTIONS 231 bool pswarpParseMultiInput (pmConfig *config, psMetadata *fileListMD) { 232 233 // the multi-input file consists of a set of metadata blocks, each with entries 234 // for INPUT and (possibly) ASTROM, MASK, VARIANCE, ??? 235 236 bool status = false; 237 238 for (int i = 0; i < fileListMD->list->n; i++) { 239 psMetadataItem *item = psMetadataGet(fileListMD, i); 240 if (item->type != PS_DATA_METADATA) { 241 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Component %s of the input metadata is not of type METADATA", item->name); 242 return false; 243 } 244 245 // next input metadata block of interest 246 psMetadata *fileBlockMD = item->data.md; 247 248 psString inputName = psMetadataLookupStr(&status, fileBlockMD, "INPUT"); // Name of image 249 if (!inputName || !strlen(inputName)) { 250 psError(PS_ERR_UNKNOWN, false, "input file not found in metadata block %d (%s)", i, item->name); 251 return false; 252 } 253 AddStringAsArray (config->arguments, inputName, "FILENAMES"); 254 255 pmFPAfile *input = pswarpDefineInputFile (config, NULL, "PSWARP.INPUT", "FILENAMES", PM_FPA_FILE_IMAGE); 256 if (!input) { 257 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.INPUT"); 258 return false; 259 } 260 261 psString astromName = psMetadataLookupStr(&status, fileBlockMD, "ASTROM"); // Name of astrom file 262 if (astromName && strlen(astromName)) { 263 AddStringAsArray (config->arguments, astromName, "FILENAMES"); 264 265 pmFPAfile *astrom = pmFPAfileDefineFromArgs (&status, config, "PSWARP.ASTROM", "FILENAMES"); 266 if (!status) { 267 psLogMsg("pswarp", PS_LOG_INFO, "Failed to load file definition for %s", "PSWARP.ASTROM"); 268 } 269 if (astrom) { 270 if ((astrom->type != PM_FPA_FILE_CMF) && (astrom->type != PM_FPA_FILE_WCS)) { 271 psLogMsg("pswarp", PS_LOG_INFO, "%s is neither CMF nor WCS", "PSWARP.ASTROM"); 272 } else { 273 foundAstrom = true; 274 } 275 } 276 psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header"); 277 } 278 279 pmFPAfile *mask = NULL; 280 psString maskName = psMetadataLookupStr(&status, fileBlockMD, "MASK"); // Name of mask 281 if (maskName && strlen(maskName)) { 282 AddStringAsArray (config->arguments, maskName, "FILENAMES"); 283 284 mask = pswarpDefineInputFile (config, input, "PSWARP.MASK", "FILENAMES", PM_FPA_FILE_MASK); 285 } 286 if (!mask) { 287 psLogMsg("pswarp", PS_LOG_INFO, "No mask supplied"); 288 } 289 290 pmFPAfile *variance = NULL; 291 psString varianceName = psMetadataLookupStr(&status, fileBlockMD, "VARIANCE"); // Name of variance 292 if (varianceName && strlen(varianceName)) { 293 AddStringAsArray (config->arguments, varianceName, "FILENAMES"); 294 295 variance = pswarpDefineInputFile (config, input, "PSWARP.VARIANCE", "FILENAMES", PM_FPA_FILE_VARIANCE); 296 } 297 if (variance) { 298 foundVariance = true; 299 } else { 300 psLogMsg("pswarp", PS_LOG_INFO, "No variance supplied"); 301 } 302 } 303 304 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NUM_INPUTS", PS_META_REPLACE, "input file sets", fileListMD->list->n); 305 return true; 306 } 307 308 // Define an input file based on name in config->arguments or config RUN block 309 pmFPAfile *pswarpDefineInputFile(pmConfig *config,// Configuration 310 pmFPAfile *bind, // File to which to bind, or NULL 311 char *filerule, // Name of file rule 312 char *argname, // Argument name 313 pmFPAfileType fileType // Type of file 314 ) 315 { 316 bool status; 317 318 pmFPAfile *file = NULL; 319 // look for the file on the argument list 320 if (bind) { 321 file = pmFPAfileBindFromArgs(&status, bind, config, filerule, argname); 322 } else { 323 file = pmFPAfileDefineFromArgs(&status, config, filerule, argname); 324 } 325 if (!status) { 326 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 327 return false; 328 } 329 if (!file) { 330 // look for the file on the RUN metadata 331 file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return 332 if (!status) { 333 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 334 return NULL; 335 } 336 } 337 338 if (!file) { 339 return NULL; 340 } 341 342 if (file->type != fileType) { 343 psError(PSWARP_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 344 return NULL; 345 } 346 347 return file; 348 } 349 350 bool AddStringAsArray (psMetadata *md, char *string, char *name) { 351 352 psArray *dummy = psArrayAlloc(1); // Dummy array of filenames for this FPA 353 dummy->data[0] = psStringCopy(string); 354 355 psMetadataAddArray(md, PS_LIST_TAIL, name, PS_META_REPLACE, "string added as array", dummy); 356 psFree(dummy); 357 return true; 358 } 359
Note:
See TracChangeset
for help on using the changeset viewer.
