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

    r18467 r18468  
    429429    psFree(modes);
    430430
    431     // setup search criterion
    432 #define addWhereStr(name) \
    433 { \
    434     psString str = NULL; \
    435     bool status = false; \
    436     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    437         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    438             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    439             psFree(config); \
    440             return NULL; \
    441         } \
    442     } \
    443 }
    444 
    445 #define addWhereS32(name) \
    446 { \
    447     psS32 s32 = 0; \
    448     bool status = false; \
    449     if ((s32= psMetadataLookupS32(&status, config->args, "-" #name))) { \
    450         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \
    451             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
    452             psFree(config); \
    453             return NULL; \
    454         } \
    455     } \
    456 }
    457 
    458 
    459431    // generate SQL where clause
    460432    config->where = psMetadataAlloc();
    461433
    462 {
    463     psS64 warp_id = -1;
    464     bool status = false;
    465     if ((warp_id = psMetadataLookupS64(&status, config->args, "-warp_id"))) {
    466         if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "warp_id", 0, "==", warp_id)) {
    467             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    468             psFree(config);
    469             return NULL;
    470         }
    471     }
    472 }
    473     addWhereStr(skycell_id);
    474     addWhereStr(tess_id);
    475     addWhereStr(exp_id);
    476 
    477     // convert '-code' to 'fault'
    478     {
    479         psS16 fault = 0;
    480         bool status = false;
    481         if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) {
    482             if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) {
    483                 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    484                 psFree(config);
    485                 return NULL;
    486             }
    487         }
    488     }
     434    PXOPT_ADD_WHERE_S64(warp_id);
     435    PXOPT_ADD_WHERE_STR(skycell_id);
     436    PXOPT_ADD_WHERE_STR(tess_id);
     437    PXOPT_ADD_WHERE_STR(exp_id);
     438    PXOPT_ADD_WHERE_S16_ALIAS("-code", "fault");
    489439
    490440    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.