IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4409


Ignore:
Timestamp:
Jun 28, 2005, 10:17:52 AM (21 years ago)
Author:
drobbin
Message:

updated files in accordance with requested revisions in apidelta-report-cycle6

Location:
trunk/psLib
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/pslib.kdevses

    r4401 r4409  
    22<!DOCTYPE KDevPrjSession>
    33<KDevPrjSession>
    4  <DocsAndViews NumberOfDocuments="0" />
     4 <DocsAndViews NumberOfDocuments="1" >
     5  <Doc0 NumberOfViews="1" URL="file:/home/drobbin/panstarrs/psLib/src/dataManip/psFunctions.h" >
     6   <View0 line="80" Type="Source" />
     7  </Doc0>
     8 </DocsAndViews>
    59 <pluginList>
    610  <kdevbookmarks>
  • trunk/psLib/src/astro/psTime.c

    r4330 r4409  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-21 03:01:37 $
     12 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-28 20:17:52 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    11661166}
    11671167
    1168 char* psTimeToISO(const psTime *time)
     1168psString psTimeToISO(const psTime *time)
    11691169{
    11701170    psS32 ds = 0;
     
    13531353}
    13541354
    1355 psTime* psTimeFromISO(const char *time)
     1355psTime* psTimeFromISO(const char *input)
    13561356{
    13571357    psS32 millisecond;
     
    13601360
    13611361    // Check for NULL string
    1362     PS_ASSERT_PTR_NON_NULL(time,NULL);
     1362    PS_ASSERT_PTR_NON_NULL(input,NULL);
    13631363
    13641364    // Convert YYYY-MM-DDThh:mm:ss.sss in string form to tm time
    1365     if (sscanf(time, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday,
     1365    if (sscanf(input, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday,
    13661366               &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec,&millisecond) < 7) {
    1367         psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, time);
     1367        psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, input);
    13681368        return NULL;
    13691369    }
     
    14261426}
    14271427
    1428 psTime* psTimeFromTimeval(const struct timeval *time)
     1428psTime* psTimeFromTimeval(const struct timeval *input)
    14291429{
    14301430    psTime *outTime = NULL;
     
    14321432
    14331433    // Error check
    1434     PS_ASSERT_PTR_NON_NULL(time,NULL);
     1434    PS_ASSERT_PTR_NON_NULL(input,NULL);
    14351435
    14361436    // Allocate psTime struct
     
    14381438
    14391439    // Convert to psTime
    1440     outTime->sec = time->tv_sec;
    1441     outTime->nsec = time->tv_usec * 1000;
     1440    outTime->sec = input->tv_sec;
     1441    outTime->nsec = input->tv_usec * 1000;
    14421442
    14431443    // Error check
  • trunk/psLib/src/astro/psTime.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3838 */
    3939typedef enum {
    40     PS_TIME_TAI,        ///< Temps Atomique International (TAI) time (time with leapseconds).
    41     PS_TIME_UTC,        ///< Universal Time Coordinated (UTC) time (time without leapseconds).
    42     PS_TIME_UT1,        ///< Universal Time corrected for polar motion
    43     PS_TIME_TT,         ///< Terrestrial Time
     40    PS_TIME_TAI,                       ///< Temps Atomique International (TAI) time (time with leapseconds)
     41    PS_TIME_UTC,                       ///< Universal Time Coordinated (UTC) time (time without leapseconds)
     42    PS_TIME_UT1,                       ///< Universal Time corrected for polar motion
     43    PS_TIME_TT,                        ///< Terrestrial Time
    4444} psTimeType;
    4545
     
    4949 */
    5050typedef enum {
    51     PS_IERS_A,          ///< IERS Bulletin A
    52     PS_IERS_B,          ///< IERS Bulletin B
     51    PS_IERS_A,                         ///< IERS Bulletin A
     52    PS_IERS_B,                         ///< IERS Bulletin B
    5353} psTimeBulletin;
    5454
     
    6262typedef struct psTime
    6363{
    64     psS64 sec;          ///< Seconds since epoch, Jan 1, 1970.
    65     psU32 nsec;         ///< Nanoseconds since last second.
    66     psBool leapsecond;  ///< if time falls on UTC leapsecond
    67     psTimeType type;    ///< Type of time.
     64    psS64 sec;                         ///< Seconds since epoch, Jan 1, 1970.
     65    psU32 nsec;                        ///< Nanoseconds since last second.
     66    psBool leapsecond;                 ///< if time falls on UTC leapsecond
     67    psTimeType type;                   ///< Type of time.
    6868}
    6969psTime;
     
    9797 */
    9898psTime* psTimeAlloc(
    99     psTimeType type                     ///< Type of time to create (UTC or TAI).
     99    psTimeType type                    ///< Type of time to create (UTC or TAI).
    100100);
    101101
     
    108108 */
    109109psTime* psTimeGetNow(
    110     psTimeType type                     ///< Type of time to get (UTC or TAI).
     110    psTimeType type                    ///< Type of time to get (UTC or TAI).
    111111);
    112112
     
    118118 */
    119119psTime* psTimeConvert(
    120     psTime *time,                       ///< Time to be converted.
    121     psTimeType type                     ///< Type to be converted to.
     120    psTime *time,                      ///< Time to be converted.
     121    psTimeType type                    ///< Type to be converted to.
    122122);
    123123
     
    131131double psTimeToLMST(
    132132    psTime *time,                      ///< psTime to be converted.
    133     double longitude                    ///< Longitude.
     133    double longitude                   ///< Longitude.
    134134);
    135135
     
    141141 */
    142142double psTimeGetUT1Delta(
    143     const psTime *time,                 ///< psTime to be looked up.
    144     psTimeBulletin bulletin             ///< IERS bulletin to use
     143    const psTime *time,                ///< psTime to be looked up.
     144    psTimeBulletin bulletin            ///< IERS bulletin to use
    145145);
    146146
     
    152152 */
    153153psF64 p_psTimeGetTAIDelta(
    154     const psTime *time                  ///< psTime to be looked up.
     154    const psTime *time                 ///< psTime to be looked up.
    155155);
    156156
     
    212212 *  This function does not add or subtract leapseconds.
    213213 *
    214  *  @return  char*: Pointer null terminated array of chars in ISO time.
    215  */
    216 char* psTimeToISO(
     214 *  @return  psString:    Pointer null terminated array of chars in ISO time.
     215 */
     216psString psTimeToISO(
    217217    const psTime* time                  ///< Input time to be converted.
    218218);
     
    268268 */
    269269psTime* psTimeFromISO(
    270     const char* time                   ///< Input time to be converted.
     270    const char* input                  ///< Input time to be converted.
    271271);
    272272
     
    278278 */
    279279psTime* psTimeFromTimeval(
    280     const struct timeval *time         ///< Input time to be converted.
     280    const struct timeval *input        ///< Input time to be converted.
    281281);
    282282
     
    296296 *  Converts UTC time to psTime.  It will verify if time specified is a leapsecond.
    297297 *
    298  *  @return psTime*: time (UTC)
     298 *  @return psTime*: time (UTC)time
    299299 */
    300300psTime* psTimeFromUTC(
  • trunk/psLib/src/astronomy/psTime.c

    r4330 r4409  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-21 03:01:37 $
     12 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-28 20:17:52 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    11661166}
    11671167
    1168 char* psTimeToISO(const psTime *time)
     1168psString psTimeToISO(const psTime *time)
    11691169{
    11701170    psS32 ds = 0;
     
    13531353}
    13541354
    1355 psTime* psTimeFromISO(const char *time)
     1355psTime* psTimeFromISO(const char *input)
    13561356{
    13571357    psS32 millisecond;
     
    13601360
    13611361    // Check for NULL string
    1362     PS_ASSERT_PTR_NON_NULL(time,NULL);
     1362    PS_ASSERT_PTR_NON_NULL(input,NULL);
    13631363
    13641364    // Convert YYYY-MM-DDThh:mm:ss.sss in string form to tm time
    1365     if (sscanf(time, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday,
     1365    if (sscanf(input, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday,
    13661366               &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec,&millisecond) < 7) {
    1367         psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, time);
     1367        psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, input);
    13681368        return NULL;
    13691369    }
     
    14261426}
    14271427
    1428 psTime* psTimeFromTimeval(const struct timeval *time)
     1428psTime* psTimeFromTimeval(const struct timeval *input)
    14291429{
    14301430    psTime *outTime = NULL;
     
    14321432
    14331433    // Error check
    1434     PS_ASSERT_PTR_NON_NULL(time,NULL);
     1434    PS_ASSERT_PTR_NON_NULL(input,NULL);
    14351435
    14361436    // Allocate psTime struct
     
    14381438
    14391439    // Convert to psTime
    1440     outTime->sec = time->tv_sec;
    1441     outTime->nsec = time->tv_usec * 1000;
     1440    outTime->sec = input->tv_sec;
     1441    outTime->nsec = input->tv_usec * 1000;
    14421442
    14431443    // Error check
  • trunk/psLib/src/astronomy/psTime.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3838 */
    3939typedef enum {
    40     PS_TIME_TAI,        ///< Temps Atomique International (TAI) time (time with leapseconds).
    41     PS_TIME_UTC,        ///< Universal Time Coordinated (UTC) time (time without leapseconds).
    42     PS_TIME_UT1,        ///< Universal Time corrected for polar motion
    43     PS_TIME_TT,         ///< Terrestrial Time
     40    PS_TIME_TAI,                       ///< Temps Atomique International (TAI) time (time with leapseconds)
     41    PS_TIME_UTC,                       ///< Universal Time Coordinated (UTC) time (time without leapseconds)
     42    PS_TIME_UT1,                       ///< Universal Time corrected for polar motion
     43    PS_TIME_TT,                        ///< Terrestrial Time
    4444} psTimeType;
    4545
     
    4949 */
    5050typedef enum {
    51     PS_IERS_A,          ///< IERS Bulletin A
    52     PS_IERS_B,          ///< IERS Bulletin B
     51    PS_IERS_A,                         ///< IERS Bulletin A
     52    PS_IERS_B,                         ///< IERS Bulletin B
    5353} psTimeBulletin;
    5454
     
    6262typedef struct psTime
    6363{
    64     psS64 sec;          ///< Seconds since epoch, Jan 1, 1970.
    65     psU32 nsec;         ///< Nanoseconds since last second.
    66     psBool leapsecond;  ///< if time falls on UTC leapsecond
    67     psTimeType type;    ///< Type of time.
     64    psS64 sec;                         ///< Seconds since epoch, Jan 1, 1970.
     65    psU32 nsec;                        ///< Nanoseconds since last second.
     66    psBool leapsecond;                 ///< if time falls on UTC leapsecond
     67    psTimeType type;                   ///< Type of time.
    6868}
    6969psTime;
     
    9797 */
    9898psTime* psTimeAlloc(
    99     psTimeType type                     ///< Type of time to create (UTC or TAI).
     99    psTimeType type                    ///< Type of time to create (UTC or TAI).
    100100);
    101101
     
    108108 */
    109109psTime* psTimeGetNow(
    110     psTimeType type                     ///< Type of time to get (UTC or TAI).
     110    psTimeType type                    ///< Type of time to get (UTC or TAI).
    111111);
    112112
     
    118118 */
    119119psTime* psTimeConvert(
    120     psTime *time,                       ///< Time to be converted.
    121     psTimeType type                     ///< Type to be converted to.
     120    psTime *time,                      ///< Time to be converted.
     121    psTimeType type                    ///< Type to be converted to.
    122122);
    123123
     
    131131double psTimeToLMST(
    132132    psTime *time,                      ///< psTime to be converted.
    133     double longitude                    ///< Longitude.
     133    double longitude                   ///< Longitude.
    134134);
    135135
     
    141141 */
    142142double psTimeGetUT1Delta(
    143     const psTime *time,                 ///< psTime to be looked up.
    144     psTimeBulletin bulletin             ///< IERS bulletin to use
     143    const psTime *time,                ///< psTime to be looked up.
     144    psTimeBulletin bulletin            ///< IERS bulletin to use
    145145);
    146146
     
    152152 */
    153153psF64 p_psTimeGetTAIDelta(
    154     const psTime *time                  ///< psTime to be looked up.
     154    const psTime *time                 ///< psTime to be looked up.
    155155);
    156156
     
    212212 *  This function does not add or subtract leapseconds.
    213213 *
    214  *  @return  char*: Pointer null terminated array of chars in ISO time.
    215  */
    216 char* psTimeToISO(
     214 *  @return  psString:    Pointer null terminated array of chars in ISO time.
     215 */
     216psString psTimeToISO(
    217217    const psTime* time                  ///< Input time to be converted.
    218218);
     
    268268 */
    269269psTime* psTimeFromISO(
    270     const char* time                   ///< Input time to be converted.
     270    const char* input                  ///< Input time to be converted.
    271271);
    272272
     
    278278 */
    279279psTime* psTimeFromTimeval(
    280     const struct timeval *time         ///< Input time to be converted.
     280    const struct timeval *input        ///< Input time to be converted.
    281281);
    282282
     
    296296 *  Converts UTC time to psTime.  It will verify if time specified is a leapsecond.
    297297 *
    298  *  @return psTime*: time (UTC)
     298 *  @return psTime*: time (UTC)time
    299299 */
    300300psTime* psTimeFromUTC(
  • trunk/psLib/src/collections/psMetadataIO.c

    r4401 r4409  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-06-27 20:38:12 $
     12*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-06-28 20:17:52 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10751075}
    10761076
    1077 psMetadata* psMetadataConfigParse(psMetadata* md, int *nFail, const char *fileName, bool overwrite)
     1077psMetadata* psMetadataConfigParse(psMetadata* md, unsigned int *nFail, const char *fileName, bool overwrite)
    10781078{
    10791079    FILE*               fp                   = NULL;
  • trunk/psLib/src/collections/psMetadataIO.h

    r4401 r4409  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-27 20:38:12 $
     12 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-28 20:17:52 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8181psMetadata* psMetadataConfigParse(
    8282    psMetadata* md,                    ///< Resulting metadata from read.
    83     int *nFail,                        ///< Number of failed lines.
     83    unsigned int *nFail,               ///< Number of failed lines.
    8484    const char *fileName,              ///< Name of file to read.
    8585    bool overwrite                     ///< Allow overwrite of duplicate specifications.
  • trunk/psLib/src/collections/psScalar.c

    r4330 r4409  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-06-21 03:01:37 $
     10 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-06-28 20:17:52 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psCollectionsErrors.h"
    2323
    24 psScalar* psScalarAlloc(psC64 value, psElemType dataType)
     24psScalar* psScalarAlloc(complex value, psElemType type)
    2525{
    2626    psScalar* scalar = NULL;
     
    3030
    3131    scalar->type.dimen = PS_DIMEN_SCALAR;
    32     scalar->type.type = dataType;
     32    scalar->type.type = type;
    3333
    34     switch (dataType) {
     34    switch (type) {
    3535    case PS_TYPE_S8:
    3636        scalar->data.S8 = (psS8) value;
     
    7272        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    7373                PS_ERRORTEXT_psScalar_UNSUPPORTED_TYPE,
    74                 dataType);
     74                type);
    7575        psFree(scalar);
    7676        return NULL;
  • trunk/psLib/src/collections/psScalar.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6666 */
    6767psScalar* psScalarAlloc(
    68     psC64 value,                       ///< Data to be put into psScalar.
    69     psElemType dataType                ///< Type of data to be held by psScalar.
     68    complex value,                     ///< Data to be put into psScalar.
     69    psElemType type                    ///< Type of data to be held by psScalar.
    7070);
    7171
  • trunk/psLib/src/collections/psVector.c

    r4392 r4409  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-06-25 02:02:05 $
     11*  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-06-28 20:17:52 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4848// FUNCTION IMPLEMENTATION - PUBLIC
    4949
    50 psVector* psVectorAlloc(psU32 nalloc, psElemType elemType)
     50psVector* psVectorAlloc(unsigned long nalloc, psElemType type)
    5151{
    5252    psVector* psVec = NULL;
    5353    psS32 elementSize = 0;
    5454
    55     elementSize = PSELEMTYPE_SIZEOF(elemType);
     55    elementSize = PSELEMTYPE_SIZEOF(type);
    5656    if (elementSize < 1) {
    5757        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    58                 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);
     58                PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, type);
    5959        return NULL;
    6060    }
     
    6666
    6767    psVec->type.dimen = PS_DIMEN_VECTOR;
    68     psVec->type.type = elemType;
     68    psVec->type.type = type;
    6969    *(int*)&psVec->nalloc = nalloc;
    7070    psVec->n = nalloc;
     
    7676}
    7777
    78 psVector* psVectorRealloc(psVector* in, psU32 nalloc)
     78psVector* psVectorRealloc(psVector* vector, unsigned long nalloc)
    7979{
    8080    psS32 elementSize = 0;
    8181    psElemType elemType;
    8282
    83     if (in == NULL) {
     83    if (vector == NULL) {
    8484        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    8585                PS_ERRORTEXT_psVector_REALLOC_NULL);
    8686        return NULL;
    87     } else if (in->nalloc != nalloc) {     // No need to realloc to same size
    88         elemType = in->type.type;
     87    } else if (vector->nalloc != nalloc) {     // No need to realloc to same size
     88        elemType = vector->type.type;
    8989        elementSize = PSELEMTYPE_SIZEOF(elemType);
    90         if (nalloc < in->n) {
    91             in->n = nalloc;
     90        if (nalloc < vector->n) {
     91            vector->n = nalloc;
    9292        }
    9393        // Realloc after decrementation to avoid accessing freed array elements
    94         in->data.U8 = psRealloc(in->data.U8, nalloc * elementSize);
    95         *(int*)&in->nalloc = nalloc;
    96     }
    97 
    98     return in;
    99 }
    100 
    101 psVector* psVectorRecycle(psVector* in, psU32 n, psElemType type)
     94        vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
     95        *(int*)&vector->nalloc = nalloc;
     96    }
     97
     98    return vector;
     99}
     100
     101psVector* psVectorRecycle(psVector* vector, unsigned long nalloc, psElemType type)
    102102{
    103103    psS32 byteSize;
    104104
    105     if (in == NULL) {
    106         return psVectorAlloc(n, type);
    107     }
    108 
    109     if (in->type.dimen !=  PS_DIMEN_VECTOR &&
    110             in->type.dimen !=  PS_DIMEN_TRANSV) {
    111         psFree(in);
     105    if (vector == NULL) {
     106        return psVectorAlloc(nalloc, type);
     107    }
     108
     109    if (vector->type.dimen !=  PS_DIMEN_VECTOR &&
     110            vector->type.dimen !=  PS_DIMEN_TRANSV) {
     111        psFree(vector);
    112112        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    113113                PS_ERRORTEXT_psVector_NOT_A_VECTOR);
     
    115115    }
    116116
    117     byteSize = n * PSELEMTYPE_SIZEOF(type);
     117    byteSize = nalloc * PSELEMTYPE_SIZEOF(type);
    118118
    119119    // need to increase data buffer?
    120     if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) {
    121         in->data.U8 = psRealloc(in->data.U8, byteSize);
    122         *(int*)&in->nalloc = n;
    123     }
    124 
    125     in->type.dimen = PS_DIMEN_VECTOR;
    126     in->type.type = type;
    127     in->n = n;
    128     return in;
     120    if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) {
     121        vector->data.U8 = psRealloc(vector->data.U8, byteSize);
     122        *(int*)&vector->nalloc = nalloc;
     123    }
     124
     125    vector->type.dimen = PS_DIMEN_VECTOR;
     126    vector->type.type = type;
     127    vector->n = nalloc;
     128    return vector;
    129129}
    130130
  • trunk/psLib/src/collections/psVector.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929///< Union of psVector data types.
    3030typedef union {
    31     psU8* U8;               ///< Unsigned 8-bit integer data.
    32     psU16* U16;             ///< Unsigned 16-bit integer data.
    33     psU32* U32;             ///< Unsigned 32-bit integer data.
    34     psU64* U64;             ///< Unsigned 64-bit integer data.
    35     psS8* S8;               ///< Signed 8-bit integer data.
    36     psS16* S16;             ///< Signed 16-bit integer data.
    37     psS32* S32;             ///< Signed 32-bit integer data.
    38     psS64* S64;             ///< Signed 64-bit integer data.
    39     psF32* F32;             ///< Single-precision float data.
    40     psF64* F64;             ///< Double-precision float data.
    41     psC32* C32;             ///< Single-precision complex data.
    42     psC64* C64;             ///< Double-precision complex data.
    43 } p_psVectorData;
     31    psU8* U8;                          ///< Unsigned 8-bit integer data.
     32    psU16* U16;                        ///< Unsigned 16-bit integer data.
     33    psU32* U32;                        ///< Unsigned 32-bit integer data.
     34    psU64* U64;                        ///< Unsigned 64-bit integer data.
     35    psS8* S8;                          ///< Signed 8-bit integer data.
     36    psS16* S16;                        ///< Signed 16-bit integer data.
     37    psS32* S32;                        ///< Signed 32-bit integer data.
     38    psS64* S64;                        ///< Signed 64-bit integer data.
     39    psF32* F32;                        ///< Single-precision float data.
     40    psF64* F64;                        ///< Double-precision float data.
     41    psC32* C32;                        ///< Single-precision complex data.
     42    psC64* C64;                        ///< Double-precision complex data.
     43}
     44p_psVectorData;
    4445
    4546/** An vector to support primitive types.
     
    5051typedef struct
    5152{
    52     psType type;                ///< Type of data.
    53     int n;                      ///< Number of elements in use.
    54     const int nalloc;           ///< Total number of elements available.
    55     p_psVectorData data;        ///< Union for data types.
     53    psType type;                       ///< Type of data.
     54    int n;                             ///< Number of elements in use.
     55    const int nalloc;                  ///< Total number of elements available.
     56    p_psVectorData data;               ///< Union for data types.
    5657}
    5758psVector;
     
    7273 */
    7374psVector* psVectorAlloc(
    74     psU32 nalloc,               ///< Total number of elements to make available.
    75     psElemType dataType                ///< Type of data to be held by vector.
     75    unsigned long nalloc,              ///< Total number of elements to make available.
     76    psElemType type                    ///< Type of data to be held by vector.
    7677);
    7778
     
    8687 */
    8788psVector* psVectorRealloc(
    88     psVector* psVec,                   ///< Vector to reallocate.
    89     psU32 nalloc                       ///< Total number of elements to make available.
     89    psVector* vector,                  ///< Vector to reallocate.
     90    unsigned long nalloc               ///< Total number of elements to make available.
    9091);
    9192
     
    115116 */
    116117psVector* psVectorRecycle(
    117     psVector* psVec,
     118    psVector* vector,
    118119    ///< Vector to recycle.  If NULL, a new vector is created.  No effort
    119120    ///< taken to preserve the values.
    120121
    121     psU32 nalloc,                      ///< Total number of elements to make available.
     122    unsigned long nalloc,              ///< Total number of elements to make available.
    122123    psElemType type                    ///< the datatype of the returned vector
    123124);
  • trunk/psLib/src/dataManip/psStats.c

    r4392 r4409  
    1414 *      stats->binsize
    1515 *
    16  *  @version $Revision: 1.135 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-06-25 02:02:05 $
     16 *  @version $Revision: 1.136 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-06-28 20:17:52 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    19871987 *****************************************************************************/
    19881988psHistogram* psVectorHistogram(psHistogram* out,
    1989                                const psVector* in,
     1989                               const psVector* values,
    19901990                               const psVector* errors,
    19911991                               const psVector* mask,
    1992                                psU32 maskVal)
     1992                               psMaskType maskVal)
    19931993{
    19941994    PS_ASSERT_PTR_NON_NULL(out, NULL);
     
    19991999    PS_ASSERT_VECTOR_TYPE(out->nums, PS_TYPE_F32, NULL);
    20002000    PS_ASSERT_INT_NONNEGATIVE(out->nums->n, NULL);
    2001     PS_ASSERT_VECTOR_NON_NULL(in, out);
     2001    PS_ASSERT_VECTOR_NON_NULL(values, out);
    20022002    if (mask != NULL) {
    2003         PS_ASSERT_VECTORS_SIZE_EQUAL(in, mask, NULL);
     2003        PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, NULL);
    20042004        PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_U8, NULL);
    20052005    }
    20062006    if (errors != NULL) {
    2007         PS_ASSERT_VECTORS_SIZE_EQUAL(in, errors, NULL);
    2008         PS_ASSERT_VECTOR_TYPE(errors, in->type.type, NULL);
     2007        PS_ASSERT_VECTORS_SIZE_EQUAL(values, errors, NULL);
     2008        PS_ASSERT_VECTOR_TYPE(errors, values->type.type, NULL);
    20092009    }
    20102010
     
    20212021
    20222022    // Convert input and errors vectors to F32 if necessary.
    2023     inF32 = p_psConvertToF32((psVector *) in);
     2023    inF32 = p_psConvertToF32((psVector *) values);
    20242024    if (inF32 == NULL) {
    2025         inF32 = (psVector *) in;
     2025        inF32 = (psVector *) values;
    20262026        mustFreeVectorIn = 0;
    20272027    }
     
    21872187                       const psVector* errors,
    21882188                       const psVector* mask,
    2189                        psU32 maskVal)
     2189                       psMaskType maskVal)
    21902190{
    21912191    PS_ASSERT_PTR_NON_NULL(stats, NULL);
  • trunk/psLib/src/dataManip/psStats.h

    r4315 r4409  
    1414 *  @author GLG, MHPCC
    1515 *
    16  *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-06-18 02:30:49 $
     16 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-06-28 20:17:52 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9494    const psVector* errors,  ///< Errors.
    9595    const psVector* mask,    ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL
    96     psU32 maskVal            ///< Only mask elements with one of these bits set in maskVector
     96    psMaskType maskVal       ///< Only mask elements with one of these bits set in maskVector
    9797);
    9898
     
    160160psHistogram* psVectorHistogram(
    161161    psHistogram* out,                  ///< Histogram data
    162     const psVector* in,                ///< Vector to analyse
     162    const psVector* values,            ///< Vector to analyse
    163163    const psVector* errors,            ///< Errors
    164164    const psVector* mask,              ///< Mask dat for input vector
    165     psU32 maskVal                      ///< Mask value
     165    psMaskType maskVal                 ///< Mask value
    166166);
    167167
  • trunk/psLib/src/dataManip/psUnaryOp.c

    r4029 r4409  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2005-05-25 20:26:55 $
     32 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2005-06-28 20:17:52 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    304304}
    305305
    306 psPtr psUnaryOp(psPtr out, psPtr in, char *op)
     306psPtr psUnaryOp(psPtr out, const psPtr in, const char *op)
    307307{
    308308    #define psUnaryOp_EXIT { \
  • trunk/psLib/src/dataManip/psUnaryOp.h

    r4162 r4409  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2005-06-08 23:40:45 $
     32 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2005-06-28 20:17:52 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6161psType* psUnaryOp(
    6262    psPtr out,                         ///< Output type, either psImage or psVector.
    63     psPtr in,                          ///< Input, either psImage or psVector.
    64     char *op                           ///< Operator.
     63    const psPtr in,                    ///< Input, either psImage or psVector.
     64    const char *op                     ///< Operator.
    6565);
    6666
  • trunk/psLib/src/image/psImage.c

    r4392 r4409  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-25 02:02:05 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    137137}
    138138
    139 char* psRegionToString(psRegion region)
     139psString psRegionToString(const psRegion region)
    140140{
    141141    char tmpText[256]; // big enough to store any region as text
  • trunk/psLib/src/image/psImage.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    132132/** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
    133133 *
    134  *  @return char*:  A new string representing the psRegion as text, or NULL
     134 *  @return psString:  A new string representing the psRegion as text, or NULL
    135135 *                  is not successful.
    136136 */
    137 char* psRegionToString(
    138     psRegion region                   ///< the psRegion to convert to a string
     137psString psRegionToString(
     138    const psRegion region              ///< the psRegion to convert to a string
    139139);
    140140
  • trunk/psLib/src/math/psStats.c

    r4392 r4409  
    1414 *      stats->binsize
    1515 *
    16  *  @version $Revision: 1.135 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-06-25 02:02:05 $
     16 *  @version $Revision: 1.136 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-06-28 20:17:52 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    19871987 *****************************************************************************/
    19881988psHistogram* psVectorHistogram(psHistogram* out,
    1989                                const psVector* in,
     1989                               const psVector* values,
    19901990                               const psVector* errors,
    19911991                               const psVector* mask,
    1992                                psU32 maskVal)
     1992                               psMaskType maskVal)
    19931993{
    19941994    PS_ASSERT_PTR_NON_NULL(out, NULL);
     
    19991999    PS_ASSERT_VECTOR_TYPE(out->nums, PS_TYPE_F32, NULL);
    20002000    PS_ASSERT_INT_NONNEGATIVE(out->nums->n, NULL);
    2001     PS_ASSERT_VECTOR_NON_NULL(in, out);
     2001    PS_ASSERT_VECTOR_NON_NULL(values, out);
    20022002    if (mask != NULL) {
    2003         PS_ASSERT_VECTORS_SIZE_EQUAL(in, mask, NULL);
     2003        PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, NULL);
    20042004        PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_U8, NULL);
    20052005    }
    20062006    if (errors != NULL) {
    2007         PS_ASSERT_VECTORS_SIZE_EQUAL(in, errors, NULL);
    2008         PS_ASSERT_VECTOR_TYPE(errors, in->type.type, NULL);
     2007        PS_ASSERT_VECTORS_SIZE_EQUAL(values, errors, NULL);
     2008        PS_ASSERT_VECTOR_TYPE(errors, values->type.type, NULL);
    20092009    }
    20102010
     
    20212021
    20222022    // Convert input and errors vectors to F32 if necessary.
    2023     inF32 = p_psConvertToF32((psVector *) in);
     2023    inF32 = p_psConvertToF32((psVector *) values);
    20242024    if (inF32 == NULL) {
    2025         inF32 = (psVector *) in;
     2025        inF32 = (psVector *) values;
    20262026        mustFreeVectorIn = 0;
    20272027    }
     
    21872187                       const psVector* errors,
    21882188                       const psVector* mask,
    2189                        psU32 maskVal)
     2189                       psMaskType maskVal)
    21902190{
    21912191    PS_ASSERT_PTR_NON_NULL(stats, NULL);
  • trunk/psLib/src/math/psStats.h

    r4315 r4409  
    1414 *  @author GLG, MHPCC
    1515 *
    16  *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-06-18 02:30:49 $
     16 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-06-28 20:17:52 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9494    const psVector* errors,  ///< Errors.
    9595    const psVector* mask,    ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL
    96     psU32 maskVal            ///< Only mask elements with one of these bits set in maskVector
     96    psMaskType maskVal       ///< Only mask elements with one of these bits set in maskVector
    9797);
    9898
     
    160160psHistogram* psVectorHistogram(
    161161    psHistogram* out,                  ///< Histogram data
    162     const psVector* in,                ///< Vector to analyse
     162    const psVector* values,            ///< Vector to analyse
    163163    const psVector* errors,            ///< Errors
    164164    const psVector* mask,              ///< Mask dat for input vector
    165     psU32 maskVal                      ///< Mask value
     165    psMaskType maskVal                 ///< Mask value
    166166);
    167167
  • trunk/psLib/src/math/psUnaryOp.c

    r4029 r4409  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2005-05-25 20:26:55 $
     32 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2005-06-28 20:17:52 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    304304}
    305305
    306 psPtr psUnaryOp(psPtr out, psPtr in, char *op)
     306psPtr psUnaryOp(psPtr out, const psPtr in, const char *op)
    307307{
    308308    #define psUnaryOp_EXIT { \
  • trunk/psLib/src/math/psUnaryOp.h

    r4162 r4409  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2005-06-08 23:40:45 $
     32 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2005-06-28 20:17:52 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6161psType* psUnaryOp(
    6262    psPtr out,                         ///< Output type, either psImage or psVector.
    63     psPtr in,                          ///< Input, either psImage or psVector.
    64     char *op                           ///< Operator.
     63    const psPtr in,                    ///< Input, either psImage or psVector.
     64    const char *op                     ///< Operator.
    6565);
    6666
  • trunk/psLib/src/mathtypes/psImage.c

    r4392 r4409  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-25 02:02:05 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    137137}
    138138
    139 char* psRegionToString(psRegion region)
     139psString psRegionToString(const psRegion region)
    140140{
    141141    char tmpText[256]; // big enough to store any region as text
  • trunk/psLib/src/mathtypes/psImage.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    132132/** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
    133133 *
    134  *  @return char*:  A new string representing the psRegion as text, or NULL
     134 *  @return psString:  A new string representing the psRegion as text, or NULL
    135135 *                  is not successful.
    136136 */
    137 char* psRegionToString(
    138     psRegion region                   ///< the psRegion to convert to a string
     137psString psRegionToString(
     138    const psRegion region              ///< the psRegion to convert to a string
    139139);
    140140
  • trunk/psLib/src/mathtypes/psScalar.c

    r4330 r4409  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-06-21 03:01:37 $
     10 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-06-28 20:17:52 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psCollectionsErrors.h"
    2323
    24 psScalar* psScalarAlloc(psC64 value, psElemType dataType)
     24psScalar* psScalarAlloc(complex value, psElemType type)
    2525{
    2626    psScalar* scalar = NULL;
     
    3030
    3131    scalar->type.dimen = PS_DIMEN_SCALAR;
    32     scalar->type.type = dataType;
     32    scalar->type.type = type;
    3333
    34     switch (dataType) {
     34    switch (type) {
    3535    case PS_TYPE_S8:
    3636        scalar->data.S8 = (psS8) value;
     
    7272        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    7373                PS_ERRORTEXT_psScalar_UNSUPPORTED_TYPE,
    74                 dataType);
     74                type);
    7575        psFree(scalar);
    7676        return NULL;
  • trunk/psLib/src/mathtypes/psScalar.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6666 */
    6767psScalar* psScalarAlloc(
    68     psC64 value,                       ///< Data to be put into psScalar.
    69     psElemType dataType                ///< Type of data to be held by psScalar.
     68    complex value,                     ///< Data to be put into psScalar.
     69    psElemType type                    ///< Type of data to be held by psScalar.
    7070);
    7171
  • trunk/psLib/src/mathtypes/psVector.c

    r4392 r4409  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-06-25 02:02:05 $
     11*  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-06-28 20:17:52 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4848// FUNCTION IMPLEMENTATION - PUBLIC
    4949
    50 psVector* psVectorAlloc(psU32 nalloc, psElemType elemType)
     50psVector* psVectorAlloc(unsigned long nalloc, psElemType type)
    5151{
    5252    psVector* psVec = NULL;
    5353    psS32 elementSize = 0;
    5454
    55     elementSize = PSELEMTYPE_SIZEOF(elemType);
     55    elementSize = PSELEMTYPE_SIZEOF(type);
    5656    if (elementSize < 1) {
    5757        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    58                 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);
     58                PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, type);
    5959        return NULL;
    6060    }
     
    6666
    6767    psVec->type.dimen = PS_DIMEN_VECTOR;
    68     psVec->type.type = elemType;
     68    psVec->type.type = type;
    6969    *(int*)&psVec->nalloc = nalloc;
    7070    psVec->n = nalloc;
     
    7676}
    7777
    78 psVector* psVectorRealloc(psVector* in, psU32 nalloc)
     78psVector* psVectorRealloc(psVector* vector, unsigned long nalloc)
    7979{
    8080    psS32 elementSize = 0;
    8181    psElemType elemType;
    8282
    83     if (in == NULL) {
     83    if (vector == NULL) {
    8484        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    8585                PS_ERRORTEXT_psVector_REALLOC_NULL);
    8686        return NULL;
    87     } else if (in->nalloc != nalloc) {     // No need to realloc to same size
    88         elemType = in->type.type;
     87    } else if (vector->nalloc != nalloc) {     // No need to realloc to same size
     88        elemType = vector->type.type;
    8989        elementSize = PSELEMTYPE_SIZEOF(elemType);
    90         if (nalloc < in->n) {
    91             in->n = nalloc;
     90        if (nalloc < vector->n) {
     91            vector->n = nalloc;
    9292        }
    9393        // Realloc after decrementation to avoid accessing freed array elements
    94         in->data.U8 = psRealloc(in->data.U8, nalloc * elementSize);
    95         *(int*)&in->nalloc = nalloc;
    96     }
    97 
    98     return in;
    99 }
    100 
    101 psVector* psVectorRecycle(psVector* in, psU32 n, psElemType type)
     94        vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
     95        *(int*)&vector->nalloc = nalloc;
     96    }
     97
     98    return vector;
     99}
     100
     101psVector* psVectorRecycle(psVector* vector, unsigned long nalloc, psElemType type)
    102102{
    103103    psS32 byteSize;
    104104
    105     if (in == NULL) {
    106         return psVectorAlloc(n, type);
    107     }
    108 
    109     if (in->type.dimen !=  PS_DIMEN_VECTOR &&
    110             in->type.dimen !=  PS_DIMEN_TRANSV) {
    111         psFree(in);
     105    if (vector == NULL) {
     106        return psVectorAlloc(nalloc, type);
     107    }
     108
     109    if (vector->type.dimen !=  PS_DIMEN_VECTOR &&
     110            vector->type.dimen !=  PS_DIMEN_TRANSV) {
     111        psFree(vector);
    112112        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    113113                PS_ERRORTEXT_psVector_NOT_A_VECTOR);
     
    115115    }
    116116
    117     byteSize = n * PSELEMTYPE_SIZEOF(type);
     117    byteSize = nalloc * PSELEMTYPE_SIZEOF(type);
    118118
    119119    // need to increase data buffer?
    120     if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) {
    121         in->data.U8 = psRealloc(in->data.U8, byteSize);
    122         *(int*)&in->nalloc = n;
    123     }
    124 
    125     in->type.dimen = PS_DIMEN_VECTOR;
    126     in->type.type = type;
    127     in->n = n;
    128     return in;
     120    if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) {
     121        vector->data.U8 = psRealloc(vector->data.U8, byteSize);
     122        *(int*)&vector->nalloc = nalloc;
     123    }
     124
     125    vector->type.dimen = PS_DIMEN_VECTOR;
     126    vector->type.type = type;
     127    vector->n = nalloc;
     128    return vector;
    129129}
    130130
  • trunk/psLib/src/mathtypes/psVector.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929///< Union of psVector data types.
    3030typedef union {
    31     psU8* U8;               ///< Unsigned 8-bit integer data.
    32     psU16* U16;             ///< Unsigned 16-bit integer data.
    33     psU32* U32;             ///< Unsigned 32-bit integer data.
    34     psU64* U64;             ///< Unsigned 64-bit integer data.
    35     psS8* S8;               ///< Signed 8-bit integer data.
    36     psS16* S16;             ///< Signed 16-bit integer data.
    37     psS32* S32;             ///< Signed 32-bit integer data.
    38     psS64* S64;             ///< Signed 64-bit integer data.
    39     psF32* F32;             ///< Single-precision float data.
    40     psF64* F64;             ///< Double-precision float data.
    41     psC32* C32;             ///< Single-precision complex data.
    42     psC64* C64;             ///< Double-precision complex data.
    43 } p_psVectorData;
     31    psU8* U8;                          ///< Unsigned 8-bit integer data.
     32    psU16* U16;                        ///< Unsigned 16-bit integer data.
     33    psU32* U32;                        ///< Unsigned 32-bit integer data.
     34    psU64* U64;                        ///< Unsigned 64-bit integer data.
     35    psS8* S8;                          ///< Signed 8-bit integer data.
     36    psS16* S16;                        ///< Signed 16-bit integer data.
     37    psS32* S32;                        ///< Signed 32-bit integer data.
     38    psS64* S64;                        ///< Signed 64-bit integer data.
     39    psF32* F32;                        ///< Single-precision float data.
     40    psF64* F64;                        ///< Double-precision float data.
     41    psC32* C32;                        ///< Single-precision complex data.
     42    psC64* C64;                        ///< Double-precision complex data.
     43}
     44p_psVectorData;
    4445
    4546/** An vector to support primitive types.
     
    5051typedef struct
    5152{
    52     psType type;                ///< Type of data.
    53     int n;                      ///< Number of elements in use.
    54     const int nalloc;           ///< Total number of elements available.
    55     p_psVectorData data;        ///< Union for data types.
     53    psType type;                       ///< Type of data.
     54    int n;                             ///< Number of elements in use.
     55    const int nalloc;                  ///< Total number of elements available.
     56    p_psVectorData data;               ///< Union for data types.
    5657}
    5758psVector;
     
    7273 */
    7374psVector* psVectorAlloc(
    74     psU32 nalloc,               ///< Total number of elements to make available.
    75     psElemType dataType                ///< Type of data to be held by vector.
     75    unsigned long nalloc,              ///< Total number of elements to make available.
     76    psElemType type                    ///< Type of data to be held by vector.
    7677);
    7778
     
    8687 */
    8788psVector* psVectorRealloc(
    88     psVector* psVec,                   ///< Vector to reallocate.
    89     psU32 nalloc                       ///< Total number of elements to make available.
     89    psVector* vector,                  ///< Vector to reallocate.
     90    unsigned long nalloc               ///< Total number of elements to make available.
    9091);
    9192
     
    115116 */
    116117psVector* psVectorRecycle(
    117     psVector* psVec,
     118    psVector* vector,
    118119    ///< Vector to recycle.  If NULL, a new vector is created.  No effort
    119120    ///< taken to preserve the values.
    120121
    121     psU32 nalloc,                      ///< Total number of elements to make available.
     122    unsigned long nalloc,              ///< Total number of elements to make available.
    122123    psElemType type                    ///< the datatype of the returned vector
    123124);
  • trunk/psLib/src/sys/psString.c

    r3997 r4409  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-05-20 01:41:17 $
     14 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-28 20:17:52 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psSysUtilsErrors.h"
    2727
    28 char *psStringCopy(const char *str)
     28psString psStringCopy(const char *string)
    2929{
    3030    // Allocate memory using psAlloc function
    3131    // Copy input string to memory just allocated
    3232    // Return the copy
    33     return strcpy(psAlloc(strlen(str) + 1), str);
     33    return strcpy(psAlloc(strlen(string) + 1), string);
    3434}
    3535
    36 char *psStringNCopy(const char *str, psS32 nChar)
     36psString psStringNCopy(const char *string, int nChar)
    3737{
    3838    char *returnValue = NULL;
     
    4949    // Copy input string to memory allocated up to nChar characters
    5050    // Return the copy
    51     returnValue = strncpy(psAlloc((size_t) nChar + 1), str, (size_t) nChar);
     51    returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar);
    5252
    5353    // Ensure the last byte is NULL character
  • trunk/psLib/src/sys/psString.h

    r4162 r4409  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-06-08 23:40:45 $
     15 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-06-28 20:17:52 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3939 *  plus one and copy the input string to the newly allocated memory.
    4040 *
    41  *  @return char*      Copy of input string
     41 *  @return psString:      Copy of input string
    4242 *
    4343 */
    44 char *psStringCopy(
    45     const char *str
    46     /**< Input string of characters to copy */
     44psString psStringCopy(
     45    const char *string                 ///< Input string of characters to copy
    4746);
    4847
     
    5756 *  be set to NULL.
    5857 *
    59  *  @return  char* Copy of input string
     58 *  @return  psString:  Copy of input string
    6059 *
    6160 */
     
    6362/*@null@*/
    6463
    65 char *psStringNCopy(
    66     const char *str,
    67     /**< Input string of characters to copy */
    68 
    69     psS32 nChar
    70     /**< Number of bytes to allocate for string copy */
     64psString psStringNCopy(
     65    const char *string,                ///< Input string of characters to copy
     66    int nChar                          ///< Number of bytes to allocate for string copy
    7167);
    7268
  • trunk/psLib/src/sys/psTrace.c

    r4392 r4409  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-25 02:02:05 $
     11 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5757
    5858static void componentFree(p_psComponent* comp);
    59 static p_psComponent* componentAlloc(const char *name, psS32 level);
     59static p_psComponent* componentAlloc(const char *name, int level);
    6060
    6161/*****************************************************************************
    6262componentAlloc(): allocate memory for a new node, and initialize members.
    6363 *****************************************************************************/
    64 static p_psComponent* componentAlloc(const char *name, psS32 level)
     64static p_psComponent* componentAlloc(const char *name, int level)
    6565{
    6666    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
     
    245245*****************************************************************************/
    246246psBool psTraceSetLevel(const char *comp,   // component of interest
    247                        psS32 level)  // desired trace level
     247                       int level)  // desired trace level
    248248{
    249249    char *compName = NULL;
     
    487487 *****************************************************************************/
    488488void p_psTrace(const char *comp,        // component being traced
    489                psS32 level,       // desired trace level
    490                ...)             // arguments
     489               int level,               // desired trace level
     490               ...)                     // arguments
    491491{
    492492    char *fmt = NULL;
  • trunk/psLib/src/sys/psTrace.h

    r4330 r4409  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-21 03:01:37 $
     11 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161#ifdef DOXYGEN
    62 void psTrace(const char *facil,        ///< facilty of interest
    63              psS32 myLevel,            ///< desired trace level
    64              ...)                      ///< trace message arguments
    65 ;
     62void psTrace(
     63    const char *facil,                 ///< facilty of interest
     64    int level,                         ///< desired trace level
     65    ...                                ///< trace message arguments
     66);
     67
    6668#else
    6769/// Send a trace message
    68 void p_psTrace(const char *facil,      ///< facilty of interest
    69                psS32 myLevel,          ///< desired trace level
    70                ...)                    ///< trace message arguments
    71 ;
     70void p_psTrace(
     71    const char *facil,                 ///< facilty of interest
     72    psS32 myLevel,                     ///< desired trace level
     73    ...                                ///< trace message arguments
     74);
    7275
    7376#ifndef SWIG
     
    7881
    7982/// Set trace level
    80 psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
    81                        psS32 level)     ///< desired trace level
    82 ;
     83psBool psTraceSetLevel(
     84    const char *facil,                 ///< facilty of interest
     85    int level                          ///< desired trace level
     86);
    8387
    8488/// Get the trace level
     
    9498
    9599/// Set the destination of future trace messages.
    96 void psTraceSetDestination(FILE * fp);
     100void psTraceSetDestination(
     101    FILE * fp                          ///<
     102);
    97103
    98104/// Get the current destination for trace messages.
  • trunk/psLib/src/sysUtils/psString.c

    r3997 r4409  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-05-20 01:41:17 $
     14 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-28 20:17:52 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psSysUtilsErrors.h"
    2727
    28 char *psStringCopy(const char *str)
     28psString psStringCopy(const char *string)
    2929{
    3030    // Allocate memory using psAlloc function
    3131    // Copy input string to memory just allocated
    3232    // Return the copy
    33     return strcpy(psAlloc(strlen(str) + 1), str);
     33    return strcpy(psAlloc(strlen(string) + 1), string);
    3434}
    3535
    36 char *psStringNCopy(const char *str, psS32 nChar)
     36psString psStringNCopy(const char *string, int nChar)
    3737{
    3838    char *returnValue = NULL;
     
    4949    // Copy input string to memory allocated up to nChar characters
    5050    // Return the copy
    51     returnValue = strncpy(psAlloc((size_t) nChar + 1), str, (size_t) nChar);
     51    returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar);
    5252
    5353    // Ensure the last byte is NULL character
  • trunk/psLib/src/sysUtils/psString.h

    r4162 r4409  
    1313 *  @author Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2005-06-08 23:40:45 $
     15 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2005-06-28 20:17:52 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3939 *  plus one and copy the input string to the newly allocated memory.
    4040 *
    41  *  @return char*      Copy of input string
     41 *  @return psString:      Copy of input string
    4242 *
    4343 */
    44 char *psStringCopy(
    45     const char *str
    46     /**< Input string of characters to copy */
     44psString psStringCopy(
     45    const char *string                 ///< Input string of characters to copy
    4746);
    4847
     
    5756 *  be set to NULL.
    5857 *
    59  *  @return  char* Copy of input string
     58 *  @return  psString:  Copy of input string
    6059 *
    6160 */
     
    6362/*@null@*/
    6463
    65 char *psStringNCopy(
    66     const char *str,
    67     /**< Input string of characters to copy */
    68 
    69     psS32 nChar
    70     /**< Number of bytes to allocate for string copy */
     64psString psStringNCopy(
     65    const char *string,                ///< Input string of characters to copy
     66    int nChar                          ///< Number of bytes to allocate for string copy
    7167);
    7268
  • trunk/psLib/src/sysUtils/psTrace.c

    r4392 r4409  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-25 02:02:05 $
     11 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5757
    5858static void componentFree(p_psComponent* comp);
    59 static p_psComponent* componentAlloc(const char *name, psS32 level);
     59static p_psComponent* componentAlloc(const char *name, int level);
    6060
    6161/*****************************************************************************
    6262componentAlloc(): allocate memory for a new node, and initialize members.
    6363 *****************************************************************************/
    64 static p_psComponent* componentAlloc(const char *name, psS32 level)
     64static p_psComponent* componentAlloc(const char *name, int level)
    6565{
    6666    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
     
    245245*****************************************************************************/
    246246psBool psTraceSetLevel(const char *comp,   // component of interest
    247                        psS32 level)  // desired trace level
     247                       int level)  // desired trace level
    248248{
    249249    char *compName = NULL;
     
    487487 *****************************************************************************/
    488488void p_psTrace(const char *comp,        // component being traced
    489                psS32 level,       // desired trace level
    490                ...)             // arguments
     489               int level,               // desired trace level
     490               ...)                     // arguments
    491491{
    492492    char *fmt = NULL;
  • trunk/psLib/src/sysUtils/psTrace.h

    r4330 r4409  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-21 03:01:37 $
     11 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161#ifdef DOXYGEN
    62 void psTrace(const char *facil,        ///< facilty of interest
    63              psS32 myLevel,            ///< desired trace level
    64              ...)                      ///< trace message arguments
    65 ;
     62void psTrace(
     63    const char *facil,                 ///< facilty of interest
     64    int level,                         ///< desired trace level
     65    ...                                ///< trace message arguments
     66);
     67
    6668#else
    6769/// Send a trace message
    68 void p_psTrace(const char *facil,      ///< facilty of interest
    69                psS32 myLevel,          ///< desired trace level
    70                ...)                    ///< trace message arguments
    71 ;
     70void p_psTrace(
     71    const char *facil,                 ///< facilty of interest
     72    psS32 myLevel,                     ///< desired trace level
     73    ...                                ///< trace message arguments
     74);
    7275
    7376#ifndef SWIG
     
    7881
    7982/// Set trace level
    80 psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
    81                        psS32 level)     ///< desired trace level
    82 ;
     83psBool psTraceSetLevel(
     84    const char *facil,                 ///< facilty of interest
     85    int level                          ///< desired trace level
     86);
    8387
    8488/// Get the trace level
     
    9498
    9599/// Set the destination of future trace messages.
    96 void psTraceSetDestination(FILE * fp);
     100void psTraceSetDestination(
     101    FILE * fp                          ///<
     102);
    97103
    98104/// Get the current destination for trace messages.
  • trunk/psLib/src/types/psMetadataConfig.c

    r4401 r4409  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-06-27 20:38:12 $
     12*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-06-28 20:17:52 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10751075}
    10761076
    1077 psMetadata* psMetadataConfigParse(psMetadata* md, int *nFail, const char *fileName, bool overwrite)
     1077psMetadata* psMetadataConfigParse(psMetadata* md, unsigned int *nFail, const char *fileName, bool overwrite)
    10781078{
    10791079    FILE*               fp                   = NULL;
  • trunk/psLib/src/types/psMetadataConfig.h

    r4401 r4409  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-27 20:38:12 $
     12 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-28 20:17:52 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8181psMetadata* psMetadataConfigParse(
    8282    psMetadata* md,                    ///< Resulting metadata from read.
    83     int *nFail,                        ///< Number of failed lines.
     83    unsigned int *nFail,               ///< Number of failed lines.
    8484    const char *fileName,              ///< Name of file to read.
    8585    bool overwrite                     ///< Allow overwrite of duplicate specifications.
  • trunk/psLib/src/xml/psXML.c

    r4401 r4409  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-06-27 20:38:12 $
     12*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-06-28 20:17:52 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10751075}
    10761076
    1077 psMetadata* psMetadataConfigParse(psMetadata* md, int *nFail, const char *fileName, bool overwrite)
     1077psMetadata* psMetadataConfigParse(psMetadata* md, unsigned int *nFail, const char *fileName, bool overwrite)
    10781078{
    10791079    FILE*               fp                   = NULL;
  • trunk/psLib/src/xml/psXML.h

    r4401 r4409  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-27 20:38:12 $
     12 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-06-28 20:17:52 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8181psMetadata* psMetadataConfigParse(
    8282    psMetadata* md,                    ///< Resulting metadata from read.
    83     int *nFail,                        ///< Number of failed lines.
     83    unsigned int *nFail,               ///< Number of failed lines.
    8484    const char *fileName,              ///< Name of file to read.
    8585    bool overwrite                     ///< Allow overwrite of duplicate specifications.
  • trunk/psLib/test/astronomy/verified/tst_psTime_01.stderr

    r4059 r4409  
    169169    Following should generate error message for NULL ISO string
    170170<DATE><TIME>|<HOST>|E|psTimeFromISO (FILE:LINENO)
    171     Unallowable operation: time is NULL.
     171    Unallowable operation: input is NULL.
    172172<DATE><TIME>|<HOST>|I|testTimeFromISO
    173173    Following should generate an error for invalid ISO string
     
    186186    Following should generate error message for NULL timeval
    187187<DATE><TIME>|<HOST>|E|psTimeFromTimeval (FILE:LINENO)
    188     Unallowable operation: time is NULL.
     188    Unallowable operation: input is NULL.
    189189
    190190---> TESTPOINT PASSED (psTime{psTimeFromTimeval} | tst_psTime_01.c)
  • trunk/psLib/test/dataManip/verified/tst_psHist02.stderr

    r3127 r4409  
    66    Following should generate an error message.
    77<DATE><TIME>|<HOST>|E|psVectorHistogram (FILE:LINENO)
    8     Unallowable operation: psVector in or its data is NULL.
     8    Unallowable operation: psVector values or its data is NULL.
Note: See TracChangeset for help on using the changeset viewer.