IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6135


Ignore:
Timestamp:
Jan 21, 2006, 3:50:25 PM (20 years ago)
Author:
jhoblitt
Message:

revised -define logic

File:
1 edited

Legend:

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

    r6128 r6135  
    44
    55int main(int argc, char **argv) {
    6     p2Config        config;
     6    p2Config        config; 
    77
    88    p2searchConfig(&config, argc, argv);
     
    3535                exit(EXIT_FAILURE);
    3636            }
     37            psArray *pendingFrames = p2searchPendingFrames(&config);
     38            // XXX compare raw frames to pending frames and remove duplicate
     39            // frames from the raw set.  This may not be quiet right as it's
     40            // possible (likely?) that a rawScienceExp is inserted into the
     41            // database prior to /ALL/ of that exposure's Imfiles
     42            if (pendingFrames) {
     43                for (int i = 0; i < rawFrames->n; i++) {
     44                    ppRawFrame *rawFrame = rawFrames->data[i];
     45                    for (int j = 0; j < pendingFrames->n; j++) {
     46                        p2PendingFrame *pendingFrame = pendingFrames->data[j];
     47                        if (strcmp(rawFrame->exposure->exp_id,
     48                                   pendingFrame->exposure->exp_id) == 0) {
     49                            psArrayRemove(rawFrames, rawFrame);
     50                            // dec the counter as the array just got shorter
     51                            // and we don't want to skip elemnts
     52                            i--;
     53                            break;
     54                        }
     55                    }
     56                }
     57
     58                psFree(pendingFrames);
     59            }
     60
     61            psArray *doneFrames = p2searchDoneFrames(&config);
     62            if (doneFrames && (rawFrames->n > 0)) {
     63                for (int i = 0; i < rawFrames->n; i++) {
     64                    ppRawFrame *rawFrame = rawFrames->data[i];
     65                    for (int j = 0; j < pendingFrames->n; j++) {
     66                        p2DoneFrame *doneFrame = pendingFrames->data[j];
     67                        if (strcmp(rawFrame->exposure->exp_id,
     68                                   doneFrame->exposure->exp_id) == 0) {
     69                            psArrayRemove(rawFrames, rawFrame);
     70                            // dec the counter as the array just got shorter
     71                            // and we don't want to skip elemnts
     72                            i--;
     73                            break;
     74                        }
     75                    }
     76                }
     77
     78                psFree(doneFrames);
     79            }
     80
     81            if (!rawFrames->n > 0) {
     82                psError(PS_ERR_UNKNOWN, false, "no unprocessed ppRawFrames found");
     83                psFree(rawFrames);
     84                exit(EXIT_FAILURE);
     85            }
     86
    3787            bool status = p2insertPendingFrames(&config, rawFrames);
    3888            if (!status) {
Note: See TracChangeset for help on using the changeset viewer.