Changeset 15299 for trunk/psModules/src/concepts/pmConceptsStandard.c
- Timestamp:
- Oct 11, 2007, 5:18:11 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConceptsStandard.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r15229 r15299 329 329 } 330 330 331 332 psList *p_pmConceptParseRegions(const char *region) 333 { 334 assert(region && strlen(region) > 0); 335 336 psList *list = psListAlloc(NULL); // List of regions 337 338 // a single BIASSEC is of the form [AAAA] 339 // we may have multiple BIASSEC entries separated by space, commas, or semicolons 340 int xParity = 0, yParity = 0; // Parity of region 341 char *p = strchr (region, '['); 342 while (p) { 343 char *q = strchr (p, ']'); 344 if (!q) { 345 break; 346 } 347 char *regionString = psStringAlloc(q - p + 2); 348 strncpy (regionString, p, q - p + 1); 349 regionString[q - p + 1] = 0; 350 351 psRegion *region = psAlloc(sizeof(psRegion)); // The region 352 *region = psRegionAndParityFromString(&xParity, &yParity, regionString); 353 psListAdd(list, PS_LIST_TAIL, region); 354 psFree(region); // Drop reference 355 psFree(regionString); // Drop reference 356 357 p = strchr (q, '['); 358 } 359 360 return list; 361 } 362 331 363 psMetadataItem *p_pmConceptParse_CELL_BIASSEC(const psMetadataItem *concept, 332 364 const psMetadataItem *pattern, … … 341 373 assert(pattern); 342 374 343 psList *biassecs = psListAlloc(NULL); // List of bias sections375 psList *biassecs; // List of bias sections 344 376 345 377 switch (concept->type) { 346 378 case PS_DATA_STRING: { 347 // a single BIASSEC is of the form [AAAA] 348 // we may have multiple BIASSEC entries separated by space, commas, or semicolons 349 int xParity = 0; 350 int yParity = 0; 351 char *p = strchr (concept->data.V, '['); 352 while (p != NULL) { 353 char *q = strchr (p, ']'); 354 if (q == NULL) break; 355 char *regionString = psAlloc (q - p + 2); 356 strncpy (regionString, p, q - p + 1); 357 regionString[q - p + 1] = 0; 358 359 psRegion *region = psAlloc(sizeof(psRegion)); // The region 360 *region = psRegionAndParityFromString(&xParity, &yParity, regionString); 361 psListAdd(biassecs, PS_LIST_TAIL, region); 362 psFree(region); // Drop reference 363 psFree(regionString); // Drop reference 364 365 p = strchr (q, '['); 366 } 379 biassecs = p_pmConceptParseRegions(concept->data.V); 367 380 break; 368 381 } 369 382 case PS_DATA_LIST: { 383 biassecs = psListAlloc(NULL); 370 384 psList *regions = concept->data.V; // The list of regions 371 385 psListIterator *regionsIter = psListIteratorAlloc(regions, PS_LIST_HEAD, false); // Iterator
Note:
See TracChangeset
for help on using the changeset viewer.
