IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 11, 2008, 8:30:31 AM (18 years ago)
Author:
eugene
Message:

make argument handling consistent across all tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080706/ippTools/src/caltoolConfig.c

    r18172 r18468  
    106106    psFree(modes);
    107107
    108     // setup search criterion
    109 #define addWhereStr(name) \
    110 { \
    111     psString str = NULL; \
    112     bool status = false; \
    113     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    114         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    115             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    116             psFree(config); \
    117             return NULL; \
    118         } \
    119     } \
    120 }
    121 
    122108    // generate SQL where clause
    123109    config->where = psMetadataAlloc();
    124110
    125     addWhereStr(det_id);
    126     {
    127         // XXX this is broke because you can't specify -iteration 0
    128         psMetadataItem *item = psMetadataLookup(config->args, "-iteration");
    129         if (item && psStrcasestr(item->comment, "found")) {
    130             if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "iteration", 0, "==", item->data.S32)) {
    131                 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
    132                 psFree(config);
    133                 return NULL;
    134             }
    135         }
    136     }
    137 
    138     addWhereStr(det_id);
    139 
    140     // convert '-code' to 'fault'
    141     {
    142         psS16 fault = 0;
    143         bool status = false;
    144         if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) {
    145             if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) {
    146                 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    147                 psFree(config);
    148                 return NULL;
    149             }
    150         }
    151     }
     111    PXOPT_ADD_WHERE_STR(det_id);
     112    PXOPT_ADD_WHERE_S32(iteration);
     113    PXOPT_ADD_WHERE_S16_ALIAS("-code", "fault");
    152114
    153115    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.