Changeset 7311 for trunk/psModules/src/concepts/pmConceptsRead.c
- Timestamp:
- Jun 2, 2006, 3:02:08 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConceptsRead.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsRead.c
r7280 r7311 71 71 parsed = parsePlain(concept, spec->blank); 72 72 } 73 if (!parsed) 74 return false; 73 if (!parsed) { 74 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s\n", spec->blank->name); 75 return false; 76 } 75 77 76 78 // Plug the parsed concept into a new psMetadataItem, so each "concept" has its own version that can … … 117 119 118 120 pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level 119 if (! hdu) {121 if (!hdu) { 120 122 return false; 121 123 } … … 124 126 psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator 125 127 psMetadataItem *specItem = NULL; // Item from the specs metadata 128 bool status = true; // Status of reading concepts 126 129 while ((specItem = psMetadataGetAndIncrement(specsIter))) { 127 130 pmConceptSpec *spec = specItem->data.V; // The specification 128 131 psString name = specItem->name; // The concept name 129 132 psMetadataItem *conceptItem = psMetadataLookup(cellConfig, name); // The concept, or NULL 130 psMetadataItem *value = NULL; // The value of the concept131 133 if (conceptItem) { 132 134 if (conceptItem->type == PS_DATA_STRING) { … … 138 140 psFree(nameSource); 139 141 if (mdok && strlen(source) > 0 && strcasecmp(source, "VALUE") == 0) { 140 value = conceptItem; 141 conceptParse(spec, value, cameraFormat, target, NULL, NULL, cell); 142 if (!conceptParse(spec, conceptItem, cameraFormat, target, NULL, NULL, cell)) { 143 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from camera " 144 "configuration\n", name); 145 status = false; 146 } 142 147 } else if (source && (strlen(source) == 0 || strcasecmp(source, "HEADER") != 0)) { 143 148 // We leave "HEADER" to pmConceptsReadFromHeader … … 148 153 } else { 149 154 // Another type --- should be OK 150 conceptParse(spec, conceptItem, cameraFormat, target, NULL, NULL, cell); 155 if (!conceptParse(spec, conceptItem, cameraFormat, target, NULL, NULL, cell)) { 156 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from camera " 157 "configuration. It has a weird %s.SOURCE: %s\n", name, name); 158 status = false; 159 } 151 160 } 152 161 } 153 162 } 154 163 psFree(specsIter); 155 return true;164 return status; 156 165 } 157 166 … … 179 188 psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator 180 189 psMetadataItem *specItem = NULL; // Item from the specs metadata 190 bool status = true; // Status of reading concepts 181 191 while ((specItem = psMetadataGetAndIncrement(specsIter))) { 182 192 pmConceptSpec *spec = specItem->data.V; // The specification 183 193 psString name = specItem->name; // The concept name 184 194 psMetadataItem *conceptItem = psMetadataLookup(defaults, name); // The concept, or NULL 185 conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell); 195 if (conceptItem && !conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell)) { 196 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from DEFAULTS.\n", name); 197 status = false; 198 } 186 199 } 187 200 psFree(specsIter); 188 return true;201 return status; 189 202 } 190 203 … … 213 226 psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator 214 227 psMetadataItem *specItem = NULL; // Item from the specs metadata 228 bool status = true; // Status of reading concepts 215 229 while ((specItem = psMetadataGetAndIncrement(specsIter))) { 216 230 pmConceptSpec *spec = specItem->data.V; // The specification … … 257 271 258 272 // This will also clean up the name 259 conceptParse(spec, headerItem, cameraFormat, target, fpa, chip, cell); 273 if (headerItem && !conceptParse(spec, headerItem, cameraFormat, target, fpa, chip, cell)) { 274 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from header.\n", name); 275 status = false; 276 } 260 277 } 261 278 psFree(specsIter); 262 return true;279 return status; 263 280 } 264 281 … … 294 311 psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator 295 312 psMetadataItem *specItem = NULL; // Item from the specs metadata 313 bool status = true; // Status of reading concepts 296 314 while ((specItem = psMetadataGetAndIncrement(specsIter))) { 297 315 pmConceptSpec *spec = specItem->data.V; // The specification … … 374 392 375 393 // Now we have the result 376 conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell); 394 if (!conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell)) { 395 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from database.\n", 396 name); 397 status = false; 398 } 377 399 378 400 } … … 385 407 psFree(specsIter); 386 408 387 return true;409 return status; 388 410 #endif 389 411 }
Note:
See TracChangeset
for help on using the changeset viewer.
