IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13646


Ignore:
Timestamp:
Jun 5, 2007, 10:39:41 AM (19 years ago)
Author:
magnier
Message:

parsing the biassec based on []

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r12890 r13646  
    318318
    319319    switch (concept->type) {
    320     case PS_DATA_STRING: {
    321             psList *regions = psStringSplit(concept->data.V, " ;", false); // List of regions
    322             psListIterator *regionsIter = psListIteratorAlloc(regions, PS_LIST_HEAD, false); // Iterator
    323             psString regionString = NULL; // Region string from iteration
    324             while ((regionString = psListGetAndIncrement(regionsIter))) {
    325                 psRegion *region = psAlloc(sizeof(psRegion)); // The region
    326                 *region = psRegionFromString(regionString);
    327                 psListAdd(biassecs, PS_LIST_TAIL, region);
    328                 psFree(region);           // Drop reference
    329             }
    330             psFree(regionsIter);
    331             psFree(regions);
    332             break;
    333         }
    334     case PS_DATA_LIST: {
     320      case PS_DATA_STRING: {
     321          // a single BIASSEC is of the form [AAAA]
     322          // we may have multiple BIASSEC entries separated by space, commas, or semicolons
     323          char *p = strchr (concept->data.V, '[');
     324          while (p != NULL) {
     325              char *q = strchr (p, ']');
     326              if (q == NULL) break;
     327              char *regionString = psAlloc (q - p + 2);
     328              strncpy (regionString, p, q - p + 1);
     329              regionString[q - p + 1] = 0;
     330         
     331              psRegion *region = psAlloc(sizeof(psRegion)); // The region
     332              *region = psRegionFromString(regionString);
     333              psListAdd(biassecs, PS_LIST_TAIL, region);
     334              psFree(region);           // Drop reference
     335              psFree(regionString);     // Drop reference
     336         
     337              p = strchr (q, '[');
     338          }
     339          break;
     340      }
     341      case PS_DATA_LIST: {
    335342            psList *regions = concept->data.V; // The list of regions
    336343            psListIterator *regionsIter = psListIteratorAlloc(regions, PS_LIST_HEAD, false); // Iterator
Note: See TracChangeset for help on using the changeset viewer.