IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 20, 2006, 5:26:12 PM (20 years ago)
Author:
Paul Price
Message:

Printing ourselves, instead of using psTrace, so that we can actually print to the desired file descriptor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmHDUUtils.c

    r9608 r9699  
    8080}
    8181
     82// Print spaces to indent
     83#define INDENT(FILE, LEVEL) \
     84{ \
     85    for (int i = 0; i < (LEVEL); i++) { \
     86        fprintf(FILE, " "); \
     87    } \
     88}
     89
    8290void pmHDUPrint(FILE *fd, const pmHDU *hdu, int level, bool header)
    8391{
    8492    PS_ASSERT_PTR_NON_NULL(hdu,);
    8593
    86     #ifndef PS_NO_TRACE
    87 
     94    INDENT(fd, level);
    8895    if (hdu->blankPHU) {
    89         psTrace("psModules.camera", level, "HDU: (PHU)\n");
     96        fprintf(fd, "HDU: (PHU)\n");
    9097    } else {
    91         psTrace("psModules.camera", level, "HDU: %s\n", hdu->extname);
     98        fprintf(fd, "HDU: %s\n", hdu->extname);
    9299    }
    93100
    94     psTrace("psModules.camera", level + 1, "Format: %p\n", hdu->format);
     101    INDENT(fd, level + 1);
     102    fprintf(fd, "Format: %p\n", hdu->format);
    95103    if (header) {
     104        INDENT(fd, level + 1);
    96105        if (hdu->header) {
    97             psTrace("psModules.camera", level + 1, "Header:\n");
     106            fprintf(fd, "Header:\n");
    98107            psMetadataPrint(fd, hdu->header, level + 2);
    99108        } else {
    100             psTrace("psModules.camera", level + 1, "No header.\n");
     109            fprintf(fd, "No header.\n");
    101110        }
    102111    }
    103112
     113    INDENT(fd, level + 1);
    104114    if (hdu->images) {
    105         psTrace("psModules.camera", level + 1, "Images:\n");
     115        fprintf(fd, "Images:\n");
    106116        for (long i = 0; i < hdu->images->n; i++) {
    107117            psImage *image = hdu->images->data[i]; // Image of interest
    108             psTrace("psModules.camera", level + 2, "%ld: %dx%d\n", i, image->numCols, image->numRows);
     118            INDENT(fd, level + 2);
     119            fprintf(fd, "%ld: %dx%d\n", i, image->numCols, image->numRows);
    109120        }
    110121    } else {
    111         psTrace("psModules.camera", level + 1, "NO images.\n");
     122        fprintf(fd, "NO images.\n");
    112123    }
    113124
     125    INDENT(fd, level + 1);
    114126    if (hdu->masks) {
    115         psTrace("psModules.camera", level + 1, "Masks:\n");
     127        fprintf(fd, "Masks:\n");
    116128        for (long i = 0; i < hdu->masks->n; i++) {
    117129            psImage *mask = hdu->masks->data[i]; // Mask of interest
    118             psTrace("psModules.camera", level + 2, "%ld: %dx%d\n", i, mask->numCols, mask->numRows);
     130            INDENT(fd, level + 2);
     131            fprintf(fd, "%ld: %dx%d\n", i, mask->numCols, mask->numRows);
    119132        }
    120133    } else {
    121         psTrace("psModules.camera", level + 1, "NO masks.\n");
     134        fprintf(fd, "NO masks.\n");
    122135    }
    123136
     137    INDENT(fd, level + 1);
    124138    if (hdu->weights) {
    125         psTrace("psModules.camera", level + 1, "Weights:\n");
     139        fprintf(fd, "Weights:\n");
    126140        for (long i = 0; i < hdu->masks->n; i++) {
    127141            psImage *weight = hdu->weights->data[i]; // Weight image of interest
    128             psTrace("psModules.camera", level + 2, "%ld: %dx%d\n", i, weight->numCols, weight->numRows);
     142            INDENT(fd, level + 2);
     143            fprintf(fd, "%ld: %dx%d\n", i, weight->numCols, weight->numRows);
    129144        }
    130145    } else {
    131         psTrace("psModules.camera", level + 1, "NO weights.\n");
     146        fprintf(fd, "NO weights.\n");
    132147    }
    133     #endif
    134148
    135149    return;
Note: See TracChangeset for help on using the changeset viewer.