IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 28, 2007, 4:35:28 PM (19 years ago)
Author:
jhoblitt
Message:

start -toprocess

File:
1 edited

Legend:

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

    r14688 r14689  
    296296
    297297
     298pxNode *pxTreeFromMagicTreeRows(psArray *rows)
     299{
     300    psHash *nodeNames = psHashAlloc(10);
     301
     302    for (long i = 0; i < psArrayLength(rows); i++) {
     303        magicTreeRow *row = rows->data[i];
     304        pxNode *parent = psHashLookup(nodeNames, row->dep);
     305        pxNode *node = pxNodeAlloc(row->node, parent);
     306        psHashAdd(nodeNames, row->node, node);
     307        psFree(node);
     308    }
     309
     310    pxNode *root = psHashLookup(nodeNames, "root");
     311    psFree(nodeNames);
     312
     313    return root;
     314}
     315
    298316static bool toprocessMode(pxConfig *config)
    299317{
    300318    PS_ASSERT_PTR_NON_NULL(config, false);
     319
     320    bool status = false;
     321    psString magic_id = psMetadataLookupStr(&status, config->args, "-magic_id");
     322    if (!status) {
     323        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -magic_id");
     324        return false;
     325    }
     326
     327    psMetadata *where = NULL;
     328    if (magic_id) {
     329        psMetadata *where = psMetadataAlloc();
     330        psMetadataAddS64(where, PS_LIST_TAIL, "magic_id", 0, "==", (psS64)atoll(magic_id));
     331    }
     332
     333    psArray *rows = magicTreeSelectRowObjects(
     334        config->dbh,
     335        where,
     336        0 // limit
     337    );
     338    psFree(where);
     339
     340    pxNode *root = pxTreeFromMagicTreeRows(rows);
     341    psFree(rows);
     342    // silence unused warnings...
     343    if (root) {}
     344
    301345    return true;
    302346}
Note: See TracChangeset for help on using the changeset viewer.