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/stacktoolConfig.c

    r18336 r18468  
    226226    psFree(modes);
    227227
    228     // setup search criterion
    229 #define addWhereStr(name) \
    230 { \
    231     psString str = NULL; \
    232     bool status = false; \
    233     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    234         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    235             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    236             psFree(config); \
    237             return NULL; \
    238         } \
    239     } \
    240 }
    241 
    242 #define addWhereS32(name) \
    243 { \
    244     psS32 s32 = 0; \
    245     bool status = false; \
    246     if ((s32= psMetadataLookupS32(&status, config->args, "-" #name))) { \
    247         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \
    248             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    249             psFree(config); \
    250             return NULL; \
    251         } \
    252     } \
    253 }
    254 
    255 
    256228    // generate SQL where clause
    257229    config->where = psMetadataAlloc();
    258230
    259 {
    260     psString str = NULL;
    261     bool status = false;
    262     if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
    263         if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(str))) {
    264             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    265             psFree(config);
    266             return NULL;
    267         }
    268     }
    269 }
    270 
    271 {
    272     psString str = NULL;
    273     bool status = false;
    274     if ((str = psMetadataLookupStr(&status, config->args, "-stack_id"))) {
    275         if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "stack_id", 0, "==", (psS64)atoll(str))) {
    276             psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id");
    277             psFree(config);
    278             return NULL;
    279         }
    280     }
    281 }
    282 
    283     addWhereStr(skycell_id);
    284     addWhereStr(tess_id);
    285 
    286     // convert '-code' to 'fault'
    287     {
    288         psS16 fault = 0;
    289         bool status = false;
    290         if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) {
    291             if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) {
    292                 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    293                 psFree(config);
    294                 return NULL;
    295             }
    296         }
    297     }
     231    PXOPT_ADD_WHERE_S64(warp_id);
     232    PXOPT_ADD_WHERE_S64(stack_id);
     233    PXOPT_ADD_WHERE_STR(skycell_id);
     234    PXOPT_ADD_WHERE_STR(tess_id);
     235    PXOPT_ADD_WHERE_S16_ALIAS("-code","fault");
    298236
    299237    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.