IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7822


Ignore:
Timestamp:
Jul 5, 2006, 3:00:06 PM (20 years ago)
Author:
jhoblitt
Message:

misc arg handling improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/dettoolConfig.c

    r7819 r7822  
    416416    // setup search criterion
    417417#define addWhereStr(name) \
     418{ \
     419    psString str = NULL; \
     420    bool status = false; \
    418421    if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    419422        if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
     
    421424            goto FAIL; \
    422425        } \
    423     }
     426    } \
     427}
    424428
    425429    // generate SQL where claus
    426430    config->where = psMetadataAlloc();
    427431
    428 {
    429     psString str = NULL;
    430     int n = 0;
    431     bool status = false;
    432     bool boolean = false;
    433 
    434432    addWhereStr(det_id);
    435     if ((n = psMetadataLookupS32(&status, config->args, "-iteration"))) {
    436         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "iteration", 0, "==", n)) {
    437             psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
    438             goto FAIL;
     433    {
     434        int n = 0;
     435        bool status = false;
     436        if ((n = psMetadataLookupS32(&status, config->args, "-iteration"))) {
     437            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "iteration", 0, "==", n)) {
     438                psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
     439                goto FAIL;
     440            }
    439441        }
    440442    }
     
    443445    addWhereStr(class_id);
    444446    // convert '-inst' to 'camera'
    445     if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
    446         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    447             psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
    448             goto FAIL;
     447    {
     448        psString str = NULL;
     449        bool status = false;
     450        if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
     451            if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
     452                psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
     453                goto FAIL;
     454            }
    449455        }
    450456    }
    451457    addWhereStr(telescope);
    452458    addWhereStr(exp_type);
    453     if ((n = psMetadataLookupS32(&status, config->args, "-imfiles"))) {
    454         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", n)) {
    455             psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
    456             goto FAIL;
     459    {
     460        int n = 0;
     461        bool status = false;
     462        if ((n = psMetadataLookupS32(&status, config->args, "-imfiles"))) {
     463            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", n)) {
     464                psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
     465                goto FAIL;
     466            }
    457467        }
    458468    }
     
    460470    addWhereStr(stats);
    461471    addWhereStr(recipe);
    462     if ((n = psMetadataLookupS32(&status, config->args, "-p1_version"))) {
    463         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p1_version", 0, "==", n)) {
    464             psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");
    465             goto FAIL;
     472    {
     473        int n = 0;
     474        bool status = false;
     475        if ((n = psMetadataLookupS32(&status, config->args, "-p1_version"))) {
     476            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p1_version", 0, "==", n)) {
     477                psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");
     478                goto FAIL;
     479            }
    466480        }
    467481    }
    468     if ((boolean = psMetadataLookupBool(&status, config->args, "-accept"))) {
    469         if (!psMetadataAddBool(config->where, PS_LIST_TAIL, "accept", 0, "==", boolean)) {
    470             psError(PS_ERR_UNKNOWN, false, "failed to add item accept");
    471             goto FAIL;
     482    {
     483        bool boolean = false;
     484        bool status = false;
     485
     486        if ((boolean = psMetadataLookupBool(&status, config->args, "-accept"))) {
     487            if (!psMetadataAddBool(config->where, PS_LIST_TAIL, "accept", 0, "==", boolean)) {
     488                psError(PS_ERR_UNKNOWN, false, "failed to add item accept");
     489                goto FAIL;
     490            }
    472491        }
    473492    }
    474 }
    475493
    476494    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.