IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5072


Ignore:
Timestamp:
Sep 19, 2005, 4:43:53 PM (21 years ago)
Author:
drobbin
Message:

added psLogGet fxns and updated spline functions for unsigned int compatability

Location:
trunk/psLib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psSpline.c

    r5070 r5072  
    77*  splines.
    88*
    9 *  @version $Revision: 1.125 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-09-19 22:50:28 $
     9*  @version $Revision: 1.126 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-09-20 02:43:53 $
    1111*
    1212*
     
    4343/*****************************************************************************/
    4444static void spline1DFree(psSpline1D *tmpSpline);
    45 static unsigned int vectorBinDisectF32(psF32 *bins,psS32 numBins,psF32 x);
    46 static unsigned int vectorBinDisectS32(psS32 *bins,psS32 numBins,psS32 x);
     45static unsigned int vectorBinDisectF32(psF32 *bins,unsigned int numBins,psF32 x);
     46static unsigned int vectorBinDisectS32(psS32 *bins,unsigned int numBins,psS32 x);
    4747
    4848/*****************************************************************************/
     
    113113    \
    114114    psTrace(".psLib.dataManip.psSpline.fullInterpolate1D##TYPE", 4, \
    115             "---- fullInterpolate1D##TYPE() begin (%d-order at x=%f) (%d data points)----\n", n-1, x, n); \
     115            "---- fullInterpolate1D##TYPE() begin (%u-order at x=%f) (%d data points)----\n", n-1, x, n); \
    116116    \
    117117    for (i=0;i<n;i++) { \
     
    123123        p->data.TYPE[i] = range[i]; \
    124124        psTrace(".psLib.dataManip.psSpline.fullInterpolate1D##TYPE", 6, \
    125                 "p->data.TYPE[%d] is %f\n", i, p->data.TYPE[i]); \
     125                "p->data.TYPE[%u] is %f\n", i, p->data.TYPE[i]); \
    126126        \
    127127    } \
     
    140140             */ \
    141141            psTrace(".psLib.dataManip.psSpline.fullInterpolate1D##TYPE", 6, \
    142                     "p->data.TYPE[%d] is %f\n", i, p->data.TYPE[i]); \
     142                    "p->data.TYPE[%u] is %f\n", i, p->data.TYPE[i]); \
    143143        } \
    144144    } \
     
    841841#define FUNC_MACRO_VECTOR_BIN_DISECT(TYPE) \
    842842static unsigned int vectorBinDisect##TYPE(ps##TYPE *bins, \
    843         psS32 numBins, \
     843        unsigned int numBins, \
    844844        ps##TYPE x) \
    845845{ \
    846     psS32 min; \
    847     psS32 max; \
    848     psS32 mid; \
     846    unsigned int min; \
     847    unsigned int max; \
     848    unsigned int mid; \
    849849    \
    850850    psTrace(".psLib.dataManip.psSpline.vectorBinDisect##TYPE", 4, \
     
    871871    while (min != max) { \
    872872        psTrace(".psLib.dataManip.psSpline.vectorBinDisect##TYPE", 4, \
    873                 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", \
     873                "(min, mid, max) is (%u, %u, %u): (x, bins) is (%f, %f)\n", \
    874874                min, mid, max, x, bins[mid]); \
    875875        \
    876876        if (x == bins[mid]) { \
    877877            psTrace(".psLib.dataManip.psSpline.vectorBinDisect##TYPE", 4, \
    878                     "---- Exiting vectorBinDisect##TYPE(): bin %d\n", mid); \
     878                    "---- Exiting vectorBinDisect##TYPE(): bin %u\n", mid); \
    879879            return(mid); \
    880880        } else if (x < bins[mid]) { \
     
    887887    \
    888888    psTrace(".psLib.dataManip.psSpline.vectorBinDisect##TYPE", 4, \
    889             "---- Exiting vectorBinDisect##TYPE(): bin %d\n", min); \
     889            "---- Exiting vectorBinDisect##TYPE(): bin %u\n", min); \
    890890    return(min); \
    891891} \
  • trunk/psLib/src/sys/psLogMsg.c

    r4979 r5072  
    1212 *  @author GLG, MHPCC
    1313 *
    14  *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-09-09 01:11:22 $
     14 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-09-20 02:43:53 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5151
    5252static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
     53static int logFD = 0;
    5354static psS32 globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
    5455static psBool logTime = true;     // Flag to include time info
     
    8182}
    8283
     84int psLogGetLevel()
     85{
     86    return (globalLogLevel);
     87}
     88
    8389/*****************************************************************************
    8490psLogSetDestination(): sets the log message destination.
     
    94100    if (logDest == (FILE *) 1) {
    95101        logDest = stderr;
     102        logFD = 2;
    96103    }
    97104    if (fd == -1)
     
    104111        }
    105112        logDest = stdout;
     113        logFD = 1;
    106114    } else if (fd == 2) {
    107115        //        fp = stderr;
     
    110118        }
    111119        logDest = stderr;
     120        logFD = 2;
    112121    } else if (fd == 0) {
    113122        //        fp = NULL;
     
    116125        }
    117126        logDest = NULL;
     127        logFD = 0;
    118128        //        return true;
    119129    } else if (fd > 2) {
     
    123133        fp = fdopen(fd, "w");
    124134        logDest = fp;
     135        logFD = fd;
    125136        //        fclose(fp);
    126137        //        return true;
     
    130141
    131142}
     143
     144int psLogGetDestination(void)
     145{
     146    if (logDest == (FILE *) 1) {
     147        logFD = 1;
     148    }
     149    return (logFD);
     150}
     151
    132152
    133153/*****************************************************************************
  • trunk/psLib/src/sys/psLogMsg.h

    r5057 r5072  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-15 21:22:22 $
     13 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-20 02:43:53 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3636);
    3737
     38/** This procedure returns the current log destination file descriptor.  If the
     39 *  destination has not been defined by the use, the descriptor for stdout is returned.
     40 *
     41 *  @return int:        The current file descriptor.
     42 */
     43int psLogGetDestination();
     44
    3845/** This procedure sets the message level for future log messages.  Subsequent
    3946 *  log messages, with a log level of "mylevel", will only be logged if
     
    4249 *  be displayed.  The old log level will be returned.
    4350 *
    44  *  @return int    old logging level
     51 *  @return int:        old logging level.
    4552 */
    4653int psLogSetLevel(
    4754    int level                          ///< Specifies the system log level
    4855);
     56
     57/** This procedures returns the current log message level.
     58 *
     59 *  @return int:        The current logging level.
     60 */
     61int psLogGetLevel();
    4962
    5063/** This procedure sets the log format for future log messages.  The argument
  • trunk/psLib/test/sys/tst_psLogMsg.c

    r4979 r5072  
    2626                              },
    2727                              {
    28                                   testLogMsg02, 2, "psLogSetLevel()", 0, false
     28                                  testLogMsg02, 2, "psLogSet/GetLevel()", 0, false
    2929                              },
    3030                              {
     
    3535                              },
    3636                              {
    37                                   testLogMsg05, 5, "psLogSetDestination()", 0, false
     37                                  testLogMsg05, 5, "psLogSet/GetDestination()", 0, false
    3838                              },
    3939                              {
     
    107107    psLogSetLevel(4);
    108108    psLogMsg(__func__, 4, "This should  be displayed (level %d)\n", 4);
     109    psLogMsg(__func__, 4, "This should display level 4 logging -> level %d\n", psLogGetLevel() );
    109110
    110111    return 0;
     
    189190    //    psLogSetDestination("none");
    190191    psLogSetDestination(0);
     192    printf("    File Descriptor = %d \n", psLogGetDestination() );
    191193    for (i=0;i<10;i++) {
    192194        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     
    196198    //    psLogSetDestination("dest:stderr");
    197199    psLogSetDestination(2);
     200    printf("    File Descriptor = %d \n", psLogGetDestination() );
    198201    for (i=0;i<10;i++) {
    199202        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     
    203206    //    psLogSetDestination("dest:stdout");
    204207    psLogSetDestination(1);
     208    printf("    File Descriptor = %d \n", psLogGetDestination() );
    205209    for (i=0;i<10;i++) {
    206210        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     
    211215    //    psLogSetDestination("file:log.txt");
    212216    psLogSetDestination(fd);
     217    printf("    File Descriptor = %d \n", psLogGetDestination() );
    213218    for (i=0;i<10;i++) {
    214219        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
  • trunk/psLib/test/sys/verified/tst_psLogMsg.stderr

    r4979 r5072  
    3535/***************************** TESTPOINT ******************************************\
    3636*             TestFile: tst_psLogMsg.c                                             *
    37 *            TestPoint: psLogMsg{psLogSetLevel()}                                  *
     37*            TestPoint: psLogMsg{psLogSet/GetLevel()}                              *
    3838*             TestType: Positive                                                   *
    3939\**********************************************************************************/
     
    6161<DATE><TIME>|<HOST>|4|testLogMsg02
    6262    This should  be displayed (level 4)
     63<DATE><TIME>|<HOST>|4|testLogMsg02
     64    This should display level 4 logging -> level 4
    6365
    64 ---> TESTPOINT PASSED (psLogMsg{psLogSetLevel()} | tst_psLogMsg.c)
     66---> TESTPOINT PASSED (psLogMsg{psLogSet/GetLevel()} | tst_psLogMsg.c)
    6567
    6668/***************************** TESTPOINT ******************************************\
     
    152154/***************************** TESTPOINT ******************************************\
    153155*             TestFile: tst_psLogMsg.c                                             *
    154 *            TestPoint: psLogMsg{psLogSetDestination()}                            *
     156*            TestPoint: psLogMsg{psLogSet/GetDestination()}                        *
    155157*             TestType: Positive                                                   *
    156158\**********************************************************************************/
     
    165167    Hello World!  My level is 3
    166168
    167 ---> TESTPOINT PASSED (psLogMsg{psLogSetDestination()} | tst_psLogMsg.c)
     169---> TESTPOINT PASSED (psLogMsg{psLogSet/GetDestination()} | tst_psLogMsg.c)
    168170
    169171/***************************** TESTPOINT ******************************************\
  • trunk/psLib/test/sys/verified/tst_psLogMsg.stdout

    r4979 r5072  
    11--------------- psLogSetDestination(PS_LOG_NONE) ----------------
     2    File Descriptor = 0
    23------------- psLogSetDestination(PS_LOG_TO_STDERR) -------------
     4    File Descriptor = 2
    35------------- psLogSetDestination(PS_LOG_TO_STDOUT) -------------
     6    File Descriptor = 1
    47<DATE><TIME>|<HOST>|A|testLogMsg05
    58    Hello World!  My level is 0
     
    1114    Hello World!  My level is 3
    1215--------------- psLogSetDestination(file:log.txt) ---------------
     16    File Descriptor = 3
    1317--------------------- The Contents of log.txt -------------------
    1418<DATE><TIME>|<HOST>|A|testLogMsg05
Note: See TracChangeset for help on using the changeset viewer.