IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 28, 2005, 11:17:02 PM (21 years ago)
Author:
magnier
Message:

checking in the versions of the files below, incorporating the changes
I made and have already submitted to bugzilla. these files should be
replaced with the versions contributed on the main trunk by MHPCC.
I will tag this state with eam-psphot-1

src/astronomy/psMetadata.c src/astronomy/psMetadata.h
src/collections/psVector.c src/collections/psVector.h
src/dataManip/psMinimize.c src/dataManip/psMinimize.h
src/image/psImage.c src/image/psImage.h src/sysUtils/psTrace.c
src/sysUtils/psTrace.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam-psphot-branch/psLib/src/sys/psTrace.c

    r3541 r3788  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-03-29 21:31:54 $
     11 *  @version $Revision: 1.44.4.1 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-04-29 09:17:02 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    252252    if (cRoot == NULL) {
    253253        initTrace();
     254    }
     255
     256    if (traceFP == NULL) {
     257        traceFP = stderr;
    254258    }
    255259
     
    425429    psS32 i = 0;
    426430
     431    if (traceFP == NULL) {
     432        traceFP = stderr;
     433    }
     434
    427435    if (comp->name[0] == '\0') {
    428436        return;
    429437    } else {
    430438        if (comp->level == PS_DEFAULT_TRACE_LEVEL) {
    431             if (traceFP == NULL) {
    432                 printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name,
    433                        defLevel);
    434             } else {
    435                 fprintf(traceFP,"%*s%-*s %d\n", depth, "", 20 - depth, comp->name,
    436                         defLevel);
    437             }
     439            fprintf(traceFP,"%*s%-*s %d\n", depth, "", 20 - depth, comp->name, defLevel);
    438440        } else {
    439             if (traceFP == NULL) {
    440                 printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name,
    441                        comp->level);
    442             } else {
    443                 fprintf(traceFP, "%*s%-*s %d\n", depth, "", 20 - depth, comp->name,
    444                         comp->level);
    445             }
     441            fprintf(traceFP, "%*s%-*s %d\n", depth, "", 20 - depth, comp->name, comp->level);
    446442        }
    447443    }
     
    498494    psS32 i = 0;
    499495
     496    if (traceFP == NULL) {
     497        traceFP = stderr;
     498    }
     499
    500500    if (NULL == comp) {
    501501        psError(PS_ERR_BAD_PARAMETER_NULL, true,
     
    514514        fmt = va_arg(ap, char *);
    515515
    516         if (traceFP != NULL) {
    517             // We indent each message one space for each level of the message.
    518             for (i = 0; i < level; i++) {
    519                 fprintf(traceFP, " ");
    520             }
    521             vfprintf(traceFP, fmt, ap);
    522         } else {
    523             // We indent each message one space for each level of the message.
    524             for (i = 0; i < level; i++) {
    525                 putchar(' ');
    526             }
    527             vprintf(fmt, ap);
    528         }
     516        // We indent each message one space for each level of the message.
     517        for (i = 0; i < level; i++) {
     518            fprintf(traceFP, " ");
     519        }
     520        vfprintf(traceFP, fmt, ap);
    529521        va_end(ap);
    530522    }
    531     // NOTE: should we free *fmt as well? Read the man page.
    532 }
    533 
     523}
     524
     525// XXX EAM : I've added code to close the old traceFP (safely)
    534526void psTraceSetDestination(FILE * fp)
    535527{
     528
     529    bool special;
     530
     531    // XXX EAM perhaps return an error?
     532    if (fp == NULL) {
     533        return;
     534    }
     535
     536    // cannot close traceFP if one of the special FILE ptrs
     537    special  = (traceFP == NULL);
     538    special |= (traceFP == stdin);
     539    special |= (traceFP == stdout);
     540    special |= (traceFP == stderr);
     541
     542    if (!special) {
     543        fclose (traceFP);
     544    }
    536545    traceFP = fp;
    537546}
    538547
     548FILE *psTraceGetDestination()
     549{
     550    if (traceFP == NULL) {
     551        traceFP = stderr;
     552    }
     553    return traceFP;
     554}
     555
    539556#endif
Note: See TracChangeset for help on using the changeset viewer.