IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 885


Ignore:
Timestamp:
Jun 4, 2004, 3:27:54 PM (22 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psLib/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psTrace.c

    r560 r885  
    3939
    4040static Component *croot = NULL;           // The root of the trace component
     41static FILE *traceFP = NULL;
    4142/*****************************************************************************
    4243    componentAlloc(): allocate memory for a new node, and initialize members.
     
    378379        va_start(ap, level);
    379380
    380         // We indent each message one space foe each level of the message.
    381         for (i = 0; i < level; i++) {
    382             putchar(' ');
    383         }
    384 
    385381        // The following functions get the variable list of parameters with
    386382        // which this function was called, and print them to the standard
    387383        // output.
    388384        fmt = va_arg(ap, char *);
    389         vprintf(fmt, ap);
     385
     386        if (traceFP != NULL) {
     387            // We indent each message one space for each level of the message.
     388            for (i = 0; i < level; i++) {
     389                fprintf(traceFP, " ");
     390            }
     391            vfprintf(traceFP, fmt, ap);
     392        } else {
     393            // We indent each message one space for each level of the message.
     394            for (i = 0; i < level; i++) {
     395                putchar(' ');
     396            }
     397            vprintf(fmt, ap);
     398        }
    390399        va_end(ap);
    391400    }
     
    393402    // NOTE: should we free *fmt as well?  Read the man page.
    394403}
     404
     405void psTraceSetDestination(FILE *fp)
     406{
     407    traceFP = fp;
     408}
  • trunk/psLib/src/sys/psTrace.h

    r560 r885  
    5555;
    5656
     57void psTraceSetDestination(FILE *fp);
     58
     59
    5760/* \} */ // End of SystemGroup Functions
    5861
     
    6770
    6871#endif
     72
  • trunk/psLib/src/sysUtils/psHash.c

    r875 r885  
    1313#include "psTrace.h"
    1414
    15 void psHashKeyList()
    16 {
    17     printf("This has not been coded.\n");
     15psDlist *psHashKeyList(psHash *table)
     16{
     17    int i = 0;
     18    psDlist *myLinkList = NULL;
     19
     20    if (table == NULL) {
     21        return NULL;
     22    }
     23
     24    myLinkList = psDlistAlloc(NULL);
     25
     26    for (i=0;i<table->nbucket;i++) {
     27        if (table->buckets[i] != NULL) {
     28            psDlistAdd(myLinkList, (table->buckets[i])->key, PS_DLIST_HEAD);
     29        }
     30    }
     31
     32    return(myLinkList);
    1833}
    1934
  • trunk/psLib/src/sysUtils/psHash.h

    r875 r885  
    66 *  \ingroup DataGroup
    77 */
     8#include "psDList.h"
     9
    810
    911/** DO WE NEED TO DEFINE HashTable? */
     
    5961
    6062/// List all keys in table.
    61 void psHashKeyList();
     63psDlist *psHashKeyList(psHash *table);
    6264
    6365/* \} */ // End of DataGroup Functions
  • trunk/psLib/src/sysUtils/psTrace.c

    r560 r885  
    3939
    4040static Component *croot = NULL;           // The root of the trace component
     41static FILE *traceFP = NULL;
    4142/*****************************************************************************
    4243    componentAlloc(): allocate memory for a new node, and initialize members.
     
    378379        va_start(ap, level);
    379380
    380         // We indent each message one space foe each level of the message.
    381         for (i = 0; i < level; i++) {
    382             putchar(' ');
    383         }
    384 
    385381        // The following functions get the variable list of parameters with
    386382        // which this function was called, and print them to the standard
    387383        // output.
    388384        fmt = va_arg(ap, char *);
    389         vprintf(fmt, ap);
     385
     386        if (traceFP != NULL) {
     387            // We indent each message one space for each level of the message.
     388            for (i = 0; i < level; i++) {
     389                fprintf(traceFP, " ");
     390            }
     391            vfprintf(traceFP, fmt, ap);
     392        } else {
     393            // We indent each message one space for each level of the message.
     394            for (i = 0; i < level; i++) {
     395                putchar(' ');
     396            }
     397            vprintf(fmt, ap);
     398        }
    390399        va_end(ap);
    391400    }
     
    393402    // NOTE: should we free *fmt as well?  Read the man page.
    394403}
     404
     405void psTraceSetDestination(FILE *fp)
     406{
     407    traceFP = fp;
     408}
  • trunk/psLib/src/sysUtils/psTrace.h

    r560 r885  
    5555;
    5656
     57void psTraceSetDestination(FILE *fp);
     58
     59
    5760/* \} */ // End of SystemGroup Functions
    5861
     
    6770
    6871#endif
     72
Note: See TracChangeset for help on using the changeset viewer.