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

    r18172 r18468  
    184184    psFree(modes);
    185185
    186     // setup search criterion
    187 #define addWhereStr(name) \
    188 { \
    189     psString str = NULL; \
    190     bool status = false; \
    191     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    192         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    193             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    194             psFree(config); \
    195             return NULL; \
    196         } \
    197     } \
    198 }
    199 
    200 #define addWhereS32(name) \
    201 { \
    202     psS32 s32 = 0; \
    203     bool status = false; \
    204     if ((s32= psMetadataLookupS32(&status, config->args, "-" #name))) { \
    205         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \
    206             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    207             psFree(config); \
    208             return NULL; \
    209         } \
    210     } \
    211 }
    212 
    213 
    214186    // generate SQL where clause
    215187    config->where = psMetadataAlloc();
    216188
    217 {
    218     psString str = NULL;
    219     bool status = false;
    220     if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
    221         if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(str))) {
    222             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    223             psFree(config);
    224             return NULL;
    225         }
    226     }
    227 }
    228     addWhereStr(skycell_id);
    229     addWhereStr(tess_id);
    230     addWhereStr(exp_id);
    231 
    232     // convert '-code' to 'fault'
    233     {
    234         psS16 fault = 0;
    235         bool status = false;
    236         if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) {
    237             if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) {
    238                 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    239                 psFree(config);
    240                 return NULL;
    241             }
    242         }
    243     }
     189    PXOPT_ADD_WHERE_S64(warp_id);
     190    PXOPT_ADD_WHERE_STR(skycell_id);
     191    PXOPT_ADD_WHERE_STR(tess_id);
     192    PXOPT_ADD_WHERE_STR(exp_id);
     193    PXOPT_ADD_WHERE_STR_ALIAS("-code", "fault");
    244194
    245195    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.