IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16101


Ignore:
Timestamp:
Jan 16, 2008, 3:53:10 PM (18 years ago)
Author:
jhoblitt
Message:

convert to PXOPT_* macros

Location:
branches/end_stage/ippTools/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/end_stage/ippTools/src/pzgetexp.c

    r15091 r16101  
    6969    PS_ASSERT_PTR_NON_NULL(config, NULL);
    7070
    71     bool status = false;
    72     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    73     if (!status) {
    74         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    75         return false;
    76     }
    77     if (!camera) {
    78         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    79         return false;
    80     }
    81 
    82     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    83     if (!status) {
    84         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    85         return false;
    86     }
    87     if (!telescope) {
    88         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    89         return false;
    90     }
     71    // required
     72    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     73    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
     74    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    9175
    9276    // find last fileset/exp_name (if we have one)
     
    119103    // invoke dsproductls
    120104    // dsproductls --uri <> --last_fileset <>
    121     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    122105    psString cmd = NULL;
    123106    if (haveLastFileSet) {
     
    275258    // these are constants for all records parsed -- look them up before we do
    276259    // any work
    277     bool status = false;
    278     char *camera = psMetadataLookupStr(&status, config->args, "-inst");
    279     if (!status) {
    280         psError(PS_ERR_UNKNOWN, false, "failed to lookup item '-inst'");
    281         return NULL;
    282     }
    283     char *telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    284     if (!status) {
    285         psError(PS_ERR_UNKNOWN, false, "failed to lookup item '-telescope'");
    286         return NULL;
    287     }
     260    // required
     261    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     262    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
    288263
    289264    // split the string into lines
  • branches/end_stage/ippTools/src/pzgetimfiles.c

    r15287 r16101  
    22 * pzgetimfiles.c
    33 *
    4  * Copyright (C) 2006  Joshua Hoblitt
     4 * Copyright (C) 2006-2008  Joshua Hoblitt
    55 *
    66 * This program is free software; you can redistribute it and/or modify it
     
    7070    PS_ASSERT_PTR_NON_NULL(config, NULL);
    7171
    72     bool status = false;
    73     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    74     if (!status) {
    75         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
    76         return false;
    77     }
    78     if (!uri) {
    79         psError(PS_ERR_UNKNOWN, true, "-uri is required");
    80         return false;
    81     }
    82 
    83     psString filesetid = psMetadataLookupStr(&status, config->args, "-filesetid");
    84     if (!status) {
    85         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filesetid");
    86         return false;
    87     }
    88     if (!filesetid) {
    89         psError(PS_ERR_UNKNOWN, true, "-filesetid is required");
    90         return false;
    91     }
    92 
    93     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    94     if (!status) {
    95         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    96         return NULL;
    97     }
    98     if (!camera) {
    99         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    100         return NULL;
    101     }
    102 
    103     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    104     if (!status) {
    105         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    106         return NULL;
    107     }
    108     if (!telescope) {
    109         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    110         return NULL;
    111     }
     72    // required
     73    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
     74    PXOPT_LOOKUP_STR(filesetid, config->args, "-filesetid", true, false);
     75    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     76    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
    11277
    11378    // invoke dsfilesetls
     
    429394    // these are constants for all records parsed -- look them up before we do
    430395    // any work
    431     bool status = false;
    432     psString exp_name = psMetadataLookupStr(&status, config->args, "-filesetid");
    433     if (!status) {
    434         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for '-filesetid'");
    435         return NULL;
    436     }
    437     if (!exp_name) {
    438         psError(PS_ERR_UNKNOWN, true, "-filesetid is required");
    439         return NULL;
    440     }
    441 
    442     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    443     if (!status) {
    444         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    445         return NULL;
    446     }
    447     if (!camera) {
    448         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    449         return NULL;
    450     }
    451 
    452     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    453     if (!status) {
    454         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    455         return NULL;
    456     }
    457     if (!telescope) {
    458         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    459         return NULL;
    460     }
     396    PXOPT_LOOKUP_STR(exp_name, config->args, "-filesetid", true, false);
     397    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     398    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
    461399
    462400    // split the string into lines
  • branches/end_stage/ippTools/src/pztool.c

    r16083 r16101  
    9292    PS_ASSERT_PTR_NON_NULL(config, false);
    9393
    94     bool status = false;
    95     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    96     if (!status) {
    97         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    98         return false;
    99     }
    100     if (!camera) {
    101         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    102         return false;
    103     }
    104 
    105     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    106     if (!status) {
    107         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    108         return false;
    109     }
    110     if (!telescope) {
    111         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    112         return false;
    113     }
    114 
    115     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    116     if (!status) {
    117         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
    118         return false;
    119     }
    120     if (!uri) {
    121         psError(PS_ERR_UNKNOWN, true, "-uri is required");
    122         return false;
    123     }
     94    // required
     95    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     96    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
     97    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    12498
    12599    if (!pzDataStoreInsert(config->dbh,
     
    139113    PS_ASSERT_PTR_NON_NULL(config, false);
    140114
     115    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     116
    141117    if (!p_psDBRunQuery(config->dbh, "SELECT * FROM pzDataStore")) {
    142118        psError(PS_ERR_UNKNOWN, false, "database error");
     
    153129        psFree(output);
    154130        return true;
    155     }
    156 
    157     bool simple = false;
    158     {
    159         bool status = false;
    160         simple = psMetadataLookupBool(&status, config->args, "-simple");
    161         if (!status) {
    162             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    163             return false;
    164         }
    165131    }
    166132
     
    180146{
    181147    PS_ASSERT_PTR_NON_NULL(config, false);
     148
     149    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    182150
    183151    psString query = psStringCopy("SELECT * FROM summitExp");
     
    207175    }
    208176
    209     bool simple = false;
    210     {
    211         bool status = false;
    212         simple = psMetadataLookupBool(&status, config->args, "-simple");
    213         if (!status) {
    214             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    215             return false;
    216         }
    217     }
    218 
    219177    // negative simple so the default is true
    220178    if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) {
     
    233191    PS_ASSERT_PTR_NON_NULL(config, false);
    234192
    235     bool status = false;
    236     psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
    237     if (!status) {
    238         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit");
    239         return false;
    240     }
     193    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     194    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    241195
    242196    psString query = psStringCopy(
     
    279233    }
    280234
    281     bool simple = false;
    282     {
    283         bool status = false;
    284         simple = psMetadataLookupBool(&status, config->args, "-simple");
    285         if (!status) {
    286             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    287             psFree(output);
    288             return false;
    289         }
    290     }
    291 
    292235    // negative simple so the default is true
    293236    if (!ippdbPrintMetadatas(stdout, output, "pzPendingExp", !simple)) {
     
    306249    PS_ASSERT_PTR_NON_NULL(config, false);
    307250
    308     bool status = false;
    309     psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
    310     if (!status) {
    311         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit");
    312         return false;
    313     }
     251    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     252    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    314253
    315254    psArray *cameras = pzGetPendingCameras(config);
     
    330269        }
    331270
     271        bool status;
    332272        psString camera = psMetadataLookupStr(&status, cameras->data[i], "camera");
    333273        psStringAppend(&query, " WHERE camera = \"%s\"", camera);
     
    380320    psFree(cameraImfiles);
    381321
    382     bool simple = false;
    383     {
    384         bool status = false;
    385         simple = psMetadataLookupBool(&status, config->args, "-simple");
    386         if (!status) {
    387             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    388             psFree(output);
    389             return false;
    390         }
    391     }
    392 
    393322    // negative simple so the default is true
    394323    if (!ippdbPrintMetadatas(stdout, output, "pzPendingImfile", !simple)) {
     
    407336    PS_ASSERT_PTR_NON_NULL(config, false);
    408337
    409     bool status = false;
    410     psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name");
    411     if (!status) {
    412         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
    413         return false;
    414     }
    415     if (!exp_name) {
    416         psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
    417         return false;
    418     }
    419 
    420     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    421     if (!status) {
    422         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    423         return NULL;
    424     }
    425     if (!camera) {
    426         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    427         return NULL;
    428     }
    429 
    430     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    431     if (!status) {
    432         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    433         return NULL;
    434     }
    435     if (!telescope) {
    436         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    437         return NULL;
    438     }
    439 
    440     psString class = psMetadataLookupStr(&status, config->args, "-class");
    441     if (!status) {
    442         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class");
    443         return NULL;
    444     }
    445     if (!class) {
    446         psError(PS_ERR_UNKNOWN, true, "-class is required");
    447         return NULL;
    448     }
    449 
    450     psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
    451     if (!status) {
    452         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
    453         return NULL;
    454     }
    455     if (!class_id) {
    456         psError(PS_ERR_UNKNOWN, true, "-class_id is required");
    457         return NULL;
    458     }
    459 
    460     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    461     if (!status) {
    462         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
    463         return false;
    464     }
    465     if (!uri) {
    466         psError(PS_ERR_UNKNOWN, true, "-uri is required");
    467         return false;
    468     }
     338    // required
     339    PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false);
     340    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     341    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
     342    PXOPT_LOOKUP_STR(class, config->args, "-class", true, false);
     343    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
     344    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    469345
    470346    // need to know exp_name, camera, telescope, class, class_id (to find the
     
    476352        return false;
    477353    }
    478  
    479354
    480355    // cp the imfile into pzDoneImfile
Note: See TracChangeset for help on using the changeset viewer.