Changeset 6379 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Feb 7, 2006, 8:52:03 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r6311 r6379 12 12 static char *extRoot = NULL; 13 13 14 void psphotOutputCleanup () { 15 16 psFree (outputRoot); 17 psFree (outputName); 18 psFree (outputMode); 19 psFree (outputFormat); 20 psFree (extNumberFormat); 21 psFree (extNameKey); 22 psFree (extRoot); 23 return; 24 } 25 14 26 void psphotOutputPrep (ppFile *file, ppConfig *config) { 15 27 16 28 bool status; 17 29 18 outputRoot = psMetadataLookupPtr (&status, config->arguments, "OUTPUT_ROOT");30 outputRoot = psMetadataLookupStr (&status, config->arguments, "OUTPUT_ROOT"); 19 31 if (!status) psAbort ("psphot", "output file not specified"); 20 32 21 outputName = psMetadataLookupPtr (&status, config->recipe, "OUTPUT_NAME");22 outputMode = psMetadataLookupPtr (&status, config->recipe, "OUTPUT_MODE");23 outputFormat = psMetadataLookupPtr (&status, config->recipe, "OUTPUT_FORMAT");33 outputName = psMetadataLookupStr (&status, config->recipe, "OUTPUT_NAME"); 34 outputMode = psMetadataLookupStr (&status, config->recipe, "OUTPUT_MODE"); 35 outputFormat = psMetadataLookupStr (&status, config->recipe, "OUTPUT_FORMAT"); 24 36 25 37 // rules to construct output names 26 extNumberFormat = psMetadataLookup Ptr (&status, config->recipe, "EXTNUMBER_FORMAT");27 extNameKey = psMetadataLookup Ptr (&status, config->recipe, "EXTNAME");28 extRoot = psMetadataLookup Ptr (&status, config->recipe, "EXTROOT");38 extNumberFormat = psMetadataLookupStr (&status, config->recipe, "EXTNUMBER_FORMAT"); 39 extNameKey = psMetadataLookupStr (&status, config->recipe, "EXTNAME"); 40 extRoot = psMetadataLookupStr (&status, config->recipe, "EXTROOT"); 29 41 30 42 if (extNumberFormat == NULL) { … … 63 75 } 64 76 77 // save so freeing config will not drop these references 78 psMemCopy (outputRoot); 79 psMemCopy (outputName); 80 psMemCopy (outputMode); 81 psMemCopy (outputFormat); 82 psMemCopy (extNumberFormat); 83 psMemCopy (extNameKey); 84 psMemCopy (extRoot); 85 65 86 return; 66 87 } … … 79 100 80 101 // find the extname: 81 char *extNameVal = psMetadataLookup Ptr (&status, header, extNameKey);102 char *extNameVal = psMetadataLookupStr (&status, header, extNameKey); 82 103 83 104 extNameWord = extNameVal; … … 157 178 if (!strcasecmp (outputMode, "SPLIT")) { 158 179 outputFile = psphotSplitName (header); 159 } else { 160 // construct appropriate extname 161 psAbort ("psphotOutput", "programming error"); 162 } 163 164 fprintf (stderr, "output file: %s\n", outputFile); 165 return; 166 167 char *psfFile = psMetadataLookupPtr (&status, arguments, "PSF_OUTPUT_FILE"); 168 char *psfSample = psMetadataLookupPtr (&status, arguments, "PSF_SAMPLE_FILE"); 169 char *residImage = psMetadataLookupPtr (&status, arguments, "RESID_IMAGE"); 180 } 181 182 char *psfFile = psMetadataLookupStr (&status, arguments, "PSF_OUTPUT_FILE"); 183 char *psfSample = psMetadataLookupStr (&status, arguments, "PSF_SAMPLE_FILE"); 184 char *residImage = psMetadataLookupStr (&status, arguments, "RESID_IMAGE"); 170 185 171 186 if (psfSample != NULL) psphotSamplePSFs (psf, readout->image, psfSample); … … 183 198 if (outputFormat == NULL) { 184 199 psLogMsg ("output", 3, "no data output format selected"); 200 psFree (outputFile); 185 201 return; 186 202 } 187 203 if (!strcasecmp (outputFormat, "SX")) { 188 204 pmSourcesWriteSX (sources, outputFile); 205 psFree (outputFile); 189 206 return; 190 207 } 191 208 if (!strcasecmp (outputFormat, "OBJ")) { 192 209 pmSourcesWriteOBJ (sources, outputFile); 210 psFree (outputFile); 193 211 return; 194 212 } 195 213 if (!strcasecmp (outputFormat, "CMP")) { 196 214 pmSourcesWriteCMP (sources, outputFile, header); 215 psFree (outputFile); 197 216 return; 198 217 } 199 218 if (!strcasecmp (outputFormat, "CMF")) { 200 219 pmSourcesWriteCMF (sources, outputFile, header); 220 psFree (outputFile); 201 221 return; 202 222 } 203 223 if (!strcasecmp (outputFormat, "TEXT")) { 204 224 pmSourcesWriteText (sources, outputFile); 225 psFree (outputFile); 205 226 return; 206 227 } … … 610 631 } 611 632 fclose (f); 633 psFree (empty); 612 634 return true; 613 635 } … … 746 768 747 769 // optional dump of all rough source data 748 char *output = psMetadataLookup Ptr (&status, config, "MOMENTS_OUTPUT_FILE");770 char *output = psMetadataLookupStr (&status, config, "MOMENTS_OUTPUT_FILE"); 749 771 if (!status) return false; 750 772 if (output == NULL) return false; … … 752 774 753 775 pmMomentsWriteText (sources, output); 754 psFree (output);755 776 return true; 756 777 }
Note:
See TracChangeset
for help on using the changeset viewer.
