IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2204


Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

Location:
trunk/psLib
Files:
217 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r2200 r2204  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-26 22:32:09 $
     12*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767}
    6868
    69 psPlaneTransform* psPlaneTransformAlloc(int n1, int n2)
     69psPlaneTransform* psPlaneTransformAlloc(psS32 n1, psS32 n2)
    7070{
    7171    psPlaneTransform *pt = psAlloc(sizeof(psPlaneTransform));
     
    9797}
    9898
    99 psPlaneDistort* psPlaneDistortAlloc(int n1, int n2, int n3, int n4)
     99psPlaneDistort* psPlaneDistortAlloc(psS32 n1, psS32 n2, psS32 n3, psS32 n4)
    100100{
    101101    psPlaneDistort *pt = psAlloc(sizeof(psPlaneDistort));
  • trunk/psLib/src/astro/psCoord.h

    r2200 r2204  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-26 22:32:09 $
     12*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    173173
    174174psPlaneTransform* psPlaneTransformAlloc(
    175     int n1,  ///< The order of the x term in the transform.
    176     int n2   ///< The order of the y term in the transform.
     175    psS32 n1,  ///< The order of the x term in the transform.
     176    psS32 n2   ///< The order of the y term in the transform.
    177177);
    178178
     
    193193
    194194psPlaneDistort* psPlaneDistortAlloc(
    195     int n1,  ///< The order of the w term in the transform.
    196     int n2,  ///< The order of the x term in the transform.
    197     int n3,  ///< The order of the y term in the transform.
    198     int n4   ///< The order of the z term in the transform.
     195    psS32 n1,  ///< The order of the w term in the transform.
     196    psS32 n2,  ///< The order of the x term in the transform.
     197    psS32 n3,  ///< The order of the y term in the transform.
     198    psS32 n4   ///< The order of the z term in the transform.
    199199);
    200200
  • trunk/psLib/src/astro/psTime.c

    r2196 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-26 00:37:44 $
     13 *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:30 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    144144static double lookupSer7Table(
    145145    const psTime *time,                 ///< time to lookup.
    146     int col                             ///< Column to lookup.
     146    psS32 col                             ///< Column to lookup.
    147147);
    148148
     
    150150{
    151151    char line[LINESIZE];
    152     int j = 0;
    153     int maxLines = 100;
     152    psS32 j = 0;
     153    psS32 maxLines = 100;
    154154    psF64 *ptr = NULL;
    155155    psImage *table = NULL;
     
    180180    }
    181181
    182     *(unsigned int *)&table->numRows = j;
     182    *(psU32 *)&table->numRows = j;
    183183
    184184    p_psMemSetPersistent(table,true);
     
    191191static psImage* readSer7File(const char *fileName)
    192192{
    193     bool beginRecord = false;
     193    psBool beginRecord = false;
    194194    char line[LINESIZE];
    195     int j = 0;
    196     int maxLines = 400;
     195    psS32 j = 0;
     196    psS32 maxLines = 400;
    197197    psImage *table = NULL;
    198198    FILE *fd = NULL;
     
    231231        }
    232232    }
    233     *(unsigned int *)&table->numRows = j;
     233    *(psU32 *)&table->numRows = j;
    234234
    235235    p_psMemSetPersistent(table,true);
     
    244244{
    245245    char line[LINESIZE];
    246     int i = 0;
    247     int j = 0;
    248     int maxLines = 2500;
     246    psS32 i = 0;
     247    psS32 j = 0;
     248    psS32 maxLines = 2500;
    249249    psImage *table = NULL;
    250250    FILE *fd = NULL;
     
    276276    }
    277277 
    278     *(unsigned int *)&table->numRows = j;
     278    *(psU32 *)&table->numRows = j;
    279279 
    280280    return table;
     
    284284{
    285285    char line[LINESIZE];
    286     int j = 0;
    287     int maxLines = 15000;
     286    psS32 j = 0;
     287    psS32 maxLines = 15000;
    288288    psImage *table = NULL;
    289289    FILE *fd = NULL;
     
    346346    }
    347347 
    348     *(unsigned int *)&table->numRows = j;
     348    *(psU32 *)&table->numRows = j;
    349349 
    350350    return table;
     
    354354static double lookupTaiUtcTable(const psTime *time)
    355355{
    356     int hiIdx = 0;
    357     int loIdx = 0;
    358     int numRows = 0;
     356    psS32 hiIdx = 0;
     357    psS32 loIdx = 0;
     358    psS32 numRows = 0;
    359359    double jd = 0.0;
    360360    double mjd = 0.0;
     
    422422}
    423423
    424 static double lookupSer7Table(const psTime *time, int col)
    425 {
    426     int hiIdx = 0;
    427     int loIdx = 0;
    428     int numRows = 0;
     424static double lookupSer7Table(const psTime *time, psS32 col)
     425{
     426    psS32 hiIdx = 0;
     427    psS32 loIdx = 0;
     428    psS32 numRows = 0;
    429429    double out = 0.0;
    430430    double denom = 0.0;
     
    752752}
    753753
    754 long psTimeLeapseconds(const psTime *time1, const psTime *time2)
    755 {
    756     long diff = 0;
     754psS64 psTimeLeapseconds(const psTime *time1, const psTime *time2)
     755{
     756    psS64 diff = 0;
    757757
    758758
     
    827827char* psTimeToISOTime(const psTime *time)
    828828{
    829     int ms = 0;
     829    psS32 ms = 0;
    830830    char *timeString = NULL;
    831831    char *tempString = NULL;
     
    889889struct tm* psTimeToTM(const psTime *time)
    890890{
    891     long cent = 0;
    892     long year = 0;
    893     long month = 0;
    894     long day = 0;
    895     long hour = 0;
    896     long minute = 0;
    897     long seconds = 0;
    898     long temp = 0;
     891    psS64 cent = 0;
     892    psS64 year = 0;
     893    psS64 month = 0;
     894    psS64 day = 0;
     895    psS64 hour = 0;
     896    psS64 minute = 0;
     897    psS64 seconds = 0;
     898    psS64 temp = 0;
    899899    struct tm* tmTime = NULL;
    900900
     
    975975    seconds = days * SEC_PER_DAY;
    976976    if(seconds < 0.0) {
    977         outTime->usec = (seconds - (long)seconds) * -1000000.0;  // psTime earlier than epoch
     977        outTime->usec = (seconds - (psS64)seconds) * -1000000.0;  // psTime earlier than epoch
    978978    } else {
    979         outTime->usec = (seconds - (long)seconds) * 1000000.0;   // psTime greater than epoch
     979        outTime->usec = (seconds - (psS64)seconds) * 1000000.0;   // psTime greater than epoch
    980980    }
    981981    outTime->sec = seconds;
     
    10031003    seconds = days * SEC_PER_DAY;
    10041004    if(seconds < 0.0) {
    1005         outTime->usec = (seconds - (long)seconds) * -1000000.0;  // psTime earlier than epoch
     1005        outTime->usec = (seconds - (psS64)seconds) * -1000000.0;  // psTime earlier than epoch
    10061006    } else {
    1007         outTime->usec = (seconds - (long)seconds) * 1000000.0;   // psTime greater than epoch
     1007        outTime->usec = (seconds - (psS64)seconds) * 1000000.0;   // psTime greater than epoch
    10081008    }
    10091009    outTime->sec = seconds;
     
    10201020{
    10211021    char tempString[MAX_TIME_STRING_LENGTH];
    1022     int month;
    1023     int day;
    1024     int year;
    1025     int hour;
    1026     int minute;
    1027     int second;
    1028     int millisecond;
     1022    psS32 month;
     1023    psS32 day;
     1024    psS32 year;
     1025    psS32 hour;
     1026    psS32 minute;
     1027    psS32 second;
     1028    psS32 millisecond;
    10291029    struct tm tmTime;
    10301030    psTime *outTime = NULL;
     
    11271127psTime* psTimeFromTM(const struct tm* time)
    11281128{
    1129     long year;
    1130     long month;
    1131     long day;
    1132     long hour;
    1133     long minute;
    1134     long seconds;
    1135     long temp;
     1129    psS64 year;
     1130    psS64 month;
     1131    psS64 day;
     1132    psS64 hour;
     1133    psS64 minute;
     1134    psS64 seconds;
     1135    psS64 temp;
    11361136    psTime *outTime = NULL;
    11371137
     
    11941194{
    11951195    psF64 deltaSec = 0;
    1196     long deltaUsec = 0;
     1196    psS64 deltaUsec = 0;
    11971197    psTime *outTime = NULL;
    11981198
     
    12431243{
    12441244    psS64 deltaSec = 0;
    1245     long deltaUsec = 0;
     1245    psS64 deltaUsec = 0;
    12461246    psTime *outTime = NULL;
    12471247
     
    12671267    outTime = psTimeAlloc(tai1->type);
    12681268    deltaSec = tai1->sec - tai2->sec;
    1269     deltaUsec = (long)tai1->usec - (long)tai2->usec;
     1269    deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec;
    12701270
    12711271    // Adjust time in case of microsecond underflow after subtraction
     
    12891289{
    12901290    psS64 deltaSec = 0;
    1291     long deltaUsec = 0;
     1291    psS64 deltaUsec = 0;
    12921292    psTime *outTime = NULL;
    12931293
     
    13131313    outTime = psTimeAlloc(tai1->type);
    13141314    deltaSec = tai1->sec - tai2->sec;
    1315     deltaUsec = (long)tai1->usec - (long)tai2->usec;
     1315    deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec;
    13161316
    13171317    // Adjust time in case of microsecond underflow after subtraction
  • trunk/psLib/src/astro/psTime.h

    r2179 r2204  
    5454 *  @author Ross Harman, MHPCC
    5555 *
    56  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    57  *  @date $Date: 2004-10-20 20:05:58 $
     56 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     57 *  @date $Date: 2004-10-27 00:57:30 $
    5858 *
    5959 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    181181 *  @return  long: leapseconds added between given times
    182182 */
    183 long psTimeLeapseconds(
     183psS64 psTimeLeapseconds(
    184184    const psTime* time1,                ///< First input time.
    185185    const psTime* time2                 ///< Second input time.
  • trunk/psLib/src/astronomy/psAstrometry.c

    r2137 r2204  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-14 23:45:53 $
     10 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 00:57:30 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333psImage.
    3434 *****************************************************************************/
    35 static int checkValidImageCoords(double x,
    36                                  double y,
    37                                  psImage* tmpImage)
     35static psS32 checkValidImageCoords(double x,
     36                                   double y,
     37                                   psImage* tmpImage)
    3838{
    3939    if (tmpImage == NULL) {
     
    5656cooefficients of order 2 are higher are non-zero, then it is not linear.
    5757 *****************************************************************************/
    58 static int isProjectionLinear(psPlaneTransform *transform)
    59 {
    60     int i = 0;
     58static psS32 isProjectionLinear(psPlaneTransform *transform)
     59{
     60    psS32 i = 0;
    6161    PS_CHECK_NULL_PTR_RETURN_ZERO(transform);
    6262
     
    178178{
    179179    if (obs != NULL) {
    180         psFree((void*)obs->name);
     180        psFree((psPtr)obs->name);
    181181    }
    182182}
     
    185185{
    186186    if (exp != NULL) {
    187         psFree((void*)exp->time);
    188         psFree((void*)exp->observatory);
    189         psFree((void*)exp->cameraName);
    190         psFree((void*)exp->telescopeName);
     187        psFree((psPtr)exp->time);
     188        psFree((psPtr)exp->observatory);
     189        psFree((psPtr)exp->cameraName);
     190        psFree((psPtr)exp->telescopeName);
    191191    }
    192192}
     
    195195{
    196196    if (fp != NULL) {
    197         for (int i = 0; i < fp->p_ps_xRows; i++) {
     197        for (psS32 i = 0; i < fp->p_ps_xRows; i++) {
    198198            psFree(fp->x[i]);
    199199        }
    200200
    201         for (int j = 0; j < fp->p_ps_yRows; j++) {
     201        for (psS32 j = 0; j < fp->p_ps_yRows; j++) {
    202202            psFree(fp->y[j]);
    203203        }
     
    226226{
    227227    psFixedPattern *tmp;
    228     int i;
    229     int j;
     228    psS32 i;
     229    psS32 j;
    230230
    231231    PS_CHECK_NULL_IMAGE_RETURN_NULL(x);
     
    301301    *(float *)&exp->wavelength = wavelength;
    302302
    303     exp->time = psMemIncrRefCounter((void*)time);
    304     exp->observatory = psMemIncrRefCounter((void*)observatory);
     303    exp->time = psMemIncrRefCounter((psPtr)time);
     304    exp->observatory = psMemIncrRefCounter((psPtr)observatory);
    305305
    306306    // XXX: how is these value derived?
     
    343343}
    344344
    345 psFPA* psFPAAlloc(int nChips,
     345psFPA* psFPAAlloc(psS32 nChips,
    346346                  const psExposure* exp)
    347347{
     
    350350    // create array of NULL chips of the size nChips
    351351    newFPA->chips = psArrayAlloc(nChips);
    352     void** chips = newFPA->chips->data;
    353     for (int i=0;i<nChips;i++) {
     352    psPtr* chips = newFPA->chips->data;
     353    for (psS32 i=0;i<nChips;i++) {
    354354        chips[i] = NULL;
    355355    }
     
    384384 * psChip constructor
    385385 */
    386 psChip* psChipAlloc(int nCells,
     386psChip* psChipAlloc(psS32 nCells,
    387387                    psFPA *parentFPA)
    388388{
     
    391391    // create array of NULL psCells
    392392    chip->cells = psArrayAlloc(nCells);
    393     void** cells = chip->cells->data;
    394     for (int i=0;i<nCells;i++) {
     393    psPtr* cells = chip->cells->data;
     394    for (psS32 i=0;i<nCells;i++) {
    395395        cells[i] = NULL;
    396396    }
     
    412412 * psCell constructor
    413413 */
    414 psCell* psCellAlloc(int nReadouts,
     414psCell* psCellAlloc(psS32 nReadouts,
    415415                    psChip* parentChip)
    416416{
     
    419419    // create array of NULL psReadouts
    420420    cell->readouts = psArrayAlloc(nReadouts);
    421     void** readouts = cell->readouts->data;
    422     for (int i=0;i<nReadouts;i++) {
     421    psPtr* readouts = cell->readouts->data;
     422    for (psS32 i=0;i<nReadouts;i++) {
    423423        readouts[i] = NULL;
    424424    }
     
    440440}
    441441
    442 psReadout* psReadoutAlloc(int col0,
    443                           int row0,
     442psReadout* psReadoutAlloc(psS32 col0,
     443                          psS32 row0,
    444444                          const psImage* image)
    445445{
    446446    psReadout* readout = psAlloc(sizeof(psReadout));
    447447
    448     *(unsigned int*)&readout->colBins = 1;
    449     *(unsigned int*)&readout->rowBins = 1;
    450     *(int*)&readout->col0 = col0;
    451     *(int*)&readout->row0 = row0;
     448    *(psU32*)&readout->colBins = 1;
     449    *(psU32*)&readout->rowBins = 1;
     450    *(psS32*)&readout->col0 = col0;
     451    *(psS32*)&readout->row0 = row0;
    452452
    453453    readout->image = (psImage*)image;
     
    521521    PS_CHECK_NULL_PTR_RETURN_NULL(FPA->chips);
    522522    psArray* chips = FPA->chips;
    523     int nChips = chips->n;
     523    psS32 nChips = chips->n;
    524524    psPlane chipCoord;
    525525    psCell *tmpCell = NULL;
     
    529529    // cells in that chip contain those chip coordinates.
    530530
    531     for (int i = 0; i < nChips; i++) {
     531    for (psS32 i = 0; i < nChips; i++) {
    532532        psChip* tmpChip = chips->data[i];
    533533        psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord);
     
    560560    // If so, then we return that cell.
    561561
    562     for (int i = 0; i < cells->n; i++) {
     562    for (psS32 i = 0; i < cells->n; i++) {
    563563        psCell* tmpCell = (psCell* ) cells->data[i];
    564564        psArray* readouts = tmpCell->readouts;
    565565
    566566        if (readouts != NULL) {
    567             for (int j = 0; j < readouts->n; j++) {
     567            for (psS32 j = 0; j < readouts->n; j++) {
    568568                psReadout* tmpReadout = readouts->data[j];
    569569
  • trunk/psLib/src/astronomy/psAstrometry.h

    r2058 r2204  
    88*  @author George Gusciora, MHPCC
    99*
    10 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-10-12 20:53:02 $
     10*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-10-27 00:57:30 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7272typedef struct
    7373{
    74     int nX;                            ///< Number of elements in x direction
    75     int nY;                            ///< Number of elements in y direction
     74    psS32 nX;                            ///< Number of elements in x direction
     75    psS32 nY;                            ///< Number of elements in y direction
    7676    double x0;                         ///< X Position of 0,0 corner on focal plane
    7777    double y0;                         ///< Y Position of 0,0 corner on focal plane
     
    7979    double yScale;                     ///< Scale of the grid in x direction
    8080    /// XXX: I added the following memvers to facilitate the psFreeing of the x,y data structures.
    81     int p_ps_xRows;                    ///< Number of rows in the x member
    82     int p_ps_xCols;                    ///< Number of cols in the x member
    83     int p_ps_yRows;                    ///< Number of rows in the y member
    84     int p_ps_yCols;                    ///< Number of cols in the y member
     81    psS32 p_ps_xRows;                    ///< Number of rows in the x member
     82    psS32 p_ps_xCols;                    ///< Number of cols in the x member
     83    psS32 p_ps_yRows;                    ///< Number of rows in the y member
     84    psS32 p_ps_yCols;                    ///< Number of cols in the y member
    8585    double **x;                        ///< The grid of offsets in x
    8686    double **y;                        ///< The grid of offsets in y
     
    9999typedef struct
    100100{
    101     const unsigned int colBins;        ///< Amount of binning in x-dimension
    102     const unsigned int rowBins;        ///< Amount of binning in y-dimension
    103     const int col0;                    ///< Offset from the left of chip.
    104     const int row0;                    ///< Offset from the bottom of chip.
     101    const psU32 colBins;        ///< Amount of binning in x-dimension
     102    const psU32 rowBins;        ///< Amount of binning in y-dimension
     103    const psS32 col0;                    ///< Offset from the left of chip.
     104    const psS32 row0;                    ///< Offset from the bottom of chip.
    105105
    106106    psImage* image;                    ///< Imaging area of readout
     
    304304 */
    305305psFPA* psFPAAlloc(
    306     int nChips,                        ///< number of chips in the FPA
     306    psS32 nChips,                        ///< number of chips in the FPA
    307307    const psExposure* exp              ///< the exposure information
    308308);
     
    317317 */
    318318psChip* psChipAlloc(
    319     int nCells,                        ///< number of cells in Chip
     319    psS32 nCells,                        ///< number of cells in Chip
    320320    psFPA* parentFPA                   ///< parent FPA
    321321);
     
    330330 */
    331331psCell* psCellAlloc(
    332     int nReadouts,                     ///< number of readouts in cell
     332    psS32 nReadouts,                     ///< number of readouts in cell
    333333    psChip* parentChip                 ///< parent Chip
    334334);
     
    342342 */
    343343psReadout* psReadoutAlloc(
    344     int col0,                          ///< offset from the left of the cell
    345     int row0,                          ///< offset from the bottom of the cell
     344    psS32 col0,                          ///< offset from the left of the cell
     345    psS32 row0,                          ///< offset from the bottom of the cell
    346346    const psImage* image               ///< image of the readout
    347347);
  • trunk/psLib/src/astronomy/psCoord.c

    r2200 r2204  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-26 22:32:09 $
     12*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767}
    6868
    69 psPlaneTransform* psPlaneTransformAlloc(int n1, int n2)
     69psPlaneTransform* psPlaneTransformAlloc(psS32 n1, psS32 n2)
    7070{
    7171    psPlaneTransform *pt = psAlloc(sizeof(psPlaneTransform));
     
    9797}
    9898
    99 psPlaneDistort* psPlaneDistortAlloc(int n1, int n2, int n3, int n4)
     99psPlaneDistort* psPlaneDistortAlloc(psS32 n1, psS32 n2, psS32 n3, psS32 n4)
    100100{
    101101    psPlaneDistort *pt = psAlloc(sizeof(psPlaneDistort));
  • trunk/psLib/src/astronomy/psCoord.h

    r2200 r2204  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-26 22:32:09 $
     12*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    173173
    174174psPlaneTransform* psPlaneTransformAlloc(
    175     int n1,  ///< The order of the x term in the transform.
    176     int n2   ///< The order of the y term in the transform.
     175    psS32 n1,  ///< The order of the x term in the transform.
     176    psS32 n2   ///< The order of the y term in the transform.
    177177);
    178178
     
    193193
    194194psPlaneDistort* psPlaneDistortAlloc(
    195     int n1,  ///< The order of the w term in the transform.
    196     int n2,  ///< The order of the x term in the transform.
    197     int n3,  ///< The order of the y term in the transform.
    198     int n4   ///< The order of the z term in the transform.
     195    psS32 n1,  ///< The order of the w term in the transform.
     196    psS32 n2,  ///< The order of the x term in the transform.
     197    psS32 n3,  ///< The order of the y term in the transform.
     198    psS32 n4   ///< The order of the z term in the transform.
    199199);
    200200
  • trunk/psLib/src/astronomy/psMetadata.c

    r2040 r2204  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-10-09 03:05:53 $
     14*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-10-27 00:57:30 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959/*****************************************************************************/
    6060
    61 static int metadataId = 0;
     61static psS32 metadataId = 0;
    6262
    6363/*****************************************************************************/
     
    143143
    144144    // Set metadata item unique id
    145     *(int *)(&metadataItem->id) = ++metadataId;
     145    *(psS32 *)(&metadataItem->id) = ++metadataId;
    146146
    147147    // Set metadata item type
     
    154154        break;
    155155    case PS_META_BOOL:
    156         metadataItem->data.B = (bool)va_arg(argPtr, int);
     156        metadataItem->data.B = (psBool)va_arg(argPtr, psS32);
    157157        break;
    158158    case PS_META_S32:
     
    215215}
    216216
    217 bool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, int location )
     217psBool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, psS32 location )
    218218{
    219219    char * key = NULL;
     
    337337}
    338338
    339 bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type,
    340                    const char *comment, ...)
     339psBool psMetadataAdd(psMetadata* restrict md, psS32 where, const char *name, psMetadataType type,
     340                     const char *comment, ...)
    341341{
    342342    va_list argPtr;
     
    359359}
    360360
    361 bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key)
    362 {
    363     int numChildren = 0;
     361psBool psMetadataRemove(psMetadata* restrict md, psS32 where, const char *restrict key)
     362{
     363    psS32 numChildren = 0;
    364364    psList* mdList = NULL;
    365365    psHash* mdTable = NULL;
     
    471471}
    472472
    473 psMetadataItem* psMetadataGet(psMetadata* restrict md, int where)
     473psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where)
    474474{
    475475    psList* mdList = NULL;
     
    497497}
    498498
    499 bool psMetadataSetIterator(psMetadata* restrict md, int where)
     499psBool psMetadataSetIterator(psMetadata* restrict md, psS32 where)
    500500{
    501501    psList* mdList = NULL;
     
    517517}
    518518
    519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)
     519psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, psS32 which)
    520520{
    521521    psList* mdList = NULL;
     
    553553}
    554554
    555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)
     555psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, psS32 which)
    556556{
    557557    psList* mdList = NULL;
  • trunk/psLib/src/astronomy/psMetadata.h

    r1970 r2204  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-10-06 01:06:27 $
     13*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:30 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838    PS_META_F32,                       ///< Single-precision float data.
    3939    PS_META_F64,                       ///< Double-precision float data.
    40     PS_META_STR,                       ///< String data (Stored in as void *).
    41     PS_META_VEC,                       ///< Vector data (Stored in as void *).
    42     PS_META_IMG,                       ///< Image data (Stored in as void *).
    43     PS_META_JPEG,                      ///< JPEG data (Stored in as void *).
    44     PS_META_PNG,                       ///< PNG data (Stored in as void *).
    45     PS_META_ASTROM,                    ///< Astrometric coefficients (Stored in as void *).
    46     PS_META_UNKNOWN,                   ///< Other data (Stored in as void *).
     40    PS_META_STR,                       ///< String data (Stored in as psPtr ).
     41    PS_META_VEC,                       ///< Vector data (Stored in as psPtr ).
     42    PS_META_IMG,                       ///< Image data (Stored in as psPtr ).
     43    PS_META_JPEG,                      ///< JPEG data (Stored in as psPtr ).
     44    PS_META_PNG,                       ///< PNG data (Stored in as psPtr ).
     45    PS_META_ASTROM,                    ///< Astrometric coefficients (Stored in as psPtr ).
     46    PS_META_UNKNOWN,                   ///< Other data (Stored in as psPtr ).
    4747    PS_META_NTYPE                      ///< Number of types. Must be last.
    4848} psMetadataType;
     
    5555typedef struct psMetadataItem
    5656{
    57     const int id;                      ///< Unique ID for metadata item.
     57    const psS32 id;                      ///< Unique ID for metadata item.
    5858    char *restrict name;               ///< Name of metadata item.
    5959    psMetadataType type;               ///< Type of metadata item.
    6060    union {
    61         bool B;                        ///< boolean data
     61        psBool B;                        ///< boolean data
    6262        psS32 S32;                     ///< Signed 32-bit integer data.
    6363        psF32 F32;                     ///< Single-precision float data.
    6464        psF64 F64;                     ///< Double-precision float data.
    65         psPTR V;                       ///< Pointer to other type of data.
     65        psPtr V;                       ///< Pointer to other type of data.
    6666    } data;                            ///< Union for data types.
    6767    char *comment;                     ///< Optional comment ("", not NULL).
     
    144144 *  @return bool: True for success, false for failure.
    145145 */
    146 bool psMetadataAddItem(
     146psBool psMetadataAddItem(
    147147    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    148148    psMetadataItem* restrict item,     ///< Metadata item to be added.
    149     int location                       ///< Location to be added.
     149    psS32 location                       ///< Location to be added.
    150150);
    151151
     
    156156 * @return bool: True for success, false for failure.
    157157 */
    158 bool psMetadataAdd(
    159     psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    160     int where,                         ///< Location to be added.
     158psBool psMetadataAdd(
     159    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
     160    psS32 where,                         ///< Location to be added.
    161161    const char *name,                  ///< Name of metadata item.
    162162    psMetadataType type,               ///< Type of metadata item.
     
    175175 * @return bool: True for success, false for failure.
    176176 */
    177 bool psMetadataRemove(
    178     psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    179     int where,                         ///< Location to be removed.
     177psBool psMetadataRemove(
     178    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
     179    psS32 where,                         ///< Location to be removed.
    180180    const char *restrict key           ///< Name of metadata key.
    181181);
     
    203203psMetadataItem* psMetadataGet(
    204204    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    205     int where                          ///< Location to be retrieved.
     205    psS32 where                          ///< Location to be retrieved.
    206206);
    207207
     
    213213 * @return void: void.
    214214 */
    215 bool psMetadataSetIterator(
     215psBool psMetadataSetIterator(
    216216    psMetadata* restrict md,           ///< Metadata collection to iterate.
    217     int where                          ///< Location of iterator.
     217    psS32 where                          ///< Location of iterator.
    218218);
    219219
     
    227227    psMetadata* restrict md,           ///< Metadata collection to iterate.
    228228    const char *restrict match,        ///< Beginning of key name.
    229     int which                          ///< Iterator to be used.
     229    psS32 which                          ///< Iterator to be used.
    230230);
    231231
     
    239239    psMetadata* restrict md,           ///< Metadata collection to iterate.
    240240    const char *restrict match,        ///< Beginning of key name.
    241     int which                          ///< Iterator to be used.
     241    psS32 which                          ///< Iterator to be used.
    242242);
    243243
  • trunk/psLib/src/astronomy/psMetadataIO.c

    r2014 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-08 00:43:12 $
     11*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104/** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string
    105105 *  must be null terminated. */
    106 bool ignoreLine(char *inString)
     106psBool ignoreLine(char *inString)
    107107{
    108108    while(*inString!='\0' && *inString!='#') {
     
    119119/** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null
    120120 *  terminated copy of the original input string. */
    121 char *cleanString(char *inString, int sLen)
     121char *cleanString(char *inString, psS32 sLen)
    122122{
    123123    char *ptrB = NULL;
     
    149149
    150150/** Count repeat occurances of a single character within a line. The input string must be null terminated. */
    151 int repeatedChars(char *inString, char ch)
    152 {
    153     int count = 0;
     151psS32 repeatedChars(char *inString, char ch)
     152{
     153    psS32 count = 0;
    154154
    155155
     
    166166/** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location
    167167 * the beginning of the string. Tokens are newly allocated null terminated strings. */
    168 char* getToken(char **inString, char *delimiter, int *status)
     168char* getToken(char **inString, char *delimiter, psS32 *status)
    169169{
    170170    char *cleanToken = NULL;
    171     int sLen = 0;
     171    psS32 sLen = 0;
    172172
    173173
     
    195195/** Returns single parsed value as a double precision number. The input string must be cleaned and null
    196196 * terminated. */
    197 double parseValue(char *inString, int *status)
     197double parseValue(char *inString, psS32 *status)
    198198{
    199199    char *end = NULL;
     
    212212
    213213/** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */
    214 bool parseBool(char *inString, int *status)
    215 {
    216     bool value = false;
     214psBool parseBool(char *inString, psS32 *status)
     215{
     216    psBool value = false;
    217217
    218218
     
    229229
    230230/** Returns parsed vector filled with with data. The input string must be null terminated. */
    231 psVector* parseVector(char *inString, psElemType elemType, int *status)
     231psVector* parseVector(char *inString, psElemType elemType, psS32 *status)
    232232{
    233233    char *end = NULL;
    234234    char *saveValue = NULL;
    235     int i = 0;
    236     int numValues = 0;
     235    psS32 i = 0;
     236    psS32 numValues = 0;
    237237    double value = 0.0;
    238238    psVector *vec = NULL;
     
    341341
    342342
    343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, int extNum, char *fileName)
    344 {
    345     bool tempBool;
    346     bool success;
     343psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName)
     344{
     345    psBool tempBool;
     346    psBool success;
    347347    char keyType;
    348348    char keyName[FITS_LINE_SIZE];
     
    350350    char keyComment[FITS_LINE_SIZE];
    351351    char fitsErr[MAX_STRING_LENGTH];
    352     int i;
    353     int hduType = 0;
    354     int status = 0;
    355     int numKeys = 0;
    356     int keyNum = 0;
     352    psS32 i;
     353    psS32 hduType = 0;
     354    psS32 status = 0;
     355    psS32 numKeys = 0;
     356    psS32 keyNum = 0;
    357357    psMetadataType metadataItemType;
    358358    fitsfile *fd = NULL;
     
    449449
    450450
    451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)
    452 {
    453     bool tempBool;
     451psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite)
     452{
     453    psBool tempBool;
    454454    char *line = NULL;
    455455    char *strName = NULL;
     
    458458    char *strComment = NULL;
    459459    char *linePtr = NULL;
    460     int status = 0;
    461     int lineCount = 0;
    462     int failedLines = 0;
     460    psS32 status = 0;
     461    psS32 lineCount = 0;
     462    psS32 failedLines = 0;
    463463    psF64 tempDbl = 0.0;
    464464    psS32 tempInt = 0.0;
  • trunk/psLib/src/astronomy/psMetadataIO.h

    r1973 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-06 01:17:39 $
     11*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    psMetadata* output,                ///< Resulting metadata from read.
    5151    char *extName,                     ///< File name extension string.
    52     int extNum,                        ///< File name extension number. Starts at 1.
     52    psS32 extNum,                        ///< File name extension number. Starts at 1.
    5353    char *fileName                     ///< Name of file to read.
    5454);
     
    5858 *  Loads pre-defined settings by parsing a configuration file into a psMetadata structure.
    5959 *
    60  *  @return int : Number of lines that failed to be read.
     60 *  @return psS32 : Number of lines that failed to be read.
    6161 */
    62 int psMetadataParseConfig(
     62psS32 psMetadataParseConfig(
    6363    psMetadata** md,                   ///< Resulting metadata from read.
    6464    char *fileName,                    ///< Name of file to read.
    65     bool overwrite                     ///< Allow overwrite of duplicate specifications.
     65    psBool overwrite                     ///< Allow overwrite of duplicate specifications.
    6666);
    6767
  • trunk/psLib/src/astronomy/psPhotometry.h

    r1441 r2204  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-09 23:40:54 $
     12*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343typedef struct
    4444{
    45     const int ID;               ///< ID number for this photometric system
     45    const psS32 ID;               ///< ID number for this photometric system
    4646    const char *name;           ///< Name of photometric system
    4747    const char *camera;         ///< Camera for photometric system
  • trunk/psLib/src/astronomy/psTime.c

    r2196 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-26 00:37:44 $
     13 *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:30 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    144144static double lookupSer7Table(
    145145    const psTime *time,                 ///< time to lookup.
    146     int col                             ///< Column to lookup.
     146    psS32 col                             ///< Column to lookup.
    147147);
    148148
     
    150150{
    151151    char line[LINESIZE];
    152     int j = 0;
    153     int maxLines = 100;
     152    psS32 j = 0;
     153    psS32 maxLines = 100;
    154154    psF64 *ptr = NULL;
    155155    psImage *table = NULL;
     
    180180    }
    181181
    182     *(unsigned int *)&table->numRows = j;
     182    *(psU32 *)&table->numRows = j;
    183183
    184184    p_psMemSetPersistent(table,true);
     
    191191static psImage* readSer7File(const char *fileName)
    192192{
    193     bool beginRecord = false;
     193    psBool beginRecord = false;
    194194    char line[LINESIZE];
    195     int j = 0;
    196     int maxLines = 400;
     195    psS32 j = 0;
     196    psS32 maxLines = 400;
    197197    psImage *table = NULL;
    198198    FILE *fd = NULL;
     
    231231        }
    232232    }
    233     *(unsigned int *)&table->numRows = j;
     233    *(psU32 *)&table->numRows = j;
    234234
    235235    p_psMemSetPersistent(table,true);
     
    244244{
    245245    char line[LINESIZE];
    246     int i = 0;
    247     int j = 0;
    248     int maxLines = 2500;
     246    psS32 i = 0;
     247    psS32 j = 0;
     248    psS32 maxLines = 2500;
    249249    psImage *table = NULL;
    250250    FILE *fd = NULL;
     
    276276    }
    277277 
    278     *(unsigned int *)&table->numRows = j;
     278    *(psU32 *)&table->numRows = j;
    279279 
    280280    return table;
     
    284284{
    285285    char line[LINESIZE];
    286     int j = 0;
    287     int maxLines = 15000;
     286    psS32 j = 0;
     287    psS32 maxLines = 15000;
    288288    psImage *table = NULL;
    289289    FILE *fd = NULL;
     
    346346    }
    347347 
    348     *(unsigned int *)&table->numRows = j;
     348    *(psU32 *)&table->numRows = j;
    349349 
    350350    return table;
     
    354354static double lookupTaiUtcTable(const psTime *time)
    355355{
    356     int hiIdx = 0;
    357     int loIdx = 0;
    358     int numRows = 0;
     356    psS32 hiIdx = 0;
     357    psS32 loIdx = 0;
     358    psS32 numRows = 0;
    359359    double jd = 0.0;
    360360    double mjd = 0.0;
     
    422422}
    423423
    424 static double lookupSer7Table(const psTime *time, int col)
    425 {
    426     int hiIdx = 0;
    427     int loIdx = 0;
    428     int numRows = 0;
     424static double lookupSer7Table(const psTime *time, psS32 col)
     425{
     426    psS32 hiIdx = 0;
     427    psS32 loIdx = 0;
     428    psS32 numRows = 0;
    429429    double out = 0.0;
    430430    double denom = 0.0;
     
    752752}
    753753
    754 long psTimeLeapseconds(const psTime *time1, const psTime *time2)
    755 {
    756     long diff = 0;
     754psS64 psTimeLeapseconds(const psTime *time1, const psTime *time2)
     755{
     756    psS64 diff = 0;
    757757
    758758
     
    827827char* psTimeToISOTime(const psTime *time)
    828828{
    829     int ms = 0;
     829    psS32 ms = 0;
    830830    char *timeString = NULL;
    831831    char *tempString = NULL;
     
    889889struct tm* psTimeToTM(const psTime *time)
    890890{
    891     long cent = 0;
    892     long year = 0;
    893     long month = 0;
    894     long day = 0;
    895     long hour = 0;
    896     long minute = 0;
    897     long seconds = 0;
    898     long temp = 0;
     891    psS64 cent = 0;
     892    psS64 year = 0;
     893    psS64 month = 0;
     894    psS64 day = 0;
     895    psS64 hour = 0;
     896    psS64 minute = 0;
     897    psS64 seconds = 0;
     898    psS64 temp = 0;
    899899    struct tm* tmTime = NULL;
    900900
     
    975975    seconds = days * SEC_PER_DAY;
    976976    if(seconds < 0.0) {
    977         outTime->usec = (seconds - (long)seconds) * -1000000.0;  // psTime earlier than epoch
     977        outTime->usec = (seconds - (psS64)seconds) * -1000000.0;  // psTime earlier than epoch
    978978    } else {
    979         outTime->usec = (seconds - (long)seconds) * 1000000.0;   // psTime greater than epoch
     979        outTime->usec = (seconds - (psS64)seconds) * 1000000.0;   // psTime greater than epoch
    980980    }
    981981    outTime->sec = seconds;
     
    10031003    seconds = days * SEC_PER_DAY;
    10041004    if(seconds < 0.0) {
    1005         outTime->usec = (seconds - (long)seconds) * -1000000.0;  // psTime earlier than epoch
     1005        outTime->usec = (seconds - (psS64)seconds) * -1000000.0;  // psTime earlier than epoch
    10061006    } else {
    1007         outTime->usec = (seconds - (long)seconds) * 1000000.0;   // psTime greater than epoch
     1007        outTime->usec = (seconds - (psS64)seconds) * 1000000.0;   // psTime greater than epoch
    10081008    }
    10091009    outTime->sec = seconds;
     
    10201020{
    10211021    char tempString[MAX_TIME_STRING_LENGTH];
    1022     int month;
    1023     int day;
    1024     int year;
    1025     int hour;
    1026     int minute;
    1027     int second;
    1028     int millisecond;
     1022    psS32 month;
     1023    psS32 day;
     1024    psS32 year;
     1025    psS32 hour;
     1026    psS32 minute;
     1027    psS32 second;
     1028    psS32 millisecond;
    10291029    struct tm tmTime;
    10301030    psTime *outTime = NULL;
     
    11271127psTime* psTimeFromTM(const struct tm* time)
    11281128{
    1129     long year;
    1130     long month;
    1131     long day;
    1132     long hour;
    1133     long minute;
    1134     long seconds;
    1135     long temp;
     1129    psS64 year;
     1130    psS64 month;
     1131    psS64 day;
     1132    psS64 hour;
     1133    psS64 minute;
     1134    psS64 seconds;
     1135    psS64 temp;
    11361136    psTime *outTime = NULL;
    11371137
     
    11941194{
    11951195    psF64 deltaSec = 0;
    1196     long deltaUsec = 0;
     1196    psS64 deltaUsec = 0;
    11971197    psTime *outTime = NULL;
    11981198
     
    12431243{
    12441244    psS64 deltaSec = 0;
    1245     long deltaUsec = 0;
     1245    psS64 deltaUsec = 0;
    12461246    psTime *outTime = NULL;
    12471247
     
    12671267    outTime = psTimeAlloc(tai1->type);
    12681268    deltaSec = tai1->sec - tai2->sec;
    1269     deltaUsec = (long)tai1->usec - (long)tai2->usec;
     1269    deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec;
    12701270
    12711271    // Adjust time in case of microsecond underflow after subtraction
     
    12891289{
    12901290    psS64 deltaSec = 0;
    1291     long deltaUsec = 0;
     1291    psS64 deltaUsec = 0;
    12921292    psTime *outTime = NULL;
    12931293
     
    13131313    outTime = psTimeAlloc(tai1->type);
    13141314    deltaSec = tai1->sec - tai2->sec;
    1315     deltaUsec = (long)tai1->usec - (long)tai2->usec;
     1315    deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec;
    13161316
    13171317    // Adjust time in case of microsecond underflow after subtraction
  • trunk/psLib/src/astronomy/psTime.h

    r2179 r2204  
    5454 *  @author Ross Harman, MHPCC
    5555 *
    56  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    57  *  @date $Date: 2004-10-20 20:05:58 $
     56 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     57 *  @date $Date: 2004-10-27 00:57:30 $
    5858 *
    5959 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    181181 *  @return  long: leapseconds added between given times
    182182 */
    183 long psTimeLeapseconds(
     183psS64 psTimeLeapseconds(
    184184    const psTime* time1,                ///< First input time.
    185185    const psTime* time2                 ///< Second input time.
  • trunk/psLib/src/collections/psArray.c

    r1920 r2204  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-28 23:26:48 $
     11 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242
    4343/*****************************************************************************/
    44 psArray* psArrayAlloc(unsigned int nalloc)
     44psArray* psArrayAlloc(psU32 nalloc)
    4545{
    4646    psArray* psArr = NULL;
     
    5454
    5555    // Create vector data array
    56     psArr->data = psAlloc(nalloc * sizeof(psPTR));
     56    psArr->data = psAlloc(nalloc * sizeof(psPtr));
    5757
    5858    return psArr;
    5959}
    6060
    61 psArray* psArrayRealloc(psArray* restrict in, unsigned int nalloc)
     61psArray* psArrayRealloc(psArray* restrict in, psU32 nalloc)
    6262{
    6363    if (in == NULL) {
     
    6565    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
    6666        if (nalloc < in->n) {
    67             for (int i = nalloc; i < in->n; i++) {      // For reduction in vector size
     67            for (psS32 i = nalloc; i < in->n; i++) {      // For reduction in vector size
    6868                psFree(in->data[i]);
    6969            }
     
    7171        }
    7272        // Realloc after decrementation to avoid accessing freed array elements
    73         in->data = psRealloc(in->data, nalloc * sizeof(psPTR));
     73        in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
    7474        in->nalloc = nalloc;
    7575    }
     
    8989}
    9090
    91 bool psArrayRemove(psArray* psArr,
    92                    psPTR data)
     91psBool psArrayRemove(psArray* psArr,
     92                     psPtr data)
    9393{
    94     bool success = false;
     94    psBool success = false;
    9595
    9696    if (psArr == NULL) {
     
    9898    }
    9999
    100     int n = psArr->n;
    101     psPTR* psArrData = psArr->data;
    102     for (int i = n-1; i<0; i--) {
     100    psS32 n = psArr->n;
     101    psPtr* psArrData = psArr->data;
     102    for (psS32 i = n-1; i<0; i--) {
    103103        if (psArrData[i] == data) {
    104             memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPTR));
     104            memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPtr));
    105105            n--;
    106106            success = true;
     
    119119    }
    120120
    121     for (int i = 0; i < psArr->n; i++) {
     121    for (psS32 i = 0; i < psArr->n; i++) {
    122122        psFree(psArr->data[i]);
    123123        psArr->data[i] = NULL;
     
    131131    }
    132132
    133     qsort(in->data, in->n, sizeof(psPTR), (int (*)(const void *, const void *))compare);
     133    qsort(in->data, in->n, sizeof(psPtr), (int (*)(const void* , const void*))compare);
    134134
    135135    return in;
  • trunk/psLib/src/collections/psArray.h

    r1920 r2204  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-28 23:26:48 $
     14 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#ifndef PS_ARRAY_H
    2121#define PS_ARRAY_H
    22 
    23 #include<stdbool.h>
    2422
    2523#include "psType.h"
     
    3634typedef struct
    3735{
    38     unsigned int nalloc;        ///< Total number of elements available.
    39     unsigned int n;             ///< Number of elements in use.
    40     psPTR* data;                ///< An Array of pointer elements
     36    psU32 nalloc;        ///< Total number of elements available.
     37    psU32 n;             ///< Number of elements in use.
     38    psPtr* data;                ///< An Array of pointer elements
    4139}
    4240psArray;
     
    5755 */
    5856psArray* psArrayAlloc(
    59     unsigned int nalloc                ///< Total number of elements to make available.
     57    psU32 nalloc                ///< Total number of elements to make available.
    6058);
    6159
     
    7068psArray* psArrayRealloc(
    7169    psArray* restrict psArr,           ///< array to reallocate.
    72     unsigned int nalloc                ///< Total number of elements to make available.
     70    psU32 nalloc                ///< Total number of elements to make available.
    7371);
    7472
     
    8179 *
    8280 */
    83 bool psArrayRemove(
     81psBool psArrayRemove(
    8482    psArray* psArr,                    ///< array to operate on
    85     psPTR data                         ///< the data pointer to remove from psArray
     83    psPtr data                         ///< the data pointer to remove from psArray
    8684);
    8785
  • trunk/psLib/src/collections/psBitSet.c

    r1842 r2204  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-21 23:17:52 $
     13 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121#include <ctype.h>
    2222#include <math.h>
    23 #include <stdbool.h>
    2423
    2524#include "psBitSet.h"
     
    4847 *  @return  char*: Pointer to byte in which bit is contained.
    4948 */
    50 static char mask(int bit)
     49static char mask(psS32 bit)
    5150{
    5251    char mask = (char)0x01;
     
    6766}
    6867
    69 psBitSet* psBitSetAlloc(int n)
    70 {
    71     int numBytes = 0;
     68psBitSet* psBitSetAlloc(psS32 n)
     69{
     70    psS32 numBytes = 0;
    7271    psBitSet* newObj = NULL;
    7372
     
    9594
    9695psBitSet* psBitSetSet(psBitSet* inBitSet,
    97                       int bit)
     96                      psS32 bit)
    9897{
    9998    char *byte = NULL;
     
    120119
    121120psBitSet* psBitSetClear(psBitSet* inBitSet,
    122                         int bit)
     121                        psS32 bit)
    123122{
    124123    char *byte = NULL;
     
    144143}
    145144
    146 bool psBitSetTest(const psBitSet* inBitSet,
    147                   int bit)
     145psBool psBitSetTest(const psBitSet* inBitSet,
     146                    psS32 bit)
    148147{
    149148    char *byte = NULL;
     
    173172                     const psBitSet* restrict inBitSet2)
    174173{
    175     int i = 0;
    176     int n = 0;
     174    psS32 i = 0;
     175    psS32 n = 0;
    177176    char* outBits = NULL;
    178177    char* inBits1 = NULL;
    179178    char* inBits2 = NULL;
    180     int op = UNKNOWN_OP;
     179    psS32 op = UNKNOWN_OP;
    181180
    182181    if (inBitSet1 == NULL) {
     
    198197
    199198    // make operator all caps
    200     int tempStrLen = strlen(operator);
     199    psS32 tempStrLen = strlen(operator);
    201200    char* tempStr = psAlloc(tempStrLen+1);
    202201
    203     for (int lcv=0;lcv<tempStrLen;lcv++) {
     202    for (psS32 lcv=0;lcv<tempStrLen;lcv++) {
    204203        tempStr[lcv] = (char)toupper(operator[lcv]);
    205204    }
     
    308307char *psBitSetToString(const psBitSet* restrict inBitSet)
    309308{
    310     int i = 0;
    311     int numBits = inBitSet->n * 8;
     309    psS32 i = 0;
     310    psS32 numBits = inBitSet->n * 8;
    312311    char *outString = psAlloc((size_t) numBits + 1);
    313312
  • trunk/psLib/src/collections/psBitSet.h

    r1807 r2204  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-14 20:01:52 $
     14 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#ifndef PSBITSET_H
    2121#define PSBITSET_H
     22
     23#include "psType.h"
    2224
    2325/// @addtogroup BitSet
     
    3537typedef struct
    3638{
    37     int n;                             ///< Number of bytes in the array
     39    psS32 n;                             ///< Number of bytes in the array
    3840    char *bits;                        ///< Aray of bytes holding bits
    3941}
     
    5456/*@null@*/
    5557psBitSet* psBitSetAlloc(
    56     int n                              ///< Number of bits in psBitSet array
     58    psS32 n                              ///< Number of bits in psBitSet array
    5759);
    5860
     
    6870    /* @returned@ */
    6971    psBitSet* restrict inMask,         ///< Pointer to psBitSet to be set.
    70     int bit                            ///< Bit to be set.
     72    psS32 bit                            ///< Bit to be set.
    7173);
    7274
     
    8284    /* @returned@ */
    8385    psBitSet* restrict inMask,         ///< Pointer to psBitSet to be cleared.
    84     int bit                            ///< Bit to be cleared.
     86    psS32 bit                            ///< Bit to be cleared.
    8587);
    8688
     
    9597 */
    9698
    97 bool psBitSetTest(
     99psBool psBitSetTest(
    98100    const psBitSet* restrict inMask,   ///< Pointer psBitSet to be tested.
    99     int bit                            ///< Bit to be tested.
     101    psS32 bit                            ///< Bit to be tested.
    100102);
    101103
  • trunk/psLib/src/collections/psCompare.c

    r1407 r2204  
    77 *  @author Robert Daniel DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-08-07 00:06:06 $
     9 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1313 */
    1414
    15 #include "psType.h"
    1615#include "psCompare.h"
    1716
  • trunk/psLib/src/collections/psCompare.h

    r1473 r2204  
     1/** @file psCompare.h
     2 *  @brief Comparison functions for sorting routines
     3 *
     4 *  @author Robert Daniel DeSonia, MHPCC
     5 *
     6 *  @ingroup Compare
     7 *
     8 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:31 $
     10 *
     11 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     12 */
     13
    114#if !defined(PS_COMPARE_H)
    215#define PS_COMPARE_H
    316
    4 /** @file psCompare.h
    5  *  @brief Comparison functions for sorting routines
    6  *
    7  *  @author Robert Daniel DeSonia, MHPCC
    8  *
    9  *  @ingroup Compare
    10  *
    11  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-11 19:58:11 $
    13  *
    14  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    15  */
     17#include "psType.h"
    1618
    1719/** @addtogroup Compare
  • trunk/psLib/src/collections/psHash.c

    r1842 r2204  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-09-21 23:17:53 $
     13*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:31 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#include <stdio.h>
    2020#include <string.h>
    21 #include <stdbool.h>
    2221#include "psHash.h"
    2322#include "psMemory.h"
     
    2928#include "psCollectionsErrors.h"
    3029
    31 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);
     30static psHashBucket* hashBucketAlloc(const char *key, psPtr data, psHashBucket* next);
    3231static void hashBucketFree(psHashBucket* bucket);
    33 static void *doHashWork(psHash* table, const char *key, void *data, bool remove
     32static psPtr doHashWork(psHash* table, const char *key, psPtr data, psBool remove
    3433                           );
    3534static void hashFree(psHash* table);
     
    4544psList* psHashKeyList(psHash* table)
    4645{
    47     int i = 0;                  // Loop index variable
     46    psS32 i = 0;                  // Loop index variable
    4847    psList* myLinkList = NULL;  // The output data structure
    4948    psHashBucket* ptr = NULL;   // Used to step thru linked list.
     
    8584 *****************************************************************************/
    8685static psHashBucket* hashBucketAlloc(const char *key,
    87                                      void *data,
     86                                     psPtr data,
    8887                                     psHashBucket* next)
    8988{
     
    135134    The new hash table.
    136135 *****************************************************************************/
    137 psHash* psHashAlloc(int nbucket)        // initial number of buckets
    138 {
    139     int i = 0;                  // loop index variable
     136psHash* psHashAlloc(psS32 nbucket)        // initial number of buckets
     137{
     138    psS32 i = 0;                  // loop index variable
    140139
    141140    // Create the new hash table.
     
    172171static void hashFree(psHash* table)
    173172{
    174     int i = 0;                  // Loop index variable.
     173    psS32 i = 0;                  // Loop index variable.
    175174
    176175    if (table == NULL) {
     
    212211there is little common code between those functions.
    213212  *****************************************************************************/
    214 static void *doHashWork(psHash* table,
     213static psPtr doHashWork(psHash* table,
    215214                        const char *key,
    216                         void *data, bool remove
     215                        psPtr data, psBool remove
    217216                           )
    218217{
    219     long int hash = 1;          // This will contain an integer value
     218    psS64 hash = 1;          // This will contain an integer value
    220219
    221220    // "hashed" from the key.
     
    236235    }
    237236    // NOTE: This is the originally supplied hash function.
    238     // for (int i = 0, len = strlen(key); i < len; i++) {
     237    // for (psS32 i = 0, len = strlen(key); i < len; i++) {
    239238    // hash = (hash << 1) ^ key[i];
    240239    // }
     
    273272                    // of removing an item from a single-linked list.
    274273
    275                     void *data = ptr->data;
     274                    psPtr data = ptr->data;
    276275
    277276                    optr->next = ptr->next;
     
    344343    boolean value defining success or failure
    345344 *****************************************************************************/
    346 bool psHashAdd(psHash* table,
    347                const char *key,
    348                void *data)
     345psBool psHashAdd(psHash* table,
     346                 const char *key,
     347                 psPtr data)
    349348{
    350349    if (table == NULL) {
     
    380379    The data associated with that key.
    381380 *****************************************************************************/
    382 void *psHashLookup(psHash* table,      // table to lookup key in
     381psPtr psHashLookup(psHash* table,      // table to lookup key in
    383382                   const char *key)     // key to lookup
    384383{
     
    409408    boolean value defining success or failure
    410409 *****************************************************************************/
    411 bool psHashRemove(psHash* table,
    412                   const char *key)
    413 {
    414     void *data = NULL;
    415     bool retVal = false;
     410psBool psHashRemove(psHash* table,
     411                    const char *key)
     412{
     413    psPtr data = NULL;
     414    psBool retVal = false;
    416415
    417416    if (table == NULL) {
  • trunk/psLib/src/collections/psHash.h

    r1441 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *   
    13  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 23:40:55 $
     13 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222 *  \{
    2323 */
    24 #include<stdbool.h>
    2524
    2625#include "psList.h"
     
    3029{
    3130    char *key;                  ///< key for this item of data
    32     void *data;                 ///< the data itself
     31    psPtr data;                 ///< the data itself
    3332    struct psHashBucket* next;  ///< list of other possible keys
    3433}
     
    4039typedef struct psHash
    4140{
    42     int nbucket;                ///< Number of buckets in hash table.
     41    psS32 nbucket;                ///< Number of buckets in hash table.
    4342    psHashBucket* *buckets;     ///< The bucket data.
    4443}
     
    4645
    4746/// Allocate hash buckets in table.
    48 psHash* psHashAlloc(int nbucket ///< The number of buckets to allocate.
     47psHash* psHashAlloc(psS32 nbucket ///< The number of buckets to allocate.
    4948                   );
    5049
    5150/// Insert entry into table.
    52 bool psHashAdd(psHash* table,  ///< table to insert in
    53                const char *key, ///< key to use
    54                void *data       ///< data to insert
    55               );
     51psBool psHashAdd(psHash* table,  ///< table to insert in
     52                 const char *key, ///< key to use
     53                 psPtr data       ///< data to insert
     54                );
    5655
    5756/// Lookup key in table.
    58 void *psHashLookup(psHash* table,      ///< table to lookup key in
     57psPtr psHashLookup(psHash* table,      ///< table to lookup key in
    5958                   const char *key      ///< key to lookup
    6059                  );
    6160
    6261/// Remove key from table.
    63 bool psHashRemove(psHash* table,       ///< table to lookup key in
    64                   const char *key       ///< key to lookup
    65                  );
     62psBool psHashRemove(psHash* table,       ///< table to lookup key in
     63                    const char *key       ///< key to lookup
     64                   );
    6665
    6766/// List all keys in table.
  • trunk/psLib/src/collections/psList.c

    r1807 r2204  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-14 20:01:52 $
     8 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:31 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1313
    1414#include <stdlib.h>
    15 #include <stdbool.h>
    1615#include <stdio.h>
    1716#include <pthread.h>                       // we need a mutex to make this stuff thread safe.
     
    2625#include "psCollectionsErrors.h"
    2726
    28 #define ITER_INIT_HEAD ((void *)1)         // next iteration should return head
    29 #define ITER_INIT_TAIL ((void *)2)         // next iteration should return tail
     27#define ITER_INIT_HEAD ((psPtr )1)         // next iteration should return head
     28#define ITER_INIT_TAIL ((psPtr )2)         // next iteration should return tail
    3029
    3130// private functions.
    3231static psListElem* listGetIterator(psList* list);
    33 static int listGetIteratorIndex(psList* list);
    34 static void listSetIterator(psList* list, int where, bool lockList);
     32static psS32 listGetIteratorIndex(psList* list);
     33static void listSetIterator(psList* list, psS32 where, psBool lockList);
    3534static void listFree(psList* list);
    3635
    37 psList* psListAlloc(void *data)
     36psList* psListAlloc(psPtr data)
    3837{
    3938    psList* list = psAlloc(sizeof(psList));
     
    8281}
    8382
    84 bool psListAdd(psList* list, int location, void *data)
     83psBool psListAdd(psList* list, psS32 location, psPtr data)
    8584{
    8685    psListElem* position;
    8786    psListElem* elem;
    88     int cursorIndex = 0;
     87    psS32 cursorIndex = 0;
    8988
    9089    if (list == NULL) {
     
    168167 * Remove an element from a list
    169168 */
    170 bool psListRemove(psList* list, int location, void *data)
     169psBool psListRemove(psList* list, psS32 location, psPtr data)
    171170{
    172171    psListElem* elem = NULL;    // element to remove
    173     int cursorIndex = 0;
     172    psS32 cursorIndex = 0;
    174173
    175174    if (list == NULL) {
     
    184183        // search list for the data item.
    185184
    186         int i = 0;              // index
     185        psS32 i = 0;              // index
    187186
    188187        for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) {
     
    247246}
    248247
    249 void psListSetIterator(psList* list, int where)
     248void psListSetIterator(psList* list, psS32 where)
    250249{
    251250    listSetIterator(list, where, true);
    252251}
    253252
    254 static void listSetIterator(psList* list, int where, bool lockList)
     253static void listSetIterator(psList* list, psS32 where, psBool lockList)
    255254{
    256255    psListElem* cursor;
    257     int position;
     256    psS32 position;
    258257
    259258    if (list == NULL) {
     
    272271    }
    273272
    274     if (where >= (int)list->size) {
     273    if (where >= (psS32)list->size) {
    275274        list->iter = NULL;
    276275        if (lockList) {
     
    323322            }
    324323
    325             int position = listGetIteratorIndex(list);
     324            psS32 position = listGetIteratorIndex(list);
    326325
    327326            if (where < position) {
    328                 int diff = position - where;
    329 
    330                 for (int count = 0; count < diff; count++) {
     327                psS32 diff = position - where;
     328
     329                for (psS32 count = 0; count < diff; count++) {
    331330                    listSetIterator(list, PS_LIST_PREVIOUS, false);
    332331                }
    333332            } else {
    334                 int diff = where - position;
    335 
    336                 for (int count = 0; count < diff; count++) {
     333                psS32 diff = where - position;
     334
     335                for (psS32 count = 0; count < diff; count++) {
    337336                    listSetIterator(list, PS_LIST_NEXT, false);
    338337                }
     
    363362}
    364363
    365 int listGetIteratorIndex(psList* list)
     364psS32 listGetIteratorIndex(psList* list)
    366365{
    367366    if (list->iter == ITER_INIT_HEAD) {
     
    374373}
    375374
    376 void *psListGet(psList* list, int location)
     375psPtr psListGet(psList* list, psS32 location)
    377376{
    378377    psListElem* element;
     
    391390 * and now return the previous/next element of the list
    392391 */
    393 void *psListGetNext(psList* list)
     392psPtr psListGetNext(psList* list)
    394393{
    395394    return psListGet(list, PS_LIST_NEXT);
    396395}
    397396
    398 void *psListGetPrevious(psList* list)
     397psPtr psListGetPrevious(psList* list)
    399398{
    400399    return psListGet(list, PS_LIST_PREVIOUS);
    401400}
    402401
    403 void *psListGetCurrent(psList* list)
     402psPtr psListGetCurrent(psList* list)
    404403{
    405404    return psListGet(list, PS_LIST_CURRENT);
     
    412411{
    413412    psListElem* ptr;
    414     unsigned int n;
     413    psU32 n;
    415414    psArray* restrict arr;
    416415
     
    429428    ptr = list->head;
    430429    n = list->size;
    431     for (int i = 0; i < n; i++) {
     430    for (psS32 i = 0; i < n; i++) {
    432431        arr->data[i] = psMemIncrRefCounter(ptr->data);
    433432        ptr = ptr->next;
     
    439438psList* psArrayToList(psArray* arr)
    440439{
    441     unsigned int n;
     440    psU32 n;
    442441    psList* list;               // list of elements
    443442
     
    448447    list = psListAlloc(NULL);
    449448    n = arr->n;
    450     for (int i = 0; i < n; i++) {
     449    for (psS32 i = 0; i < n; i++) {
    451450        psListAdd(list, PS_LIST_TAIL, arr->data[i]);
    452451    }
  • trunk/psLib/src/collections/psList.h

    r1747 r2204  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-09 02:23:27 $
     12 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717
    1818#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
    19 #include <stdbool.h>                   // we use the bool type.
    2019
    2120#include "psCompare.h"
     
    4645    struct psListElem* prev;           ///< previous link in list
    4746    struct psListElem* next;           ///< next link in list
    48     void *data;                        ///< real data item
     47    psPtr data;                        ///< real data item
    4948}
    5049psListElem;
     
    5756typedef struct
    5857{
    59     unsigned int size;                 ///< number of elements on list
     58    psU32 size;                 ///< number of elements on list
    6059    psListElem* head;                  ///< first element on list (may be NULL)
    6160    psListElem* tail;                  ///< last element on list (may be NULL)
    6261    psListElem* iter;                  ///< iteration cursor
    63     unsigned int iterIndex;            ///< the numeric position of the iteration cursor in the list
     62    psU32 iterIndex;            ///< the numeric position of the iteration cursor in the list
    6463    pthread_mutex_t lock;              ///< mutex to lock a node during changes
    6564}
     
    7170 */
    7271psList* psListAlloc(
    73     void *data
     72    psPtr data
    7473    ///< initial data item; may be NULL if no an empty psList is desired
    7574)
     
    8180 *                      NULL, the return value will also be NULL.
    8281 */
    83 bool psListAdd(
     82psBool psListAdd(
    8483    psList* restrict list,             ///< list to add to (if NULL, nothing is done)
    85     int location,                      ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
    86     void *data                         ///< data item to add.  If NULL, list is not modified.
     84    psS32 location,                      ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     85    psPtr data                         ///< data item to add.  If NULL, list is not modified.
    8786);
    8887
    8988/** Remove an item from a list.  If location parameter is PS_LIST_UNKNOWN,
    9089 *
    91  *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
     90 *  @return psBool        TRUE if element is successfully removed, otherwise FALSE.
    9291 */
    93 bool psListRemove(
     92psBool psListRemove(
    9493    psList* restrict list,
    9594    ///< list to remove element from
    96     int location,
     95    psS32 location,
    9796    ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
    98     void *data
     97    psPtr data
    9998    ///< if location is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
    10099);
     
    102101/** Retrieve an item from a list.
    103102 *
    104  *  @return void*       the item corresponding to the location parameter.  If
     103 *  @return psPtr       the item corresponding to the location parameter.  If
    105104 *                      location is invalid (e.g., a numbered index greater
    106105 *                      than the list size or if the list is empty), a
    107106 *                      NULL is returned.
    108107 */
    109 void *psListGet(
     108psPtr psListGet(
    110109    psList* restrict list,             ///< list to retrieve element from
    111     int location                       ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
     110    psS32 location                       ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
    112111);
    113112
     
    118117void psListSetIterator(
    119118    psList* restrict list,             ///< list to retrieve element from
    120     int location                       ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
     119    psS32 location                       ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    121120);
    122121
     
    124123 *  the next list position.
    125124 *
    126  *  @return void*       the data item next on the list or NULL if the iterator
     125 *  @return psPtr       the data item next on the list or NULL if the iterator
    127126 *                      is already pointing to the last element or the list
    128127 *                      parameter was NULL.
    129128 */
    130 void *psListGetNext(
     129psPtr psListGetNext(
    131130    psList* restrict list              ///< list to retrieve element from
    132131);
     
    135134 *  not move the iterator location.
    136135 *
    137  *  @return void*       the data item cooresponding to current iterator
     136 *  @return psPtr       the data item cooresponding to current iterator
    138137 *                      cursor position of the list, or NULL if either the
    139138 *                      iterator is not valid or list parameter was NULL.
    140139 */
    141 void *psListGetCurrent(
     140psPtr psListGetCurrent(
    142141    psList* restrict list              ///< list to retrieve element from
    143142);
     
    146145 *  iterator to the previous list position.
    147146 *
    148  *  @return void*       the data item previous on the list or NULL if the iterator
     147 *  @return psPtr       the data item previous on the list or NULL if the iterator
    149148 *                      is already pointing to the first element or the list
    150149 *                      parameter was NULL.
    151150 */
    152 void *psListGetPrevious(
     151psPtr psListGetPrevious(
    153152    psList* restrict list              ///< list to retrieve element from
    154153);
  • trunk/psLib/src/collections/psMetadata.c

    r2040 r2204  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-10-09 03:05:53 $
     14*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-10-27 00:57:30 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959/*****************************************************************************/
    6060
    61 static int metadataId = 0;
     61static psS32 metadataId = 0;
    6262
    6363/*****************************************************************************/
     
    143143
    144144    // Set metadata item unique id
    145     *(int *)(&metadataItem->id) = ++metadataId;
     145    *(psS32 *)(&metadataItem->id) = ++metadataId;
    146146
    147147    // Set metadata item type
     
    154154        break;
    155155    case PS_META_BOOL:
    156         metadataItem->data.B = (bool)va_arg(argPtr, int);
     156        metadataItem->data.B = (psBool)va_arg(argPtr, psS32);
    157157        break;
    158158    case PS_META_S32:
     
    215215}
    216216
    217 bool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, int location )
     217psBool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, psS32 location )
    218218{
    219219    char * key = NULL;
     
    337337}
    338338
    339 bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type,
    340                    const char *comment, ...)
     339psBool psMetadataAdd(psMetadata* restrict md, psS32 where, const char *name, psMetadataType type,
     340                     const char *comment, ...)
    341341{
    342342    va_list argPtr;
     
    359359}
    360360
    361 bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key)
    362 {
    363     int numChildren = 0;
     361psBool psMetadataRemove(psMetadata* restrict md, psS32 where, const char *restrict key)
     362{
     363    psS32 numChildren = 0;
    364364    psList* mdList = NULL;
    365365    psHash* mdTable = NULL;
     
    471471}
    472472
    473 psMetadataItem* psMetadataGet(psMetadata* restrict md, int where)
     473psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where)
    474474{
    475475    psList* mdList = NULL;
     
    497497}
    498498
    499 bool psMetadataSetIterator(psMetadata* restrict md, int where)
     499psBool psMetadataSetIterator(psMetadata* restrict md, psS32 where)
    500500{
    501501    psList* mdList = NULL;
     
    517517}
    518518
    519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)
     519psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, psS32 which)
    520520{
    521521    psList* mdList = NULL;
     
    553553}
    554554
    555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)
     555psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, psS32 which)
    556556{
    557557    psList* mdList = NULL;
  • trunk/psLib/src/collections/psMetadata.h

    r1970 r2204  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-10-06 01:06:27 $
     13*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:30 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838    PS_META_F32,                       ///< Single-precision float data.
    3939    PS_META_F64,                       ///< Double-precision float data.
    40     PS_META_STR,                       ///< String data (Stored in as void *).
    41     PS_META_VEC,                       ///< Vector data (Stored in as void *).
    42     PS_META_IMG,                       ///< Image data (Stored in as void *).
    43     PS_META_JPEG,                      ///< JPEG data (Stored in as void *).
    44     PS_META_PNG,                       ///< PNG data (Stored in as void *).
    45     PS_META_ASTROM,                    ///< Astrometric coefficients (Stored in as void *).
    46     PS_META_UNKNOWN,                   ///< Other data (Stored in as void *).
     40    PS_META_STR,                       ///< String data (Stored in as psPtr ).
     41    PS_META_VEC,                       ///< Vector data (Stored in as psPtr ).
     42    PS_META_IMG,                       ///< Image data (Stored in as psPtr ).
     43    PS_META_JPEG,                      ///< JPEG data (Stored in as psPtr ).
     44    PS_META_PNG,                       ///< PNG data (Stored in as psPtr ).
     45    PS_META_ASTROM,                    ///< Astrometric coefficients (Stored in as psPtr ).
     46    PS_META_UNKNOWN,                   ///< Other data (Stored in as psPtr ).
    4747    PS_META_NTYPE                      ///< Number of types. Must be last.
    4848} psMetadataType;
     
    5555typedef struct psMetadataItem
    5656{
    57     const int id;                      ///< Unique ID for metadata item.
     57    const psS32 id;                      ///< Unique ID for metadata item.
    5858    char *restrict name;               ///< Name of metadata item.
    5959    psMetadataType type;               ///< Type of metadata item.
    6060    union {
    61         bool B;                        ///< boolean data
     61        psBool B;                        ///< boolean data
    6262        psS32 S32;                     ///< Signed 32-bit integer data.
    6363        psF32 F32;                     ///< Single-precision float data.
    6464        psF64 F64;                     ///< Double-precision float data.
    65         psPTR V;                       ///< Pointer to other type of data.
     65        psPtr V;                       ///< Pointer to other type of data.
    6666    } data;                            ///< Union for data types.
    6767    char *comment;                     ///< Optional comment ("", not NULL).
     
    144144 *  @return bool: True for success, false for failure.
    145145 */
    146 bool psMetadataAddItem(
     146psBool psMetadataAddItem(
    147147    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    148148    psMetadataItem* restrict item,     ///< Metadata item to be added.
    149     int location                       ///< Location to be added.
     149    psS32 location                       ///< Location to be added.
    150150);
    151151
     
    156156 * @return bool: True for success, false for failure.
    157157 */
    158 bool psMetadataAdd(
    159     psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    160     int where,                         ///< Location to be added.
     158psBool psMetadataAdd(
     159    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
     160    psS32 where,                         ///< Location to be added.
    161161    const char *name,                  ///< Name of metadata item.
    162162    psMetadataType type,               ///< Type of metadata item.
     
    175175 * @return bool: True for success, false for failure.
    176176 */
    177 bool psMetadataRemove(
    178     psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    179     int where,                         ///< Location to be removed.
     177psBool psMetadataRemove(
     178    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
     179    psS32 where,                         ///< Location to be removed.
    180180    const char *restrict key           ///< Name of metadata key.
    181181);
     
    203203psMetadataItem* psMetadataGet(
    204204    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    205     int where                          ///< Location to be retrieved.
     205    psS32 where                          ///< Location to be retrieved.
    206206);
    207207
     
    213213 * @return void: void.
    214214 */
    215 bool psMetadataSetIterator(
     215psBool psMetadataSetIterator(
    216216    psMetadata* restrict md,           ///< Metadata collection to iterate.
    217     int where                          ///< Location of iterator.
     217    psS32 where                          ///< Location of iterator.
    218218);
    219219
     
    227227    psMetadata* restrict md,           ///< Metadata collection to iterate.
    228228    const char *restrict match,        ///< Beginning of key name.
    229     int which                          ///< Iterator to be used.
     229    psS32 which                          ///< Iterator to be used.
    230230);
    231231
     
    239239    psMetadata* restrict md,           ///< Metadata collection to iterate.
    240240    const char *restrict match,        ///< Beginning of key name.
    241     int which                          ///< Iterator to be used.
     241    psS32 which                          ///< Iterator to be used.
    242242);
    243243
  • trunk/psLib/src/collections/psMetadataIO.c

    r2014 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-08 00:43:12 $
     11*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104/** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string
    105105 *  must be null terminated. */
    106 bool ignoreLine(char *inString)
     106psBool ignoreLine(char *inString)
    107107{
    108108    while(*inString!='\0' && *inString!='#') {
     
    119119/** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null
    120120 *  terminated copy of the original input string. */
    121 char *cleanString(char *inString, int sLen)
     121char *cleanString(char *inString, psS32 sLen)
    122122{
    123123    char *ptrB = NULL;
     
    149149
    150150/** Count repeat occurances of a single character within a line. The input string must be null terminated. */
    151 int repeatedChars(char *inString, char ch)
    152 {
    153     int count = 0;
     151psS32 repeatedChars(char *inString, char ch)
     152{
     153    psS32 count = 0;
    154154
    155155
     
    166166/** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location
    167167 * the beginning of the string. Tokens are newly allocated null terminated strings. */
    168 char* getToken(char **inString, char *delimiter, int *status)
     168char* getToken(char **inString, char *delimiter, psS32 *status)
    169169{
    170170    char *cleanToken = NULL;
    171     int sLen = 0;
     171    psS32 sLen = 0;
    172172
    173173
     
    195195/** Returns single parsed value as a double precision number. The input string must be cleaned and null
    196196 * terminated. */
    197 double parseValue(char *inString, int *status)
     197double parseValue(char *inString, psS32 *status)
    198198{
    199199    char *end = NULL;
     
    212212
    213213/** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */
    214 bool parseBool(char *inString, int *status)
    215 {
    216     bool value = false;
     214psBool parseBool(char *inString, psS32 *status)
     215{
     216    psBool value = false;
    217217
    218218
     
    229229
    230230/** Returns parsed vector filled with with data. The input string must be null terminated. */
    231 psVector* parseVector(char *inString, psElemType elemType, int *status)
     231psVector* parseVector(char *inString, psElemType elemType, psS32 *status)
    232232{
    233233    char *end = NULL;
    234234    char *saveValue = NULL;
    235     int i = 0;
    236     int numValues = 0;
     235    psS32 i = 0;
     236    psS32 numValues = 0;
    237237    double value = 0.0;
    238238    psVector *vec = NULL;
     
    341341
    342342
    343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, int extNum, char *fileName)
    344 {
    345     bool tempBool;
    346     bool success;
     343psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName)
     344{
     345    psBool tempBool;
     346    psBool success;
    347347    char keyType;
    348348    char keyName[FITS_LINE_SIZE];
     
    350350    char keyComment[FITS_LINE_SIZE];
    351351    char fitsErr[MAX_STRING_LENGTH];
    352     int i;
    353     int hduType = 0;
    354     int status = 0;
    355     int numKeys = 0;
    356     int keyNum = 0;
     352    psS32 i;
     353    psS32 hduType = 0;
     354    psS32 status = 0;
     355    psS32 numKeys = 0;
     356    psS32 keyNum = 0;
    357357    psMetadataType metadataItemType;
    358358    fitsfile *fd = NULL;
     
    449449
    450450
    451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)
    452 {
    453     bool tempBool;
     451psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite)
     452{
     453    psBool tempBool;
    454454    char *line = NULL;
    455455    char *strName = NULL;
     
    458458    char *strComment = NULL;
    459459    char *linePtr = NULL;
    460     int status = 0;
    461     int lineCount = 0;
    462     int failedLines = 0;
     460    psS32 status = 0;
     461    psS32 lineCount = 0;
     462    psS32 failedLines = 0;
    463463    psF64 tempDbl = 0.0;
    464464    psS32 tempInt = 0.0;
  • trunk/psLib/src/collections/psMetadataIO.h

    r1973 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-06 01:17:39 $
     11*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    psMetadata* output,                ///< Resulting metadata from read.
    5151    char *extName,                     ///< File name extension string.
    52     int extNum,                        ///< File name extension number. Starts at 1.
     52    psS32 extNum,                        ///< File name extension number. Starts at 1.
    5353    char *fileName                     ///< Name of file to read.
    5454);
     
    5858 *  Loads pre-defined settings by parsing a configuration file into a psMetadata structure.
    5959 *
    60  *  @return int : Number of lines that failed to be read.
     60 *  @return psS32 : Number of lines that failed to be read.
    6161 */
    62 int psMetadataParseConfig(
     62psS32 psMetadataParseConfig(
    6363    psMetadata** md,                   ///< Resulting metadata from read.
    6464    char *fileName,                    ///< Name of file to read.
    65     bool overwrite                     ///< Allow overwrite of duplicate specifications.
     65    psBool overwrite                     ///< Allow overwrite of duplicate specifications.
    6666);
    6767
  • trunk/psLib/src/collections/psVector.c

    r2006 r2204  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-07 19:51:30 $
     12*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:31 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242// FUNCTION IMPLEMENTATION - PUBLIC
    4343
    44 psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType)
     44psVector* psVectorAlloc(psU32 nalloc, psElemType elemType)
    4545{
    4646    psVector* psVec = NULL;
    47     int elementSize = 0;
     47    psS32 elementSize = 0;
    4848
    4949    elementSize = PSELEMTYPE_SIZEOF(elemType);
     
    6464}
    6565
    66 psVector* psVectorRealloc(psVector* restrict in, unsigned int nalloc)
    67 {
    68     int elementSize = 0;
     66psVector* psVectorRealloc(psVector* restrict in, psU32 nalloc)
     67{
     68    psS32 elementSize = 0;
    6969    psElemType elemType;
    7070
     
    8888}
    8989
    90 psVector* psVectorRecycle(psVector* restrict in, unsigned int n, psElemType type)
    91 {
    92     int byteSize;
     90psVector* psVectorRecycle(psVector* restrict in, psU32 n, psElemType type)
     91{
     92    psS32 byteSize;
    9393
    9494    if (in == NULL) {
     
    129129    }
    130130
    131     int nElements = in->n;
     131    psS32 nElements = in->n;
    132132
    133133    out = psVectorRecycle(out, nElements, type);
     
    136136        ps##INTYPE *inVec = in->data.INTYPE; \
    137137        ps##OUTTYPE *outVec = out->data.OUTTYPE; \
    138         for (int col=0;col<nElements;col++) { \
     138        for (psS32 col=0;col<nElements;col++) { \
    139139            *(outVec++) = *(inVec++); \
    140140        } \
     
    225225psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector)
    226226{
    227     int N = 0;
    228     int elSize = 0;
    229     void *inVec = NULL;
    230     void *outVec = NULL;
     227    psS32 N = 0;
     228    psS32 elSize = 0;
     229    psPtr inVec = NULL;
     230    psPtr outVec = NULL;
    231231    psElemType inType = 0;
    232232
     
    311311psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector)
    312312{
    313     int N = 0;
     313    psS32 N = 0;
    314314    psVector* tmpVector = NULL;
    315315    psElemType inType = 0;
     
    350350        ps##TYPE* tmpVec = tmpVector->data.TYPE;                              \
    351351        ps##TYPE  diff;                                                       \
    352         for(int i=0; i<N; i++) {                                              \
    353             for(int j=0; j<N; j++) {                                          \
     352        for(psS32 i=0; i<N; i++) {                                              \
     353            for(psS32 j=0; j<N; j++) {                                          \
    354354                diff = absfcn(tmpVec[i] - inVec[j]);                          \
    355355                if(diff < maxError) {                                         \
  • trunk/psLib/src/collections/psVector.h

    r1982 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-06 21:30:52 $
     13 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333{
    3434    psType type;                ///< Type of data.
    35     unsigned int nalloc;        ///< Total number of elements available.
    36     unsigned int n;             ///< Number of elements in use.
     35    psU32 nalloc;        ///< Total number of elements available.
     36    psU32 n;             ///< Number of elements in use.
    3737
    3838    union {
     
    4949        psC32* C32;             ///< Single-precision complex data.
    5050        psC64* C64;             ///< Double-precision complex data.
    51         psPTR V;                ///< Pointer to data.
     51        psPtr V;                ///< Pointer to data.
    5252    } data;                     ///< Union for data types.
    5353}
     
    6969 */
    7070psVector* psVectorAlloc(
    71     unsigned int nalloc,               ///< Total number of elements to make available.
     71    psU32 nalloc,               ///< Total number of elements to make available.
    7272    psElemType dataType                ///< Type of data to be held by vector.
    7373);
     
    8484psVector* psVectorRealloc(
    8585    psVector* restrict psVec,          ///< Vector to reallocate.
    86     unsigned int nalloc                ///< Total number of elements to make available.
     86    psU32 nalloc                ///< Total number of elements to make available.
    8787);
    8888
     
    101101    ///< taken to preserve the values.
    102102
    103     unsigned int nalloc,               ///< Total number of elements to make available.
     103    psU32 nalloc,               ///< Total number of elements to make available.
    104104    psElemType type                    ///< the datatype of the returned vector
    105105);
  • trunk/psLib/src/dataManip/psConstants.h

    r2197 r2204  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-26 21:24:42 $
     8 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:31 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454p_psMemSetPersistent(VEC, true); \
    5555p_psMemSetPersistent(VEC->data.V, true); \
    56 for (int i=0;i<N;i++) { \
     56for (psS32 i=0;i<N;i++) { \
    5757    VEC->data.F32[i] = 1.0; \
    5858} \
     
    6262p_psMemSetPersistent(VEC, true); \
    6363p_psMemSetPersistent(VEC->data.V, true); \
    64 for (int i=0;i<N;i++) { \
     64for (psS32 i=0;i<N;i++) { \
    6565    VEC->data.F64[i] = 1.0; \
    6666} \
     
    7070p_psMemSetPersistent(VEC, true); \
    7171p_psMemSetPersistent(VEC->data.V, true); \
    72 for (int i=0;i<N;i++) { \
     72for (psS32 i=0;i<N;i++) { \
    7373    VEC->data.F32[i] = (float) i; \
    7474} \
     
    7878p_psMemSetPersistent(VEC, true); \
    7979p_psMemSetPersistent(VEC->data.V, true); \
    80 for (int i=0;i<N;i++) { \
     80for (psS32 i=0;i<N;i++) { \
    8181    VEC->data.F64[i] = (float) i; \
    8282} \
     
    209209
    210210#define PS_PRINT_VECTOR(NAME) \
    211 for (int my_i=0;my_i<NAME->n;my_i++) { \
     211for (psS32 my_i=0;my_i<NAME->n;my_i++) { \
    212212    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
    213213} \
     
    216216#define PS_VECTOR_F64_TO_F32(X64, X32) \
    217217psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \
    218 for (int i=0;i<X64->n;i++) { \
     218for (psS32 i=0;i<X64->n;i++) { \
    219219    X32->data.F32[i] = (float) X64->data.F64[i]; \
    220220} \
     
    222222#define PS_VECTOR_F32_TO_F64(X32, X64) \
    223223psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \
    224 for (int i=0;i<X32->n;i++) { \
     224for (psS32 i=0;i<X32->n;i++) { \
    225225    X64->data.F64[i] = (float) X32->data.F32[i]; \
    226226} \
  • trunk/psLib/src/dataManip/psFunctions.c

    r2197 r2204  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-26 21:24:42 $
     9 *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    \
    5151    if (IN->type.type == PS_TYPE_F64) { \
    52         for (int i=0;i<IN->n;i++) { \
     52        for (psS32 i=0;i<IN->n;i++) { \
    5353            OUT->data.F32[i] = (float) (IN->data.F64[i]); \
    5454        } \
     
    6969    \
    7070    if (IN->type.type == PS_TYPE_F32) { \
    71         for (int i=0;i<IN->n;i++) { \
     71        for (psS32 i=0;i<IN->n;i++) { \
    7272            OUT->data.F64[i] = (float) (IN->data.F32[i]); \
    7373        } \
     
    117117outer coefficients of the Chebyshev polynomials.
    118118 *****************************************************************************/
    119 static psPolynomial1D **CreateChebyshevPolys(int maxChebyPoly)
     119static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly)
    120120{
    121121    psPolynomial1D **chebPolys = NULL;
    122     int i = 0;
    123     int j = 0;
     122    psS32 i = 0;
     123    psS32 j = 0;
    124124
    125125    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    153153    evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f]
    154154 *****************************************************************************/
    155 float psGaussian(float x, float mean, float sigma, bool normal)
     155float psGaussian(float x, float mean, float sigma, psBool normal)
    156156{
    157157    float tmp = 1.0;
     
    185185 NOTE: XXX: There is no way to seed the random generator.
    186186 *****************************************************************************/
    187 psVector* psGaussianDev(float mean, float sigma, int Npts)
     187psVector* psGaussianDev(float mean, float sigma, psS32 Npts)
    188188{
    189189    psVector* gauss = NULL;
    190190    const gsl_rng_type *T = NULL;
    191191    gsl_rng *r = NULL;
    192     int i = 0;
     192    psS32 i = 0;
    193193
    194194    gauss = psVectorAlloc(Npts, PS_TYPE_F32);
     
    209209    This routine must allocate memory for the polynomial structures.
    210210 *****************************************************************************/
    211 psPolynomial1D* psPolynomial1DAlloc(int n,
     211psPolynomial1D* psPolynomial1DAlloc(psS32 n,
    212212                                    psPolynomialType type)
    213213{
    214     int i = 0;
     214    psS32 i = 0;
    215215    psPolynomial1D* newPoly = NULL;
    216216
     
    232232}
    233233
    234 psPolynomial2D* psPolynomial2DAlloc(int nX, int nY,
     234psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY,
    235235                                    psPolynomialType type)
    236236{
    237     int x = 0;
    238     int y = 0;
     237    psS32 x = 0;
     238    psS32 y = 0;
    239239    psPolynomial2D* newPoly = NULL;
    240240
     
    265265}
    266266
    267 psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ,
     267psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
    268268                                    psPolynomialType type)
    269269{
    270     int x = 0;
    271     int y = 0;
    272     int z = 0;
     270    psS32 x = 0;
     271    psS32 y = 0;
     272    psS32 z = 0;
    273273    psPolynomial3D* newPoly = NULL;
    274274
     
    307307}
    308308
    309 psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
     309psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
    310310                                    psPolynomialType type)
    311311{
    312     int w = 0;
    313     int x = 0;
    314     int y = 0;
    315     int z = 0;
     312    psS32 w = 0;
     313    psS32 x = 0;
     314    psS32 y = 0;
     315    psS32 z = 0;
    316316    psPolynomial4D* newPoly = NULL;
    317317
     
    367367static void polynomial2DFree(psPolynomial2D* myPoly)
    368368{
    369     int x = 0;
     369    psS32 x = 0;
    370370
    371371    for (x = 0; x < myPoly->nX; x++) {
     
    381381static void polynomial3DFree(psPolynomial3D* myPoly)
    382382{
    383     int x = 0;
    384     int y = 0;
     383    psS32 x = 0;
     384    psS32 y = 0;
    385385
    386386    for (x = 0; x < myPoly->nX; x++) {
     
    402402static void polynomial4DFree(psPolynomial4D* myPoly)
    403403{
    404     int w = 0;
    405     int x = 0;
    406     int y = 0;
     404    psS32 w = 0;
     405    psS32 x = 0;
     406    psS32 y = 0;
    407407
    408408    for (w = 0; w < myPoly->nW; w++) {
     
    434434float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly)
    435435{
    436     int loop_x = 0;
     436    psS32 loop_x = 0;
    437437    float polySum = 0.0;
    438438    float xSum = 1.0;
     
    478478{
    479479    psVector *d;
    480     int n;
    481     int i;
     480    psS32 n;
     481    psS32 i;
    482482    float tmp;
    483483
     
    500500    /*
    501501
    502     int n;
    503     int i;
     502    psS32 n;
     503    psS32 i;
    504504    float tmp;
    505505    psPolynomial1D **chebPolys = NULL;
     
    537537    psVector *tmp;
    538538    psVector *myX;
    539     int i;
     539    psS32 i;
    540540
    541541    PS_CONVERT_VECTOR_F32(x, myX);
     
    555555float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    556556{
    557     int loop_x = 0;
    558     int loop_y = 0;
     557    psS32 loop_x = 0;
     558    psS32 loop_y = 0;
    559559    float polySum = 0.0;
    560560    float xSum = 1.0;
     
    577577float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    578578{
    579     int loop_x = 0;
    580     int loop_y = 0;
    581     int i = 0;
     579    psS32 loop_x = 0;
     580    psS32 loop_y = 0;
     581    psS32 i = 0;
    582582    float polySum = 0.0;
    583583    psPolynomial1D* *chebPolys = NULL;
    584     int maxChebyPoly = 0;
     584    psS32 maxChebyPoly = 0;
    585585
    586586    // Determine how many Chebyshev polynomials
     
    628628    psVector *myX;
    629629    psVector *myY;
    630     int i;
    631     int vecLen=x->n;
     630    psS32 i;
     631    psS32 vecLen=x->n;
    632632
    633633    PS_CONVERT_VECTOR_F32(x, myX);
     
    658658float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    659659{
    660     int loop_x = 0;
    661     int loop_y = 0;
    662     int loop_z = 0;
     660    psS32 loop_x = 0;
     661    psS32 loop_y = 0;
     662    psS32 loop_z = 0;
    663663    float polySum = 0.0;
    664664    float xSum = 1.0;
     
    686686float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    687687{
    688     int loop_x = 0;
    689     int loop_y = 0;
    690     int loop_z = 0;
    691     int i = 0;
     688    psS32 loop_x = 0;
     689    psS32 loop_y = 0;
     690    psS32 loop_z = 0;
     691    psS32 i = 0;
    692692    float polySum = 0.0;
    693693    psPolynomial1D* *chebPolys = NULL;
    694     int maxChebyPoly = 0;
     694    psS32 maxChebyPoly = 0;
    695695
    696696    // Determine how many Chebyshev polynomials
     
    746746    psVector *myY;
    747747    psVector *myZ;
    748     int i;
    749     int vecLen=x->n;
     748    psS32 i;
     749    psS32 vecLen=x->n;
    750750
    751751    PS_CONVERT_VECTOR_F32(x, myX);
     
    787787float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    788788{
    789     int loop_w = 0;
    790     int loop_x = 0;
    791     int loop_y = 0;
    792     int loop_z = 0;
     789    psS32 loop_w = 0;
     790    psS32 loop_x = 0;
     791    psS32 loop_y = 0;
     792    psS32 loop_z = 0;
    793793    float polySum = 0.0;
    794794    float wSum = 1.0;
     
    821821float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    822822{
    823     int loop_w = 0;
    824     int loop_x = 0;
    825     int loop_y = 0;
    826     int loop_z = 0;
    827     int i = 0;
     823    psS32 loop_w = 0;
     824    psS32 loop_x = 0;
     825    psS32 loop_y = 0;
     826    psS32 loop_z = 0;
     827    psS32 i = 0;
    828828    float polySum = 0.0;
    829829    psPolynomial1D* *chebPolys = NULL;
    830     int maxChebyPoly = 0;
     830    psS32 maxChebyPoly = 0;
    831831
    832832    // Determine how many Chebyshev polynomials
     
    890890    psVector *myY;
    891891    psVector *myZ;
    892     int i;
    893     int vecLen=x->n;
     892    psS32 i;
     893    psS32 vecLen=x->n;
    894894
    895895    PS_CONVERT_VECTOR_F32(w, myW);
     
    936936
    937937
    938 psDPolynomial1D* psDPolynomial1DAlloc(int n,
     938psDPolynomial1D* psDPolynomial1DAlloc(psS32 n,
    939939                                      psPolynomialType type)
    940940{
    941     int i = 0;
     941    psS32 i = 0;
    942942    psDPolynomial1D* newPoly = NULL;
    943943
     
    959959}
    960960
    961 psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY,
     961psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY,
    962962                                      psPolynomialType type)
    963963{
    964     int x = 0;
    965     int y = 0;
     964    psS32 x = 0;
     965    psS32 y = 0;
    966966    psDPolynomial2D* newPoly = NULL;
    967967
     
    992992}
    993993
    994 psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ,
     994psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
    995995                                      psPolynomialType type)
    996996{
    997     int x = 0;
    998     int y = 0;
    999     int z = 0;
     997    psS32 x = 0;
     998    psS32 y = 0;
     999    psS32 z = 0;
    10001000    psDPolynomial3D* newPoly = NULL;
    10011001
     
    10341034}
    10351035
    1036 psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
     1036psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
    10371037                                      psPolynomialType type)
    10381038{
    1039     int w = 0;
    1040     int x = 0;
    1041     int y = 0;
    1042     int z = 0;
     1039    psS32 w = 0;
     1040    psS32 x = 0;
     1041    psS32 y = 0;
     1042    psS32 z = 0;
    10431043    psDPolynomial4D* newPoly = NULL;
    10441044
     
    10941094static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    10951095{
    1096     int x = 0;
     1096    psS32 x = 0;
    10971097
    10981098    for (x = 0; x < myPoly->nX; x++) {
     
    11081108static void dPolynomial3DFree(psDPolynomial3D* myPoly)
    11091109{
    1110     int x = 0;
    1111     int y = 0;
     1110    psS32 x = 0;
     1111    psS32 y = 0;
    11121112
    11131113    for (x = 0; x < myPoly->nX; x++) {
     
    11291129static void dPolynomial4DFree(psDPolynomial4D* myPoly)
    11301130{
    1131     int w = 0;
    1132     int x = 0;
    1133     int y = 0;
     1131    psS32 w = 0;
     1132    psS32 x = 0;
     1133    psS32 y = 0;
    11341134
    11351135    for (w = 0; w < myPoly->nW; w++) {
     
    11591159double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
    11601160{
    1161     int loop_x = 0;
     1161    psS32 loop_x = 0;
    11621162    double polySum = 0.0;
    11631163    double xSum = 1.0;
     
    11831183{
    11841184    psVector *d;
    1185     int n;
    1186     int i;
     1185    psS32 n;
     1186    psS32 i;
    11871187    double tmp;
    11881188
     
    12221222    psVector *tmp;
    12231223    psVector *myX;
    1224     int i;
     1224    psS32 i;
    12251225
    12261226    PS_CONVERT_VECTOR_F64(x, myX);
     
    12411241double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    12421242{
    1243     int loop_x = 0;
    1244     int loop_y = 0;
     1243    psS32 loop_x = 0;
     1244    psS32 loop_y = 0;
    12451245    double polySum = 0.0;
    12461246    double xSum = 1.0;
     
    12631263double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    12641264{
    1265     int loop_x = 0;
    1266     int loop_y = 0;
    1267     int i = 0;
     1265    psS32 loop_x = 0;
     1266    psS32 loop_y = 0;
     1267    psS32 i = 0;
    12681268    double polySum = 0.0;
    12691269    psPolynomial1D* *chebPolys = NULL;
    1270     int maxChebyPoly = 0;
     1270    psS32 maxChebyPoly = 0;
    12711271
    12721272    // Determine how many Chebyshev polynomials
     
    13141314    psVector *myX;
    13151315    psVector *myY;
    1316     int i;
    1317     int vecLen=x->n;
     1316    psS32 i;
     1317    psS32 vecLen=x->n;
    13181318
    13191319    PS_CONVERT_VECTOR_F64(x, myX);
     
    13441344double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    13451345{
    1346     int loop_x = 0;
    1347     int loop_y = 0;
    1348     int loop_z = 0;
     1346    psS32 loop_x = 0;
     1347    psS32 loop_y = 0;
     1348    psS32 loop_z = 0;
    13491349    double polySum = 0.0;
    13501350    double xSum = 1.0;
     
    13721372double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    13731373{
    1374     int loop_x = 0;
    1375     int loop_y = 0;
    1376     int loop_z = 0;
    1377     int i = 0;
     1374    psS32 loop_x = 0;
     1375    psS32 loop_y = 0;
     1376    psS32 loop_z = 0;
     1377    psS32 i = 0;
    13781378    double polySum = 0.0;
    13791379    psPolynomial1D* *chebPolys = NULL;
    1380     int maxChebyPoly = 0;
     1380    psS32 maxChebyPoly = 0;
    13811381
    13821382    // Determine how many Chebyshev polynomials
     
    14321432    psVector *myY;
    14331433    psVector *myZ;
    1434     int i;
    1435     int vecLen=x->n;
     1434    psS32 i;
     1435    psS32 vecLen=x->n;
    14361436
    14371437    PS_CONVERT_VECTOR_F64(x, myX);
     
    14751475double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    14761476{
    1477     int loop_w = 0;
    1478     int loop_x = 0;
    1479     int loop_y = 0;
    1480     int loop_z = 0;
     1477    psS32 loop_w = 0;
     1478    psS32 loop_x = 0;
     1479    psS32 loop_y = 0;
     1480    psS32 loop_z = 0;
    14811481    double polySum = 0.0;
    14821482    double wSum = 1.0;
     
    15091509double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    15101510{
    1511     int loop_w = 0;
    1512     int loop_x = 0;
    1513     int loop_y = 0;
    1514     int loop_z = 0;
    1515     int i = 0;
     1511    psS32 loop_w = 0;
     1512    psS32 loop_x = 0;
     1513    psS32 loop_y = 0;
     1514    psS32 loop_z = 0;
     1515    psS32 i = 0;
    15161516    double polySum = 0.0;
    15171517    psPolynomial1D* *chebPolys = NULL;
    1518     int maxChebyPoly = 0;
     1518    psS32 maxChebyPoly = 0;
    15191519
    15201520    // Determine how many Chebyshev polynomials
     
    15781578    psVector *myY;
    15791579    psVector *myZ;
    1580     int i;
    1581     int vecLen=x->n;
     1580    psS32 i;
     1581    psS32 vecLen=x->n;
    15821582
    15831583    PS_CONVERT_VECTOR_F64(w, myW);
     
    16241624
    16251625//typedef struct {
    1626 //    int n;
     1626//    psS32 n;
    16271627//    psPolynomial1D **spline;
    16281628//    float *p_psDeriv2;
     
    16361636XXX: Ensure that domain[i+1] != domain[i]
    16371637 *****************************************************************************/
    1638 psSpline1D *psSpline1DAlloc(int numSplines,
    1639                             int order,
     1638psSpline1D *psSpline1DAlloc(psS32 numSplines,
     1639                            psS32 order,
    16401640                            float min,
    16411641                            float max)
    16421642{
    16431643    psSpline1D *tmp = NULL;
    1644     int i;
     1644    psS32 i;
    16451645    float tmpDomain;
    16461646    float width;
     
    16771677
    16781678// XXX: Have Robert put the dealocator in the memory file.
    1679 int p_psSpline1DFree(psSpline1D *tmpSpline)
    1680 {
    1681     int i;
     1679psS32 p_psSpline1DFree(psSpline1D *tmpSpline)
     1680{
     1681    psS32 i;
    16821682
    16831683    if (tmpSpline == NULL) {
     
    17041704 *****************************************************************************/
    17051705psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
    1706                                    int order)
     1706                                   psS32 order)
    17071707{
    17081708    psSpline1D *tmp = NULL;
    1709     int i;
    1710     int numSplines;
     1709    psS32 i;
     1710    psS32 numSplines;
    17111711
    17121712    tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D));
     
    17461746XXX: name since we don't take psVectors as input.
    17471747 *****************************************************************************/
    1748 int p_psVectorBinDisectF32(float *bins,
    1749                            int numBins,
    1750                            float x)
    1751 {
    1752     int min;
    1753     int max;
    1754     int mid;
     1748psS32 p_psVectorBinDisectF32(float *bins,
     1749                             psS32 numBins,
     1750                             float x)
     1751{
     1752    psS32 min;
     1753    psS32 max;
     1754    psS32 mid;
    17551755
    17561756    psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4,
     
    18001800p_psVectorBinDisectS32(): integer version of above.
    18011801 *****************************************************************************/
    1802 int p_psVectorBinDisectS32(int *bins,
    1803                            int numBins,
    1804                            int x)
    1805 {
    1806     int min;
    1807     int max;
    1808     int mid;
     1802psS32 p_psVectorBinDisectS32(psS32 *bins,
     1803                             psS32 numBins,
     1804                             psS32 x)
     1805{
     1806    psS32 min;
     1807    psS32 max;
     1808    psS32 mid;
    18091809
    18101810    psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4,
     
    18481848p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect().
    18491849 *****************************************************************************/
    1850 int p_psVectorBinDisect(psVector *bins,
    1851                         psScalar *x)
     1850psS32 p_psVectorBinDisect(psVector *bins,
     1851                          psScalar *x)
    18521852{
    18531853    if (x->type.type != bins->type.type) {
     
    18771877float p_ps1DFullInterpolateF32(float *domain,
    18781878                               float *range,
    1879                                int n,
     1879                               psS32 n,
    18801880                               float x)
    18811881{
    1882     int i;
    1883     int m;
     1882    psS32 i;
     1883    psS32 m;
    18841884    static psVector *p = NULL;
    18851885    p = psVectorRecycle(p, n, PS_TYPE_F32);
     
    19371937float p_ps1DInterpolateF32(float *domain,
    19381938                           float *range,
    1939                            int n,
    1940                            int order,
     1939                           psS32 n,
     1940                           psS32 order,
    19411941                           float x)
    19421942{
    1943     int binNum;
    1944     int numIntPoints = order+1;
    1945     int origin;
     1943    psS32 binNum;
     1944    psS32 numIntPoints = order+1;
     1945    psS32 origin;
    19461946
    19471947    psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4,
     
    19871987psScalar *p_psVectorInterpolate(psVector *domain,
    19881988                                psVector *range,
    1989                                 int order,
     1989                                psS32 order,
    19901990                                psScalar *x)
    19911991{
     
    20652065                     float x)
    20662066{
    2067     int binNum;
    2068     int n;
     2067    psS32 binNum;
     2068    psS32 n;
    20692069
    20702070    n = spline->n;
     
    20912091                               const psSpline1D *spline)
    20922092{
    2093     int i;
     2093    psS32 i;
    20942094    psVector *tmpVector;
    20952095
  • trunk/psLib/src/dataManip/psFunctions.h

    r1968 r2204  
    1212*  @author George Gusciora, MHPCC
    1313*
    14 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-10-06 00:48:15 $
     14*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-10-27 00:57:31 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545    float mean,                        ///< Mean for the Gaussian
    4646    float stddev,                      ///< Standard deviation for the Gaussian
    47     bool normal                        ///< Indicates whether result should be normalized
     47    psBool normal                        ///< Indicates whether result should be normalized
    4848);
    4949
     
    5757    float mean,                        ///< The mean of the Gaussian
    5858    float sigma,                       ///< The sigma of the Gaussian
    59     int Npts                           ///< The size of the vector
     59    psS32 Npts                           ///< The size of the vector
    6060);
    6161
     
    6969{
    7070    psPolynomialType type;             ///< Polynomial type
    71     int n;                             ///< Number of terms
     71    psS32 n;                             ///< Number of terms
    7272    float *coeff;                      ///< Coefficients
    7373    float *coeffErr;                   ///< Error in coefficients
     
    8080{
    8181    psPolynomialType type;             ///< Polynomial type
    82     int nX;                            ///< Number of terms in x
    83     int nY;                            ///< Number of terms in y
     82    psS32 nX;                            ///< Number of terms in x
     83    psS32 nY;                            ///< Number of terms in y
    8484    float **coeff;                     ///< Coefficients
    8585    float **coeffErr;                  ///< Error in coefficients
     
    9292{
    9393    psPolynomialType type;             ///< Polynomial type
    94     int nX;                            ///< Number of terms in x
    95     int nY;                            ///< Number of terms in y
    96     int nZ;                            ///< Number of terms in z
     94    psS32 nX;                            ///< Number of terms in x
     95    psS32 nY;                            ///< Number of terms in y
     96    psS32 nZ;                            ///< Number of terms in z
    9797    float ***coeff;                    ///< Coefficients
    9898    float ***coeffErr;                 ///< Error in coefficients
     
    105105{
    106106    psPolynomialType type;             ///< Polynomial type
    107     int nW;                            ///< Number of terms in w
    108     int nX;                            ///< Number of terms in x
    109     int nY;                            ///< Number of terms in y
    110     int nZ;                            ///< Number of terms in z
     107    psS32 nW;                            ///< Number of terms in w
     108    psS32 nX;                            ///< Number of terms in x
     109    psS32 nY;                            ///< Number of terms in y
     110    psS32 nZ;                            ///< Number of terms in z
    111111    float ****coeff;                   ///< Coefficients
    112112    float ****coeffErr;                ///< Error in coefficients
     
    121121 */
    122122psPolynomial1D* psPolynomial1DAlloc(
    123     int n,                              ///< Number of terms
     123    psS32 n,                              ///< Number of terms
    124124    psPolynomialType type               ///< Polynomial Type
    125125);
     
    130130 */
    131131psPolynomial2D* psPolynomial2DAlloc(
    132     int nX,                            ///< Number of terms in x
    133     int nY,                            ///< Number of terms in y
     132    psS32 nX,                            ///< Number of terms in x
     133    psS32 nY,                            ///< Number of terms in y
    134134    psPolynomialType type              ///< Polynomial Type
    135135);
     
    140140 */
    141141psPolynomial3D* psPolynomial3DAlloc(
    142     int nX,                            ///< Number of terms in x
    143     int nY,                            ///< Number of terms in y
    144     int nZ,                            ///< Number of terms in z
     142    psS32 nX,                            ///< Number of terms in x
     143    psS32 nY,                            ///< Number of terms in y
     144    psS32 nZ,                            ///< Number of terms in z
    145145    psPolynomialType type              ///< Polynomial Type
    146146);
     
    151151 */
    152152psPolynomial4D* psPolynomial4DAlloc(
    153     int nW,                            ///< Number of terms in w
    154     int nX,                            ///< Number of terms in x
    155     int nY,                            ///< Number of terms in y
    156     int nZ,                            ///< Number of terms in z
     153    psS32 nW,                            ///< Number of terms in w
     154    psS32 nX,                            ///< Number of terms in x
     155    psS32 nY,                            ///< Number of terms in y
     156    psS32 nZ,                            ///< Number of terms in z
    157157    psPolynomialType type              ///< Polynomial Type
    158158);
     
    230230{
    231231    psPolynomialType type;             ///< Polynomial type
    232     int n;                             ///< Number of terms
     232    psS32 n;                             ///< Number of terms
    233233    double *coeff;                     ///< Coefficients
    234234    double *coeffErr;                  ///< Error in coefficients
     
    241241{
    242242    psPolynomialType type;             ///< Polynomial type
    243     int nX;                            ///< Number of terms in x
    244     int nY;                            ///< Number of terms in y
     243    psS32 nX;                            ///< Number of terms in x
     244    psS32 nY;                            ///< Number of terms in y
    245245    double **coeff;                    ///< Coefficients
    246246    double **coeffErr;                 ///< Error in coefficients
     
    253253{
    254254    psPolynomialType type;             ///< Polynomial type
    255     int nX;                            ///< Number of terms in x
    256     int nY;                            ///< Number of terms in y
    257     int nZ;                            ///< Number of terms in z
     255    psS32 nX;                            ///< Number of terms in x
     256    psS32 nY;                            ///< Number of terms in y
     257    psS32 nZ;                            ///< Number of terms in z
    258258    double ***coeff;                   ///< Coefficients
    259259    double ***coeffErr;                ///< Error in coefficients
     
    266266{
    267267    psPolynomialType type;             ///< Polynomial type
    268     int nW;                            ///< Number of terms in w
    269     int nX;                            ///< Number of terms in x
    270     int nY;                            ///< Number of terms in y
    271     int nZ;                            ///< Number of terms in z
     268    psS32 nW;                            ///< Number of terms in w
     269    psS32 nX;                            ///< Number of terms in x
     270    psS32 nY;                            ///< Number of terms in y
     271    psS32 nZ;                            ///< Number of terms in z
    272272    double ****coeff;                  ///< Coefficients
    273273    double ****coeffErr;               ///< Error in coefficients
     
    281281 */
    282282psDPolynomial1D* psDPolynomial1DAlloc(
    283     int n,                             ///< Number of terms
     283    psS32 n,                             ///< Number of terms
    284284    psPolynomialType type              ///< Polynomial Type
    285285);
     
    290290 */
    291291psDPolynomial2D* psDPolynomial2DAlloc(
    292     int nX,                            ///< Number of terms in x
    293     int nY,                            ///< Number of terms in y
     292    psS32 nX,                            ///< Number of terms in x
     293    psS32 nY,                            ///< Number of terms in y
    294294    psPolynomialType type              ///< Polynomial Type
    295295);
     
    300300 */
    301301psDPolynomial3D* psDPolynomial3DAlloc(
    302     int nX,                            ///< Number of terms in x
    303     int nY,                            ///< Number of terms in y
    304     int nZ,                            ///< Number of terms in z
     302    psS32 nX,                            ///< Number of terms in x
     303    psS32 nY,                            ///< Number of terms in y
     304    psS32 nZ,                            ///< Number of terms in z
    305305    psPolynomialType type              ///< Polynomial Type
    306306);
     
    311311 */
    312312psDPolynomial4D* psDPolynomial4DAlloc(
    313     int nW,                            ///< Number of terms in w
    314     int nX,                            ///< Number of terms in x
    315     int nY,                            ///< Number of terms in y
    316     int nZ,                            ///< Number of terms in z
     313    psS32 nW,                            ///< Number of terms in w
     314    psS32 nX,                            ///< Number of terms in x
     315    psS32 nY,                            ///< Number of terms in y
     316    psS32 nZ,                            ///< Number of terms in z
    317317    psPolynomialType type              ///< Polynomial Type
    318318);
     
    386386typedef struct
    387387{
    388     int n;                        ///< The number of spline polynomials
     388    psS32 n;                        ///< The number of spline polynomials
    389389    psPolynomial1D **spline;      ///< An array of n pointers to the spline polynomials
    390390    float *p_psDeriv2;            ///< For cubic splines, the second derivative at each domain point.  Size is n+1.
     
    393393psSpline1D;
    394394
    395 psSpline1D *psSpline1DAlloc(int n,
    396                             int order,
     395psSpline1D *psSpline1DAlloc(psS32 n,
     396                            psS32 order,
    397397                            float min,
    398398                            float max);
    399399
    400 int p_psSpline1DFree(psSpline1D *tmpSpline);
     400psS32 p_psSpline1DFree(psSpline1D *tmpSpline);
    401401
    402402psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
    403                                    int order);
     403                                   psS32 order);
    404404
    405405float psSpline1DEval(const psSpline1D *spline,
     
    409409                               const psSpline1D *spline);
    410410
    411 int p_psVectorBinDisectF32(float *bins,
    412                            int numBins,
    413                            float x);
    414 
    415 int p_psVectorBinDisectS32(int *bins,
    416                            int numBins,
    417                            int x);
    418 
    419 int p_psVectorBinDisect(psVector *bins,
    420                         psScalar *x);
     411psS32 p_psVectorBinDisectF32(float *bins,
     412                             psS32 numBins,
     413                             float x);
     414
     415psS32 p_psVectorBinDisectS32(psS32 *bins,
     416                             psS32 numBins,
     417                             psS32 x);
     418
     419psS32 p_psVectorBinDisect(psVector *bins,
     420                          psScalar *x);
    421421
    422422psScalar *p_psVectorInterpolate(psVector *domain,
    423423                                psVector *range,
    424                                 int order,
     424                                psS32 order,
    425425                                psScalar *x);
    426426
  • trunk/psLib/src/dataManip/psMatrix.c

    r2021 r2204  
    2020 *  @author Ross Harman, MHPCC
    2121 *   
    22  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-10-08 02:48:01 $
     22 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     23 *  @date $Date: 2004-10-27 00:57:31 $
    2424 *
    2525 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    119119psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage)
    120120{
    121     int signum = 0;
    122     int arraySize = 0;
    123     int numRows = 0;
    124     int numCols = 0;
     121    psS32 signum = 0;
     122    psS32 arraySize = 0;
     123    psS32 numRows = 0;
     124    psS32 numCols = 0;
    125125    gsl_matrix lu;
    126126    gsl_permutation perm;
     
    165165                          const psVector* inVector, const psVector* inPerm)
    166166{
    167     int arraySize = 0;
    168     int numRows = 0;
    169     int numCols = 0;
     167    psS32 arraySize = 0;
     168    psS32 numRows = 0;
     169    psS32 numCols = 0;
    170170    gsl_matrix lu;
    171171    gsl_permutation perm;
     
    217217psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det)
    218218{
    219     int signum = 0;
    220     int arraySize = 0;
    221     int numRows = 0;
    222     int numCols = 0;
     219    psS32 signum = 0;
     220    psS32 arraySize = 0;
     221    psS32 numRows = 0;
     222    psS32 numCols = 0;
    223223    gsl_matrix inv;
    224224    gsl_matrix *lu;
     
    271271float *psMatrixDeterminant(const psImage* restrict inImage)
    272272{
    273     int signum = 0;
    274     int arraySize = 0;
    275     int numRows = 0;
    276     int numCols = 0;
     273    psS32 signum = 0;
     274    psS32 arraySize = 0;
     275    psS32 numRows = 0;
     276    psS32 numCols = 0;
    277277    float *det = NULL;
    278278    gsl_matrix *lu = NULL;
     
    313313psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2)
    314314{
    315     int arraySize = 0;
    316     int numRows = 0;
    317     int numCols = 0;
     315    psS32 arraySize = 0;
     316    psS32 numRows = 0;
     317    psS32 numCols = 0;
    318318    gsl_matrix m1;
    319319    gsl_matrix m2;
     
    355355psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage)
    356356{
    357     int arraySize = 0;
    358     int numRows = 0;
    359     int numCols = 0;
     357    psS32 arraySize = 0;
     358    psS32 numRows = 0;
     359    psS32 numCols = 0;
    360360    gsl_matrix trans;
    361361
     
    392392psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage)
    393393{
    394     int numRows = 0;
    395     int numCols = 0;
     394    psS32 numRows = 0;
     395    psS32 numCols = 0;
    396396    gsl_vector *eVals = NULL;
    397397    gsl_eigen_symmv_workspace *w = NULL;
     
    436436psVector* psMatrixToVector(psVector* outVector, const psImage* inImage)
    437437{
    438     int size = 0;
     438    psS32 size = 0;
    439439
    440440    // Error checks
     
    495495psImage* psVectorToMatrix(psImage* outImage, const psVector* inVector)
    496496{
    497     int size = 0;
     497    psS32 size = 0;
    498498
    499499    // Error checks
  • trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c

    r2021 r2204  
    2929 *  @author Ross Harman, MHPCC
    3030 *
    31  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    32  *  @date $Date: 2004-10-08 02:48:01 $
     31 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     32 *  @date $Date: 2004-10-27 00:57:31 $
    3333 *
    3434 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888#define SCALAR_VECTOR(OUT,IN1,OP,IN2,TYPE)                                                                   \
    8989{                                                                                                            \
    90     int i = 0;                                                                                               \
    91     int npt = 0;                                                                                             \
     90    psS32 i = 0;                                                                                               \
     91    psS32 npt = 0;                                                                                             \
    9292    ps##TYPE *o = NULL;                                                                                      \
    9393    ps##TYPE *i1 = NULL;                                                                                     \
     
    104104#define SCALAR_IMAGE(OUT,IN1,OP,IN2,TYPE)                                                                    \
    105105{                                                                                                            \
    106     int i = 0;                                                                                               \
    107     int j = 0;                                                                                               \
    108     int numRows = 0;                                                                                         \
    109     int numCols = 0;                                                                                         \
     106    psS32 i = 0;                                                                                               \
     107    psS32 j = 0;                                                                                               \
     108    psS32 numRows = 0;                                                                                         \
     109    psS32 numCols = 0;                                                                                         \
    110110    ps##TYPE *o = NULL;                                                                                      \
    111111    ps##TYPE *i1 = NULL;                                                                                     \
     
    126126#define VECTOR_SCALAR(OUT,IN1,OP,IN2,TYPE)                                                                   \
    127127{                                                                                                            \
    128     int i = 0;                                                                                               \
    129     int n1 = 0;                                                                                              \
     128    psS32 i = 0;                                                                                               \
     129    psS32 n1 = 0;                                                                                              \
    130130    ps##TYPE *o = NULL;                                                                                      \
    131131    ps##TYPE *i1 = NULL;                                                                                     \
     
    142142#define VECTOR_VECTOR(OUT,IN1,OP,IN2,TYPE)                                                                   \
    143143{                                                                                                            \
    144     int i = 0;                                                                                               \
    145     int n1 = 0;                                                                                              \
    146     int n2 = 0;                                                                                              \
     144    psS32 i = 0;                                                                                               \
     145    psS32 n1 = 0;                                                                                              \
     146    psS32 n2 = 0;                                                                                              \
    147147    ps##TYPE *o = NULL;                                                                                      \
    148148    ps##TYPE *i1 = NULL;                                                                                     \
     
    167167#define VECTOR_IMAGE(OUT,IN1,OP,IN2,TYPE)                                                                    \
    168168{                                                                                                            \
    169     int i = 0;                                                                                               \
    170     int j = 0;                                                                                               \
    171     int n1 = 0;                                                                                              \
    172     int numRows2 = 0;                                                                                        \
    173     int numCols2 = 0;                                                                                        \
     169    psS32 i = 0;                                                                                               \
     170    psS32 j = 0;                                                                                               \
     171    psS32 n1 = 0;                                                                                              \
     172    psS32 numRows2 = 0;                                                                                        \
     173    psS32 numCols2 = 0;                                                                                        \
    174174    psDimen dim1 = 0;                                                                                        \
    175175    ps##TYPE *o = NULL;                                                                                      \
     
    221221#define IMAGE_SCALAR(OUT,IN1,OP,IN2,TYPE)                                                                    \
    222222{                                                                                                            \
    223     int i = 0;                                                                                               \
    224     int j = 0;                                                                                               \
    225     int numRows = 0;                                                                                         \
    226     int numCols = 0;                                                                                         \
     223    psS32 i = 0;                                                                                               \
     224    psS32 j = 0;                                                                                               \
     225    psS32 numRows = 0;                                                                                         \
     226    psS32 numCols = 0;                                                                                         \
    227227    ps##TYPE *o = NULL;                                                                                      \
    228228    ps##TYPE *i1 = NULL;                                                                                     \
     
    242242#define IMAGE_VECTOR(OUT,IN1,OP,IN2,TYPE)                                                                    \
    243243{                                                                                                            \
    244     int i = 0;                                                                                               \
    245     int j = 0;                                                                                               \
    246     int n2 = 0;                                                                                              \
    247     int numRows1 = 0;                                                                                        \
    248     int numCols1 = 0;                                                                                        \
     244    psS32 i = 0;                                                                                               \
     245    psS32 j = 0;                                                                                               \
     246    psS32 n2 = 0;                                                                                              \
     247    psS32 numRows1 = 0;                                                                                        \
     248    psS32 numCols1 = 0;                                                                                        \
    249249    psDimen dim2 = 0;                                                                                        \
    250250    ps##TYPE *o = NULL;                                                                                      \
     
    295295#define IMAGE_IMAGE(OUT,IN1,OP,IN2,TYPE)                                                                     \
    296296{                                                                                                            \
    297     int i = 0;                                                                                               \
    298     int j = 0;                                                                                               \
    299     int numRows1 = 0;                                                                                        \
    300     int numCols1 = 0;                                                                                        \
    301     int numRows2 = 0;                                                                                        \
    302     int numCols2 = 0;                                                                                        \
     297    psS32 i = 0;                                                                                               \
     298    psS32 j = 0;                                                                                               \
     299    psS32 numRows1 = 0;                                                                                        \
     300    psS32 numCols1 = 0;                                                                                        \
     301    psS32 numRows2 = 0;                                                                                        \
     302    psS32 numCols2 = 0;                                                                                        \
    303303    ps##TYPE *o = NULL;                                                                                      \
    304304    ps##TYPE *i1 = NULL;                                                                                     \
     
    417417}
    418418
    419 void *psBinaryOp(void *out, void *in1, char *op, void *in2)
     419psPtr psBinaryOp(psPtr out, psPtr in1, char *op, psPtr in2)
    420420{
    421421    psDimen dim1 = 0;
     
    605605#define VECTOR(OUT,IN,OP,TYPE)                                                                               \
    606606{                                                                                                            \
    607     int i = 0;                                                                                               \
    608     int nIn = 0;                                                                                             \
    609     int nOut = 0;                                                                                            \
     607    psS32 i = 0;                                                                                               \
     608    psS32 nIn = 0;                                                                                             \
     609    psS32 nOut = 0;                                                                                            \
    610610    ps##TYPE *o = NULL;                                                                                      \
    611611    ps##TYPE *i1 = NULL;                                                                                     \
     
    629629#define IMAGE(OUT,IN,OP,TYPE)                                                                                \
    630630{                                                                                                            \
    631     int i = 0;                                                                                               \
    632     int j = 0;                                                                                               \
    633     int numRowsIn = 0;                                                                                       \
    634     int numColsIn = 0;                                                                                       \
    635     int numRowsOut = 0;                                                                                      \
    636     int numColsOut = 0;                                                                                      \
     631    psS32 i = 0;                                                                                               \
     632    psS32 j = 0;                                                                                               \
     633    psS32 numRowsIn = 0;                                                                                       \
     634    psS32 numColsIn = 0;                                                                                       \
     635    psS32 numRowsOut = 0;                                                                                      \
     636    psS32 numColsOut = 0;                                                                                      \
    637637    ps##TYPE *o = NULL;                                                                                      \
    638638    ps##TYPE *i1 = NULL;                                                                                     \
     
    818818}
    819819
    820 void *psUnaryOp(void *out, void *in, char *op)
     820psPtr psUnaryOp(psPtr out, psPtr in, char *op)
    821821{
    822822    psDimen dimIn = 0;
  • trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h

    r1464 r2204  
    3030 *  @author Ross Harman, MHPCC
    3131 *
    32  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2004-08-11 02:37:55 $
     32 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2004-10-27 00:57:31 $
    3434 *
    3535 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5656 */
    5757psType* psBinaryOp(
    58     void *out,                         ///< Output type, either psImage or psVector.
    59     void *in1,                         ///< First input, either psImage or psVector.
     58    psPtr out,                         ///< Output type, either psImage or psVector.
     59    psPtr in1,                         ///< First input, either psImage or psVector.
    6060    char *op,                          ///< Operator.
    61     void *in2                          ///< Second input, either psImage or psVector.
     61    psPtr in2                          ///< Second input, either psImage or psVector.
    6262);
    6363
     
    7979 */
    8080psType* psUnaryOp(
    81     void *out,                         ///< Output type, either psImage or psVector.
    82     void *in,                          ///< Input, either psImage or psVector.
     81    psPtr out,                         ///< Output type, either psImage or psVector.
     82    psPtr in,                          ///< Input, either psImage or psVector.
    8383    char *op                           ///< Operator.
    8484);
  • trunk/psLib/src/dataManip/psMinimize.c

    r2202 r2204  
    99 *  @author GLF, MHPCC
    1010 *
    11  *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 23:14:04 $
     11 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959 *****************************************************************************/
    6060void p_psBuildSums1D(double x,
    61                      int polyOrder,
     61                     psS32 polyOrder,
    6262                     psVector* sums)
    6363{
    64     int i = 0;
     64    psS32 i = 0;
    6565    double xSum = 0.0;
    6666
     
    101101            "---- CalculateSecondDerivs() begin ----\n");
    102102
    103     int i;
    104     int k;
    105     bool mustFreeX = false;
     103    psS32 i;
     104    psS32 k;
     105    psBool mustFreeX = false;
    106106    float sig;
    107107    float p;
    108     int n = y->n;
     108    psS32 n = y->n;
    109109    float *u = (float *) psAlloc(n * sizeof(float));
    110110    float *derivs2 = (float *) psAlloc(n * sizeof(float));
     
    173173                         float X)
    174174{
    175     int n;
    176     int klo;
    177     int khi;
     175    psS32 n;
     176    psS32 klo;
     177    psS32 khi;
    178178    float H;
    179179    float A;
     
    240240    psTrace(".psLib.dataManip.psVectorFitSpline1D", 4,
    241241            "---- psVectorFitSpline1D() begin ----\n");
    242     int numSplines = (y->n)-1;
     242    psS32 numSplines = (y->n)-1;
    243243    float tmp;
    244244    float H;
    245     int i;
     245    psS32 i;
    246246    float slope;
    247247    psVector *x32 = NULL;
     
    416416     the F64 port might be.
    417417 *****************************************************************************/
    418 bool psMinimizeLMChi2(psMinimization *min,
    419                       psImage *covar,
    420                       psVector *params,
    421                       const psVector *paramMask,
    422                       const psArray *x,
    423                       const psVector *y,
    424                       const psVector *yErr,
    425                       psMinimizeLMChi2Func func)
     418psBool psMinimizeLMChi2(psMinimization *min,
     419                        psImage *covar,
     420                        psVector *params,
     421                        const psVector *paramMask,
     422                        const psArray *x,
     423                        const psVector *y,
     424                        const psVector *yErr,
     425                        psMinimizeLMChi2Func func)
    426426{
    427427    PS_CHECK_NULL_PTR_RETURN_NULL(min);
     
    441441    psTrace(".psLib.dataManip.psMinimizeLMChi2", 4,
    442442            "---- psMinimizeLMChi2() begin ----\n");
    443     int numData = y->n;
    444     int numParams = params->n;
    445     int i;
    446     int j;
    447     int k;
    448     int l;
    449     int n;
    450     int p;
     443    psS32 numData = y->n;
     444    psS32 numParams = params->n;
     445    psS32 i;
     446    psS32 j;
     447    psS32 k;
     448    psS32 l;
     449    psS32 n;
     450    psS32 p;
    451451    psVector *beta = psVectorAlloc(numParams, PS_TYPE_F64);
    452452    psVector *perm = psVectorAlloc(numParams, PS_TYPE_F64);
     
    663663        const psVector* restrict yErr)
    664664{
    665     int j;
    666     int k;
    667     int n = x->n;
     665    psS32 j;
     666    psS32 k;
     667    psS32 n = x->n;
    668668    double fac;
    669669    double sum;
     
    689689    // are fitting this ChebyShev polynomial to.
    690690
    691     for (int i=0;i<n;i++) {
     691    for (psS32 i=0;i<n;i++) {
    692692        // NR 5.8.4
    693693        double Y = cos(M_PI * (0.5 + ((float) i)) / ((float) n));
     
    741741        const psVector* restrict yErr)
    742742{
    743     int polyOrder = myPoly->n;
     743    psS32 polyOrder = myPoly->n;
    744744    psImage* A = NULL;
    745745    psImage* ALUD = NULL;
     
    748748    psVector* X = NULL;         // NOTE: do we need this?
    749749    psVector* coeffs = NULL;
    750     int i = 0;
    751     int j = 0;
    752     int k = 0;
     750    psS32 i = 0;
     751    psS32 j = 0;
     752    psS32 k = 0;
    753753    psVector* xSums = NULL;
    754754
     
    853853                                        const psVector* restrict yErr)
    854854{
    855     int i;
     855    psS32 i;
    856856    psPolynomial1D *tmpPoly;
    857857    PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly);
     
    908908/******************************************************************************
    909909 *****************************************************************************/
    910 psMinimization *psMinimizationAlloc(int maxIter,
     910psMinimization *psMinimizationAlloc(psS32 maxIter,
    911911                                    float tol)
    912912{
     
    952952    float fb = 0.0;
    953953    float fc = 0.0;
    954     int iter = 100;
     954    psS32 iter = 100;
    955955    float aDir = 0.0;
    956956    float cDir = 0.0;
     
    960960    float stepSize = DETERMINE_BRACKET_STEP_SIZE;
    961961    psVector *tmp = NULL;
    962     int i = 0;
    963     int null = 0;
     962    psS32 i = 0;
     963    psS32 null = 0;
    964964
    965965    psTrace(".psLib.dataManip.p_psDetermineBracket", 4,
     
    11411141    psVector *tmpc = NULL;
    11421142    psVector *tmpn = NULL;
    1143     int i = 0;
    1144     int null = 0;
     1143    psS32 i = 0;
     1144    psS32 null = 0;
    11451145
    11461146    psTrace(".psLib.dataManip.p_psLineMin", 4,
     
    13131313XXX: Check for F32 types?
    13141314 *****************************************************************************/
    1315 bool psMinimizePowell(psMinimization *min,
    1316                       psVector *params,
    1317                       const psVector *paramMask,
    1318                       const psArray *coords,
    1319                       psMinimizePowellFunc func)
     1315psBool psMinimizePowell(psMinimization *min,
     1316                        psVector *params,
     1317                        const psVector *paramMask,
     1318                        const psArray *coords,
     1319                        psMinimizePowellFunc func)
    13201320{
    13211321    PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     
    13251325    PS_CHECK_NULL_PTR_RETURN_NULL(func);
    13261326
    1327     int numDims = params->n;
    1328     int i = 0;
    1329     int j = 0;
     1327    psS32 numDims = params->n;
     1328    psS32 i = 0;
     1329    psS32 j = 0;
    13301330    psVector **v = NULL;
    13311331    psVector *pQP = NULL;
     
    13371337    float baseFuncVal = 0.0;
    13381338    float currFuncVal = 0.0;
    1339     int biggestIter = 0;
     1339    psS32 biggestIter = 0;
    13401340    float biggestDiff = 0.0;
    13411341    float term1 = 0.0;
     
    15291529    float chi2 = 0.0;
    15301530    float d;
    1531     int i;
     1531    psS32 i;
    15321532    psVector *tmp;
    15331533
     
    15521552psMinimizePowell().
    15531553 *****************************************************************************/
    1554 bool psMinimizeChi2Powell(psMinimization *min,
    1555                           psVector *params,
    1556                           const psVector *paramMask,
    1557                           const psArray *coords,
    1558                           const psVector *value,
    1559                           const psVector *error,
    1560                           psMinimizeChi2PowellFunc func)
     1554psBool psMinimizeChi2Powell(psMinimization *min,
     1555                            psVector *params,
     1556                            const psVector *paramMask,
     1557                            const psArray *coords,
     1558                            const psVector *value,
     1559                            const psVector *error,
     1560                            psMinimizeChi2PowellFunc func)
    15611561{
    15621562    myValue = (psVector *) value;
  • trunk/psLib/src/dataManip/psMinimize.h

    r2202 r2204  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-26 23:14:04 $
     10 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 00:57:31 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646typedef struct
    4747{
    48     int maxIter;                       ///< Convergence limit
     48    psS32 maxIter;                       ///< Convergence limit
    4949    float tol;                         ///< Error Tolerance
    5050    float value;                       ///< Value of function at minimum
    51     int iter;                          ///< Number of iterations required
     51    psS32 iter;                          ///< Number of iterations required
    5252    float lastDelta;                   ///< The last difference for the fit
    5353}
    5454psMinimization;
    5555
    56 psMinimization *psMinimizationAlloc(int maxIter,
     56psMinimization *psMinimizationAlloc(psS32 maxIter,
    5757                                    float tol);
    5858
     
    8888                                  const psArray *x);
    8989
    90 bool psMinimizeLMChi2(psMinimization *min,
    91                       psImage *covar,
    92                       psVector *params,
    93                       const psVector *paramMask,
    94                       const psArray *x,
    95                       const psVector *y,
    96                       const psVector *yErr,
    97                       psMinimizeLMChi2Func func);
     90psBool psMinimizeLMChi2(psMinimization *min,
     91                        psImage *covar,
     92                        psVector *params,
     93                        const psVector *paramMask,
     94                        const psArray *x,
     95                        const psVector *y,
     96                        const psVector *yErr,
     97                        psMinimizeLMChi2Func func);
    9898
    9999typedef
     
    101101                              const psArray *coords);
    102102
    103 bool psMinimizePowell(psMinimization *min,
    104                       psVector *params,
    105                       const psVector *paramMask,
    106                       const psArray *coords,
    107                       psMinimizePowellFunc func);
     103psBool psMinimizePowell(psMinimization *min,
     104                        psVector *params,
     105                        const psVector *paramMask,
     106                        const psArray *coords,
     107                        psMinimizePowellFunc func);
    108108
    109109typedef
     
    111111                                      const psArray *coords);
    112112
    113 bool psMinimizeChi2Powell(psMinimization *min,
    114                           psVector *params,
    115                           const psVector *paramMask,
    116                           const psArray *coords,
    117                           const psVector *value,
    118                           const psVector *error,
    119                           psMinimizeChi2PowellFunc func);
     113psBool psMinimizeChi2Powell(psMinimization *min,
     114                            psVector *params,
     115                            const psVector *paramMask,
     116                            const psArray *coords,
     117                            const psVector *value,
     118                            const psVector *error,
     119                            psMinimizeChi2PowellFunc func);
    120120
    121121
  • trunk/psLib/src/dataManip/psStats.c

    r2197 r2204  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 21:24:43 $
     11 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151
    5252void p_psVectorRobustStats(const psVector* restrict myVector,
    53                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
     53                           const psVector* restrict maskVector, psU32 maskVal, psStats* stats);
    5454
    5555
     
    7575/*****************************************************************************/
    7676
    77 bool p_psGetStatValue(const psStats* stats, double *value)
     77psBool p_psGetStatValue(const psStats* stats, double *value)
    7878{
    7979
     
    134134 *****************************************************************************/
    135135
    136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
    137 {
    138     int i = 0;                  // Loop index variable.
     136void p_psVectorPrint(psVector* myVector, psVector* maskVector, psU32 maskVal, psStats* stats)
     137{
     138    psS32 i = 0;                  // Loop index variable.
    139139
    140140    for (i = 0; i < myVector->n; i++) {
     
    178178
    179179void p_psVectorSampleMean(const psVector* restrict myVector,
    180                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    181 {
    182     int i = 0;                  // Loop index variable
     180                          const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     181{
     182    psS32 i = 0;                  // Loop index variable
    183183    float mean = 0.0;           // The mean
    184     int count = 0;              // # of points in this mean?
     184    psS32 count = 0;              // # of points in this mean?
    185185    float rangeMin = 0.0;       // Exclude data below this
    186186    float rangeMax = 0.0;       // Exclude date above this
     
    242242 *****************************************************************************/
    243243void p_psVectorMax(const psVector* restrict myVector,
    244                    const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    245 {
    246     int i = 0;                  // Loop index variable
     244                   const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     245{
     246    psS32 i = 0;                  // Loop index variable
    247247    float max = -MY_MAX_FLOAT;  // The calculated maximum
    248248    float rangeMin = 0.0;       // Exclude data below this
     
    303303 *****************************************************************************/
    304304void p_psVectorMin(const psVector* restrict myVector,
    305                    const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    306 {
    307     int i = 0;                  // Loop index variable
     305                   const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     306{
     307    psS32 i = 0;                  // Loop index variable
    308308    float min = MY_MAX_FLOAT;   // The calculated maximum
    309309    float rangeMin = 0.0;       // Exclude data below this
     
    363363    NULL
    364364 *****************************************************************************/
    365 int p_psVectorNValues(const psVector* restrict myVector,
    366                       const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    367 {
    368     int i = 0;                  // Loop index variable
    369     int numData = 0;            // The number of data points
     365psS32 p_psVectorNValues(const psVector* restrict myVector,
     366                        const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     367{
     368    psS32 i = 0;                  // Loop index variable
     369    psS32 numData = 0;            // The number of data points
    370370    float rangeMin = 0.0;       // Exclude data below this
    371371    float rangeMax = 0.0;       // Exclude date above this
     
    414414 *****************************************************************************/
    415415void p_psVectorSampleMedian(const psVector* restrict myVector,
    416                             const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     416                            const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
    417417{
    418418    psVector* unsortedVector = NULL;    // Temporary vector
    419419    psVector* sortedVector = NULL;      // Temporary vector
    420     int i = 0;                  // Loop index variable
    421     int count = 0;              // # of points in this mean?
    422     int nValues = 0;            // # of points in vector
     420    psS32 i = 0;                  // Loop index variable
     421    psS32 count = 0;              // # of points in this mean?
     422    psS32 nValues = 0;            // # of points in vector
    423423    float rangeMin = 0.0;       // Exclude data below this
    424424    float rangeMax = 0.0;       // Exclude date above this
     
    497497                                       float sigma)
    498498{
    499     int i = 0;                  // Loop index variable
    500     int j = 0;                  // Loop index variable
     499    psS32 i = 0;                  // Loop index variable
     500    psS32 j = 0;                  // Loop index variable
    501501    float iMid;
    502502    float jMid;
    503     int numBins = robustHistogram->nums->n;
    504     int numBounds = robustHistogram->bounds->n;
     503    psS32 numBins = robustHistogram->nums->n;
     504    psS32 numBounds = robustHistogram->bounds->n;
    505505    psVector* smooth = psVectorAlloc(numBins, PS_TYPE_F32);
    506     int jMin = 0;
    507     int jMax = 0;
     506    psS32 jMin = 0;
     507    psS32 jMax = 0;
    508508    float firstBound = robustHistogram->bounds->data.F32[0];
    509509    float lastBound = robustHistogram->bounds->data.F32[numBounds-1];
     
    566566 *****************************************************************************/
    567567void p_psVectorSampleQuartiles(const psVector* restrict myVector,
    568                                const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     568                               const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
    569569{
    570570    psVector* unsortedVector = NULL;    // Temporary vector
    571571    psVector* sortedVector = NULL;      // Temporary vector
    572     int i = 0;                  // Loop index variable
    573     int count = 0;              // # of points in this mean?
    574     int nValues = 0;            // # data points
     572    psS32 i = 0;                  // Loop index variable
     573    psS32 count = 0;              // # of points in this mean?
     574    psS32 nValues = 0;            // # data points
    575575    float rangeMin = 0.0;       // Exclude data below this
    576576    float rangeMax = 0.0;       // Exclude date above this
     
    648648 *****************************************************************************/
    649649void p_psVectorSampleStdev(const psVector* restrict myVector,
    650                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    651 {
    652     int i = 0;                  // Loop index variable
    653     int countInt = 0;           // # of data points being used
     650                           const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     651{
     652    psS32 i = 0;                  // Loop index variable
     653    psS32 countInt = 0;           // # of data points being used
    654654    float countFloat = 0.0;     // # of data points being used
    655655    float mean = 0.0;           // The mean
     
    733733 *****************************************************************************/
    734734void p_psVectorClippedStats(const psVector* restrict myVector,
    735                             const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    736 {
    737     int i = 0;                  // Loop index variable
    738     int j = 0;                  // Loop index variable
     735                            const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     736{
     737    psS32 i = 0;                  // Loop index variable
     738    psS32 j = 0;                  // Loop index variable
    739739    float clippedMean = 0.0;    // self-explanatory
    740740    float clippedStdev = 0.0;   // self-explanatory
     
    825825    float min = (float)HUGE;
    826826    float max = (float)-HUGE;
    827     int i = 0;
     827    psS32 i = 0;
    828828
    829829    for (i = 0; i < myData->n; i++) {
     
    856856    float max = (double)-HUGE;
    857857    double range = 0.0;
    858     int i = 0;
     858    psS32 i = 0;
    859859
    860860    for (i = 0; i < myData->n; i++) {
     
    914914 *****************************************************************************/
    915915float p_psGaussianDeriv(const psVector* restrict myData,
    916                         const psVector* restrict myParams, int whichParam)
     916                        const psVector* restrict myParams, psS32 whichParam)
    917917{
    918918    float x = myData->data.F32[0];
     
    957957 *****************************************************************************/
    958958float p_psQuadraticDeriv(const psVector* restrict myParams,
    959                          const psVector* restrict myCoords, int whichParamDeriv)
     959                         const psVector* restrict myCoords, psS32 whichParamDeriv)
    960960{
    961961    float x = myCoords->data.F32[0];
     
    989989                       float getThisValue)
    990990{
    991     int numIterations = 0;
     991    psS32 numIterations = 0;
    992992    float midpoint = 0.0;
    993993    float oldMidpoint = 1.0;
     
    10301030float fitQuadraticSearchForYThenReturnX(psVector *xVec,
    10311031                                        psVector *yVec,
    1032                                         int binNum,
     1032                                        psS32 binNum,
    10331033                                        float yVal)
    10341034{
     
    11291129void p_psVectorRobustStats(const psVector* restrict myVector,
    11301130                           const psVector* restrict maskVector,
    1131                            unsigned int maskVal,
     1131                           psU32 maskVal,
    11321132                           psStats* stats)
    11331133{
     
    11351135    psVector* robustHistogramVector = NULL;
    11361136    float binSize = 0.0;        // Size of the histogram bins
    1137     int LQBinNum = -1;          // Bin num for lower quartile
    1138     int UQBinNum = -1;          // Bin num for upper quartile
    1139     int medianBinNum = -1;
    1140     int i = 0;                  // Loop index variable
    1141     int modeBinNum = 0;
     1137    psS32 LQBinNum = -1;          // Bin num for lower quartile
     1138    psS32 UQBinNum = -1;          // Bin num for upper quartile
     1139    psS32 medianBinNum = -1;
     1140    psS32 i = 0;                  // Loop index variable
     1141    psS32 modeBinNum = 0;
    11421142    float modeBinCount = 0.0;
    11431143    float dL = 0.0;
    1144     int numBins = 0;
     1144    psS32 numBins = 0;
    11451145    float myMean = 0.0;
    11461146    float myStdev = 0.0;
     
    12001200    // bins, not the binSize.  Also, if we get here, we know that
    12011201    // binSize != 0.0.
    1202     numBins = (int)((stats->max - stats->min) / binSize);
     1202    numBins = (psS32)((stats->max - stats->min) / binSize);
    12031203    robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins);
    12041204
     
    14401440    The histogram structure
    14411441 *****************************************************************************/
    1442 psHistogram* psHistogramAlloc(float lower, float upper, int n)
    1443 {
    1444     int i = 0;                  // Loop index variable
     1442psHistogram* psHistogramAlloc(float lower, float upper, psS32 n)
     1443{
     1444    psS32 i = 0;                  // Loop index variable
    14451445    psHistogram* newHist = NULL;        // The new histogram structure
    14461446    float binSize = 0.0;        // The histogram bin size
     
    15001500{
    15011501    psHistogram* newHist = NULL;        // The new histogram structure
    1502     int i;                      // Loop index variable
     1502    psS32 i;                      // Loop index variable
    15031503
    15041504    // NOTE: Verify that this is the correct action.
     
    15651565                               const psVector* restrict in,
    15661566                               const psVector* restrict mask,
    1567                                unsigned int maskVal)
    1568 {
    1569     int i = 0;                  // Loop index variable
     1567                               psU32 maskVal)
     1568{
     1569    psS32 i = 0;                  // Loop index variable
    15701570    float binSize = 0.0;        // Histogram bin size
    1571     int binNum = 0;             // A temporary bin number
    1572     int numBins = 0;            // The total number of bins
    1573     int tmp = 0;
     1571    psS32 binNum = 0;             // A temporary bin number
     1572    psS32 numBins = 0;            // The total number of bins
     1573    psS32 tmp = 0;
    15741574    psScalar tmpScalar;
    15751575    tmpScalar.type.type = PS_TYPE_F32;
    15761576    psVector* inF32;
    1577     int mustFreeTmp = 1;
     1577    psS32 mustFreeTmp = 1;
    15781578
    15791579    // NOTE: Verify that this is the correct action.
     
    16291629                if (out->uniform == true) {
    16301630                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
    1631                     binNum = (int)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);
     1631                    binNum = (psS32)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);
    16321632
    16331633                    // NOTE: This next if-statement really shouldn't be necessary.
     
    16731673psVector* p_psConvertToF32(psVector* in)
    16741674{
    1675     int i = 0;
     1675    psS32 i = 0;
    16761676    psVector* tmp = NULL;
    16771677
     
    17241724                       psVector* in,
    17251725                       psVector* mask,
    1726                        unsigned int maskVal)
     1726                       psU32 maskVal)
    17271727{
    17281728    psVector* inF32;
    1729     int mustFreeTmp = 1;
     1729    psS32 mustFreeTmp = 1;
    17301730
    17311731    if (in == NULL) {
  • trunk/psLib/src/dataManip/psStats.h

    r1980 r2204  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-06 20:07:04 $
     12 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767    double robustUQ;            ///< robust upper quartile
    6868    double robustLQ;            ///< robust lower quartile
    69     int robustN50;              ///<
    70     int robustNfit;             ///<
     69    psS32 robustN50;              ///<
     70    psS32 robustNfit;             ///<
    7171    double clippedMean;         ///< Nsigma clipped mean
    7272    double clippedStdev;        ///< standard deviation after clipping
    73     int clippedNvalues;         ///< ???
     73    psS32 clippedNvalues;         ///< ???
    7474    double clipSigma;           ///< Nsigma used for clipping; user input
    75     int clipIter;               ///< Number of clipping iterations; user input
     75    psS32 clipIter;               ///< Number of clipping iterations; user input
    7676    double min;                 ///< minimum data value in array
    7777    double max;                 ///< maximum data value in array
     
    8989    psVector* in,    ///< Vector to be analysed: must be F32
    9090    psVector* mask,    ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL
    91     unsigned int maskVal    ///< Only mask elements with one of these bits set in maskVector
     91    psU32 maskVal    ///< Only mask elements with one of these bits set in maskVector
    9292);
    9393
     
    118118    psVector* bounds;                  ///< Bounds for the bins (type F32)
    119119    psVector* nums;                    ///< Number in each of the bins (INT)
    120     int minNum;                        ///< Number below the minimum
    121     int maxNum;                        ///< Number above the maximum
    122     bool uniform;                      ///< Is it a uniform distribution?
     120    psS32 minNum;                        ///< Number below the minimum
     121    psS32 maxNum;                        ///< Number above the maximum
     122    psBool uniform;                      ///< Is it a uniform distribution?
    123123}
    124124psHistogram;
     
    133133    float lower,                       ///< Lower limit for the bins
    134134    float upper,                       ///< Upper limit for the bins
    135     int n                              ///< Number of bins
     135    psS32 n                              ///< Number of bins
    136136);
    137137
     
    157157    const psVector* restrict in,       ///< Vector to analyse
    158158    const psVector* restrict mask,     ///< Mask dat for input vector
    159     unsigned int maskVal               ///< Mask value
     159    psU32 maskVal               ///< Mask value
    160160);
    161161
    162162/** Extracts the statistic value specified by stats->options.
    163163 *
    164  *  @return bool    If more than one statistic result is set in stats->options,
     164 *  @return psBool    If more than one statistic result is set in stats->options,
    165165 *                  false is returned and the value parameter is not set,
    166166 *                  otherwise true is returned.
    167167 */
    168 bool p_psGetStatValue(
     168psBool p_psGetStatValue(
    169169    const psStats* stats,
    170170    ///< the statistic struct to operate on
  • trunk/psLib/src/dataManip/psVectorFFT.c

    r2080 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-13 20:46:57 $
     7 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2828
    29 static bool p_fftwWisdomImported = false;
     29static psBool p_fftwWisdomImported = false;
    3030
    3131psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction)
    3232{
    33     unsigned int numElements;
     33    psU32 numElements;
    3434    psElemType type;
    3535    fftwf_plan plan;
     
    8585
    8686    if ((direction & PS_FFT_REAL_RESULT) != 0) {
    87         for (int i = 0; i < numElements; i++) {
     87        for (psS32 i = 0; i < numElements; i++) {
    8888            out->data.F32[i] = out->data.C32[i];
    8989        }
     
    9898{
    9999    psElemType type;
    100     unsigned int numElements;
     100    psU32 numElements;
    101101
    102102    if (in == NULL) {
     
    127127        outVec = out->data.F32;
    128128
    129         for (unsigned int i = 0; i < numElements; i++) {
     129        for (psU32 i = 0; i < numElements; i++) {
    130130            outVec[i] = crealf(inVec[i]);
    131131        }
     
    138138        outVec = out->data.F64;
    139139
    140         for (unsigned int i = 0; i < numElements; i++) {
     140        for (psU32 i = 0; i < numElements; i++) {
    141141            outVec[i] = creal(inVec[i]);
    142142        }
     
    158158{
    159159    psElemType type;
    160     unsigned int numElements;
     160    psU32 numElements;
    161161
    162162    if (in == NULL) {
     
    187187        outVec = out->data.F32;
    188188
    189         for (unsigned int i = 0; i < numElements; i++) {
     189        for (psU32 i = 0; i < numElements; i++) {
    190190            outVec[i] = cimagf(inVec[i]);
    191191        }
     
    198198        outVec = out->data.F64;
    199199
    200         for (unsigned int i = 0; i < numElements; i++) {
     200        for (psU32 i = 0; i < numElements; i++) {
    201201            outVec[i] = cimag(inVec[i]);
    202202        }
     
    218218{
    219219    psElemType type;
    220     unsigned int numElements;
     220    psU32 numElements;
    221221
    222222    if (real == NULL || imag == NULL) {
     
    254254        outVec = out->data.C32;
    255255
    256         for (unsigned int i = 0; i < numElements; i++) {
     256        for (psU32 i = 0; i < numElements; i++) {
    257257            outVec[i] = realVec[i] + I * imagVec[i];
    258258        }
     
    266266        outVec = out->data.C64;
    267267
    268         for (unsigned int i = 0; i < numElements; i++) {
     268        for (psU32 i = 0; i < numElements; i++) {
    269269            outVec[i] = realVec[i] + I * imagVec[i];
    270270        }
     
    286286{
    287287    psElemType type;
    288     unsigned int numElements;
     288    psU32 numElements;
    289289
    290290    if (in == NULL) {
     
    316316        outVec = out->data.C32;
    317317
    318         for (unsigned int i = 0; i < numElements; i++) {
     318        for (psU32 i = 0; i < numElements; i++) {
    319319            outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]);
    320320        }
     
    327327        outVec = out->data.C64;
    328328
    329         for (unsigned int i = 0; i < numElements; i++) {
     329        for (psU32 i = 0; i < numElements; i++) {
    330330            outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]);
    331331        }
     
    347347{
    348348    psElemType type;
    349     unsigned int outNumElements;
    350     unsigned int inNumElements;
    351     unsigned int inHalfNumElements;
    352     unsigned int inNumElementsSquared;
     349    psU32 outNumElements;
     350    psU32 inNumElements;
     351    psU32 inHalfNumElements;
     352    psU32 inNumElementsSquared;
    353353
    354354    if (in == NULL) {
     
    378378
    379379        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
    380         for (unsigned int i = 1; i < inHalfNumElements; i++) {
     380        for (psU32 i = 1; i < inHalfNumElements; i++) {
    381381            inAbs1 = cabsf(inVec[i]);
    382382            inAbs2 = cabsf(inVec[inNumElements - i]);
     
    402402
    403403        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
    404         for (unsigned int i = 1; i < inHalfNumElements; i++) {
     404        for (psU32 i = 1; i < inHalfNumElements; i++) {
    405405            inAbs1 = cabs(inVec[i]);
    406406            inAbs2 = cabs(inVec[inNumElements - i]);
  • trunk/psLib/src/fft/psImageFFT.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
    1212#include <unistd.h>
    13 #include <stdbool.h>
    1413#include <string.h>
    1514#include <complex.h>
     
    2726#define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2827
    29 static bool p_fftwWisdomImported = false;
     28static psBool p_fftwWisdomImported = false;
    3029
    3130psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3231{
    33     unsigned int numCols;
    34     unsigned int numRows;
     32    psU32 numCols;
     33    psU32 numRows;
    3534    psElemType type;
    3635    fftwf_plan plan;
     
    7776
    7877    // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place.
    79     int sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
     78    psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
    8079    out = psImageCopy(out, in, PS_TYPE_C32);
    8180    plan = fftwf_plan_dft_2d(numCols, numRows,
     
    118117{
    119118    psElemType type;
    120     unsigned int numCols;
    121     unsigned int numRows;
     119    psU32 numCols;
     120    psU32 numRows;
    122121
    123122    if (in == NULL) {
     
    140139
    141140        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    142         for (unsigned int row = 0; row < numRows; row++) {
     141        for (psU32 row = 0; row < numRows; row++) {
    143142            outRow = out->data.F32[row];
    144143            inRow = in->data.C32[row];
    145144
    146             for (unsigned int col = 0; col < numCols; col++) {
     145            for (psU32 col = 0; col < numCols; col++) {
    147146                outRow[col] = crealf(inRow[col]);
    148147            }
     
    153152
    154153        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    155         for (unsigned int row = 0; row < numRows; row++) {
     154        for (psU32 row = 0; row < numRows; row++) {
    156155            outRow = out->data.F64[row];
    157156            inRow = in->data.C64[row];
    158157
    159             for (unsigned int col = 0; col < numCols; col++) {
     158            for (psU32 col = 0; col < numCols; col++) {
    160159                outRow[col] = creal(inRow[col]);
    161160            }
     
    179178{
    180179    psElemType type;
    181     unsigned int numCols;
    182     unsigned int numRows;
     180    psU32 numCols;
     181    psU32 numRows;
    183182
    184183    if (in == NULL) {
     
    203202
    204203        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    205         for (unsigned int row = 0; row < numRows; row++) {
     204        for (psU32 row = 0; row < numRows; row++) {
    206205            outRow = out->data.F32[row];
    207206            inRow = in->data.C32[row];
    208207
    209             for (unsigned int col = 0; col < numCols; col++) {
     208            for (psU32 col = 0; col < numCols; col++) {
    210209                outRow[col] = cimagf(inRow[col]);
    211210            }
     
    216215
    217216        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    218         for (unsigned int row = 0; row < numRows; row++) {
     217        for (psU32 row = 0; row < numRows; row++) {
    219218            outRow = out->data.F64[row];
    220219            inRow = in->data.C64[row];
    221220
    222             for (unsigned int col = 0; col < numCols; col++) {
     221            for (psU32 col = 0; col < numCols; col++) {
    223222                outRow[col] = cimag(inRow[col]);
    224223            }
     
    241240{
    242241    psElemType type;
    243     unsigned int numCols;
    244     unsigned int numRows;
     242    psU32 numCols;
     243    psU32 numRows;
    245244
    246245    if (real == NULL || imag == NULL) {
     
    282281        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    283282
    284         for (unsigned int row = 0; row < numRows; row++) {
     283        for (psU32 row = 0; row < numRows; row++) {
    285284            outRow = out->data.C32[row];
    286285            realRow = real->data.F32[row];
    287286            imagRow = imag->data.F32[row];
    288287
    289             for (unsigned int col = 0; col < numCols; col++) {
     288            for (psU32 col = 0; col < numCols; col++) {
    290289                outRow[col] = realRow[col] + I * imagRow[col];
    291290            }
     
    297296
    298297        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    299         for (unsigned int row = 0; row < numRows; row++) {
     298        for (psU32 row = 0; row < numRows; row++) {
    300299            outRow = out->data.C64[row];
    301300            realRow = real->data.F64[row];
    302301            imagRow = imag->data.F64[row];
    303302
    304             for (unsigned int col = 0; col < numCols; col++) {
     303            for (psU32 col = 0; col < numCols; col++) {
    305304                outRow[col] = realRow[col] + I * imagRow[col];
    306305            }
     
    324323{
    325324    psElemType type;
    326     unsigned int numCols;
    327     unsigned int numRows;
     325    psU32 numCols;
     326    psU32 numRows;
    328327
    329328    if (in == NULL) {
     
    346345
    347346        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    348         for (unsigned int row = 0; row < numRows; row++) {
     347        for (psU32 row = 0; row < numRows; row++) {
    349348            outRow = out->data.C32[row];
    350349            inRow = in->data.C32[row];
    351350
    352             for (unsigned int col = 0; col < numCols; col++) {
     351            for (psU32 col = 0; col < numCols; col++) {
    353352                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
    354353            }
     
    359358
    360359        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    361         for (unsigned int row = 0; row < numRows; row++) {
     360        for (psU32 row = 0; row < numRows; row++) {
    362361            outRow = out->data.C64[row];
    363362            inRow = in->data.C64[row];
    364363
    365             for (unsigned int col = 0; col < numCols; col++) {
     364            for (psU32 col = 0; col < numCols; col++) {
    366365                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
    367366            }
     
    384383{
    385384    psElemType type;
    386     unsigned int numCols;
    387     unsigned int numRows;
    388     int numElementsSquared;
     385    psU32 numCols;
     386    psU32 numRows;
     387    psS32 numElementsSquared;
    389388
    390389    if (in == NULL) {
     
    405404
    406405        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    407         for (unsigned int row = 0; row < numRows; row++) {
     406        for (psU32 row = 0; row < numRows; row++) {
    408407            outRow = out->data.F32[row];
    409408            inRow = in->data.C32[row];
    410409
    411             for (unsigned int col = 0; col < numCols; col++) {
     410            for (psU32 col = 0; col < numCols; col++) {
    412411                real = crealf(inRow[col]);
    413412                imag = cimagf(inRow[col]);
     
    422421
    423422        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    424         for (unsigned int row = 0; row < numRows; row++) {
     423        for (psU32 row = 0; row < numRows; row++) {
    425424            outRow = out->data.F64[row];
    426425            inRow = in->data.C64[row];
    427426
    428             for (unsigned int col = 0; col < numCols; col++) {
     427            for (psU32 col = 0; col < numCols; col++) {
    429428                real = creal(inRow[col]);
    430429                imag = cimag(inRow[col]);
  • trunk/psLib/src/fft/psVectorFFT.c

    r2080 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-13 20:46:57 $
     7 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2828
    29 static bool p_fftwWisdomImported = false;
     29static psBool p_fftwWisdomImported = false;
    3030
    3131psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction)
    3232{
    33     unsigned int numElements;
     33    psU32 numElements;
    3434    psElemType type;
    3535    fftwf_plan plan;
     
    8585
    8686    if ((direction & PS_FFT_REAL_RESULT) != 0) {
    87         for (int i = 0; i < numElements; i++) {
     87        for (psS32 i = 0; i < numElements; i++) {
    8888            out->data.F32[i] = out->data.C32[i];
    8989        }
     
    9898{
    9999    psElemType type;
    100     unsigned int numElements;
     100    psU32 numElements;
    101101
    102102    if (in == NULL) {
     
    127127        outVec = out->data.F32;
    128128
    129         for (unsigned int i = 0; i < numElements; i++) {
     129        for (psU32 i = 0; i < numElements; i++) {
    130130            outVec[i] = crealf(inVec[i]);
    131131        }
     
    138138        outVec = out->data.F64;
    139139
    140         for (unsigned int i = 0; i < numElements; i++) {
     140        for (psU32 i = 0; i < numElements; i++) {
    141141            outVec[i] = creal(inVec[i]);
    142142        }
     
    158158{
    159159    psElemType type;
    160     unsigned int numElements;
     160    psU32 numElements;
    161161
    162162    if (in == NULL) {
     
    187187        outVec = out->data.F32;
    188188
    189         for (unsigned int i = 0; i < numElements; i++) {
     189        for (psU32 i = 0; i < numElements; i++) {
    190190            outVec[i] = cimagf(inVec[i]);
    191191        }
     
    198198        outVec = out->data.F64;
    199199
    200         for (unsigned int i = 0; i < numElements; i++) {
     200        for (psU32 i = 0; i < numElements; i++) {
    201201            outVec[i] = cimag(inVec[i]);
    202202        }
     
    218218{
    219219    psElemType type;
    220     unsigned int numElements;
     220    psU32 numElements;
    221221
    222222    if (real == NULL || imag == NULL) {
     
    254254        outVec = out->data.C32;
    255255
    256         for (unsigned int i = 0; i < numElements; i++) {
     256        for (psU32 i = 0; i < numElements; i++) {
    257257            outVec[i] = realVec[i] + I * imagVec[i];
    258258        }
     
    266266        outVec = out->data.C64;
    267267
    268         for (unsigned int i = 0; i < numElements; i++) {
     268        for (psU32 i = 0; i < numElements; i++) {
    269269            outVec[i] = realVec[i] + I * imagVec[i];
    270270        }
     
    286286{
    287287    psElemType type;
    288     unsigned int numElements;
     288    psU32 numElements;
    289289
    290290    if (in == NULL) {
     
    316316        outVec = out->data.C32;
    317317
    318         for (unsigned int i = 0; i < numElements; i++) {
     318        for (psU32 i = 0; i < numElements; i++) {
    319319            outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]);
    320320        }
     
    327327        outVec = out->data.C64;
    328328
    329         for (unsigned int i = 0; i < numElements; i++) {
     329        for (psU32 i = 0; i < numElements; i++) {
    330330            outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]);
    331331        }
     
    347347{
    348348    psElemType type;
    349     unsigned int outNumElements;
    350     unsigned int inNumElements;
    351     unsigned int inHalfNumElements;
    352     unsigned int inNumElementsSquared;
     349    psU32 outNumElements;
     350    psU32 inNumElements;
     351    psU32 inHalfNumElements;
     352    psU32 inNumElementsSquared;
    353353
    354354    if (in == NULL) {
     
    378378
    379379        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
    380         for (unsigned int i = 1; i < inHalfNumElements; i++) {
     380        for (psU32 i = 1; i < inHalfNumElements; i++) {
    381381            inAbs1 = cabsf(inVec[i]);
    382382            inAbs2 = cabsf(inVec[inNumElements - i]);
     
    402402
    403403        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
    404         for (unsigned int i = 1; i < inHalfNumElements; i++) {
     404        for (psU32 i = 1; i < inHalfNumElements; i++) {
    405405            inAbs1 = cabs(inVec[i]);
    406406            inAbs2 = cabs(inVec[inNumElements - i]);
  • trunk/psLib/src/image/psImage.c

    r2105 r2204  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-14 01:22:59 $
     12 *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929static void imageFree(psImage* image);
    3030
    31 psImage* psImageAlloc(unsigned int numCols,
    32                       unsigned int numRows,
     31psImage* psImageAlloc(psU32 numCols,
     32                      psU32 numRows,
    3333                      const psElemType type)
    3434{
    35     int area = 0;
    36     int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
    37     int rowSize = numCols * elementSize;        // row size in bytes.
     35    psS32 area = 0;
     36    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     37    psS32 rowSize = numCols * elementSize;        // row size in bytes.
    3838
    3939    area = numCols * numRows;
     
    5151    p_psMemSetDeallocator(image, (psFreeFcn) imageFree);
    5252
    53     image->data.V = psAlloc(sizeof(void *) * numRows);
     53    image->data.V = psAlloc(sizeof(psPtr ) * numRows);
    5454
    5555    image->rawDataBuffer = psAlloc(area * elementSize);
     
    5757    // set the row pointers.
    5858    image->data.V[0] = image->rawDataBuffer;
    59     for (int i = 1; i < numRows; i++) {
    60         image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
    61     }
    62 
    63     *(int *)&image->col0 = 0;
    64     *(int *)&image->row0 = 0;
    65     *(unsigned int *)&image->numCols = numCols;
    66     *(unsigned int *)&image->numRows = numRows;
     59    for (psS32 i = 1; i < numRows; i++) {
     60        image->data.V[i] = (psPtr )((int8_t *) image->data.V[i - 1] + rowSize);
     61    }
     62
     63    *(psS32 *)&image->col0 = 0;
     64    *(psS32 *)&image->row0 = 0;
     65    *(psU32 *)&image->numCols = numCols;
     66    *(psU32 *)&image->numRows = numRows;
    6767    *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE;
    6868    *(psElemType* ) & image->type.type = type;
     
    8181    if (image->type.type == PS_TYPE_PTR) {
    8282        // 2-D array of pointers -- must dereference elements
    83         unsigned int oldNumRows = image->numRows;
    84         unsigned int oldNumCols = image->numCols;
    85         psPTR* rowPtr;
    86 
    87         for (unsigned int row = 0; row < oldNumRows; row++) {
     83        psU32 oldNumRows = image->numRows;
     84        psU32 oldNumCols = image->numCols;
     85        psPtr* rowPtr;
     86
     87        for (psU32 row = 0; row < oldNumRows; row++) {
    8888            rowPtr = image->data.PTR[row];
    89             for (unsigned int col = 0; col < oldNumCols; col++) {
     89            for (psU32 col = 0; col < oldNumCols; col++) {
    9090                psMemDecrRefCounter(rowPtr[col]);
    9191            }
     
    105105
    106106psImage* psImageRecycle(psImage* old,
    107                         unsigned int numCols,
    108                         unsigned int numRows,
     107                        psU32 numCols,
     108                        psU32 numRows,
    109109                        const psElemType type)
    110110{
    111     int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
    112     int rowSize = numCols * elementSize;        // row size in bytes.
     111    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     112    psS32 rowSize = numCols * elementSize;        // row size in bytes.
    113113
    114114    if (old == NULL) {
     
    128128        // 2-D array of pointers -- must
    129129        // dereference
    130         unsigned int oldNumRows = old->numRows;
    131         unsigned int oldNumCols = old->numCols;
    132         psPTR* rowPtr;
    133 
    134         for (unsigned int row = 0; row < oldNumRows; row++) {
     130        psU32 oldNumRows = old->numRows;
     131        psU32 oldNumCols = old->numCols;
     132        psPtr* rowPtr;
     133
     134        for (psU32 row = 0; row < oldNumRows; row++) {
    135135            rowPtr = old->data.PTR[row];
    136             for (unsigned int col = 0; col < oldNumCols; col++) {
     136            for (psU32 col = 0; col < oldNumCols; col++) {
    137137                psMemDecrRefCounter(rowPtr[col]);
    138138                rowPtr[col] = NULL;
     
    149149    old->rawDataBuffer = psRealloc(old->data.V[0],
    150150                                   numCols * numRows * elementSize);
    151     old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
     151    old->data.V = (psPtr *)psRealloc(old->data.V, numRows * sizeof(psPtr ));
    152152
    153153    // recreate the row pointers
    154154    old->data.V[0] = old->rawDataBuffer;
    155     for (int i = 1; i < numRows; i++) {
    156         old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
    157     }
    158 
    159     *(unsigned int *)&old->numCols = numCols;
    160     *(unsigned int *)&old->numRows = numRows;
     155    for (psS32 i = 1; i < numRows; i++) {
     156        old->data.V[i] = (psPtr )((int8_t *) old->data.V[i - 1] + rowSize);
     157    }
     158
     159    *(psU32 *)&old->numCols = numCols;
     160    *(psU32 *)&old->numRows = numRows;
    161161    *(psElemType* ) & old->type.type = type;
    162162
     
    169169{
    170170    psElemType inDatatype;
    171     int elementSize;
    172     int elements;
    173     int numRows;
    174     int numCols;
     171    psS32 elementSize;
     172    psS32 elements;
     173    psS32 numRows;
     174    psS32 numCols;
    175175
    176176    if (input == NULL || input->data.V == NULL) {
     
    218218    // datatype.
    219219    if (type == inDatatype) {
    220         for (int row=0;row<numRows;row++) {
     220        for (psS32 row=0;row<numRows;row++) {
    221221            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
    222222        }
     
    227227        ps##INTYPE *in; \
    228228        ps##OUTTYPE *out; \
    229         for(int row=0;row<numRows;row++) { \
     229        for(psS32 row=0;row<numRows;row++) { \
    230230            in = IN->data.INTYPE[row]; \
    231231            out = OUT->data.OUTTYPE[row]; \
    232             for (int col=0;col<numCols;col++) { \
     232            for (psS32 col=0;col<numCols;col++) { \
    233233                *(out++) = *(in++); \
    234234            } \
     
    331331}
    332332
    333 int psImageFreeChildren(psImage* image)
     333psS32 psImageFreeChildren(psImage* image)
    334334{
    335     int numFreed = 0;
     335    psS32 numFreed = 0;
    336336
    337337    if (image == NULL) {
     
    345345        // orphan the children first
    346346        // (so psFree doesn't try to modify the parent's children array while I'm using it)
    347         for (int i=0;i<numFreed;i++) {
     347        for (psS32 i=0;i<numFreed;i++) {
    348348            children[i]->parent = NULL;
    349349        }
     
    366366                              float y,
    367367                              const psImage* mask,
    368                               unsigned int maskVal,
     368                              psU32 maskVal,
    369369                              psC64 unexposedValue,
    370370                              psImageInterpolateMode mode)
     
    438438        float y, \
    439439        const psImage* mask, \
    440         unsigned int maskVal, \
     440        psU32 maskVal, \
    441441        psF64 unexposedValue) \
    442442{ \
    443     int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \
    444     int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \
    445     int lastX = input->numCols - 1; \
    446     int lastY = input->numRows - 1; \
     443    psS32 intX = (psS32) round((psF64)(x) - 0.5 + FLT_EPSILON); \
     444    psS32 intY = (psS32) round((psF64)(y) - 0.5 + FLT_EPSILON); \
     445    psS32 lastX = input->numCols - 1; \
     446    psS32 lastY = input->numRows - 1; \
    447447    \
    448448    if ((intX < 0) || \
     
    463463        float y, \
    464464        const psImage* mask, \
    465         unsigned int maskVal, \
     465        psU32 maskVal, \
    466466        psC64 unexposedValue) \
    467467{ \
    468     int intX = (int) round((psF64)(x) - 0.5); \
    469     int intY = (int) round((psF64)(y) - 0.5); \
    470     int lastX = input->numCols - 1; \
    471     int lastY = input->numRows - 1; \
     468    psS32 intX = (psS32) round((psF64)(x) - 0.5); \
     469    psS32 intY = (psS32) round((psF64)(y) - 0.5); \
     470    psS32 lastX = input->numCols - 1; \
     471    psS32 lastY = input->numRows - 1; \
    472472    \
    473473    if ((intX < 0) || \
     
    501501        float y, \
    502502        const psImage* mask, \
    503         unsigned int maskVal, \
     503        psU32 maskVal, \
    504504        psF64 unexposedValue) \
    505505{ \
     
    508508    psF64 fracX = x - 0.5 - floorX; \
    509509    psF64 fracY = y - 0.5 - floorY; \
    510     int intFloorX = (int) floorX; \
    511     int intFloorY = (int) floorY; \
    512     int lastX = input->numCols - 1; \
    513     int lastY = input->numRows - 1; \
     510    psS32 intFloorX = (psS32) floorX; \
     511    psS32 intFloorY = (psS32) floorY; \
     512    psS32 lastX = input->numCols - 1; \
     513    psS32 lastY = input->numRows - 1; \
    514514    ps##TYPE V00; \
    515515    ps##TYPE V01; \
    516516    ps##TYPE V10; \
    517517    ps##TYPE V11; \
    518     bool valid00 = false; \
    519     bool valid01 = false; \
    520     bool valid10 = false; \
    521     bool valid11 = false; \
     518    psBool valid00 = false; \
     519    psBool valid01 = false; \
     520    psBool valid10 = false; \
     521    psBool valid11 = false; \
    522522    \
    523523    if (intFloorY >= 0 && intFloorY <= lastY) { \
     
    556556    \
    557557    psF64 V0; \
    558     bool valid0 = true; \
     558    psBool valid0 = true; \
    559559    if (valid00 && valid10) { \
    560560        V0 = V00*(1-fracX)+V10*fracX; \
     
    568568    \
    569569    psF64 V1; \
    570     bool valid1 = true; \
     570    psBool valid1 = true; \
    571571    if (valid01 && valid11) { \
    572572        V1 = V01*(1-fracX)+V11*fracX; \
     
    595595        float y, \
    596596        const psImage* mask, \
    597         unsigned int maskVal, \
     597        psU32 maskVal, \
    598598        psC64 unexposedValue) \
    599599{ \
     
    602602    psF64 fracX = x - 0.5 - floorX; \
    603603    psF64 fracY = y - 0.5 - floorY; \
    604     int intFloorX = (int) floorX; \
    605     int intFloorY = (int) floorY; \
    606     int lastX = input->numCols - 1; \
    607     int lastY = input->numRows - 1; \
     604    psS32 intFloorX = (psS32) floorX; \
     605    psS32 intFloorY = (psS32) floorY; \
     606    psS32 lastX = input->numCols - 1; \
     607    psS32 lastY = input->numRows - 1; \
    608608    ps##TYPE V00; \
    609609    ps##TYPE V01; \
    610610    ps##TYPE V10; \
    611611    ps##TYPE V11; \
    612     bool valid00 = false; \
    613     bool valid01 = false; \
    614     bool valid10 = false; \
    615     bool valid11 = false; \
     612    psBool valid00 = false; \
     613    psBool valid01 = false; \
     614    psBool valid10 = false; \
     615    psBool valid11 = false; \
    616616    \
    617617    if (intFloorY >= 0 && intFloorY <= lastY) { \
     
    650650    \
    651651    psC64 V0; \
    652     bool valid0 = true; \
     652    psBool valid0 = true; \
    653653    if (valid00 && valid10) { \
    654654        V0 = V00*(1-fracX)+V10*fracX; \
     
    662662    \
    663663    psC64 V1; \
    664     bool valid1 = true; \
     664    psBool valid1 = true; \
    665665    if (valid01 && valid11) { \
    666666        V0 = V01*(1-fracX)+V11*fracX; \
  • trunk/psLib/src/image/psImage.h

    r2105 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-14 01:22:59 $
     13 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4747{
    4848    const psType type;                 ///< Image data type and dimension.
    49     const unsigned int numCols;        ///< Number of columns in image
    50     const unsigned int numRows;        ///< Number of rows in image.
    51     const int col0;                    ///< Column position relative to parent.
    52     const int row0;                    ///< Row position relative to parent.
     49    const psU32 numCols;        ///< Number of columns in image
     50    const psU32 numRows;        ///< Number of rows in image.
     51    const psS32 col0;                    ///< Column position relative to parent.
     52    const psS32 row0;                    ///< Row position relative to parent.
    5353
    5454    union {
     
    6565        psC32** C32;                   ///< Single-precision complex data.
    6666        psC64** C64;                   ///< Double-precision complex data.
    67         psPTR** PTR;                   ///< Void pointers.
    68         psPTR*  V;                     ///< Pointer to data.
     67        psPtr** PTR;                   ///< Void pointers.
     68        psPtr*  V;                     ///< Pointer to data.
    6969    } data;                            ///< Union for data types.
    7070    const struct psImage* parent;      ///< Parent, if a subimage.
    7171    psArray* children;                 ///< Children of this region.
    7272
    73     void* rawDataBuffer;
     73    psPtr rawDataBuffer;
    7474}
    7575psImage;
     
    8484 */
    8585psImage* psImageAlloc(
    86     unsigned int numCols,              ///< Number of rows in image.
    87     unsigned int numRows,              ///< Number of columns in image.
     86    psU32 numCols,              ///< Number of rows in image.
     87    psU32 numRows,              ///< Number of columns in image.
    8888    const psElemType type              ///< Type of data for image.
    8989);
     
    9696psImage* psImageRecycle(
    9797    psImage* old,                      ///< the psImage to recycle by resizing image buffer
    98     unsigned int numCols,              ///< the desired number of columns in image
    99     unsigned int numRows,              ///< the desired number of rows in image
     98    psU32 numCols,              ///< the desired number of columns in image
     99    psU32 numRows,              ///< the desired number of rows in image
    100100    const psElemType type              ///< the desired datatype of the image
    101101);
     
    115115/** Frees all children of a psImage.
    116116 *
    117  *  @return int      Number of children freed.
     117 *  @return psS32      Number of children freed.
    118118 *
    119119 */
    120 int psImageFreeChildren(
     120psS32 psImageFreeChildren(
    121121    psImage* image                     ///< psImage in which all children shall be deallocated
    122122);
     
    132132    float y,                           ///< row location ot derive value of
    133133    const psImage* mask,               ///< if not NULL, the mask of the input image
    134     unsigned int maskVal,              ///< the mask value
     134    psU32 maskVal,              ///< the mask value
    135135    psC64 unexposedValue,              ///< return value if x,y location is not in image.
    136136    psImageInterpolateMode mode        ///< interpolation mode
     
    143143        float y,                       /**< row location ot derive value of */ \
    144144        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    145         unsigned int maskVal,          /**< the mask value */ \
     145        psU32 maskVal,          /**< the mask value */ \
    146146        psF64 unexposedValue           /**< return value if x,y location is not in image. */ \
    147147                                                 ); \
     
    151151        float y,                       /**< row location ot derive value of */ \
    152152        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    153         unsigned int maskVal,          /**< the mask value */ \
     153        psU32 maskVal,          /**< the mask value */ \
    154154        psF64 unexposedValue           /**< return value if x,y location is not in image. */ \
    155155                                                     );
     
    161161        float y,                       /**< row location ot derive value of */ \
    162162        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    163         unsigned int maskVal,          /**< the mask value */ \
     163        psU32 maskVal,          /**< the mask value */ \
    164164        psC64 unexposedValue           /**< return value if x,y location is not in image. */ \
    165165                                                 ); \
     
    169169        float y,                       /**< row location ot derive value of */ \
    170170        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    171         unsigned int maskVal,          /**< the mask value */ \
     171        psU32 maskVal,          /**< the mask value */ \
    172172        psC64 unexposedValue           /**< return value if x,y location is not in image. */ \
    173173                                                     );
  • trunk/psLib/src/image/psImageConvolve.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static void freeKernel(psKernel* ptr);
    2929
    30 psKernel* psKernelAlloc(int xMin, int xMax, int yMin, int yMax)
     30psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax)
    3131{
    3232    psKernel* result;
    33     int numRows;
    34     int numCols;
     33    psS32 numRows;
     34    psS32 numCols;
    3535
    3636    // following is explicitly spelled out in the SDRS as a requirement
     
    4040                 yMin, yMax);
    4141
    42         int temp = yMin;
     42        psS32 temp = yMin;
    4343        yMin = yMax;
    4444        yMax = temp;
     
    5151                 xMin, xMax);
    5252
    53         int temp = xMin;
     53        psS32 temp = xMin;
    5454        xMin = xMax;
    5555        xMax = temp;
     
    7070    psKernelType** kernelRows = result->p_kernelRows;
    7171    psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA;
    72     for (int i = 0; i < numRows; i++) {
     72    for (psS32 i = 0; i < numRows; i++) {
    7373        kernelRows[i] = imageRows[i] - xMin;
    7474    }
     
    9191                           const psVector* xShifts,
    9292                           const psVector* yShifts,
    93                            bool relative)
     93                           psBool relative)
    9494{
    95     int x = 0;
    96     int y = 0;
    97     int t = 0;
    98     int deltaT;
    99     int oldX;
    100     int oldY;
    101     int xMin = 0;
    102     int xMax = 0;
    103     int yMin = 0;
    104     int yMax = 0;
    105     int length = 0;
     95    psS32 x = 0;
     96    psS32 y = 0;
     97    psS32 t = 0;
     98    psS32 deltaT;
     99    psS32 oldX;
     100    psS32 oldY;
     101    psS32 xMin = 0;
     102    psS32 xMax = 0;
     103    psS32 yMin = 0;
     104    psS32 yMax = 0;
     105    psS32 length = 0;
    106106    psKernelType normalizeTime = 1.0;  // fraction of total time for each shift clock
    107107    psKernel* result = NULL;
     
    153153        y = 0; \
    154154        t = 0; \
    155         for (int lcv = 0; lcv < length; lcv++) { \
     155        for (psS32 lcv = 0; lcv < length; lcv++) { \
    156156            if (relative) { \
    157157                x += xShiftData[lcv]; \
     
    181181        y = 0; \
    182182        t = 0; \
    183         for (int i = 0; i < length; i++) { \
     183        for (psS32 i = 0; i < length; i++) { \
    184184            deltaT = t; \
    185185            oldX = x; \
     
    228228}
    229229
    230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)
     230psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct)
    231231{
    232232    if (in == NULL) {
     
    242242        return NULL;
    243243    }
    244     int xMin = kernel->xMin;
    245     int xMax = kernel->xMax;
    246     int yMin = kernel->yMin;
    247     int yMax = kernel->yMax;
     244    psS32 xMin = kernel->xMin;
     245    psS32 xMax = kernel->xMax;
     246    psS32 yMin = kernel->yMin;
     247    psS32 yMax = kernel->yMax;
    248248    psKernelType** kData = kernel->kernel;
    249249
    250250    // make the output image to the proper size and type
    251     int numRows = in->numRows;
    252     int numCols = in->numCols;
     251    psS32 numRows = in->numRows;
     252    psS32 numCols = in->numCols;
    253253
    254254
     
    261261            ps##TYPE** inData = in->data.TYPE; \
    262262            out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \
    263             for (int row=0;row<numRows;row++) { \
     263            for (psS32 row=0;row<numRows;row++) { \
    264264                ps##TYPE* outRow = out->data.TYPE[row]; \
    265                 for (int col=0;col<numCols;col++) { \
     265                for (psS32 col=0;col<numCols;col++) { \
    266266                    ps##TYPE pixel = 0.0; \
    267                     for (int kRow = yMin; kRow < yMax; kRow++) { \
     267                    for (psS32 kRow = yMin; kRow < yMax; kRow++) { \
    268268                        if (row-kRow >= 0 && row-kRow < numRows) { \
    269                             for (int kCol = xMin; kCol < xMax; kCol++) { \
     269                            for (psS32 kCol = xMin; kCol < xMax; kCol++) { \
    270270                                if (col-kCol >= 0 && col-kCol < numCols) { \
    271271                                    pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \
     
    310310    } else {
    311311        // fourier convolution
    312         int paddedCols = numCols+2*FOURIER_PADDING;
    313         int paddedRows = numRows+2*FOURIER_PADDING;
     312        psS32 paddedCols = numCols+2*FOURIER_PADDING;
     313        psS32 paddedRows = numRows+2*FOURIER_PADDING;
    314314
    315315        // check to see if kernel is smaller, otherwise padding it up will fail.
    316         int kRows = kernel->image->numRows;
    317         int kCols = kernel->image->numCols;
     316        psS32 kRows = kernel->image->numRows;
     317        psS32 kCols = kernel->image->numCols;
    318318        if (kRows >= numRows || kCols >= numCols) {
    319319            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve",
     
    328328        // pad the image
    329329        psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type);
    330         int elementSize = PSELEMTYPE_SIZEOF(in->type.type);
     330        psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type);
    331331
    332332        // zero out padded area on top and bottom
     
    335335
    336336        // fill in the image-containing rows.
    337         int sidePaddingSize = FOURIER_PADDING*elementSize;
    338         int imageRowSize = numCols*elementSize;
     337        psS32 sidePaddingSize = FOURIER_PADDING*elementSize;
     338        psS32 imageRowSize = numCols*elementSize;
    339339        psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING];
    340         for (int row=0;row<numRows;row++) {
     340        for (psS32 row=0;row<numRows;row++) {
    341341            // zero out padded area on left edge.
    342342            memset(paddedData,0,sidePaddingSize);
     
    354354        psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL);
    355355        memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image
    356         int yMax = kernel->yMax;
    357         int xMax = kernel->xMax;
    358         for (int row = kernel->yMin; row <= yMax;row++) {
    359             int padRow = row;
     356        psS32 yMax = kernel->yMax;
     357        psS32 xMax = kernel->xMax;
     358        for (psS32 row = kernel->yMin; row <= yMax;row++) {
     359            psS32 padRow = row;
    360360            if (padRow < 0) {
    361361                padRow += paddedRows;
     
    363363            psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow];
    364364            psKernelType* kernelRow = kernel->kernel[row];
    365             for (int col = kernel->xMin; col <= xMax; col++) {
     365            for (psS32 col = kernel->xMin; col <= xMax; col++) {
    366366                if (col < 0) {
    367367                    padData[col+paddedCols] = kernelRow[col];
     
    418418        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
    419419        float factor = 1.0f/numCols/numRows;
    420         for (int row = 0; row < numRows; row++) {
     420        for (psS32 row = 0; row < numRows; row++) {
    421421            psF32* outRow = out->data.F32[row];
    422422            psC32* resultRow = complexOutSansPad->data.C32[row];
    423             for (int col = 0; col < numCols; col++) {
     423            for (psS32 col = 0; col < numCols; col++) {
    424424                outRow[col] = crealf(resultRow[col])*factor;
    425425            }
  • trunk/psLib/src/image/psImageConvolve.h

    r1863 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 18:30:57 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#ifndef PS_IMAGE_CONVOLVE_H
    1616#define PS_IMAGE_CONVOLVE_H
    17 
    18 #include<stdbool.h>
    1917
    2018#include "psImage.h"
     
    3230{
    3331    psImage* image;                    ///< Kernel data, in the form of an image
    34     int xMin;                          ///< Most negative x index
    35     int yMin;                          ///< Most negative y index
    36     int xMax;                          ///< Most positive x index
    37     int yMax;                          ///< Most positive y index
     32    psS32 xMin;                          ///< Most negative x index
     33    psS32 yMin;                          ///< Most negative y index
     34    psS32 xMax;                          ///< Most positive x index
     35    psS32 yMax;                          ///< Most positive y index
    3836    psKernelType** kernel;             ///< Pointer to the kernel data
    3937    psKernelType** p_kernelRows;       ///< Pointer to the rows of the kernel data; not intended for user use.
     
    6866 */
    6967psKernel* psKernelAlloc(
    70     int xMin,                          ///< Most negative x index
    71     int xMax,                          ///< Most positive x index
    72     int yMin,                          ///< Most negative y index
    73     int yMax                           ///< Most positive y index
     68    psS32 xMin,                          ///< Most negative x index
     69    psS32 xMax,                          ///< Most positive x index
     70    psS32 yMin,                          ///< Most negative y index
     71    psS32 yMax                           ///< Most positive y index
    7472);
    7573
     
    9492    const psVector* xShifts,           ///< list of x-axis shifts
    9593    const psVector* yShifts,           ///< list of y-axis shifts
    96     bool relative
     94    psBool relative
    9795);
    9896
     
    118116    const psImage* in,                 ///< the psImage to convolve
    119117    const psKernel* kernel,            ///< kernel to colvolve with
    120     bool direct                        ///< specifies method, true=direct convolution, false=fourier
     118    psBool direct                        ///< specifies method, true=direct convolution, false=fourier
    121119);
    122120
  • trunk/psLib/src/image/psImageExtraction.c

    r2105 r2204  
    99 *  @author Robert DeSonia, MHPCC
    1010 *
    11  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-14 01:22:59 $
     11 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626psImage* imageSubset(psImage* out,
    2727                     psImage* image,
    28                      int col0,
    29                      int row0,
    30                      int col1,
    31                      int row1)
     28                     psS32 col0,
     29                     psS32 row0,
     30                     psS32 col1,
     31                     psS32 row1)
    3232{
    33     unsigned int elementSize;          // size of image element in bytes
    34     unsigned int inputColOffset;       // offset in bytes to first subset pixel in input row
     33    psU32 elementSize;          // size of image element in bytes
     34    psU32 inputColOffset;       // offset in bytes to first subset pixel in input row
    3535
    3636    if (image == NULL || image->data.V == NULL) {
     
    6868        return NULL;
    6969    }
    70     int numRows = row1-row0;
    71     int numCols = col1-col0;
     70    psS32 numRows = row1-row0;
     71    psS32 numCols = col1-col0;
    7272
    7373    elementSize = PSELEMTYPE_SIZEOF(image->type.type);
     
    8282
    8383    // increment the raw data buffer before freeing anything in the 'out'
    84     void* rawData = psMemIncrRefCounter(image->rawDataBuffer);
     84    psPtr rawData = psMemIncrRefCounter(image->rawDataBuffer);
    8585
    8686    if (out != NULL) {
     
    9797    }
    9898
    99     out->data.V = psRealloc(out->data.V,sizeof(void*)*numRows); // resize row pointer array
     99    out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array
    100100    *(psType*)&out->type = image->type;
    101     *(unsigned int*)&out->numCols = numCols;
    102     *(unsigned int*)&out->numRows = numRows;
    103     *(int*)&out->row0 = row0;
    104     *(int*)&out->col0 = col0;
     101    *(psU32*)&out->numCols = numCols;
     102    *(psU32*)&out->numRows = numRows;
     103    *(psS32*)&out->row0 = row0;
     104    *(psS32*)&out->col0 = col0;
    105105    out->parent = image;
    106106    out->children = NULL;
     
    111111
    112112    inputColOffset = elementSize * col0;
    113     for (int row = 0; row < numRows; row++) {
     113    for (psS32 row = 0; row < numRows; row++) {
    114114        out->data.V[row] = image->data.U8[row0 + row] + inputColOffset;
    115115    }
    116116
    117117    // add output image as a child of the input image.
    118     int n = 0;
     118    psS32 n = 0;
    119119    psArray* children = image->children;
    120120    if (children == NULL) {
     
    134134
    135135psImage* psImageSubset(psImage* image,
    136                        int col0,
    137                        int row0,
    138                        int col1,
    139                        int row1)
     136                       psS32 col0,
     137                       psS32 row0,
     138                       psS32 col1,
     139                       psS32 row1)
    140140{
    141141    return imageSubset(NULL,image,col0,row0,col1,row1);
     
    145145                           const char* section)
    146146{
    147     int col0;
    148     int col1;
    149     int row0;
    150     int row1;
     147    psS32 col0;
     148    psS32 col1;
     149    psS32 row0;
     150    psS32 row1;
    151151
    152152    // section should be of the form '[col0:col1,row0:row1]'
     
    177177}
    178178
    179 psImage* psImageTrim(psImage* image, int col0, int row0, int col1, int row1)
     179psImage* psImageTrim(psImage* image, psS32 col0, psS32 row0, psS32 col1, psS32 row1)
    180180{
    181181    if (image == NULL || image->data.V == NULL) {
     
    220220    psImageFreeChildren(image);
    221221
    222     unsigned int elementSize = PSELEMTYPE_SIZEOF(image->type.type);
    223     unsigned int numCols = col1-col0;
    224     unsigned int numRows = row1-row0;
    225     unsigned int rowSize = elementSize*numCols;
    226     unsigned int colOffset = elementSize * col0;
     222    psU32 elementSize = PSELEMTYPE_SIZEOF(image->type.type);
     223    psU32 numCols = col1-col0;
     224    psU32 numRows = row1-row0;
     225    psU32 rowSize = elementSize*numCols;
     226    psU32 colOffset = elementSize * col0;
    227227    psU8* imageData = image->rawDataBuffer;
    228     for (int row = row0; row < row1; row++) {
     228    for (psS32 row = row0; row < row1; row++) {
    229229        memmove(imageData,image->data.U8[row] + colOffset,rowSize);
    230230        imageData += rowSize;
    231231    }
    232232
    233     *(unsigned int*)&image->numRows = numRows;
    234     *(unsigned int*)&image->numCols = numCols;
     233    *(psU32*)&image->numRows = numRows;
     234    *(psU32*)&image->numCols = numCols;
    235235
    236236    // XXX: should I really resize the buffers?
    237     image->data.V = psRealloc(image->data.V,sizeof(void*)*numRows);
     237    image->data.V = psRealloc(image->data.V,sizeof(psPtr)*numRows);
    238238    image->rawDataBuffer = psRealloc(image->rawDataBuffer,rowSize*numRows);
    239239
    240240    image->data.V[0] = image->rawDataBuffer;
    241     for (int r = 1; r < numRows; r++) {
     241    for (psS32 r = 1; r < numRows; r++) {
    242242        image->data.U8[r] = image->data.U8[r-1] + rowSize;
    243243    }
     
    250250                       const psImage* restrict in,
    251251                       const psImage* restrict mask,
    252                        unsigned int maskVal,
    253                        int col0,
    254                        int row0,
    255                        int col1,
    256                        int row1,
     252                       psU32 maskVal,
     253                       psS32 col0,
     254                       psS32 row0,
     255                       psS32 col1,
     256                       psS32 row1,
    257257                       psImageCutDirection direction,
    258258                       const psStats* stats)
     
    261261    psStats* myStats;
    262262    psElemType type;
    263     int inRows;
    264     int inCols;
    265     int delta = 1;
     263    psS32 inRows;
     264    psS32 inCols;
     265    psS32 delta = 1;
    266266    psF64* outData;
    267267
     
    349349    *myStats = *stats;
    350350
    351     int numCols = col1-col0;
    352     int numRows = row1-row0;
     351    psS32 numCols = col1-col0;
     352    psS32 numRows = row1-row0;
    353353
    354354    if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) {
     
    380380    case PS_TYPE_##TYPE: { \
    381381            psMaskType* maskVecData = NULL; \
    382             for (int c=col0;c<col1;c++) { \
     382            for (psS32 c=col0;c<col1;c++) { \
    383383                ps##TYPE *imgData = in->data.TYPE[row0] + c; \
    384384                ps##TYPE *imgVecData = imgVec->data.TYPE; \
     
    387387                    maskData = (psMaskType* )(mask->data.V[row0]) + c; \
    388388                } \
    389                 for (int r=row0;r<row1;r++) { \
     389                for (psS32 r=row0;r<row1;r++) { \
    390390                    *(imgVecData++) = *imgData; \
    391391                    imgData += inCols; \
     
    437437        psVector* imgVec = NULL;
    438438        psVector* maskVec = NULL;
    439         int elementSize = PSELEMTYPE_SIZEOF(type);
     439        psS32 elementSize = PSELEMTYPE_SIZEOF(type);
    440440        psU32* outPosition = NULL;
    441441
     
    465465        }
    466466
    467         for (int r = row0; r < row1; r++) {
     467        for (psS32 r = row0; r < row1; r++) {
    468468            // point the vector struct to the
    469469            // data to calculate the stats
    470             imgVec->data.V = (void *)(in->data.U8[r] + col0 * elementSize);
     470            imgVec->data.V = (psPtr )(in->data.U8[r] + col0 * elementSize);
    471471            if (maskVec != NULL) {
    472                 maskVec->data.V = (void *)(mask->data.U8[r] + col0 * sizeof(psMaskType));
     472                maskVec->data.V = (psPtr )(mask->data.U8[r] + col0 * sizeof(psMaskType));
    473473            }
    474474            myStats = psVectorStats(myStats, imgVec, maskVec, maskVal);
     
    503503                     const psImage* in,
    504504                     const psImage* restrict mask,
    505                      unsigned int maskVal,
     505                     psU32 maskVal,
    506506                     float startCol,
    507507                     float startRow,
    508508                     float endCol,
    509509                     float endRow,
    510                      unsigned int nSamples,
     510                     psU32 nSamples,
    511511                     psImageInterpolateMode mode)
    512512{
     
    518518        return NULL;
    519519    }
    520     int numCols = in->numCols;
    521     int numRows = in->numRows;
     520    psS32 numCols = in->numCols;
     521    psS32 numRows = in->numRows;
    522522
    523523    if (nSamples < 2) {
     
    594594case PS_TYPE_##TYPE: { \
    595595        ps##TYPE* outData = out->data.TYPE; \
    596         for (int i = 0; i < nSamples; i++) { \
     596        for (psS32 i = 0; i < nSamples; i++) { \
    597597            float x = startCol + (float)i*dX; \
    598598            float y = startRow + (float)i*dY; \
     
    642642                           const psImage* in,
    643643                           const psImage* restrict mask,
    644                            unsigned int maskVal,
     644                           psU32 maskVal,
    645645                           float centerCol,
    646646                           float centerRow,
     
    659659        return NULL;
    660660    }
    661     int numCols = in->numCols;
    662     int numRows = in->numRows;
     661    psS32 numCols = in->numCols;
     662    psS32 numRows = in->numRows;
    663663
    664664    if (mask != NULL) {
     
    734734
    735735    // size the output vector to proper size.
    736     int numOut = radii->n - 1;
     736    psS32 numOut = radii->n - 1;
    737737    out = psVectorRecycle(out, numOut, PS_TYPE_F64);
    738738    psF64* outData = out->data.F64;
     
    741741    psF32* rSq = rSqVec->data.F32;
    742742
    743     int startRow = centerRow - rSq[numOut];
    744     int endRow = centerRow + rSq[numOut];
    745     int startCol = centerCol - rSq[numOut];
    746     int endCol = centerCol + rSq[numOut];
     743    psS32 startRow = centerRow - rSq[numOut];
     744    psS32 endRow = centerRow + rSq[numOut];
     745    psS32 startCol = centerCol - rSq[numOut];
     746    psS32 endCol = centerCol + rSq[numOut];
    747747
    748748    if (startRow < 0) {
     
    763763
    764764    // Square the radii data
    765     for (int d = 0; d <= numOut; d++) {
     765    for (psS32 d = 0; d <= numOut; d++) {
    766766        rSq[d] *= rSq[d];
    767767    }
     
    770770    psVector** buffer = psAlloc(sizeof(psVector*)*numOut);
    771771    psVector** bufferMask = psAlloc(sizeof(psVector*)*numOut);
    772     for (int lcv = 0; lcv < numOut; lcv++) {
     772    for (psS32 lcv = 0; lcv < numOut; lcv++) {
    773773        // n.b. alloc enough for the data by making the vectors slightly larger
    774774        // than the area of the region of interest.
     
    788788    float dY;
    789789    float dist;
    790     for (int row=startRow; row <= endRow; row++) {
     790    for (psS32 row=startRow; row <= endRow; row++) {
    791791        psF32* inRow = in->data.F32[row];
    792792        psMaskType* maskRow = NULL;
     
    794794            maskRow = mask->data.PS_TYPE_MASK_DATA[row];
    795795        }
    796         for (int col=startCol; col <= endCol; col++) {
     796        for (psS32 col=startCol; col <= endCol; col++) {
    797797            dX = centerCol - (float)col - 0.5f;
    798798            dY = centerRow - (float)row - 0.5f;
    799799            dist = dX*dX+dY*dY;
    800             for (int r = 0; r < numOut; r++) {
     800            for (psS32 r = 0; r < numOut; r++) {
    801801                if (rSq[r] < dist && dist < rSq[r+1]) {
    802                     int n = buffer[r]->n;
     802                    psS32 n = buffer[r]->n;
    803803                    if (n == buffer[r]->nalloc) { // in case buffers already full, expand
    804804                        buffer[r] = psVectorRealloc(buffer[r], n*2);
     
    825825    *myStats = *stats;
    826826
    827     for (int r = 0; r < numOut; r++) {
     827    for (psS32 r = 0; r < numOut; r++) {
    828828        myStats = psVectorStats(myStats,buffer[r], bufferMask[r],maskVal);
    829829        (void)p_psGetStatValue(myStats,&statVal);
     
    833833    psFree(myStats);
    834834
    835     for (int lcv = 0; lcv < numOut; lcv++) {
     835    for (psS32 lcv = 0; lcv < numOut; lcv++) {
    836836        psFree(buffer[lcv]);
    837837        psFree(bufferMask[lcv]);
  • trunk/psLib/src/image/psImageExtraction.h

    r2088 r2204  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-13 22:05:03 $
     12*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:31 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454psImage* psImageSubset(
    5555    psImage* image,                    ///< Parent image.
    56     int col0,                          ///< starting column of subimage
    57     int row0,                          ///< starting row of subimage
    58     int col1,                          ///< exclusive end column of subimage.
    59     int row1                           ///< exclusive end row of subimage
     56    psS32 col0,                          ///< starting column of subimage
     57    psS32 row0,                          ///< starting row of subimage
     58    psS32 col1,                          ///< exclusive end column of subimage.
     59    psS32 row1                           ///< exclusive end row of subimage
    6060);
    6161
     
    9393psImage* psImageTrim(
    9494    psImage* image,                    ///< image to trim
    95     int col0,                          ///< column of trim region's left boundary
    96     int row0,                          ///< row of trim region's lower boundary
    97     int col1,                          ///< column of trim region's right boundary
    98     int row1                           ///< row of trim region's upper boundary
     95    psS32 col0,                          ///< column of trim region's left boundary
     96    psS32 row0,                          ///< row of trim region's lower boundary
     97    psS32 col1,                          ///< column of trim region's right boundary
     98    psS32 row1                           ///< row of trim region's upper boundary
    9999);
    100100
     
    130130    const psImage* restrict input,     ///< the input image in which to perform the slice
    131131    const psImage* restrict mask,      ///< the mask for the input image.
    132     unsigned int maskVal,              ///< the mask value to apply to the mask
    133     int col0,                          ///< the leftmost column of the slice region
    134     int row0,                          ///< the bottommost row of the slice region
    135     int col1,                          ///< exclusive end column of the slice region
    136     int row1,                           ///< exclusive end row of the slice region
     132    psU32 maskVal,              ///< the mask value to apply to the mask
     133    psS32 col0,                          ///< the leftmost column of the slice region
     134    psS32 row0,                          ///< the bottommost row of the slice region
     135    psS32 col1,                          ///< exclusive end column of the slice region
     136    psS32 row1,                           ///< exclusive end row of the slice region
    137137    psImageCutDirection direction,     ///< the slice dimension and direction
    138138    const psStats* stats               ///< the statistic to perform in slice operation
     
    161161    const psImage* input,              ///< the input image in which to perform the cut
    162162    const psImage* restrict mask,      ///< the mask for the input image.
    163     unsigned int maskVal,              ///< the mask value to apply to the mask
     163    psU32 maskVal,              ///< the mask value to apply to the mask
    164164    float startCol,                    ///< the column of the start of the cut line
    165165    float startRow,                    ///< the row of the start of the cut line
    166166    float endCol,                      ///< the column of the end of the cut line
    167167    float endRow,                      ///< the row of the end of the cut line
    168     unsigned int nSamples,             ///< the number of samples along the cut
     168    psU32 nSamples,             ///< the number of samples along the cut
    169169    psImageInterpolateMode mode        ///< the interpolation method to use
    170170);
     
    187187    const psImage* input,              ///< the input image in which to perform the cut
    188188    const psImage* restrict mask,      ///< the mask for the input image.
    189     unsigned int maskVal,              ///< the mask value to apply to the mask
     189    psU32 maskVal,              ///< the mask value to apply to the mask
    190190    float centerCol,                   ///< the column of the center of the cut circle
    191191    float centerRow,                   ///< the row of the center of the cut circle
  • trunk/psLib/src/image/psImageFFT.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
    1212#include <unistd.h>
    13 #include <stdbool.h>
    1413#include <string.h>
    1514#include <complex.h>
     
    2726#define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2827
    29 static bool p_fftwWisdomImported = false;
     28static psBool p_fftwWisdomImported = false;
    3029
    3130psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3231{
    33     unsigned int numCols;
    34     unsigned int numRows;
     32    psU32 numCols;
     33    psU32 numRows;
    3534    psElemType type;
    3635    fftwf_plan plan;
     
    7776
    7877    // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place.
    79     int sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
     78    psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
    8079    out = psImageCopy(out, in, PS_TYPE_C32);
    8180    plan = fftwf_plan_dft_2d(numCols, numRows,
     
    118117{
    119118    psElemType type;
    120     unsigned int numCols;
    121     unsigned int numRows;
     119    psU32 numCols;
     120    psU32 numRows;
    122121
    123122    if (in == NULL) {
     
    140139
    141140        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    142         for (unsigned int row = 0; row < numRows; row++) {
     141        for (psU32 row = 0; row < numRows; row++) {
    143142            outRow = out->data.F32[row];
    144143            inRow = in->data.C32[row];
    145144
    146             for (unsigned int col = 0; col < numCols; col++) {
     145            for (psU32 col = 0; col < numCols; col++) {
    147146                outRow[col] = crealf(inRow[col]);
    148147            }
     
    153152
    154153        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    155         for (unsigned int row = 0; row < numRows; row++) {
     154        for (psU32 row = 0; row < numRows; row++) {
    156155            outRow = out->data.F64[row];
    157156            inRow = in->data.C64[row];
    158157
    159             for (unsigned int col = 0; col < numCols; col++) {
     158            for (psU32 col = 0; col < numCols; col++) {
    160159                outRow[col] = creal(inRow[col]);
    161160            }
     
    179178{
    180179    psElemType type;
    181     unsigned int numCols;
    182     unsigned int numRows;
     180    psU32 numCols;
     181    psU32 numRows;
    183182
    184183    if (in == NULL) {
     
    203202
    204203        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    205         for (unsigned int row = 0; row < numRows; row++) {
     204        for (psU32 row = 0; row < numRows; row++) {
    206205            outRow = out->data.F32[row];
    207206            inRow = in->data.C32[row];
    208207
    209             for (unsigned int col = 0; col < numCols; col++) {
     208            for (psU32 col = 0; col < numCols; col++) {
    210209                outRow[col] = cimagf(inRow[col]);
    211210            }
     
    216215
    217216        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    218         for (unsigned int row = 0; row < numRows; row++) {
     217        for (psU32 row = 0; row < numRows; row++) {
    219218            outRow = out->data.F64[row];
    220219            inRow = in->data.C64[row];
    221220
    222             for (unsigned int col = 0; col < numCols; col++) {
     221            for (psU32 col = 0; col < numCols; col++) {
    223222                outRow[col] = cimag(inRow[col]);
    224223            }
     
    241240{
    242241    psElemType type;
    243     unsigned int numCols;
    244     unsigned int numRows;
     242    psU32 numCols;
     243    psU32 numRows;
    245244
    246245    if (real == NULL || imag == NULL) {
     
    282281        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    283282
    284         for (unsigned int row = 0; row < numRows; row++) {
     283        for (psU32 row = 0; row < numRows; row++) {
    285284            outRow = out->data.C32[row];
    286285            realRow = real->data.F32[row];
    287286            imagRow = imag->data.F32[row];
    288287
    289             for (unsigned int col = 0; col < numCols; col++) {
     288            for (psU32 col = 0; col < numCols; col++) {
    290289                outRow[col] = realRow[col] + I * imagRow[col];
    291290            }
     
    297296
    298297        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    299         for (unsigned int row = 0; row < numRows; row++) {
     298        for (psU32 row = 0; row < numRows; row++) {
    300299            outRow = out->data.C64[row];
    301300            realRow = real->data.F64[row];
    302301            imagRow = imag->data.F64[row];
    303302
    304             for (unsigned int col = 0; col < numCols; col++) {
     303            for (psU32 col = 0; col < numCols; col++) {
    305304                outRow[col] = realRow[col] + I * imagRow[col];
    306305            }
     
    324323{
    325324    psElemType type;
    326     unsigned int numCols;
    327     unsigned int numRows;
     325    psU32 numCols;
     326    psU32 numRows;
    328327
    329328    if (in == NULL) {
     
    346345
    347346        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    348         for (unsigned int row = 0; row < numRows; row++) {
     347        for (psU32 row = 0; row < numRows; row++) {
    349348            outRow = out->data.C32[row];
    350349            inRow = in->data.C32[row];
    351350
    352             for (unsigned int col = 0; col < numCols; col++) {
     351            for (psU32 col = 0; col < numCols; col++) {
    353352                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
    354353            }
     
    359358
    360359        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    361         for (unsigned int row = 0; row < numRows; row++) {
     360        for (psU32 row = 0; row < numRows; row++) {
    362361            outRow = out->data.C64[row];
    363362            inRow = in->data.C64[row];
    364363
    365             for (unsigned int col = 0; col < numCols; col++) {
     364            for (psU32 col = 0; col < numCols; col++) {
    366365                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
    367366            }
     
    384383{
    385384    psElemType type;
    386     unsigned int numCols;
    387     unsigned int numRows;
    388     int numElementsSquared;
     385    psU32 numCols;
     386    psU32 numRows;
     387    psS32 numElementsSquared;
    389388
    390389    if (in == NULL) {
     
    405404
    406405        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    407         for (unsigned int row = 0; row < numRows; row++) {
     406        for (psU32 row = 0; row < numRows; row++) {
    408407            outRow = out->data.F32[row];
    409408            inRow = in->data.C32[row];
    410409
    411             for (unsigned int col = 0; col < numCols; col++) {
     410            for (psU32 col = 0; col < numCols; col++) {
    412411                real = crealf(inRow[col]);
    413412                imag = cimagf(inRow[col]);
     
    422421
    423422        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    424         for (unsigned int row = 0; row < numRows; row++) {
     423        for (psU32 row = 0; row < numRows; row++) {
    425424            outRow = out->data.F64[row];
    426425            inRow = in->data.C64[row];
    427426
    428             for (unsigned int col = 0; col < numCols; col++) {
     427            for (psU32 col = 0; col < numCols; col++) {
    429428                real = creal(inRow[col]);
    430429                imag = cimag(inRow[col]);
  • trunk/psLib/src/image/psImageIO.c

    r1941 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-02 02:08:00 $
     9 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#include <fitsio.h>
    1616#include <unistd.h>
    17 #include <stdbool.h>
    1817
    1918#include "psImageIO.h"
     
    2423
    2524psImage* psImageReadSection(psImage* output,
    26                             int col,
    27                             int row,
    28                             int numCols,
    29                             int numRows,
    30                             int z,
     25                            psS32 col,
     26                            psS32 row,
     27                            psS32 numCols,
     28                            psS32 numRows,
     29                            psS32 z,
    3130                            char *extname,
    32                             int extnum,
     31                            psS32 extnum,
    3332                            char *filename)
    3433{
    3534    fitsfile *fptr = NULL;      /* Pointer to the FITS file */
    36     int status = 0;             /* CFITSIO file vars */
    37     int nAxis = 0;
    38     int anynull = 0;
    39     int bitPix = 0;             /* Pixel type */
    40     long nAxes[3];
    41     long firstPixel[3];         /* lower-left corner of image subset */
    42     long lastPixel[3];          /* upper-right corner of image subset */
    43     long increment[3];          /* increment for image subset */
     35    psS32 status = 0;             /* CFITSIO file vars */
     36    psS32 nAxis = 0;
     37    psS32 anynull = 0;
     38    psS32 bitPix = 0;             /* Pixel type */
     39    psS64 nAxes[3];
     40    psS64 firstPixel[3];         /* lower-left corner of image subset */
     41    psS64 lastPixel[3];          /* upper-right corner of image subset */
     42    psS64 increment[3];          /* increment for image subset */
    4443    char fitsErr[80] = "";      /* CFITSIO error message string */
    45     int hduType = IMAGE_HDU;
    46     int fitsDatatype = 0;
    47     int datatype = 0;
     44    psS32 hduType = IMAGE_HDU;
     45    psS32 fitsDatatype = 0;
     46    psS32 datatype = 0;
    4847
    4948    if (filename == NULL) {
     
    228227}
    229228
    230 bool psImageWriteSection(psImage* input,
    231                          int col0,
    232                          int row0,
    233                          int z,
    234                          char *extname,
    235                          int extnum,
    236                          char *filename)
     229psBool psImageWriteSection(psImage* input,
     230                           psS32 col0,
     231                           psS32 row0,
     232                           psS32 z,
     233                           char *extname,
     234                           psS32 extnum,
     235                           char *filename)
    237236{
    238     int numCols = 0;
    239     int numRows = 0;
    240 
    241     int status = 0;             /* CFITSIO status */
     237    psS32 numCols = 0;
     238    psS32 numRows = 0;
     239
     240    psS32 status = 0;             /* CFITSIO status */
    242241    fitsfile *fptr = NULL;      /* pointer to the FITS file */
    243     long nAxes[3];              /* Image axis vars */
    244     long firstPixel[3];         /* First Pixel to read */
    245     long lastPixel[3];          /* Last Pixel to read */
     242    psS64 nAxes[3];              /* Image axis vars */
     243    psS64 firstPixel[3];         /* First Pixel to read */
     244    psS64 lastPixel[3];          /* Last Pixel to read */
    246245    char fitsErr[80];           /* FITSIO message string */
    247     int datatype = 0;           /* the datatype of the image */
    248     int bitPix = 0;             /* FITS bitPix value */
    249     int hduType = IMAGE_HDU;    /* the HDU type (image,table, etc.) */
     246    psS32 datatype = 0;           /* the datatype of the image */
     247    psS32 bitPix = 0;             /* FITS bitPix value */
     248    psS32 hduType = IMAGE_HDU;    /* the HDU type (image,table, etc.) */
    250249    double bscale = 1.0;
    251250    double bzero = 0.0;
    252     bool createNewHDU = false;
     251    psBool createNewHDU = false;
    253252
    254253    /* need a valid image to write */
     
    336335            }
    337336        } else {
    338             int numHDUs = 0;
     337            psS32 numHDUs = 0;
    339338
    340339            fits_get_num_hdus(fptr, &numHDUs, &status);
  • trunk/psLib/src/image/psImageIO.h

    r1442 r2204  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-10 01:05:53 $
     12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717#ifndef PS_IMAGEIO_H
    1818#define PS_IMAGEIO_H
    19 
    20 #include <stdbool.h>
    2119
    2220#include "psImage.h"
     
    3432    /**< the output psImage to recycle, or NULL if new psImage desired */
    3533
    36     int col0,
     34    psS32 col0,
    3735    /**< the column index of the origin to start reading */
    3836
    39     int row0,
     37    psS32 row0,
    4038    /**< the row index of the origin to start reading */
    4139
    42     int numCols,
     40    psS32 numCols,
    4341    /**< the number of desired columns to read */
    4442
    45     int numRows,
     43    psS32 numRows,
    4644    /**< the number of desired rows to read */
    4745
    48     int z,
     46    psS32 z,
    4947    /**< the z index to read if file is organized as a 3D image cube. */
    5048
     
    5452        */
    5553
    56     int extnum,
     54    psS32 extnum,
    5755    /**< the image extension to read (0=PHU, 1=first extension, etc.)  This is
    5856        *   only used if extname is NULL
     
    6563/** Read an image or subimage from a FITS file specified by a filename.
    6664 *
    67  *  return bool         TRUE is successful, otherwise FALSE.
     65 *  return psBool         TRUE is successful, otherwise FALSE.
    6866 */
    69 bool psImageWriteSection(
     67psBool psImageWriteSection(
    7068    psImage* input,
    7169    /**< the psImage to write */
    7270
    73     int col0,
     71    psS32 col0,
    7472    /**< the column index of the origin to start writing */
    7573
    76     int row0,
     74    psS32 row0,
    7775    /**< the row index of the origin to start writing */
    7876
    79     int z,
     77    psS32 z,
    8078    /**< the z index to start writing */
    8179
     
    8583    */
    8684
    87     int extnum,
     85    psS32 extnum,
    8886    /**< the image extension to write (0=PHU, 1=first extension, etc.)  This is
    8987    *   only used if extname is NULL.
  • trunk/psLib/src/image/psImageManip.c

    r2105 r2204  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-14 01:22:59 $
     12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <math.h>                          // for isfinite(), etc.
    1919#include <stdlib.h>
    20 #include <stdbool.h>
    2120#include <string.h>                        // for memcpy, etc.
    2221
     
    2928#include "psImageErrors.h"
    3029
    31 int psImageClip(psImage* input,
    32                 psF64 min,
    33                 psF64 vmin,
    34                 psF64 max,
    35                 psF64 vmax)
     30psS32 psImageClip(psImage* input,
     31                  psF64 min,
     32                  psF64 vmin,
     33                  psF64 max,
     34                  psF64 vmax)
    3635{
    37     int numClipped = 0;
    38     unsigned int numRows;
    39     unsigned int numCols;
     36    psS32 numClipped = 0;
     37    psU32 numRows;
     38    psU32 numCols;
    4039
    4140    if (input == NULL) {
     
    7271                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    7372            } \
    74             for (unsigned int row = 0;row<numRows;row++) { \
     73            for (psU32 row = 0;row<numRows;row++) { \
    7574                ps##type* inputRow = input->data.type[row]; \
    76                 for (unsigned int col = 0; col < numCols; col++) { \
     75                for (psU32 col = 0; col < numCols; col++) { \
    7776                    if ((psF64)inputRow[col] < min) { \
    7877                        inputRow[col] = (ps##type)vmin; \
     
    103102                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    104103            } \
    105             for (unsigned int row = 0;row<numRows;row++) { \
     104            for (psU32 row = 0;row<numRows;row++) { \
    106105                ps##type* inputRow = input->data.type[row]; \
    107                 for (unsigned int col = 0; col < numCols; col++) { \
     106                for (psU32 col = 0; col < numCols; col++) { \
    108107                    if (absfcn(inputRow[col]) < min) { \
    109108                        inputRow[col] = (ps##type)vmin; \
     
    144143}
    145144
    146 int psImageClipNaN(psImage* input,
    147                    psF64 value)
     145psS32 psImageClipNaN(psImage* input,
     146                     psF64 value)
    148147{
    149     int numClipped = 0;
    150     unsigned int numRows;
    151     unsigned int numCols;
     148    psS32 numClipped = 0;
     149    psU32 numRows;
     150    psU32 numCols;
    152151
    153152    if (input == NULL) {
     
    161160        #define psImageClipNaNCase(type) \
    162161    case PS_TYPE_##type: \
    163         for (unsigned int row = 0;row<numRows;row++) { \
     162        for (psU32 row = 0;row<numRows;row++) { \
    164163            ps##type* inputRow = input->data.type[row]; \
    165             for (unsigned int col = 0; col < numCols; col++) { \
     164            for (psU32 col = 0; col < numCols; col++) { \
    166165                if (! isfinite(inputRow[col])) { \
    167166                    inputRow[col] = (ps##type)value; \
     
    190189}
    191190
    192 int psImageOverlaySection(psImage* image,
    193                           const psImage* overlay,
    194                           int col0,
    195                           int row0,
    196                           const char *op)
     191psS32 psImageOverlaySection(psImage* image,
     192                            const psImage* overlay,
     193                            psS32 col0,
     194                            psS32 row0,
     195                            const char *op)
    197196{
    198     unsigned int imageNumRows;
    199     unsigned int imageNumCols;
    200     unsigned int overlayNumRows;
    201     unsigned int overlayNumCols;
    202     unsigned int imageRowLimit;
    203     unsigned int imageColLimit;
     197    psU32 imageNumRows;
     198    psU32 imageNumCols;
     199    psU32 overlayNumRows;
     200    psU32 overlayNumCols;
     201    psU32 imageRowLimit;
     202    psU32 imageColLimit;
    204203    psElemType type;
    205204
     
    257256        #define psImageOverlayCase(DATATYPE) \
    258257    case PS_TYPE_##DATATYPE: \
    259         for (unsigned int row=row0;row<imageRowLimit;row++) { \
     258        for (psU32 row=row0;row<imageRowLimit;row++) { \
    260259            ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \
    261260            ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-row0]; \
    262             for (unsigned int col=col0;col<imageColLimit;col++) { \
     261            for (psU32 col=col0;col<imageColLimit;col++) { \
    263262                switch (*op) { \
    264263                case '+': \
     
    315314}
    316315
    317 int psImageClipComplexRegion(psImage* input,
    318                              psC64 min,
    319                              psC64 vmin,
    320                              psC64 max,
    321                              psC64 vmax)
     316psS32 psImageClipComplexRegion(psImage* input,
     317                               psC64 min,
     318                               psC64 vmin,
     319                               psC64 max,
     320                               psC64 vmax)
    322321{
    323     int numClipped = 0;
    324     unsigned int numRows;
    325     unsigned int numCols;
     322    psS32 numClipped = 0;
     323    psU32 numRows;
     324    psU32 numCols;
    326325    psF64 realMin = creal(min);
    327326    psF64 imagMin = cimag(min);
     
    374373            break; \
    375374        } \
    376         for (unsigned int row = 0;row<numRows;row++) { \
     375        for (psU32 row = 0;row<numRows;row++) { \
    377376            ps##type* inputRow = input->data.type[row]; \
    378             for (unsigned int col = 0; col < numCols; col++) { \
     377            for (psU32 col = 0; col < numCols; col++) { \
    379378                if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \
    380379                    inputRow[col] = (ps##type)vmax; \
     
    411410                      const psImage* restrict mask,
    412411                      psMaskType maskVal,
    413                       unsigned int scale,
     412                      psU32 scale,
    414413                      const psStats* stats)
    415414{
    416     int inRows;
    417     int inCols;
    418     int outRows;
    419     int outCols;
     415    psS32 inRows;
     416    psS32 inCols;
     417    psS32 outRows;
     418    psS32 outCols;
    420419    psVector* vec;                     // vector to hold the values of a single bin.
    421420    psVector* maskVec = NULL;          // vector to hold the mask of a single bin.
     
    491490        ps##type* vecData = vec->data.type; \
    492491        psMaskType* inRowMask = NULL; \
    493         for (int row = 0; row < outRows; row++) { \
     492        for (psS32 row = 0; row < outRows; row++) { \
    494493            outRowData = out->data.type[row]; \
    495             int inCurrentRow = row*scale; \
    496             int inNextRow = (row+1)*scale; \
    497             for (int col = 0; col < outCols; col++) { \
    498                 int inCurrentCol = col*scale; \
    499                 int inNextCol = (col+1)*scale; \
    500                 int n = 0; \
    501                 for (int inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \
     494            psS32 inCurrentRow = row*scale; \
     495            psS32 inNextRow = (row+1)*scale; \
     496            for (psS32 col = 0; col < outCols; col++) { \
     497                psS32 inCurrentCol = col*scale; \
     498                psS32 inNextCol = (col+1)*scale; \
     499                psS32 n = 0; \
     500                for (psS32 inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \
    502501                    ps##type* inRowData = in->data.type[inRow]; \
    503502                    if (mask != NULL) { \
    504503                        inRowMask = mask->data.PS_TYPE_MASK_DATA[inRow]; \
    505504                    } \
    506                     for (int inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
     505                    for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
    507506                        if (maskData != NULL) { \
    508507                            maskData[n] = inRowMask[inCol]; \
     
    555554psImage* psImageResample(psImage* out,
    556555                         const psImage* in,
    557                          int scale,
     556                         psS32 scale,
    558557                         psImageInterpolateMode mode)
    559558{
    560     int outRows;
    561     int outCols;
     559    psS32 outRows;
     560    psS32 outCols;
    562561    float invScale;
    563562
     
    597596case PS_TYPE_##TYPE: { \
    598597        out = psImageRecycle(out,outCols, outRows, PS_TYPE_##TYPE); \
    599         for (int row=0;row<outRows;row++) { \
     598        for (psS32 row=0;row<outRows;row++) { \
    600599            ps##TYPE* rowData = out->data.TYPE[row]; \
    601600            float inRow = (float)row * invScale; \
    602             for (int col=0;col<outCols;col++) { \
     601            for (psS32 col=0;col<outCols;col++) { \
    603602                rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \
    604603            } \
     
    637636psImage* psImageRoll(psImage* out,
    638637                     const psImage* in,
    639                      int dx,
    640                      int dy)
     638                     psS32 dx,
     639                     psS32 dy)
    641640{
    642     int outRows;
    643     int outCols;
    644     int elementSize;
     641    psS32 outRows;
     642    psS32 outCols;
     643    psS32 elementSize;
    645644
    646645    if (in == NULL) {
     
    669668    }
    670669
    671     int segment1Size = elementSize * (outCols - dx);
    672     int segment2Size = elementSize * dx;
    673 
    674     for (int row = 0; row < outRows; row++) {
    675         int inRowNumber = row + dy;
     670    psS32 segment1Size = elementSize * (outCols - dx);
     671    psS32 segment2Size = elementSize * dx;
     672
     673    for (psS32 row = 0; row < outRows; row++) {
     674        psS32 inRowNumber = row + dy;
    676675
    677676        if (inRowNumber >= outRows) {
     
    706705    if (fabsf(angle - 90.0f) < FLT_EPSILON) {
    707706        // perform 1/4 rotate counter-clockwise
    708         int numRows = in->numCols;
    709         int numCols = in->numRows;
    710         int lastCol = numCols - 1;
     707        psS32 numRows = in->numCols;
     708        psS32 numCols = in->numRows;
     709        psS32 lastCol = numCols - 1;
    711710        psElemType type = in->type.type;
    712711
     
    716715    case PS_TYPE_##TYPE: { \
    717716            ps##TYPE** inData = in->data.TYPE; \
    718             for (int row=0;row<numRows;row++) { \
     717            for (psS32 row=0;row<numRows;row++) { \
    719718                ps##TYPE* outRow = out->data.TYPE[row]; \
    720                 for (int col=0;col<numCols;col++) { \
     719                for (psS32 col=0;col<numCols;col++) { \
    721720                    outRow[col] = inData[lastCol-col][row]; \
    722721                } \
     
    752751    } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
    753752        // perform 1/2 rotate
    754         int numRows = in->numRows;
    755         int lastRow = numRows - 1;
    756         int numCols = in->numCols;
    757         int lastCol = numCols - 1;
     753        psS32 numRows = in->numRows;
     754        psS32 lastRow = numRows - 1;
     755        psS32 numCols = in->numCols;
     756        psS32 lastCol = numCols - 1;
    758757        psElemType type = in->type.type;
    759758
     
    762761        #define PSIMAGE_ROTATE_180_CASE(TYPE) \
    763762    case PS_TYPE_##TYPE: { \
    764             for (int row=0;row<numRows;row++) { \
     763            for (psS32 row=0;row<numRows;row++) { \
    765764                ps##TYPE* outRow = out->data.TYPE[row]; \
    766765                ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
    767                 for (int col=0;col<numCols;col++) { \
     766                for (psS32 col=0;col<numCols;col++) { \
    768767                    outRow[col] = inRow[lastCol - col]; \
    769768                } \
     
    799798    } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
    800799        // perform 1/4 rotate clockwise
    801         int numRows = in->numCols;
    802         int lastRow = numRows - 1;
    803         int numCols = in->numRows;
     800        psS32 numRows = in->numCols;
     801        psS32 lastRow = numRows - 1;
     802        psS32 numCols = in->numRows;
    804803        psElemType type = in->type.type;
    805804
     
    809808    case PS_TYPE_##TYPE: { \
    810809            ps##TYPE** inData = in->data.TYPE; \
    811             for (int row=0;row<numRows;row++) { \
     810            for (psS32 row=0;row<numRows;row++) { \
    812811                ps##TYPE* outRow = out->data.TYPE[row]; \
    813                 for (int col=0;col<numCols;col++) { \
     812                for (psS32 col=0;col<numCols;col++) { \
    814813                    outRow[col] = inData[col][lastRow-row]; \
    815814                } \
     
    847846    } else {
    848847        psElemType type = in->type.type;
    849         int numRows = in->numRows;
    850         int numCols = in->numCols;
     848        psS32 numRows = in->numRows;
     849        psS32 numCols = in->numCols;
    851850        float centerX = (float)(numCols) / 2.0f;
    852851        float centerY = (float)(numRows) / 2.0f;
     
    859858        // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
    860859
    861         int outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
    862         int outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
     860        psS32 outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
     861        psS32 outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
    863862        float minX = (float)outCols / -2.0f;
    864         int intMinY = outRows / -2;
     863        psS32 intMinY = outRows / -2;
    865864
    866865        out = psImageRecycle(out, outCols, outRows, type);
     
    906905            float inY; \
    907906            ps##TYPE* outRow; \
    908             for (int y = 0; y < outRows; y++) { \
     907            for (psS32 y = 0; y < outRows; y++) { \
    909908                inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
    910909                inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
    911910                outRow = out->data.TYPE[y]; \
    912                 for (int x = 0; x < outCols; x++) { \
     911                for (psS32 x = 0; x < outCols; x++) { \
    913912                    outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,NULL,0,unexposedValue); \
    914913                    inX += cosT; \
     
    993992                      psImageInterpolateMode mode)
    994993{
    995     int outRows;
    996     int outCols;
    997     int elementSize;
     994    psS32 outRows;
     995    psS32 outCols;
     996    psS32 elementSize;
    998997    psElemType type;
    999998
     
    10301029        break; \
    10311030    } \
    1032     for (int row=0;row<outRows;row++) { \
     1031    for (psS32 row=0;row<outRows;row++) { \
    10331032        ps##TYPE* outRow = out->data.TYPE[row]; \
    10341033        float y = dy+(float)row; \
    1035         for (int col=0;col<outCols;col++) { \
     1034        for (psS32 col=0;col<outCols;col++) { \
    10361035            outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \
    10371036                          in,dx+(float)col,y,NULL,0,unexposedValue); \
  • trunk/psLib/src/image/psImageManip.h

    r1635 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-27 19:49:54 $
     13 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030 *  defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64.
    3131 *
    32  *  @return int     The number of clipped pixels
     32 *  @return psS32     The number of clipped pixels
    3333 */
    34 int psImageClip(
     34psS32 psImageClip(
    3535    psImage* input,                    ///< the image to clip
    3636    psF64 min,                         ///< the minimum image value allowed
     
    4747 *  This function is defined for psC32, and psC64 imagery only.
    4848 *
    49  *  @return int     The number of clipped pixels
     49 *  @return psS32     The number of clipped pixels
    5050 */
    51 int psImageClipComplexRegion(
     51psS32 psImageClipComplexRegion(
    5252    psImage* input,                    ///< the image to clip
    5353    psC64 min,                         ///< the minimum image value allowed
     
    6262 *  function is defined for psF32, psF64, psC32, and psC64.
    6363 *
    64  *  @return int     The number of clipped pixels
     64 *  @return psS32     The number of clipped pixels
    6565 */
    66 int psImageClipNaN(
     66psS32 psImageClipNaN(
    6767    psImage* input,                    ///< the image to clip
    6868    psF64 value                        ///< the value to set all NaN/Inf values to
     
    7878 *  function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
    7979 *
    80  *  @return int         0 if success, non-zero if failed.
     80 *  @return psS32         0 if success, non-zero if failed.
    8181 */
    82 int psImageOverlaySection(
     82psS32 psImageOverlaySection(
    8383    psImage* image,                    ///< target image
    8484    const psImage* overlay,            ///< the overlay image
    85     int col0,                          ///< the column to start overlay
    86     int row0,                          ///< the row to start overlay
     85    psS32 col0,                          ///< the column to start overlay
     86    psS32 row0,                          ///< the row to start overlay
    8787    const char *op                     ///< the operation to perform for overlay
    8888);
     
    103103    const psImage* restrict mask,      ///< mask for input image.  If NULL, no masking is done.
    104104    psMaskType maskVal,                ///< the bits to check in mask.
    105     unsigned int scale,                ///< the scale to rebin for each dimension
     105    psU32 scale,                ///< the scale to rebin for each dimension
    106106    const psStats* stats
    107107    ///< the statistic to perform when rebinning.  Only one method should be set.
     
    121121    psImage* out,                      ///< an psImage to recycle.  If NULL, a new image is created
    122122    const psImage* in,                 ///< input image
    123     int scale,                         ///< resample scaling factor
     123    psS32 scale,                         ///< resample scaling factor
    124124    psImageInterpolateMode mode        ///< the interpolation mode used in resampling
    125125);
     
    176176    psImage* out,                      ///< an psImage to recycle.  If NULL, a new image is created
    177177    const psImage* in,                 ///< input image
    178     int dx,                            ///< number of pixels to roll in the x-dimension
    179     int dy                             ///< number of pixels to roll in the y-dimension
     178    psS32 dx,                            ///< number of pixels to roll in the x-dimension
     179    psS32 dy                             ///< number of pixels to roll in the y-dimension
    180180);
    181181
  • trunk/psLib/src/image/psImageStats.c

    r2102 r2204  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-14 01:06:44 $
     11*  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040                      psImage* in,
    4141                      psImage* mask,
    42                       int maskVal)
     42                      psS32 maskVal)
    4343{
    4444    psVector* junkData = NULL;
     
    106106                              psImage* in,
    107107                              psImage* mask,
    108                               unsigned int maskVal)
     108                              psU32 maskVal)
    109109{
    110110    psVector* junkData = NULL;
     
    150150
    151151// XXX: Why do we have this function?
    152 float *p_psCalcScaleFactorsFit(int n)
    153 {
    154     int i = 0;
     152float *p_psCalcScaleFactorsFit(psS32 n)
     153{
     154    psS32 i = 0;
    155155    float tmp = 0.0;
    156156    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
     
    175175output a vector of evenly spaced floating point values between -1.0:1.0.
    176176 *****************************************************************************/
    177 float *p_psCalcScaleFactorsEval(int n)
    178 {
    179     int i = 0;
     177float *p_psCalcScaleFactorsEval(psS32 n)
     178{
     179    psS32 i = 0;
    180180    float tmp = 0.0;
    181181
     
    196196
    197197// XXX: Use a static array of CHebyshev polynomials.
    198 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)
     198psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly)
    199199{
    200200    if (maxChebyPoly < 1) {
     
    202202    }
    203203    psPolynomial1D **chebPolys = NULL;
    204     int i = 0;
    205     int j = 0;
     204    psS32 i = 0;
     205    psS32 j = 0;
    206206
    207207    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    245245                                     const psImage* input)
    246246{
    247     int x = 0;
    248     int y = 0;
    249     int i = 0;
    250     int j = 0;
     247    psS32 x = 0;
     248    psS32 y = 0;
     249    psS32 i = 0;
     250    psS32 j = 0;
    251251    float **sums = NULL;
    252252    psPolynomial1D* *chebPolys = NULL;
    253     int maxChebyPoly = 0;
     253    psS32 maxChebyPoly = 0;
    254254    float *cScalingFactors = NULL;
    255255    float *rScalingFactors = NULL;
     
    365365psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
    366366{
    367     int x = 0;
    368     int y = 0;
    369     int i = 0;
    370     int j = 0;
     367    psS32 x = 0;
     368    psS32 y = 0;
     369    psS32 i = 0;
     370    psS32 j = 0;
    371371    //    float **sums = NULL;
    372372    psPolynomial1D* *chebPolys = NULL;
    373     int maxChebyPoly = 0;
     373    psS32 maxChebyPoly = 0;
    374374    float *cScalingFactors = NULL;
    375375    float *rScalingFactors = NULL;
  • trunk/psLib/src/image/psImageStats.h

    r1951 r2204  
    99*  @author George Gusciora, MHPCC
    1010*
    11 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-05 01:03:11 $
     11*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040    psImage* in,                       ///< image (or subimage) to calculate stats
    4141    psImage* mask,                     ///< mask data for image (NULL ok)
    42     int maskVal                        ///< mask Mask for mask
     42    psS32 maskVal                        ///< mask Mask for mask
    4343);
    4444
     
    5555    psImage* in,                       ///< Image data to be histogramed.
    5656    psImage* mask,                     ///< mask data for image (NULL ok)
    57     unsigned int maskVal               ///< mask Mask for mask
     57    psU32 maskVal               ///< mask Mask for mask
    5858);
    5959
  • trunk/psLib/src/imageops/psImageConvolve.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static void freeKernel(psKernel* ptr);
    2929
    30 psKernel* psKernelAlloc(int xMin, int xMax, int yMin, int yMax)
     30psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax)
    3131{
    3232    psKernel* result;
    33     int numRows;
    34     int numCols;
     33    psS32 numRows;
     34    psS32 numCols;
    3535
    3636    // following is explicitly spelled out in the SDRS as a requirement
     
    4040                 yMin, yMax);
    4141
    42         int temp = yMin;
     42        psS32 temp = yMin;
    4343        yMin = yMax;
    4444        yMax = temp;
     
    5151                 xMin, xMax);
    5252
    53         int temp = xMin;
     53        psS32 temp = xMin;
    5454        xMin = xMax;
    5555        xMax = temp;
     
    7070    psKernelType** kernelRows = result->p_kernelRows;
    7171    psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA;
    72     for (int i = 0; i < numRows; i++) {
     72    for (psS32 i = 0; i < numRows; i++) {
    7373        kernelRows[i] = imageRows[i] - xMin;
    7474    }
     
    9191                           const psVector* xShifts,
    9292                           const psVector* yShifts,
    93                            bool relative)
     93                           psBool relative)
    9494{
    95     int x = 0;
    96     int y = 0;
    97     int t = 0;
    98     int deltaT;
    99     int oldX;
    100     int oldY;
    101     int xMin = 0;
    102     int xMax = 0;
    103     int yMin = 0;
    104     int yMax = 0;
    105     int length = 0;
     95    psS32 x = 0;
     96    psS32 y = 0;
     97    psS32 t = 0;
     98    psS32 deltaT;
     99    psS32 oldX;
     100    psS32 oldY;
     101    psS32 xMin = 0;
     102    psS32 xMax = 0;
     103    psS32 yMin = 0;
     104    psS32 yMax = 0;
     105    psS32 length = 0;
    106106    psKernelType normalizeTime = 1.0;  // fraction of total time for each shift clock
    107107    psKernel* result = NULL;
     
    153153        y = 0; \
    154154        t = 0; \
    155         for (int lcv = 0; lcv < length; lcv++) { \
     155        for (psS32 lcv = 0; lcv < length; lcv++) { \
    156156            if (relative) { \
    157157                x += xShiftData[lcv]; \
     
    181181        y = 0; \
    182182        t = 0; \
    183         for (int i = 0; i < length; i++) { \
     183        for (psS32 i = 0; i < length; i++) { \
    184184            deltaT = t; \
    185185            oldX = x; \
     
    228228}
    229229
    230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)
     230psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct)
    231231{
    232232    if (in == NULL) {
     
    242242        return NULL;
    243243    }
    244     int xMin = kernel->xMin;
    245     int xMax = kernel->xMax;
    246     int yMin = kernel->yMin;
    247     int yMax = kernel->yMax;
     244    psS32 xMin = kernel->xMin;
     245    psS32 xMax = kernel->xMax;
     246    psS32 yMin = kernel->yMin;
     247    psS32 yMax = kernel->yMax;
    248248    psKernelType** kData = kernel->kernel;
    249249
    250250    // make the output image to the proper size and type
    251     int numRows = in->numRows;
    252     int numCols = in->numCols;
     251    psS32 numRows = in->numRows;
     252    psS32 numCols = in->numCols;
    253253
    254254
     
    261261            ps##TYPE** inData = in->data.TYPE; \
    262262            out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \
    263             for (int row=0;row<numRows;row++) { \
     263            for (psS32 row=0;row<numRows;row++) { \
    264264                ps##TYPE* outRow = out->data.TYPE[row]; \
    265                 for (int col=0;col<numCols;col++) { \
     265                for (psS32 col=0;col<numCols;col++) { \
    266266                    ps##TYPE pixel = 0.0; \
    267                     for (int kRow = yMin; kRow < yMax; kRow++) { \
     267                    for (psS32 kRow = yMin; kRow < yMax; kRow++) { \
    268268                        if (row-kRow >= 0 && row-kRow < numRows) { \
    269                             for (int kCol = xMin; kCol < xMax; kCol++) { \
     269                            for (psS32 kCol = xMin; kCol < xMax; kCol++) { \
    270270                                if (col-kCol >= 0 && col-kCol < numCols) { \
    271271                                    pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \
     
    310310    } else {
    311311        // fourier convolution
    312         int paddedCols = numCols+2*FOURIER_PADDING;
    313         int paddedRows = numRows+2*FOURIER_PADDING;
     312        psS32 paddedCols = numCols+2*FOURIER_PADDING;
     313        psS32 paddedRows = numRows+2*FOURIER_PADDING;
    314314
    315315        // check to see if kernel is smaller, otherwise padding it up will fail.
    316         int kRows = kernel->image->numRows;
    317         int kCols = kernel->image->numCols;
     316        psS32 kRows = kernel->image->numRows;
     317        psS32 kCols = kernel->image->numCols;
    318318        if (kRows >= numRows || kCols >= numCols) {
    319319            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve",
     
    328328        // pad the image
    329329        psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type);
    330         int elementSize = PSELEMTYPE_SIZEOF(in->type.type);
     330        psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type);
    331331
    332332        // zero out padded area on top and bottom
     
    335335
    336336        // fill in the image-containing rows.
    337         int sidePaddingSize = FOURIER_PADDING*elementSize;
    338         int imageRowSize = numCols*elementSize;
     337        psS32 sidePaddingSize = FOURIER_PADDING*elementSize;
     338        psS32 imageRowSize = numCols*elementSize;
    339339        psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING];
    340         for (int row=0;row<numRows;row++) {
     340        for (psS32 row=0;row<numRows;row++) {
    341341            // zero out padded area on left edge.
    342342            memset(paddedData,0,sidePaddingSize);
     
    354354        psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL);
    355355        memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image
    356         int yMax = kernel->yMax;
    357         int xMax = kernel->xMax;
    358         for (int row = kernel->yMin; row <= yMax;row++) {
    359             int padRow = row;
     356        psS32 yMax = kernel->yMax;
     357        psS32 xMax = kernel->xMax;
     358        for (psS32 row = kernel->yMin; row <= yMax;row++) {
     359            psS32 padRow = row;
    360360            if (padRow < 0) {
    361361                padRow += paddedRows;
     
    363363            psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow];
    364364            psKernelType* kernelRow = kernel->kernel[row];
    365             for (int col = kernel->xMin; col <= xMax; col++) {
     365            for (psS32 col = kernel->xMin; col <= xMax; col++) {
    366366                if (col < 0) {
    367367                    padData[col+paddedCols] = kernelRow[col];
     
    418418        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
    419419        float factor = 1.0f/numCols/numRows;
    420         for (int row = 0; row < numRows; row++) {
     420        for (psS32 row = 0; row < numRows; row++) {
    421421            psF32* outRow = out->data.F32[row];
    422422            psC32* resultRow = complexOutSansPad->data.C32[row];
    423             for (int col = 0; col < numCols; col++) {
     423            for (psS32 col = 0; col < numCols; col++) {
    424424                outRow[col] = crealf(resultRow[col])*factor;
    425425            }
  • trunk/psLib/src/imageops/psImageConvolve.h

    r1863 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 18:30:57 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#ifndef PS_IMAGE_CONVOLVE_H
    1616#define PS_IMAGE_CONVOLVE_H
    17 
    18 #include<stdbool.h>
    1917
    2018#include "psImage.h"
     
    3230{
    3331    psImage* image;                    ///< Kernel data, in the form of an image
    34     int xMin;                          ///< Most negative x index
    35     int yMin;                          ///< Most negative y index
    36     int xMax;                          ///< Most positive x index
    37     int yMax;                          ///< Most positive y index
     32    psS32 xMin;                          ///< Most negative x index
     33    psS32 yMin;                          ///< Most negative y index
     34    psS32 xMax;                          ///< Most positive x index
     35    psS32 yMax;                          ///< Most positive y index
    3836    psKernelType** kernel;             ///< Pointer to the kernel data
    3937    psKernelType** p_kernelRows;       ///< Pointer to the rows of the kernel data; not intended for user use.
     
    6866 */
    6967psKernel* psKernelAlloc(
    70     int xMin,                          ///< Most negative x index
    71     int xMax,                          ///< Most positive x index
    72     int yMin,                          ///< Most negative y index
    73     int yMax                           ///< Most positive y index
     68    psS32 xMin,                          ///< Most negative x index
     69    psS32 xMax,                          ///< Most positive x index
     70    psS32 yMin,                          ///< Most negative y index
     71    psS32 yMax                           ///< Most positive y index
    7472);
    7573
     
    9492    const psVector* xShifts,           ///< list of x-axis shifts
    9593    const psVector* yShifts,           ///< list of y-axis shifts
    96     bool relative
     94    psBool relative
    9795);
    9896
     
    118116    const psImage* in,                 ///< the psImage to convolve
    119117    const psKernel* kernel,            ///< kernel to colvolve with
    120     bool direct                        ///< specifies method, true=direct convolution, false=fourier
     118    psBool direct                        ///< specifies method, true=direct convolution, false=fourier
    121119);
    122120
  • trunk/psLib/src/imageops/psImageStats.c

    r2102 r2204  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-14 01:06:44 $
     11*  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040                      psImage* in,
    4141                      psImage* mask,
    42                       int maskVal)
     42                      psS32 maskVal)
    4343{
    4444    psVector* junkData = NULL;
     
    106106                              psImage* in,
    107107                              psImage* mask,
    108                               unsigned int maskVal)
     108                              psU32 maskVal)
    109109{
    110110    psVector* junkData = NULL;
     
    150150
    151151// XXX: Why do we have this function?
    152 float *p_psCalcScaleFactorsFit(int n)
    153 {
    154     int i = 0;
     152float *p_psCalcScaleFactorsFit(psS32 n)
     153{
     154    psS32 i = 0;
    155155    float tmp = 0.0;
    156156    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
     
    175175output a vector of evenly spaced floating point values between -1.0:1.0.
    176176 *****************************************************************************/
    177 float *p_psCalcScaleFactorsEval(int n)
    178 {
    179     int i = 0;
     177float *p_psCalcScaleFactorsEval(psS32 n)
     178{
     179    psS32 i = 0;
    180180    float tmp = 0.0;
    181181
     
    196196
    197197// XXX: Use a static array of CHebyshev polynomials.
    198 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)
     198psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly)
    199199{
    200200    if (maxChebyPoly < 1) {
     
    202202    }
    203203    psPolynomial1D **chebPolys = NULL;
    204     int i = 0;
    205     int j = 0;
     204    psS32 i = 0;
     205    psS32 j = 0;
    206206
    207207    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    245245                                     const psImage* input)
    246246{
    247     int x = 0;
    248     int y = 0;
    249     int i = 0;
    250     int j = 0;
     247    psS32 x = 0;
     248    psS32 y = 0;
     249    psS32 i = 0;
     250    psS32 j = 0;
    251251    float **sums = NULL;
    252252    psPolynomial1D* *chebPolys = NULL;
    253     int maxChebyPoly = 0;
     253    psS32 maxChebyPoly = 0;
    254254    float *cScalingFactors = NULL;
    255255    float *rScalingFactors = NULL;
     
    365365psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
    366366{
    367     int x = 0;
    368     int y = 0;
    369     int i = 0;
    370     int j = 0;
     367    psS32 x = 0;
     368    psS32 y = 0;
     369    psS32 i = 0;
     370    psS32 j = 0;
    371371    //    float **sums = NULL;
    372372    psPolynomial1D* *chebPolys = NULL;
    373     int maxChebyPoly = 0;
     373    psS32 maxChebyPoly = 0;
    374374    float *cScalingFactors = NULL;
    375375    float *rScalingFactors = NULL;
  • trunk/psLib/src/imageops/psImageStats.h

    r1951 r2204  
    99*  @author George Gusciora, MHPCC
    1010*
    11 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-05 01:03:11 $
     11*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040    psImage* in,                       ///< image (or subimage) to calculate stats
    4141    psImage* mask,                     ///< mask data for image (NULL ok)
    42     int maskVal                        ///< mask Mask for mask
     42    psS32 maskVal                        ///< mask Mask for mask
    4343);
    4444
     
    5555    psImage* in,                       ///< Image data to be histogramed.
    5656    psImage* mask,                     ///< mask data for image (NULL ok)
    57     unsigned int maskVal               ///< mask Mask for mask
     57    psU32 maskVal               ///< mask Mask for mask
    5858);
    5959
  • trunk/psLib/src/math/psCompare.c

    r1407 r2204  
    77 *  @author Robert Daniel DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-08-07 00:06:06 $
     9 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1313 */
    1414
    15 #include "psType.h"
    1615#include "psCompare.h"
    1716
  • trunk/psLib/src/math/psCompare.h

    r1473 r2204  
     1/** @file psCompare.h
     2 *  @brief Comparison functions for sorting routines
     3 *
     4 *  @author Robert Daniel DeSonia, MHPCC
     5 *
     6 *  @ingroup Compare
     7 *
     8 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:31 $
     10 *
     11 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     12 */
     13
    114#if !defined(PS_COMPARE_H)
    215#define PS_COMPARE_H
    316
    4 /** @file psCompare.h
    5  *  @brief Comparison functions for sorting routines
    6  *
    7  *  @author Robert Daniel DeSonia, MHPCC
    8  *
    9  *  @ingroup Compare
    10  *
    11  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-11 19:58:11 $
    13  *
    14  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    15  */
     17#include "psType.h"
    1618
    1719/** @addtogroup Compare
  • trunk/psLib/src/math/psConstants.h

    r2197 r2204  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-26 21:24:42 $
     8 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:31 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454p_psMemSetPersistent(VEC, true); \
    5555p_psMemSetPersistent(VEC->data.V, true); \
    56 for (int i=0;i<N;i++) { \
     56for (psS32 i=0;i<N;i++) { \
    5757    VEC->data.F32[i] = 1.0; \
    5858} \
     
    6262p_psMemSetPersistent(VEC, true); \
    6363p_psMemSetPersistent(VEC->data.V, true); \
    64 for (int i=0;i<N;i++) { \
     64for (psS32 i=0;i<N;i++) { \
    6565    VEC->data.F64[i] = 1.0; \
    6666} \
     
    7070p_psMemSetPersistent(VEC, true); \
    7171p_psMemSetPersistent(VEC->data.V, true); \
    72 for (int i=0;i<N;i++) { \
     72for (psS32 i=0;i<N;i++) { \
    7373    VEC->data.F32[i] = (float) i; \
    7474} \
     
    7878p_psMemSetPersistent(VEC, true); \
    7979p_psMemSetPersistent(VEC->data.V, true); \
    80 for (int i=0;i<N;i++) { \
     80for (psS32 i=0;i<N;i++) { \
    8181    VEC->data.F64[i] = (float) i; \
    8282} \
     
    209209
    210210#define PS_PRINT_VECTOR(NAME) \
    211 for (int my_i=0;my_i<NAME->n;my_i++) { \
     211for (psS32 my_i=0;my_i<NAME->n;my_i++) { \
    212212    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
    213213} \
     
    216216#define PS_VECTOR_F64_TO_F32(X64, X32) \
    217217psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \
    218 for (int i=0;i<X64->n;i++) { \
     218for (psS32 i=0;i<X64->n;i++) { \
    219219    X32->data.F32[i] = (float) X64->data.F64[i]; \
    220220} \
     
    222222#define PS_VECTOR_F32_TO_F64(X32, X64) \
    223223psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \
    224 for (int i=0;i<X32->n;i++) { \
     224for (psS32 i=0;i<X32->n;i++) { \
    225225    X64->data.F64[i] = (float) X32->data.F32[i]; \
    226226} \
  • trunk/psLib/src/math/psMatrix.c

    r2021 r2204  
    2020 *  @author Ross Harman, MHPCC
    2121 *   
    22  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    23  *  @date $Date: 2004-10-08 02:48:01 $
     22 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     23 *  @date $Date: 2004-10-27 00:57:31 $
    2424 *
    2525 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    119119psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage)
    120120{
    121     int signum = 0;
    122     int arraySize = 0;
    123     int numRows = 0;
    124     int numCols = 0;
     121    psS32 signum = 0;
     122    psS32 arraySize = 0;
     123    psS32 numRows = 0;
     124    psS32 numCols = 0;
    125125    gsl_matrix lu;
    126126    gsl_permutation perm;
     
    165165                          const psVector* inVector, const psVector* inPerm)
    166166{
    167     int arraySize = 0;
    168     int numRows = 0;
    169     int numCols = 0;
     167    psS32 arraySize = 0;
     168    psS32 numRows = 0;
     169    psS32 numCols = 0;
    170170    gsl_matrix lu;
    171171    gsl_permutation perm;
     
    217217psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det)
    218218{
    219     int signum = 0;
    220     int arraySize = 0;
    221     int numRows = 0;
    222     int numCols = 0;
     219    psS32 signum = 0;
     220    psS32 arraySize = 0;
     221    psS32 numRows = 0;
     222    psS32 numCols = 0;
    223223    gsl_matrix inv;
    224224    gsl_matrix *lu;
     
    271271float *psMatrixDeterminant(const psImage* restrict inImage)
    272272{
    273     int signum = 0;
    274     int arraySize = 0;
    275     int numRows = 0;
    276     int numCols = 0;
     273    psS32 signum = 0;
     274    psS32 arraySize = 0;
     275    psS32 numRows = 0;
     276    psS32 numCols = 0;
    277277    float *det = NULL;
    278278    gsl_matrix *lu = NULL;
     
    313313psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2)
    314314{
    315     int arraySize = 0;
    316     int numRows = 0;
    317     int numCols = 0;
     315    psS32 arraySize = 0;
     316    psS32 numRows = 0;
     317    psS32 numCols = 0;
    318318    gsl_matrix m1;
    319319    gsl_matrix m2;
     
    355355psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage)
    356356{
    357     int arraySize = 0;
    358     int numRows = 0;
    359     int numCols = 0;
     357    psS32 arraySize = 0;
     358    psS32 numRows = 0;
     359    psS32 numCols = 0;
    360360    gsl_matrix trans;
    361361
     
    392392psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage)
    393393{
    394     int numRows = 0;
    395     int numCols = 0;
     394    psS32 numRows = 0;
     395    psS32 numCols = 0;
    396396    gsl_vector *eVals = NULL;
    397397    gsl_eigen_symmv_workspace *w = NULL;
     
    436436psVector* psMatrixToVector(psVector* outVector, const psImage* inImage)
    437437{
    438     int size = 0;
     438    psS32 size = 0;
    439439
    440440    // Error checks
     
    495495psImage* psVectorToMatrix(psImage* outImage, const psVector* inVector)
    496496{
    497     int size = 0;
     497    psS32 size = 0;
    498498
    499499    // Error checks
  • trunk/psLib/src/math/psMinimize.c

    r2202 r2204  
    99 *  @author GLF, MHPCC
    1010 *
    11  *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 23:14:04 $
     11 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959 *****************************************************************************/
    6060void p_psBuildSums1D(double x,
    61                      int polyOrder,
     61                     psS32 polyOrder,
    6262                     psVector* sums)
    6363{
    64     int i = 0;
     64    psS32 i = 0;
    6565    double xSum = 0.0;
    6666
     
    101101            "---- CalculateSecondDerivs() begin ----\n");
    102102
    103     int i;
    104     int k;
    105     bool mustFreeX = false;
     103    psS32 i;
     104    psS32 k;
     105    psBool mustFreeX = false;
    106106    float sig;
    107107    float p;
    108     int n = y->n;
     108    psS32 n = y->n;
    109109    float *u = (float *) psAlloc(n * sizeof(float));
    110110    float *derivs2 = (float *) psAlloc(n * sizeof(float));
     
    173173                         float X)
    174174{
    175     int n;
    176     int klo;
    177     int khi;
     175    psS32 n;
     176    psS32 klo;
     177    psS32 khi;
    178178    float H;
    179179    float A;
     
    240240    psTrace(".psLib.dataManip.psVectorFitSpline1D", 4,
    241241            "---- psVectorFitSpline1D() begin ----\n");
    242     int numSplines = (y->n)-1;
     242    psS32 numSplines = (y->n)-1;
    243243    float tmp;
    244244    float H;
    245     int i;
     245    psS32 i;
    246246    float slope;
    247247    psVector *x32 = NULL;
     
    416416     the F64 port might be.
    417417 *****************************************************************************/
    418 bool psMinimizeLMChi2(psMinimization *min,
    419                       psImage *covar,
    420                       psVector *params,
    421                       const psVector *paramMask,
    422                       const psArray *x,
    423                       const psVector *y,
    424                       const psVector *yErr,
    425                       psMinimizeLMChi2Func func)
     418psBool psMinimizeLMChi2(psMinimization *min,
     419                        psImage *covar,
     420                        psVector *params,
     421                        const psVector *paramMask,
     422                        const psArray *x,
     423                        const psVector *y,
     424                        const psVector *yErr,
     425                        psMinimizeLMChi2Func func)
    426426{
    427427    PS_CHECK_NULL_PTR_RETURN_NULL(min);
     
    441441    psTrace(".psLib.dataManip.psMinimizeLMChi2", 4,
    442442            "---- psMinimizeLMChi2() begin ----\n");
    443     int numData = y->n;
    444     int numParams = params->n;
    445     int i;
    446     int j;
    447     int k;
    448     int l;
    449     int n;
    450     int p;
     443    psS32 numData = y->n;
     444    psS32 numParams = params->n;
     445    psS32 i;
     446    psS32 j;
     447    psS32 k;
     448    psS32 l;
     449    psS32 n;
     450    psS32 p;
    451451    psVector *beta = psVectorAlloc(numParams, PS_TYPE_F64);
    452452    psVector *perm = psVectorAlloc(numParams, PS_TYPE_F64);
     
    663663        const psVector* restrict yErr)
    664664{
    665     int j;
    666     int k;
    667     int n = x->n;
     665    psS32 j;
     666    psS32 k;
     667    psS32 n = x->n;
    668668    double fac;
    669669    double sum;
     
    689689    // are fitting this ChebyShev polynomial to.
    690690
    691     for (int i=0;i<n;i++) {
     691    for (psS32 i=0;i<n;i++) {
    692692        // NR 5.8.4
    693693        double Y = cos(M_PI * (0.5 + ((float) i)) / ((float) n));
     
    741741        const psVector* restrict yErr)
    742742{
    743     int polyOrder = myPoly->n;
     743    psS32 polyOrder = myPoly->n;
    744744    psImage* A = NULL;
    745745    psImage* ALUD = NULL;
     
    748748    psVector* X = NULL;         // NOTE: do we need this?
    749749    psVector* coeffs = NULL;
    750     int i = 0;
    751     int j = 0;
    752     int k = 0;
     750    psS32 i = 0;
     751    psS32 j = 0;
     752    psS32 k = 0;
    753753    psVector* xSums = NULL;
    754754
     
    853853                                        const psVector* restrict yErr)
    854854{
    855     int i;
     855    psS32 i;
    856856    psPolynomial1D *tmpPoly;
    857857    PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly);
     
    908908/******************************************************************************
    909909 *****************************************************************************/
    910 psMinimization *psMinimizationAlloc(int maxIter,
     910psMinimization *psMinimizationAlloc(psS32 maxIter,
    911911                                    float tol)
    912912{
     
    952952    float fb = 0.0;
    953953    float fc = 0.0;
    954     int iter = 100;
     954    psS32 iter = 100;
    955955    float aDir = 0.0;
    956956    float cDir = 0.0;
     
    960960    float stepSize = DETERMINE_BRACKET_STEP_SIZE;
    961961    psVector *tmp = NULL;
    962     int i = 0;
    963     int null = 0;
     962    psS32 i = 0;
     963    psS32 null = 0;
    964964
    965965    psTrace(".psLib.dataManip.p_psDetermineBracket", 4,
     
    11411141    psVector *tmpc = NULL;
    11421142    psVector *tmpn = NULL;
    1143     int i = 0;
    1144     int null = 0;
     1143    psS32 i = 0;
     1144    psS32 null = 0;
    11451145
    11461146    psTrace(".psLib.dataManip.p_psLineMin", 4,
     
    13131313XXX: Check for F32 types?
    13141314 *****************************************************************************/
    1315 bool psMinimizePowell(psMinimization *min,
    1316                       psVector *params,
    1317                       const psVector *paramMask,
    1318                       const psArray *coords,
    1319                       psMinimizePowellFunc func)
     1315psBool psMinimizePowell(psMinimization *min,
     1316                        psVector *params,
     1317                        const psVector *paramMask,
     1318                        const psArray *coords,
     1319                        psMinimizePowellFunc func)
    13201320{
    13211321    PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     
    13251325    PS_CHECK_NULL_PTR_RETURN_NULL(func);
    13261326
    1327     int numDims = params->n;
    1328     int i = 0;
    1329     int j = 0;
     1327    psS32 numDims = params->n;
     1328    psS32 i = 0;
     1329    psS32 j = 0;
    13301330    psVector **v = NULL;
    13311331    psVector *pQP = NULL;
     
    13371337    float baseFuncVal = 0.0;
    13381338    float currFuncVal = 0.0;
    1339     int biggestIter = 0;
     1339    psS32 biggestIter = 0;
    13401340    float biggestDiff = 0.0;
    13411341    float term1 = 0.0;
     
    15291529    float chi2 = 0.0;
    15301530    float d;
    1531     int i;
     1531    psS32 i;
    15321532    psVector *tmp;
    15331533
     
    15521552psMinimizePowell().
    15531553 *****************************************************************************/
    1554 bool psMinimizeChi2Powell(psMinimization *min,
    1555                           psVector *params,
    1556                           const psVector *paramMask,
    1557                           const psArray *coords,
    1558                           const psVector *value,
    1559                           const psVector *error,
    1560                           psMinimizeChi2PowellFunc func)
     1554psBool psMinimizeChi2Powell(psMinimization *min,
     1555                            psVector *params,
     1556                            const psVector *paramMask,
     1557                            const psArray *coords,
     1558                            const psVector *value,
     1559                            const psVector *error,
     1560                            psMinimizeChi2PowellFunc func)
    15611561{
    15621562    myValue = (psVector *) value;
  • trunk/psLib/src/math/psMinimize.h

    r2202 r2204  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-26 23:14:04 $
     10 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 00:57:31 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646typedef struct
    4747{
    48     int maxIter;                       ///< Convergence limit
     48    psS32 maxIter;                       ///< Convergence limit
    4949    float tol;                         ///< Error Tolerance
    5050    float value;                       ///< Value of function at minimum
    51     int iter;                          ///< Number of iterations required
     51    psS32 iter;                          ///< Number of iterations required
    5252    float lastDelta;                   ///< The last difference for the fit
    5353}
    5454psMinimization;
    5555
    56 psMinimization *psMinimizationAlloc(int maxIter,
     56psMinimization *psMinimizationAlloc(psS32 maxIter,
    5757                                    float tol);
    5858
     
    8888                                  const psArray *x);
    8989
    90 bool psMinimizeLMChi2(psMinimization *min,
    91                       psImage *covar,
    92                       psVector *params,
    93                       const psVector *paramMask,
    94                       const psArray *x,
    95                       const psVector *y,
    96                       const psVector *yErr,
    97                       psMinimizeLMChi2Func func);
     90psBool psMinimizeLMChi2(psMinimization *min,
     91                        psImage *covar,
     92                        psVector *params,
     93                        const psVector *paramMask,
     94                        const psArray *x,
     95                        const psVector *y,
     96                        const psVector *yErr,
     97                        psMinimizeLMChi2Func func);
    9898
    9999typedef
     
    101101                              const psArray *coords);
    102102
    103 bool psMinimizePowell(psMinimization *min,
    104                       psVector *params,
    105                       const psVector *paramMask,
    106                       const psArray *coords,
    107                       psMinimizePowellFunc func);
     103psBool psMinimizePowell(psMinimization *min,
     104                        psVector *params,
     105                        const psVector *paramMask,
     106                        const psArray *coords,
     107                        psMinimizePowellFunc func);
    108108
    109109typedef
     
    111111                                      const psArray *coords);
    112112
    113 bool psMinimizeChi2Powell(psMinimization *min,
    114                           psVector *params,
    115                           const psVector *paramMask,
    116                           const psArray *coords,
    117                           const psVector *value,
    118                           const psVector *error,
    119                           psMinimizeChi2PowellFunc func);
     113psBool psMinimizeChi2Powell(psMinimization *min,
     114                            psVector *params,
     115                            const psVector *paramMask,
     116                            const psArray *coords,
     117                            const psVector *value,
     118                            const psVector *error,
     119                            psMinimizeChi2PowellFunc func);
    120120
    121121
  • trunk/psLib/src/math/psPolynomial.c

    r2197 r2204  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-26 21:24:42 $
     9 *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    \
    5151    if (IN->type.type == PS_TYPE_F64) { \
    52         for (int i=0;i<IN->n;i++) { \
     52        for (psS32 i=0;i<IN->n;i++) { \
    5353            OUT->data.F32[i] = (float) (IN->data.F64[i]); \
    5454        } \
     
    6969    \
    7070    if (IN->type.type == PS_TYPE_F32) { \
    71         for (int i=0;i<IN->n;i++) { \
     71        for (psS32 i=0;i<IN->n;i++) { \
    7272            OUT->data.F64[i] = (float) (IN->data.F32[i]); \
    7373        } \
     
    117117outer coefficients of the Chebyshev polynomials.
    118118 *****************************************************************************/
    119 static psPolynomial1D **CreateChebyshevPolys(int maxChebyPoly)
     119static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly)
    120120{
    121121    psPolynomial1D **chebPolys = NULL;
    122     int i = 0;
    123     int j = 0;
     122    psS32 i = 0;
     123    psS32 j = 0;
    124124
    125125    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    153153    evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f]
    154154 *****************************************************************************/
    155 float psGaussian(float x, float mean, float sigma, bool normal)
     155float psGaussian(float x, float mean, float sigma, psBool normal)
    156156{
    157157    float tmp = 1.0;
     
    185185 NOTE: XXX: There is no way to seed the random generator.
    186186 *****************************************************************************/
    187 psVector* psGaussianDev(float mean, float sigma, int Npts)
     187psVector* psGaussianDev(float mean, float sigma, psS32 Npts)
    188188{
    189189    psVector* gauss = NULL;
    190190    const gsl_rng_type *T = NULL;
    191191    gsl_rng *r = NULL;
    192     int i = 0;
     192    psS32 i = 0;
    193193
    194194    gauss = psVectorAlloc(Npts, PS_TYPE_F32);
     
    209209    This routine must allocate memory for the polynomial structures.
    210210 *****************************************************************************/
    211 psPolynomial1D* psPolynomial1DAlloc(int n,
     211psPolynomial1D* psPolynomial1DAlloc(psS32 n,
    212212                                    psPolynomialType type)
    213213{
    214     int i = 0;
     214    psS32 i = 0;
    215215    psPolynomial1D* newPoly = NULL;
    216216
     
    232232}
    233233
    234 psPolynomial2D* psPolynomial2DAlloc(int nX, int nY,
     234psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY,
    235235                                    psPolynomialType type)
    236236{
    237     int x = 0;
    238     int y = 0;
     237    psS32 x = 0;
     238    psS32 y = 0;
    239239    psPolynomial2D* newPoly = NULL;
    240240
     
    265265}
    266266
    267 psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ,
     267psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
    268268                                    psPolynomialType type)
    269269{
    270     int x = 0;
    271     int y = 0;
    272     int z = 0;
     270    psS32 x = 0;
     271    psS32 y = 0;
     272    psS32 z = 0;
    273273    psPolynomial3D* newPoly = NULL;
    274274
     
    307307}
    308308
    309 psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
     309psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
    310310                                    psPolynomialType type)
    311311{
    312     int w = 0;
    313     int x = 0;
    314     int y = 0;
    315     int z = 0;
     312    psS32 w = 0;
     313    psS32 x = 0;
     314    psS32 y = 0;
     315    psS32 z = 0;
    316316    psPolynomial4D* newPoly = NULL;
    317317
     
    367367static void polynomial2DFree(psPolynomial2D* myPoly)
    368368{
    369     int x = 0;
     369    psS32 x = 0;
    370370
    371371    for (x = 0; x < myPoly->nX; x++) {
     
    381381static void polynomial3DFree(psPolynomial3D* myPoly)
    382382{
    383     int x = 0;
    384     int y = 0;
     383    psS32 x = 0;
     384    psS32 y = 0;
    385385
    386386    for (x = 0; x < myPoly->nX; x++) {
     
    402402static void polynomial4DFree(psPolynomial4D* myPoly)
    403403{
    404     int w = 0;
    405     int x = 0;
    406     int y = 0;
     404    psS32 w = 0;
     405    psS32 x = 0;
     406    psS32 y = 0;
    407407
    408408    for (w = 0; w < myPoly->nW; w++) {
     
    434434float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly)
    435435{
    436     int loop_x = 0;
     436    psS32 loop_x = 0;
    437437    float polySum = 0.0;
    438438    float xSum = 1.0;
     
    478478{
    479479    psVector *d;
    480     int n;
    481     int i;
     480    psS32 n;
     481    psS32 i;
    482482    float tmp;
    483483
     
    500500    /*
    501501
    502     int n;
    503     int i;
     502    psS32 n;
     503    psS32 i;
    504504    float tmp;
    505505    psPolynomial1D **chebPolys = NULL;
     
    537537    psVector *tmp;
    538538    psVector *myX;
    539     int i;
     539    psS32 i;
    540540
    541541    PS_CONVERT_VECTOR_F32(x, myX);
     
    555555float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    556556{
    557     int loop_x = 0;
    558     int loop_y = 0;
     557    psS32 loop_x = 0;
     558    psS32 loop_y = 0;
    559559    float polySum = 0.0;
    560560    float xSum = 1.0;
     
    577577float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    578578{
    579     int loop_x = 0;
    580     int loop_y = 0;
    581     int i = 0;
     579    psS32 loop_x = 0;
     580    psS32 loop_y = 0;
     581    psS32 i = 0;
    582582    float polySum = 0.0;
    583583    psPolynomial1D* *chebPolys = NULL;
    584     int maxChebyPoly = 0;
     584    psS32 maxChebyPoly = 0;
    585585
    586586    // Determine how many Chebyshev polynomials
     
    628628    psVector *myX;
    629629    psVector *myY;
    630     int i;
    631     int vecLen=x->n;
     630    psS32 i;
     631    psS32 vecLen=x->n;
    632632
    633633    PS_CONVERT_VECTOR_F32(x, myX);
     
    658658float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    659659{
    660     int loop_x = 0;
    661     int loop_y = 0;
    662     int loop_z = 0;
     660    psS32 loop_x = 0;
     661    psS32 loop_y = 0;
     662    psS32 loop_z = 0;
    663663    float polySum = 0.0;
    664664    float xSum = 1.0;
     
    686686float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    687687{
    688     int loop_x = 0;
    689     int loop_y = 0;
    690     int loop_z = 0;
    691     int i = 0;
     688    psS32 loop_x = 0;
     689    psS32 loop_y = 0;
     690    psS32 loop_z = 0;
     691    psS32 i = 0;
    692692    float polySum = 0.0;
    693693    psPolynomial1D* *chebPolys = NULL;
    694     int maxChebyPoly = 0;
     694    psS32 maxChebyPoly = 0;
    695695
    696696    // Determine how many Chebyshev polynomials
     
    746746    psVector *myY;
    747747    psVector *myZ;
    748     int i;
    749     int vecLen=x->n;
     748    psS32 i;
     749    psS32 vecLen=x->n;
    750750
    751751    PS_CONVERT_VECTOR_F32(x, myX);
     
    787787float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    788788{
    789     int loop_w = 0;
    790     int loop_x = 0;
    791     int loop_y = 0;
    792     int loop_z = 0;
     789    psS32 loop_w = 0;
     790    psS32 loop_x = 0;
     791    psS32 loop_y = 0;
     792    psS32 loop_z = 0;
    793793    float polySum = 0.0;
    794794    float wSum = 1.0;
     
    821821float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    822822{
    823     int loop_w = 0;
    824     int loop_x = 0;
    825     int loop_y = 0;
    826     int loop_z = 0;
    827     int i = 0;
     823    psS32 loop_w = 0;
     824    psS32 loop_x = 0;
     825    psS32 loop_y = 0;
     826    psS32 loop_z = 0;
     827    psS32 i = 0;
    828828    float polySum = 0.0;
    829829    psPolynomial1D* *chebPolys = NULL;
    830     int maxChebyPoly = 0;
     830    psS32 maxChebyPoly = 0;
    831831
    832832    // Determine how many Chebyshev polynomials
     
    890890    psVector *myY;
    891891    psVector *myZ;
    892     int i;
    893     int vecLen=x->n;
     892    psS32 i;
     893    psS32 vecLen=x->n;
    894894
    895895    PS_CONVERT_VECTOR_F32(w, myW);
     
    936936
    937937
    938 psDPolynomial1D* psDPolynomial1DAlloc(int n,
     938psDPolynomial1D* psDPolynomial1DAlloc(psS32 n,
    939939                                      psPolynomialType type)
    940940{
    941     int i = 0;
     941    psS32 i = 0;
    942942    psDPolynomial1D* newPoly = NULL;
    943943
     
    959959}
    960960
    961 psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY,
     961psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY,
    962962                                      psPolynomialType type)
    963963{
    964     int x = 0;
    965     int y = 0;
     964    psS32 x = 0;
     965    psS32 y = 0;
    966966    psDPolynomial2D* newPoly = NULL;
    967967
     
    992992}
    993993
    994 psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ,
     994psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
    995995                                      psPolynomialType type)
    996996{
    997     int x = 0;
    998     int y = 0;
    999     int z = 0;
     997    psS32 x = 0;
     998    psS32 y = 0;
     999    psS32 z = 0;
    10001000    psDPolynomial3D* newPoly = NULL;
    10011001
     
    10341034}
    10351035
    1036 psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
     1036psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
    10371037                                      psPolynomialType type)
    10381038{
    1039     int w = 0;
    1040     int x = 0;
    1041     int y = 0;
    1042     int z = 0;
     1039    psS32 w = 0;
     1040    psS32 x = 0;
     1041    psS32 y = 0;
     1042    psS32 z = 0;
    10431043    psDPolynomial4D* newPoly = NULL;
    10441044
     
    10941094static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    10951095{
    1096     int x = 0;
     1096    psS32 x = 0;
    10971097
    10981098    for (x = 0; x < myPoly->nX; x++) {
     
    11081108static void dPolynomial3DFree(psDPolynomial3D* myPoly)
    11091109{
    1110     int x = 0;
    1111     int y = 0;
     1110    psS32 x = 0;
     1111    psS32 y = 0;
    11121112
    11131113    for (x = 0; x < myPoly->nX; x++) {
     
    11291129static void dPolynomial4DFree(psDPolynomial4D* myPoly)
    11301130{
    1131     int w = 0;
    1132     int x = 0;
    1133     int y = 0;
     1131    psS32 w = 0;
     1132    psS32 x = 0;
     1133    psS32 y = 0;
    11341134
    11351135    for (w = 0; w < myPoly->nW; w++) {
     
    11591159double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
    11601160{
    1161     int loop_x = 0;
     1161    psS32 loop_x = 0;
    11621162    double polySum = 0.0;
    11631163    double xSum = 1.0;
     
    11831183{
    11841184    psVector *d;
    1185     int n;
    1186     int i;
     1185    psS32 n;
     1186    psS32 i;
    11871187    double tmp;
    11881188
     
    12221222    psVector *tmp;
    12231223    psVector *myX;
    1224     int i;
     1224    psS32 i;
    12251225
    12261226    PS_CONVERT_VECTOR_F64(x, myX);
     
    12411241double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    12421242{
    1243     int loop_x = 0;
    1244     int loop_y = 0;
     1243    psS32 loop_x = 0;
     1244    psS32 loop_y = 0;
    12451245    double polySum = 0.0;
    12461246    double xSum = 1.0;
     
    12631263double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    12641264{
    1265     int loop_x = 0;
    1266     int loop_y = 0;
    1267     int i = 0;
     1265    psS32 loop_x = 0;
     1266    psS32 loop_y = 0;
     1267    psS32 i = 0;
    12681268    double polySum = 0.0;
    12691269    psPolynomial1D* *chebPolys = NULL;
    1270     int maxChebyPoly = 0;
     1270    psS32 maxChebyPoly = 0;
    12711271
    12721272    // Determine how many Chebyshev polynomials
     
    13141314    psVector *myX;
    13151315    psVector *myY;
    1316     int i;
    1317     int vecLen=x->n;
     1316    psS32 i;
     1317    psS32 vecLen=x->n;
    13181318
    13191319    PS_CONVERT_VECTOR_F64(x, myX);
     
    13441344double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    13451345{
    1346     int loop_x = 0;
    1347     int loop_y = 0;
    1348     int loop_z = 0;
     1346    psS32 loop_x = 0;
     1347    psS32 loop_y = 0;
     1348    psS32 loop_z = 0;
    13491349    double polySum = 0.0;
    13501350    double xSum = 1.0;
     
    13721372double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    13731373{
    1374     int loop_x = 0;
    1375     int loop_y = 0;
    1376     int loop_z = 0;
    1377     int i = 0;
     1374    psS32 loop_x = 0;
     1375    psS32 loop_y = 0;
     1376    psS32 loop_z = 0;
     1377    psS32 i = 0;
    13781378    double polySum = 0.0;
    13791379    psPolynomial1D* *chebPolys = NULL;
    1380     int maxChebyPoly = 0;
     1380    psS32 maxChebyPoly = 0;
    13811381
    13821382    // Determine how many Chebyshev polynomials
     
    14321432    psVector *myY;
    14331433    psVector *myZ;
    1434     int i;
    1435     int vecLen=x->n;
     1434    psS32 i;
     1435    psS32 vecLen=x->n;
    14361436
    14371437    PS_CONVERT_VECTOR_F64(x, myX);
     
    14751475double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    14761476{
    1477     int loop_w = 0;
    1478     int loop_x = 0;
    1479     int loop_y = 0;
    1480     int loop_z = 0;
     1477    psS32 loop_w = 0;
     1478    psS32 loop_x = 0;
     1479    psS32 loop_y = 0;
     1480    psS32 loop_z = 0;
    14811481    double polySum = 0.0;
    14821482    double wSum = 1.0;
     
    15091509double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    15101510{
    1511     int loop_w = 0;
    1512     int loop_x = 0;
    1513     int loop_y = 0;
    1514     int loop_z = 0;
    1515     int i = 0;
     1511    psS32 loop_w = 0;
     1512    psS32 loop_x = 0;
     1513    psS32 loop_y = 0;
     1514    psS32 loop_z = 0;
     1515    psS32 i = 0;
    15161516    double polySum = 0.0;
    15171517    psPolynomial1D* *chebPolys = NULL;
    1518     int maxChebyPoly = 0;
     1518    psS32 maxChebyPoly = 0;
    15191519
    15201520    // Determine how many Chebyshev polynomials
     
    15781578    psVector *myY;
    15791579    psVector *myZ;
    1580     int i;
    1581     int vecLen=x->n;
     1580    psS32 i;
     1581    psS32 vecLen=x->n;
    15821582
    15831583    PS_CONVERT_VECTOR_F64(w, myW);
     
    16241624
    16251625//typedef struct {
    1626 //    int n;
     1626//    psS32 n;
    16271627//    psPolynomial1D **spline;
    16281628//    float *p_psDeriv2;
     
    16361636XXX: Ensure that domain[i+1] != domain[i]
    16371637 *****************************************************************************/
    1638 psSpline1D *psSpline1DAlloc(int numSplines,
    1639                             int order,
     1638psSpline1D *psSpline1DAlloc(psS32 numSplines,
     1639                            psS32 order,
    16401640                            float min,
    16411641                            float max)
    16421642{
    16431643    psSpline1D *tmp = NULL;
    1644     int i;
     1644    psS32 i;
    16451645    float tmpDomain;
    16461646    float width;
     
    16771677
    16781678// XXX: Have Robert put the dealocator in the memory file.
    1679 int p_psSpline1DFree(psSpline1D *tmpSpline)
    1680 {
    1681     int i;
     1679psS32 p_psSpline1DFree(psSpline1D *tmpSpline)
     1680{
     1681    psS32 i;
    16821682
    16831683    if (tmpSpline == NULL) {
     
    17041704 *****************************************************************************/
    17051705psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
    1706                                    int order)
     1706                                   psS32 order)
    17071707{
    17081708    psSpline1D *tmp = NULL;
    1709     int i;
    1710     int numSplines;
     1709    psS32 i;
     1710    psS32 numSplines;
    17111711
    17121712    tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D));
     
    17461746XXX: name since we don't take psVectors as input.
    17471747 *****************************************************************************/
    1748 int p_psVectorBinDisectF32(float *bins,
    1749                            int numBins,
    1750                            float x)
    1751 {
    1752     int min;
    1753     int max;
    1754     int mid;
     1748psS32 p_psVectorBinDisectF32(float *bins,
     1749                             psS32 numBins,
     1750                             float x)
     1751{
     1752    psS32 min;
     1753    psS32 max;
     1754    psS32 mid;
    17551755
    17561756    psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4,
     
    18001800p_psVectorBinDisectS32(): integer version of above.
    18011801 *****************************************************************************/
    1802 int p_psVectorBinDisectS32(int *bins,
    1803                            int numBins,
    1804                            int x)
    1805 {
    1806     int min;
    1807     int max;
    1808     int mid;
     1802psS32 p_psVectorBinDisectS32(psS32 *bins,
     1803                             psS32 numBins,
     1804                             psS32 x)
     1805{
     1806    psS32 min;
     1807    psS32 max;
     1808    psS32 mid;
    18091809
    18101810    psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4,
     
    18481848p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect().
    18491849 *****************************************************************************/
    1850 int p_psVectorBinDisect(psVector *bins,
    1851                         psScalar *x)
     1850psS32 p_psVectorBinDisect(psVector *bins,
     1851                          psScalar *x)
    18521852{
    18531853    if (x->type.type != bins->type.type) {
     
    18771877float p_ps1DFullInterpolateF32(float *domain,
    18781878                               float *range,
    1879                                int n,
     1879                               psS32 n,
    18801880                               float x)
    18811881{
    1882     int i;
    1883     int m;
     1882    psS32 i;
     1883    psS32 m;
    18841884    static psVector *p = NULL;
    18851885    p = psVectorRecycle(p, n, PS_TYPE_F32);
     
    19371937float p_ps1DInterpolateF32(float *domain,
    19381938                           float *range,
    1939                            int n,
    1940                            int order,
     1939                           psS32 n,
     1940                           psS32 order,
    19411941                           float x)
    19421942{
    1943     int binNum;
    1944     int numIntPoints = order+1;
    1945     int origin;
     1943    psS32 binNum;
     1944    psS32 numIntPoints = order+1;
     1945    psS32 origin;
    19461946
    19471947    psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4,
     
    19871987psScalar *p_psVectorInterpolate(psVector *domain,
    19881988                                psVector *range,
    1989                                 int order,
     1989                                psS32 order,
    19901990                                psScalar *x)
    19911991{
     
    20652065                     float x)
    20662066{
    2067     int binNum;
    2068     int n;
     2067    psS32 binNum;
     2068    psS32 n;
    20692069
    20702070    n = spline->n;
     
    20912091                               const psSpline1D *spline)
    20922092{
    2093     int i;
     2093    psS32 i;
    20942094    psVector *tmpVector;
    20952095
  • trunk/psLib/src/math/psPolynomial.h

    r1968 r2204  
    1212*  @author George Gusciora, MHPCC
    1313*
    14 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-10-06 00:48:15 $
     14*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-10-27 00:57:31 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545    float mean,                        ///< Mean for the Gaussian
    4646    float stddev,                      ///< Standard deviation for the Gaussian
    47     bool normal                        ///< Indicates whether result should be normalized
     47    psBool normal                        ///< Indicates whether result should be normalized
    4848);
    4949
     
    5757    float mean,                        ///< The mean of the Gaussian
    5858    float sigma,                       ///< The sigma of the Gaussian
    59     int Npts                           ///< The size of the vector
     59    psS32 Npts                           ///< The size of the vector
    6060);
    6161
     
    6969{
    7070    psPolynomialType type;             ///< Polynomial type
    71     int n;                             ///< Number of terms
     71    psS32 n;                             ///< Number of terms
    7272    float *coeff;                      ///< Coefficients
    7373    float *coeffErr;                   ///< Error in coefficients
     
    8080{
    8181    psPolynomialType type;             ///< Polynomial type
    82     int nX;                            ///< Number of terms in x
    83     int nY;                            ///< Number of terms in y
     82    psS32 nX;                            ///< Number of terms in x
     83    psS32 nY;                            ///< Number of terms in y
    8484    float **coeff;                     ///< Coefficients
    8585    float **coeffErr;                  ///< Error in coefficients
     
    9292{
    9393    psPolynomialType type;             ///< Polynomial type
    94     int nX;                            ///< Number of terms in x
    95     int nY;                            ///< Number of terms in y
    96     int nZ;                            ///< Number of terms in z
     94    psS32 nX;                            ///< Number of terms in x
     95    psS32 nY;                            ///< Number of terms in y
     96    psS32 nZ;                            ///< Number of terms in z
    9797    float ***coeff;                    ///< Coefficients
    9898    float ***coeffErr;                 ///< Error in coefficients
     
    105105{
    106106    psPolynomialType type;             ///< Polynomial type
    107     int nW;                            ///< Number of terms in w
    108     int nX;                            ///< Number of terms in x
    109     int nY;                            ///< Number of terms in y
    110     int nZ;                            ///< Number of terms in z
     107    psS32 nW;                            ///< Number of terms in w
     108    psS32 nX;                            ///< Number of terms in x
     109    psS32 nY;                            ///< Number of terms in y
     110    psS32 nZ;                            ///< Number of terms in z
    111111    float ****coeff;                   ///< Coefficients
    112112    float ****coeffErr;                ///< Error in coefficients
     
    121121 */
    122122psPolynomial1D* psPolynomial1DAlloc(
    123     int n,                              ///< Number of terms
     123    psS32 n,                              ///< Number of terms
    124124    psPolynomialType type               ///< Polynomial Type
    125125);
     
    130130 */
    131131psPolynomial2D* psPolynomial2DAlloc(
    132     int nX,                            ///< Number of terms in x
    133     int nY,                            ///< Number of terms in y
     132    psS32 nX,                            ///< Number of terms in x
     133    psS32 nY,                            ///< Number of terms in y
    134134    psPolynomialType type              ///< Polynomial Type
    135135);
     
    140140 */
    141141psPolynomial3D* psPolynomial3DAlloc(
    142     int nX,                            ///< Number of terms in x
    143     int nY,                            ///< Number of terms in y
    144     int nZ,                            ///< Number of terms in z
     142    psS32 nX,                            ///< Number of terms in x
     143    psS32 nY,                            ///< Number of terms in y
     144    psS32 nZ,                            ///< Number of terms in z
    145145    psPolynomialType type              ///< Polynomial Type
    146146);
     
    151151 */
    152152psPolynomial4D* psPolynomial4DAlloc(
    153     int nW,                            ///< Number of terms in w
    154     int nX,                            ///< Number of terms in x
    155     int nY,                            ///< Number of terms in y
    156     int nZ,                            ///< Number of terms in z
     153    psS32 nW,                            ///< Number of terms in w
     154    psS32 nX,                            ///< Number of terms in x
     155    psS32 nY,                            ///< Number of terms in y
     156    psS32 nZ,                            ///< Number of terms in z
    157157    psPolynomialType type              ///< Polynomial Type
    158158);
     
    230230{
    231231    psPolynomialType type;             ///< Polynomial type
    232     int n;                             ///< Number of terms
     232    psS32 n;                             ///< Number of terms
    233233    double *coeff;                     ///< Coefficients
    234234    double *coeffErr;                  ///< Error in coefficients
     
    241241{
    242242    psPolynomialType type;             ///< Polynomial type
    243     int nX;                            ///< Number of terms in x
    244     int nY;                            ///< Number of terms in y
     243    psS32 nX;                            ///< Number of terms in x
     244    psS32 nY;                            ///< Number of terms in y
    245245    double **coeff;                    ///< Coefficients
    246246    double **coeffErr;                 ///< Error in coefficients
     
    253253{
    254254    psPolynomialType type;             ///< Polynomial type
    255     int nX;                            ///< Number of terms in x
    256     int nY;                            ///< Number of terms in y
    257     int nZ;                            ///< Number of terms in z
     255    psS32 nX;                            ///< Number of terms in x
     256    psS32 nY;                            ///< Number of terms in y
     257    psS32 nZ;                            ///< Number of terms in z
    258258    double ***coeff;                   ///< Coefficients
    259259    double ***coeffErr;                ///< Error in coefficients
     
    266266{
    267267    psPolynomialType type;             ///< Polynomial type
    268     int nW;                            ///< Number of terms in w
    269     int nX;                            ///< Number of terms in x
    270     int nY;                            ///< Number of terms in y
    271     int nZ;                            ///< Number of terms in z
     268    psS32 nW;                            ///< Number of terms in w
     269    psS32 nX;                            ///< Number of terms in x
     270    psS32 nY;                            ///< Number of terms in y
     271    psS32 nZ;                            ///< Number of terms in z
    272272    double ****coeff;                  ///< Coefficients
    273273    double ****coeffErr;               ///< Error in coefficients
     
    281281 */
    282282psDPolynomial1D* psDPolynomial1DAlloc(
    283     int n,                             ///< Number of terms
     283    psS32 n,                             ///< Number of terms
    284284    psPolynomialType type              ///< Polynomial Type
    285285);
     
    290290 */
    291291psDPolynomial2D* psDPolynomial2DAlloc(
    292     int nX,                            ///< Number of terms in x
    293     int nY,                            ///< Number of terms in y
     292    psS32 nX,                            ///< Number of terms in x
     293    psS32 nY,                            ///< Number of terms in y
    294294    psPolynomialType type              ///< Polynomial Type
    295295);
     
    300300 */
    301301psDPolynomial3D* psDPolynomial3DAlloc(
    302     int nX,                            ///< Number of terms in x
    303     int nY,                            ///< Number of terms in y
    304     int nZ,                            ///< Number of terms in z
     302    psS32 nX,                            ///< Number of terms in x
     303    psS32 nY,                            ///< Number of terms in y
     304    psS32 nZ,                            ///< Number of terms in z
    305305    psPolynomialType type              ///< Polynomial Type
    306306);
     
    311311 */
    312312psDPolynomial4D* psDPolynomial4DAlloc(
    313     int nW,                            ///< Number of terms in w
    314     int nX,                            ///< Number of terms in x
    315     int nY,                            ///< Number of terms in y
    316     int nZ,                            ///< Number of terms in z
     313    psS32 nW,                            ///< Number of terms in w
     314    psS32 nX,                            ///< Number of terms in x
     315    psS32 nY,                            ///< Number of terms in y
     316    psS32 nZ,                            ///< Number of terms in z
    317317    psPolynomialType type              ///< Polynomial Type
    318318);
     
    386386typedef struct
    387387{
    388     int n;                        ///< The number of spline polynomials
     388    psS32 n;                        ///< The number of spline polynomials
    389389    psPolynomial1D **spline;      ///< An array of n pointers to the spline polynomials
    390390    float *p_psDeriv2;            ///< For cubic splines, the second derivative at each domain point.  Size is n+1.
     
    393393psSpline1D;
    394394
    395 psSpline1D *psSpline1DAlloc(int n,
    396                             int order,
     395psSpline1D *psSpline1DAlloc(psS32 n,
     396                            psS32 order,
    397397                            float min,
    398398                            float max);
    399399
    400 int p_psSpline1DFree(psSpline1D *tmpSpline);
     400psS32 p_psSpline1DFree(psSpline1D *tmpSpline);
    401401
    402402psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
    403                                    int order);
     403                                   psS32 order);
    404404
    405405float psSpline1DEval(const psSpline1D *spline,
     
    409409                               const psSpline1D *spline);
    410410
    411 int p_psVectorBinDisectF32(float *bins,
    412                            int numBins,
    413                            float x);
    414 
    415 int p_psVectorBinDisectS32(int *bins,
    416                            int numBins,
    417                            int x);
    418 
    419 int p_psVectorBinDisect(psVector *bins,
    420                         psScalar *x);
     411psS32 p_psVectorBinDisectF32(float *bins,
     412                             psS32 numBins,
     413                             float x);
     414
     415psS32 p_psVectorBinDisectS32(psS32 *bins,
     416                             psS32 numBins,
     417                             psS32 x);
     418
     419psS32 p_psVectorBinDisect(psVector *bins,
     420                          psScalar *x);
    421421
    422422psScalar *p_psVectorInterpolate(psVector *domain,
    423423                                psVector *range,
    424                                 int order,
     424                                psS32 order,
    425425                                psScalar *x);
    426426
  • trunk/psLib/src/math/psSpline.c

    r2197 r2204  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-26 21:24:42 $
     9 *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    \
    5151    if (IN->type.type == PS_TYPE_F64) { \
    52         for (int i=0;i<IN->n;i++) { \
     52        for (psS32 i=0;i<IN->n;i++) { \
    5353            OUT->data.F32[i] = (float) (IN->data.F64[i]); \
    5454        } \
     
    6969    \
    7070    if (IN->type.type == PS_TYPE_F32) { \
    71         for (int i=0;i<IN->n;i++) { \
     71        for (psS32 i=0;i<IN->n;i++) { \
    7272            OUT->data.F64[i] = (float) (IN->data.F32[i]); \
    7373        } \
     
    117117outer coefficients of the Chebyshev polynomials.
    118118 *****************************************************************************/
    119 static psPolynomial1D **CreateChebyshevPolys(int maxChebyPoly)
     119static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly)
    120120{
    121121    psPolynomial1D **chebPolys = NULL;
    122     int i = 0;
    123     int j = 0;
     122    psS32 i = 0;
     123    psS32 j = 0;
    124124
    125125    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    153153    evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f]
    154154 *****************************************************************************/
    155 float psGaussian(float x, float mean, float sigma, bool normal)
     155float psGaussian(float x, float mean, float sigma, psBool normal)
    156156{
    157157    float tmp = 1.0;
     
    185185 NOTE: XXX: There is no way to seed the random generator.
    186186 *****************************************************************************/
    187 psVector* psGaussianDev(float mean, float sigma, int Npts)
     187psVector* psGaussianDev(float mean, float sigma, psS32 Npts)
    188188{
    189189    psVector* gauss = NULL;
    190190    const gsl_rng_type *T = NULL;
    191191    gsl_rng *r = NULL;
    192     int i = 0;
     192    psS32 i = 0;
    193193
    194194    gauss = psVectorAlloc(Npts, PS_TYPE_F32);
     
    209209    This routine must allocate memory for the polynomial structures.
    210210 *****************************************************************************/
    211 psPolynomial1D* psPolynomial1DAlloc(int n,
     211psPolynomial1D* psPolynomial1DAlloc(psS32 n,
    212212                                    psPolynomialType type)
    213213{
    214     int i = 0;
     214    psS32 i = 0;
    215215    psPolynomial1D* newPoly = NULL;
    216216
     
    232232}
    233233
    234 psPolynomial2D* psPolynomial2DAlloc(int nX, int nY,
     234psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY,
    235235                                    psPolynomialType type)
    236236{
    237     int x = 0;
    238     int y = 0;
     237    psS32 x = 0;
     238    psS32 y = 0;
    239239    psPolynomial2D* newPoly = NULL;
    240240
     
    265265}
    266266
    267 psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ,
     267psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
    268268                                    psPolynomialType type)
    269269{
    270     int x = 0;
    271     int y = 0;
    272     int z = 0;
     270    psS32 x = 0;
     271    psS32 y = 0;
     272    psS32 z = 0;
    273273    psPolynomial3D* newPoly = NULL;
    274274
     
    307307}
    308308
    309 psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
     309psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
    310310                                    psPolynomialType type)
    311311{
    312     int w = 0;
    313     int x = 0;
    314     int y = 0;
    315     int z = 0;
     312    psS32 w = 0;
     313    psS32 x = 0;
     314    psS32 y = 0;
     315    psS32 z = 0;
    316316    psPolynomial4D* newPoly = NULL;
    317317
     
    367367static void polynomial2DFree(psPolynomial2D* myPoly)
    368368{
    369     int x = 0;
     369    psS32 x = 0;
    370370
    371371    for (x = 0; x < myPoly->nX; x++) {
     
    381381static void polynomial3DFree(psPolynomial3D* myPoly)
    382382{
    383     int x = 0;
    384     int y = 0;
     383    psS32 x = 0;
     384    psS32 y = 0;
    385385
    386386    for (x = 0; x < myPoly->nX; x++) {
     
    402402static void polynomial4DFree(psPolynomial4D* myPoly)
    403403{
    404     int w = 0;
    405     int x = 0;
    406     int y = 0;
     404    psS32 w = 0;
     405    psS32 x = 0;
     406    psS32 y = 0;
    407407
    408408    for (w = 0; w < myPoly->nW; w++) {
     
    434434float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly)
    435435{
    436     int loop_x = 0;
     436    psS32 loop_x = 0;
    437437    float polySum = 0.0;
    438438    float xSum = 1.0;
     
    478478{
    479479    psVector *d;
    480     int n;
    481     int i;
     480    psS32 n;
     481    psS32 i;
    482482    float tmp;
    483483
     
    500500    /*
    501501
    502     int n;
    503     int i;
     502    psS32 n;
     503    psS32 i;
    504504    float tmp;
    505505    psPolynomial1D **chebPolys = NULL;
     
    537537    psVector *tmp;
    538538    psVector *myX;
    539     int i;
     539    psS32 i;
    540540
    541541    PS_CONVERT_VECTOR_F32(x, myX);
     
    555555float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    556556{
    557     int loop_x = 0;
    558     int loop_y = 0;
     557    psS32 loop_x = 0;
     558    psS32 loop_y = 0;
    559559    float polySum = 0.0;
    560560    float xSum = 1.0;
     
    577577float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
    578578{
    579     int loop_x = 0;
    580     int loop_y = 0;
    581     int i = 0;
     579    psS32 loop_x = 0;
     580    psS32 loop_y = 0;
     581    psS32 i = 0;
    582582    float polySum = 0.0;
    583583    psPolynomial1D* *chebPolys = NULL;
    584     int maxChebyPoly = 0;
     584    psS32 maxChebyPoly = 0;
    585585
    586586    // Determine how many Chebyshev polynomials
     
    628628    psVector *myX;
    629629    psVector *myY;
    630     int i;
    631     int vecLen=x->n;
     630    psS32 i;
     631    psS32 vecLen=x->n;
    632632
    633633    PS_CONVERT_VECTOR_F32(x, myX);
     
    658658float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    659659{
    660     int loop_x = 0;
    661     int loop_y = 0;
    662     int loop_z = 0;
     660    psS32 loop_x = 0;
     661    psS32 loop_y = 0;
     662    psS32 loop_z = 0;
    663663    float polySum = 0.0;
    664664    float xSum = 1.0;
     
    686686float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
    687687{
    688     int loop_x = 0;
    689     int loop_y = 0;
    690     int loop_z = 0;
    691     int i = 0;
     688    psS32 loop_x = 0;
     689    psS32 loop_y = 0;
     690    psS32 loop_z = 0;
     691    psS32 i = 0;
    692692    float polySum = 0.0;
    693693    psPolynomial1D* *chebPolys = NULL;
    694     int maxChebyPoly = 0;
     694    psS32 maxChebyPoly = 0;
    695695
    696696    // Determine how many Chebyshev polynomials
     
    746746    psVector *myY;
    747747    psVector *myZ;
    748     int i;
    749     int vecLen=x->n;
     748    psS32 i;
     749    psS32 vecLen=x->n;
    750750
    751751    PS_CONVERT_VECTOR_F32(x, myX);
     
    787787float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    788788{
    789     int loop_w = 0;
    790     int loop_x = 0;
    791     int loop_y = 0;
    792     int loop_z = 0;
     789    psS32 loop_w = 0;
     790    psS32 loop_x = 0;
     791    psS32 loop_y = 0;
     792    psS32 loop_z = 0;
    793793    float polySum = 0.0;
    794794    float wSum = 1.0;
     
    821821float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
    822822{
    823     int loop_w = 0;
    824     int loop_x = 0;
    825     int loop_y = 0;
    826     int loop_z = 0;
    827     int i = 0;
     823    psS32 loop_w = 0;
     824    psS32 loop_x = 0;
     825    psS32 loop_y = 0;
     826    psS32 loop_z = 0;
     827    psS32 i = 0;
    828828    float polySum = 0.0;
    829829    psPolynomial1D* *chebPolys = NULL;
    830     int maxChebyPoly = 0;
     830    psS32 maxChebyPoly = 0;
    831831
    832832    // Determine how many Chebyshev polynomials
     
    890890    psVector *myY;
    891891    psVector *myZ;
    892     int i;
    893     int vecLen=x->n;
     892    psS32 i;
     893    psS32 vecLen=x->n;
    894894
    895895    PS_CONVERT_VECTOR_F32(w, myW);
     
    936936
    937937
    938 psDPolynomial1D* psDPolynomial1DAlloc(int n,
     938psDPolynomial1D* psDPolynomial1DAlloc(psS32 n,
    939939                                      psPolynomialType type)
    940940{
    941     int i = 0;
     941    psS32 i = 0;
    942942    psDPolynomial1D* newPoly = NULL;
    943943
     
    959959}
    960960
    961 psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY,
     961psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY,
    962962                                      psPolynomialType type)
    963963{
    964     int x = 0;
    965     int y = 0;
     964    psS32 x = 0;
     965    psS32 y = 0;
    966966    psDPolynomial2D* newPoly = NULL;
    967967
     
    992992}
    993993
    994 psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ,
     994psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
    995995                                      psPolynomialType type)
    996996{
    997     int x = 0;
    998     int y = 0;
    999     int z = 0;
     997    psS32 x = 0;
     998    psS32 y = 0;
     999    psS32 z = 0;
    10001000    psDPolynomial3D* newPoly = NULL;
    10011001
     
    10341034}
    10351035
    1036 psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
     1036psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
    10371037                                      psPolynomialType type)
    10381038{
    1039     int w = 0;
    1040     int x = 0;
    1041     int y = 0;
    1042     int z = 0;
     1039    psS32 w = 0;
     1040    psS32 x = 0;
     1041    psS32 y = 0;
     1042    psS32 z = 0;
    10431043    psDPolynomial4D* newPoly = NULL;
    10441044
     
    10941094static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    10951095{
    1096     int x = 0;
     1096    psS32 x = 0;
    10971097
    10981098    for (x = 0; x < myPoly->nX; x++) {
     
    11081108static void dPolynomial3DFree(psDPolynomial3D* myPoly)
    11091109{
    1110     int x = 0;
    1111     int y = 0;
     1110    psS32 x = 0;
     1111    psS32 y = 0;
    11121112
    11131113    for (x = 0; x < myPoly->nX; x++) {
     
    11291129static void dPolynomial4DFree(psDPolynomial4D* myPoly)
    11301130{
    1131     int w = 0;
    1132     int x = 0;
    1133     int y = 0;
     1131    psS32 w = 0;
     1132    psS32 x = 0;
     1133    psS32 y = 0;
    11341134
    11351135    for (w = 0; w < myPoly->nW; w++) {
     
    11591159double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
    11601160{
    1161     int loop_x = 0;
     1161    psS32 loop_x = 0;
    11621162    double polySum = 0.0;
    11631163    double xSum = 1.0;
     
    11831183{
    11841184    psVector *d;
    1185     int n;
    1186     int i;
     1185    psS32 n;
     1186    psS32 i;
    11871187    double tmp;
    11881188
     
    12221222    psVector *tmp;
    12231223    psVector *myX;
    1224     int i;
     1224    psS32 i;
    12251225
    12261226    PS_CONVERT_VECTOR_F64(x, myX);
     
    12411241double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    12421242{
    1243     int loop_x = 0;
    1244     int loop_y = 0;
     1243    psS32 loop_x = 0;
     1244    psS32 loop_y = 0;
    12451245    double polySum = 0.0;
    12461246    double xSum = 1.0;
     
    12631263double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
    12641264{
    1265     int loop_x = 0;
    1266     int loop_y = 0;
    1267     int i = 0;
     1265    psS32 loop_x = 0;
     1266    psS32 loop_y = 0;
     1267    psS32 i = 0;
    12681268    double polySum = 0.0;
    12691269    psPolynomial1D* *chebPolys = NULL;
    1270     int maxChebyPoly = 0;
     1270    psS32 maxChebyPoly = 0;
    12711271
    12721272    // Determine how many Chebyshev polynomials
     
    13141314    psVector *myX;
    13151315    psVector *myY;
    1316     int i;
    1317     int vecLen=x->n;
     1316    psS32 i;
     1317    psS32 vecLen=x->n;
    13181318
    13191319    PS_CONVERT_VECTOR_F64(x, myX);
     
    13441344double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    13451345{
    1346     int loop_x = 0;
    1347     int loop_y = 0;
    1348     int loop_z = 0;
     1346    psS32 loop_x = 0;
     1347    psS32 loop_y = 0;
     1348    psS32 loop_z = 0;
    13491349    double polySum = 0.0;
    13501350    double xSum = 1.0;
     
    13721372double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
    13731373{
    1374     int loop_x = 0;
    1375     int loop_y = 0;
    1376     int loop_z = 0;
    1377     int i = 0;
     1374    psS32 loop_x = 0;
     1375    psS32 loop_y = 0;
     1376    psS32 loop_z = 0;
     1377    psS32 i = 0;
    13781378    double polySum = 0.0;
    13791379    psPolynomial1D* *chebPolys = NULL;
    1380     int maxChebyPoly = 0;
     1380    psS32 maxChebyPoly = 0;
    13811381
    13821382    // Determine how many Chebyshev polynomials
     
    14321432    psVector *myY;
    14331433    psVector *myZ;
    1434     int i;
    1435     int vecLen=x->n;
     1434    psS32 i;
     1435    psS32 vecLen=x->n;
    14361436
    14371437    PS_CONVERT_VECTOR_F64(x, myX);
     
    14751475double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    14761476{
    1477     int loop_w = 0;
    1478     int loop_x = 0;
    1479     int loop_y = 0;
    1480     int loop_z = 0;
     1477    psS32 loop_w = 0;
     1478    psS32 loop_x = 0;
     1479    psS32 loop_y = 0;
     1480    psS32 loop_z = 0;
    14811481    double polySum = 0.0;
    14821482    double wSum = 1.0;
     
    15091509double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
    15101510{
    1511     int loop_w = 0;
    1512     int loop_x = 0;
    1513     int loop_y = 0;
    1514     int loop_z = 0;
    1515     int i = 0;
     1511    psS32 loop_w = 0;
     1512    psS32 loop_x = 0;
     1513    psS32 loop_y = 0;
     1514    psS32 loop_z = 0;
     1515    psS32 i = 0;
    15161516    double polySum = 0.0;
    15171517    psPolynomial1D* *chebPolys = NULL;
    1518     int maxChebyPoly = 0;
     1518    psS32 maxChebyPoly = 0;
    15191519
    15201520    // Determine how many Chebyshev polynomials
     
    15781578    psVector *myY;
    15791579    psVector *myZ;
    1580     int i;
    1581     int vecLen=x->n;
     1580    psS32 i;
     1581    psS32 vecLen=x->n;
    15821582
    15831583    PS_CONVERT_VECTOR_F64(w, myW);
     
    16241624
    16251625//typedef struct {
    1626 //    int n;
     1626//    psS32 n;
    16271627//    psPolynomial1D **spline;
    16281628//    float *p_psDeriv2;
     
    16361636XXX: Ensure that domain[i+1] != domain[i]
    16371637 *****************************************************************************/
    1638 psSpline1D *psSpline1DAlloc(int numSplines,
    1639                             int order,
     1638psSpline1D *psSpline1DAlloc(psS32 numSplines,
     1639                            psS32 order,
    16401640                            float min,
    16411641                            float max)
    16421642{
    16431643    psSpline1D *tmp = NULL;
    1644     int i;
     1644    psS32 i;
    16451645    float tmpDomain;
    16461646    float width;
     
    16771677
    16781678// XXX: Have Robert put the dealocator in the memory file.
    1679 int p_psSpline1DFree(psSpline1D *tmpSpline)
    1680 {
    1681     int i;
     1679psS32 p_psSpline1DFree(psSpline1D *tmpSpline)
     1680{
     1681    psS32 i;
    16821682
    16831683    if (tmpSpline == NULL) {
     
    17041704 *****************************************************************************/
    17051705psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
    1706                                    int order)
     1706                                   psS32 order)
    17071707{
    17081708    psSpline1D *tmp = NULL;
    1709     int i;
    1710     int numSplines;
     1709    psS32 i;
     1710    psS32 numSplines;
    17111711
    17121712    tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D));
     
    17461746XXX: name since we don't take psVectors as input.
    17471747 *****************************************************************************/
    1748 int p_psVectorBinDisectF32(float *bins,
    1749                            int numBins,
    1750                            float x)
    1751 {
    1752     int min;
    1753     int max;
    1754     int mid;
     1748psS32 p_psVectorBinDisectF32(float *bins,
     1749                             psS32 numBins,
     1750                             float x)
     1751{
     1752    psS32 min;
     1753    psS32 max;
     1754    psS32 mid;
    17551755
    17561756    psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4,
     
    18001800p_psVectorBinDisectS32(): integer version of above.
    18011801 *****************************************************************************/
    1802 int p_psVectorBinDisectS32(int *bins,
    1803                            int numBins,
    1804                            int x)
    1805 {
    1806     int min;
    1807     int max;
    1808     int mid;
     1802psS32 p_psVectorBinDisectS32(psS32 *bins,
     1803                             psS32 numBins,
     1804                             psS32 x)
     1805{
     1806    psS32 min;
     1807    psS32 max;
     1808    psS32 mid;
    18091809
    18101810    psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4,
     
    18481848p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect().
    18491849 *****************************************************************************/
    1850 int p_psVectorBinDisect(psVector *bins,
    1851                         psScalar *x)
     1850psS32 p_psVectorBinDisect(psVector *bins,
     1851                          psScalar *x)
    18521852{
    18531853    if (x->type.type != bins->type.type) {
     
    18771877float p_ps1DFullInterpolateF32(float *domain,
    18781878                               float *range,
    1879                                int n,
     1879                               psS32 n,
    18801880                               float x)
    18811881{
    1882     int i;
    1883     int m;
     1882    psS32 i;
     1883    psS32 m;
    18841884    static psVector *p = NULL;
    18851885    p = psVectorRecycle(p, n, PS_TYPE_F32);
     
    19371937float p_ps1DInterpolateF32(float *domain,
    19381938                           float *range,
    1939                            int n,
    1940                            int order,
     1939                           psS32 n,
     1940                           psS32 order,
    19411941                           float x)
    19421942{
    1943     int binNum;
    1944     int numIntPoints = order+1;
    1945     int origin;
     1943    psS32 binNum;
     1944    psS32 numIntPoints = order+1;
     1945    psS32 origin;
    19461946
    19471947    psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4,
     
    19871987psScalar *p_psVectorInterpolate(psVector *domain,
    19881988                                psVector *range,
    1989                                 int order,
     1989                                psS32 order,
    19901990                                psScalar *x)
    19911991{
     
    20652065                     float x)
    20662066{
    2067     int binNum;
    2068     int n;
     2067    psS32 binNum;
     2068    psS32 n;
    20692069
    20702070    n = spline->n;
     
    20912091                               const psSpline1D *spline)
    20922092{
    2093     int i;
     2093    psS32 i;
    20942094    psVector *tmpVector;
    20952095
  • trunk/psLib/src/math/psSpline.h

    r1968 r2204  
    1212*  @author George Gusciora, MHPCC
    1313*
    14 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-10-06 00:48:15 $
     14*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-10-27 00:57:31 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545    float mean,                        ///< Mean for the Gaussian
    4646    float stddev,                      ///< Standard deviation for the Gaussian
    47     bool normal                        ///< Indicates whether result should be normalized
     47    psBool normal                        ///< Indicates whether result should be normalized
    4848);
    4949
     
    5757    float mean,                        ///< The mean of the Gaussian
    5858    float sigma,                       ///< The sigma of the Gaussian
    59     int Npts                           ///< The size of the vector
     59    psS32 Npts                           ///< The size of the vector
    6060);
    6161
     
    6969{
    7070    psPolynomialType type;             ///< Polynomial type
    71     int n;                             ///< Number of terms
     71    psS32 n;                             ///< Number of terms
    7272    float *coeff;                      ///< Coefficients
    7373    float *coeffErr;                   ///< Error in coefficients
     
    8080{
    8181    psPolynomialType type;             ///< Polynomial type
    82     int nX;                            ///< Number of terms in x
    83     int nY;                            ///< Number of terms in y
     82    psS32 nX;                            ///< Number of terms in x
     83    psS32 nY;                            ///< Number of terms in y
    8484    float **coeff;                     ///< Coefficients
    8585    float **coeffErr;                  ///< Error in coefficients
     
    9292{
    9393    psPolynomialType type;             ///< Polynomial type
    94     int nX;                            ///< Number of terms in x
    95     int nY;                            ///< Number of terms in y
    96     int nZ;                            ///< Number of terms in z
     94    psS32 nX;                            ///< Number of terms in x
     95    psS32 nY;                            ///< Number of terms in y
     96    psS32 nZ;                            ///< Number of terms in z
    9797    float ***coeff;                    ///< Coefficients
    9898    float ***coeffErr;                 ///< Error in coefficients
     
    105105{
    106106    psPolynomialType type;             ///< Polynomial type
    107     int nW;                            ///< Number of terms in w
    108     int nX;                            ///< Number of terms in x
    109     int nY;                            ///< Number of terms in y
    110     int nZ;                            ///< Number of terms in z
     107    psS32 nW;                            ///< Number of terms in w
     108    psS32 nX;                            ///< Number of terms in x
     109    psS32 nY;                            ///< Number of terms in y
     110    psS32 nZ;                            ///< Number of terms in z
    111111    float ****coeff;                   ///< Coefficients
    112112    float ****coeffErr;                ///< Error in coefficients
     
    121121 */
    122122psPolynomial1D* psPolynomial1DAlloc(
    123     int n,                              ///< Number of terms
     123    psS32 n,                              ///< Number of terms
    124124    psPolynomialType type               ///< Polynomial Type
    125125);
     
    130130 */
    131131psPolynomial2D* psPolynomial2DAlloc(
    132     int nX,                            ///< Number of terms in x
    133     int nY,                            ///< Number of terms in y
     132    psS32 nX,                            ///< Number of terms in x
     133    psS32 nY,                            ///< Number of terms in y
    134134    psPolynomialType type              ///< Polynomial Type
    135135);
     
    140140 */
    141141psPolynomial3D* psPolynomial3DAlloc(
    142     int nX,                            ///< Number of terms in x
    143     int nY,                            ///< Number of terms in y
    144     int nZ,                            ///< Number of terms in z
     142    psS32 nX,                            ///< Number of terms in x
     143    psS32 nY,                            ///< Number of terms in y
     144    psS32 nZ,                            ///< Number of terms in z
    145145    psPolynomialType type              ///< Polynomial Type
    146146);
     
    151151 */
    152152psPolynomial4D* psPolynomial4DAlloc(
    153     int nW,                            ///< Number of terms in w
    154     int nX,                            ///< Number of terms in x
    155     int nY,                            ///< Number of terms in y
    156     int nZ,                            ///< Number of terms in z
     153    psS32 nW,                            ///< Number of terms in w
     154    psS32 nX,                            ///< Number of terms in x
     155    psS32 nY,                            ///< Number of terms in y
     156    psS32 nZ,                            ///< Number of terms in z
    157157    psPolynomialType type              ///< Polynomial Type
    158158);
     
    230230{
    231231    psPolynomialType type;             ///< Polynomial type
    232     int n;                             ///< Number of terms
     232    psS32 n;                             ///< Number of terms
    233233    double *coeff;                     ///< Coefficients
    234234    double *coeffErr;                  ///< Error in coefficients
     
    241241{
    242242    psPolynomialType type;             ///< Polynomial type
    243     int nX;                            ///< Number of terms in x
    244     int nY;                            ///< Number of terms in y
     243    psS32 nX;                            ///< Number of terms in x
     244    psS32 nY;                            ///< Number of terms in y
    245245    double **coeff;                    ///< Coefficients
    246246    double **coeffErr;                 ///< Error in coefficients
     
    253253{
    254254    psPolynomialType type;             ///< Polynomial type
    255     int nX;                            ///< Number of terms in x
    256     int nY;                            ///< Number of terms in y
    257     int nZ;                            ///< Number of terms in z
     255    psS32 nX;                            ///< Number of terms in x
     256    psS32 nY;                            ///< Number of terms in y
     257    psS32 nZ;                            ///< Number of terms in z
    258258    double ***coeff;                   ///< Coefficients
    259259    double ***coeffErr;                ///< Error in coefficients
     
    266266{
    267267    psPolynomialType type;             ///< Polynomial type
    268     int nW;                            ///< Number of terms in w
    269     int nX;                            ///< Number of terms in x
    270     int nY;                            ///< Number of terms in y
    271     int nZ;                            ///< Number of terms in z
     268    psS32 nW;                            ///< Number of terms in w
     269    psS32 nX;                            ///< Number of terms in x
     270    psS32 nY;                            ///< Number of terms in y
     271    psS32 nZ;                            ///< Number of terms in z
    272272    double ****coeff;                  ///< Coefficients
    273273    double ****coeffErr;               ///< Error in coefficients
     
    281281 */
    282282psDPolynomial1D* psDPolynomial1DAlloc(
    283     int n,                             ///< Number of terms
     283    psS32 n,                             ///< Number of terms
    284284    psPolynomialType type              ///< Polynomial Type
    285285);
     
    290290 */
    291291psDPolynomial2D* psDPolynomial2DAlloc(
    292     int nX,                            ///< Number of terms in x
    293     int nY,                            ///< Number of terms in y
     292    psS32 nX,                            ///< Number of terms in x
     293    psS32 nY,                            ///< Number of terms in y
    294294    psPolynomialType type              ///< Polynomial Type
    295295);
     
    300300 */
    301301psDPolynomial3D* psDPolynomial3DAlloc(
    302     int nX,                            ///< Number of terms in x
    303     int nY,                            ///< Number of terms in y
    304     int nZ,                            ///< Number of terms in z
     302    psS32 nX,                            ///< Number of terms in x
     303    psS32 nY,                            ///< Number of terms in y
     304    psS32 nZ,                            ///< Number of terms in z
    305305    psPolynomialType type              ///< Polynomial Type
    306306);
     
    311311 */
    312312psDPolynomial4D* psDPolynomial4DAlloc(
    313     int nW,                            ///< Number of terms in w
    314     int nX,                            ///< Number of terms in x
    315     int nY,                            ///< Number of terms in y
    316     int nZ,                            ///< Number of terms in z
     313    psS32 nW,                            ///< Number of terms in w
     314    psS32 nX,                            ///< Number of terms in x
     315    psS32 nY,                            ///< Number of terms in y
     316    psS32 nZ,                            ///< Number of terms in z
    317317    psPolynomialType type              ///< Polynomial Type
    318318);
     
    386386typedef struct
    387387{
    388     int n;                        ///< The number of spline polynomials
     388    psS32 n;                        ///< The number of spline polynomials
    389389    psPolynomial1D **spline;      ///< An array of n pointers to the spline polynomials
    390390    float *p_psDeriv2;            ///< For cubic splines, the second derivative at each domain point.  Size is n+1.
     
    393393psSpline1D;
    394394
    395 psSpline1D *psSpline1DAlloc(int n,
    396                             int order,
     395psSpline1D *psSpline1DAlloc(psS32 n,
     396                            psS32 order,
    397397                            float min,
    398398                            float max);
    399399
    400 int p_psSpline1DFree(psSpline1D *tmpSpline);
     400psS32 p_psSpline1DFree(psSpline1D *tmpSpline);
    401401
    402402psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
    403                                    int order);
     403                                   psS32 order);
    404404
    405405float psSpline1DEval(const psSpline1D *spline,
     
    409409                               const psSpline1D *spline);
    410410
    411 int p_psVectorBinDisectF32(float *bins,
    412                            int numBins,
    413                            float x);
    414 
    415 int p_psVectorBinDisectS32(int *bins,
    416                            int numBins,
    417                            int x);
    418 
    419 int p_psVectorBinDisect(psVector *bins,
    420                         psScalar *x);
     411psS32 p_psVectorBinDisectF32(float *bins,
     412                             psS32 numBins,
     413                             float x);
     414
     415psS32 p_psVectorBinDisectS32(psS32 *bins,
     416                             psS32 numBins,
     417                             psS32 x);
     418
     419psS32 p_psVectorBinDisect(psVector *bins,
     420                          psScalar *x);
    421421
    422422psScalar *p_psVectorInterpolate(psVector *domain,
    423423                                psVector *range,
    424                                 int order,
     424                                psS32 order,
    425425                                psScalar *x);
    426426
  • trunk/psLib/src/math/psStats.c

    r2197 r2204  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 21:24:43 $
     11 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151
    5252void p_psVectorRobustStats(const psVector* restrict myVector,
    53                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats);
     53                           const psVector* restrict maskVector, psU32 maskVal, psStats* stats);
    5454
    5555
     
    7575/*****************************************************************************/
    7676
    77 bool p_psGetStatValue(const psStats* stats, double *value)
     77psBool p_psGetStatValue(const psStats* stats, double *value)
    7878{
    7979
     
    134134 *****************************************************************************/
    135135
    136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
    137 {
    138     int i = 0;                  // Loop index variable.
     136void p_psVectorPrint(psVector* myVector, psVector* maskVector, psU32 maskVal, psStats* stats)
     137{
     138    psS32 i = 0;                  // Loop index variable.
    139139
    140140    for (i = 0; i < myVector->n; i++) {
     
    178178
    179179void p_psVectorSampleMean(const psVector* restrict myVector,
    180                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    181 {
    182     int i = 0;                  // Loop index variable
     180                          const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     181{
     182    psS32 i = 0;                  // Loop index variable
    183183    float mean = 0.0;           // The mean
    184     int count = 0;              // # of points in this mean?
     184    psS32 count = 0;              // # of points in this mean?
    185185    float rangeMin = 0.0;       // Exclude data below this
    186186    float rangeMax = 0.0;       // Exclude date above this
     
    242242 *****************************************************************************/
    243243void p_psVectorMax(const psVector* restrict myVector,
    244                    const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    245 {
    246     int i = 0;                  // Loop index variable
     244                   const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     245{
     246    psS32 i = 0;                  // Loop index variable
    247247    float max = -MY_MAX_FLOAT;  // The calculated maximum
    248248    float rangeMin = 0.0;       // Exclude data below this
     
    303303 *****************************************************************************/
    304304void p_psVectorMin(const psVector* restrict myVector,
    305                    const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    306 {
    307     int i = 0;                  // Loop index variable
     305                   const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     306{
     307    psS32 i = 0;                  // Loop index variable
    308308    float min = MY_MAX_FLOAT;   // The calculated maximum
    309309    float rangeMin = 0.0;       // Exclude data below this
     
    363363    NULL
    364364 *****************************************************************************/
    365 int p_psVectorNValues(const psVector* restrict myVector,
    366                       const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    367 {
    368     int i = 0;                  // Loop index variable
    369     int numData = 0;            // The number of data points
     365psS32 p_psVectorNValues(const psVector* restrict myVector,
     366                        const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     367{
     368    psS32 i = 0;                  // Loop index variable
     369    psS32 numData = 0;            // The number of data points
    370370    float rangeMin = 0.0;       // Exclude data below this
    371371    float rangeMax = 0.0;       // Exclude date above this
     
    414414 *****************************************************************************/
    415415void p_psVectorSampleMedian(const psVector* restrict myVector,
    416                             const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     416                            const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
    417417{
    418418    psVector* unsortedVector = NULL;    // Temporary vector
    419419    psVector* sortedVector = NULL;      // Temporary vector
    420     int i = 0;                  // Loop index variable
    421     int count = 0;              // # of points in this mean?
    422     int nValues = 0;            // # of points in vector
     420    psS32 i = 0;                  // Loop index variable
     421    psS32 count = 0;              // # of points in this mean?
     422    psS32 nValues = 0;            // # of points in vector
    423423    float rangeMin = 0.0;       // Exclude data below this
    424424    float rangeMax = 0.0;       // Exclude date above this
     
    497497                                       float sigma)
    498498{
    499     int i = 0;                  // Loop index variable
    500     int j = 0;                  // Loop index variable
     499    psS32 i = 0;                  // Loop index variable
     500    psS32 j = 0;                  // Loop index variable
    501501    float iMid;
    502502    float jMid;
    503     int numBins = robustHistogram->nums->n;
    504     int numBounds = robustHistogram->bounds->n;
     503    psS32 numBins = robustHistogram->nums->n;
     504    psS32 numBounds = robustHistogram->bounds->n;
    505505    psVector* smooth = psVectorAlloc(numBins, PS_TYPE_F32);
    506     int jMin = 0;
    507     int jMax = 0;
     506    psS32 jMin = 0;
     507    psS32 jMax = 0;
    508508    float firstBound = robustHistogram->bounds->data.F32[0];
    509509    float lastBound = robustHistogram->bounds->data.F32[numBounds-1];
     
    566566 *****************************************************************************/
    567567void p_psVectorSampleQuartiles(const psVector* restrict myVector,
    568                                const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
     568                               const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
    569569{
    570570    psVector* unsortedVector = NULL;    // Temporary vector
    571571    psVector* sortedVector = NULL;      // Temporary vector
    572     int i = 0;                  // Loop index variable
    573     int count = 0;              // # of points in this mean?
    574     int nValues = 0;            // # data points
     572    psS32 i = 0;                  // Loop index variable
     573    psS32 count = 0;              // # of points in this mean?
     574    psS32 nValues = 0;            // # data points
    575575    float rangeMin = 0.0;       // Exclude data below this
    576576    float rangeMax = 0.0;       // Exclude date above this
     
    648648 *****************************************************************************/
    649649void p_psVectorSampleStdev(const psVector* restrict myVector,
    650                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    651 {
    652     int i = 0;                  // Loop index variable
    653     int countInt = 0;           // # of data points being used
     650                           const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     651{
     652    psS32 i = 0;                  // Loop index variable
     653    psS32 countInt = 0;           // # of data points being used
    654654    float countFloat = 0.0;     // # of data points being used
    655655    float mean = 0.0;           // The mean
     
    733733 *****************************************************************************/
    734734void p_psVectorClippedStats(const psVector* restrict myVector,
    735                             const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
    736 {
    737     int i = 0;                  // Loop index variable
    738     int j = 0;                  // Loop index variable
     735                            const psVector* restrict maskVector, psU32 maskVal, psStats* stats)
     736{
     737    psS32 i = 0;                  // Loop index variable
     738    psS32 j = 0;                  // Loop index variable
    739739    float clippedMean = 0.0;    // self-explanatory
    740740    float clippedStdev = 0.0;   // self-explanatory
     
    825825    float min = (float)HUGE;
    826826    float max = (float)-HUGE;
    827     int i = 0;
     827    psS32 i = 0;
    828828
    829829    for (i = 0; i < myData->n; i++) {
     
    856856    float max = (double)-HUGE;
    857857    double range = 0.0;
    858     int i = 0;
     858    psS32 i = 0;
    859859
    860860    for (i = 0; i < myData->n; i++) {
     
    914914 *****************************************************************************/
    915915float p_psGaussianDeriv(const psVector* restrict myData,
    916                         const psVector* restrict myParams, int whichParam)
     916                        const psVector* restrict myParams, psS32 whichParam)
    917917{
    918918    float x = myData->data.F32[0];
     
    957957 *****************************************************************************/
    958958float p_psQuadraticDeriv(const psVector* restrict myParams,
    959                          const psVector* restrict myCoords, int whichParamDeriv)
     959                         const psVector* restrict myCoords, psS32 whichParamDeriv)
    960960{
    961961    float x = myCoords->data.F32[0];
     
    989989                       float getThisValue)
    990990{
    991     int numIterations = 0;
     991    psS32 numIterations = 0;
    992992    float midpoint = 0.0;
    993993    float oldMidpoint = 1.0;
     
    10301030float fitQuadraticSearchForYThenReturnX(psVector *xVec,
    10311031                                        psVector *yVec,
    1032                                         int binNum,
     1032                                        psS32 binNum,
    10331033                                        float yVal)
    10341034{
     
    11291129void p_psVectorRobustStats(const psVector* restrict myVector,
    11301130                           const psVector* restrict maskVector,
    1131                            unsigned int maskVal,
     1131                           psU32 maskVal,
    11321132                           psStats* stats)
    11331133{
     
    11351135    psVector* robustHistogramVector = NULL;
    11361136    float binSize = 0.0;        // Size of the histogram bins
    1137     int LQBinNum = -1;          // Bin num for lower quartile
    1138     int UQBinNum = -1;          // Bin num for upper quartile
    1139     int medianBinNum = -1;
    1140     int i = 0;                  // Loop index variable
    1141     int modeBinNum = 0;
     1137    psS32 LQBinNum = -1;          // Bin num for lower quartile
     1138    psS32 UQBinNum = -1;          // Bin num for upper quartile
     1139    psS32 medianBinNum = -1;
     1140    psS32 i = 0;                  // Loop index variable
     1141    psS32 modeBinNum = 0;
    11421142    float modeBinCount = 0.0;
    11431143    float dL = 0.0;
    1144     int numBins = 0;
     1144    psS32 numBins = 0;
    11451145    float myMean = 0.0;
    11461146    float myStdev = 0.0;
     
    12001200    // bins, not the binSize.  Also, if we get here, we know that
    12011201    // binSize != 0.0.
    1202     numBins = (int)((stats->max - stats->min) / binSize);
     1202    numBins = (psS32)((stats->max - stats->min) / binSize);
    12031203    robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins);
    12041204
     
    14401440    The histogram structure
    14411441 *****************************************************************************/
    1442 psHistogram* psHistogramAlloc(float lower, float upper, int n)
    1443 {
    1444     int i = 0;                  // Loop index variable
     1442psHistogram* psHistogramAlloc(float lower, float upper, psS32 n)
     1443{
     1444    psS32 i = 0;                  // Loop index variable
    14451445    psHistogram* newHist = NULL;        // The new histogram structure
    14461446    float binSize = 0.0;        // The histogram bin size
     
    15001500{
    15011501    psHistogram* newHist = NULL;        // The new histogram structure
    1502     int i;                      // Loop index variable
     1502    psS32 i;                      // Loop index variable
    15031503
    15041504    // NOTE: Verify that this is the correct action.
     
    15651565                               const psVector* restrict in,
    15661566                               const psVector* restrict mask,
    1567                                unsigned int maskVal)
    1568 {
    1569     int i = 0;                  // Loop index variable
     1567                               psU32 maskVal)
     1568{
     1569    psS32 i = 0;                  // Loop index variable
    15701570    float binSize = 0.0;        // Histogram bin size
    1571     int binNum = 0;             // A temporary bin number
    1572     int numBins = 0;            // The total number of bins
    1573     int tmp = 0;
     1571    psS32 binNum = 0;             // A temporary bin number
     1572    psS32 numBins = 0;            // The total number of bins
     1573    psS32 tmp = 0;
    15741574    psScalar tmpScalar;
    15751575    tmpScalar.type.type = PS_TYPE_F32;
    15761576    psVector* inF32;
    1577     int mustFreeTmp = 1;
     1577    psS32 mustFreeTmp = 1;
    15781578
    15791579    // NOTE: Verify that this is the correct action.
     
    16291629                if (out->uniform == true) {
    16301630                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
    1631                     binNum = (int)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);
     1631                    binNum = (psS32)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);
    16321632
    16331633                    // NOTE: This next if-statement really shouldn't be necessary.
     
    16731673psVector* p_psConvertToF32(psVector* in)
    16741674{
    1675     int i = 0;
     1675    psS32 i = 0;
    16761676    psVector* tmp = NULL;
    16771677
     
    17241724                       psVector* in,
    17251725                       psVector* mask,
    1726                        unsigned int maskVal)
     1726                       psU32 maskVal)
    17271727{
    17281728    psVector* inF32;
    1729     int mustFreeTmp = 1;
     1729    psS32 mustFreeTmp = 1;
    17301730
    17311731    if (in == NULL) {
  • trunk/psLib/src/math/psStats.h

    r1980 r2204  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-06 20:07:04 $
     12 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767    double robustUQ;            ///< robust upper quartile
    6868    double robustLQ;            ///< robust lower quartile
    69     int robustN50;              ///<
    70     int robustNfit;             ///<
     69    psS32 robustN50;              ///<
     70    psS32 robustNfit;             ///<
    7171    double clippedMean;         ///< Nsigma clipped mean
    7272    double clippedStdev;        ///< standard deviation after clipping
    73     int clippedNvalues;         ///< ???
     73    psS32 clippedNvalues;         ///< ???
    7474    double clipSigma;           ///< Nsigma used for clipping; user input
    75     int clipIter;               ///< Number of clipping iterations; user input
     75    psS32 clipIter;               ///< Number of clipping iterations; user input
    7676    double min;                 ///< minimum data value in array
    7777    double max;                 ///< maximum data value in array
     
    8989    psVector* in,    ///< Vector to be analysed: must be F32
    9090    psVector* mask,    ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL
    91     unsigned int maskVal    ///< Only mask elements with one of these bits set in maskVector
     91    psU32 maskVal    ///< Only mask elements with one of these bits set in maskVector
    9292);
    9393
     
    118118    psVector* bounds;                  ///< Bounds for the bins (type F32)
    119119    psVector* nums;                    ///< Number in each of the bins (INT)
    120     int minNum;                        ///< Number below the minimum
    121     int maxNum;                        ///< Number above the maximum
    122     bool uniform;                      ///< Is it a uniform distribution?
     120    psS32 minNum;                        ///< Number below the minimum
     121    psS32 maxNum;                        ///< Number above the maximum
     122    psBool uniform;                      ///< Is it a uniform distribution?
    123123}
    124124psHistogram;
     
    133133    float lower,                       ///< Lower limit for the bins
    134134    float upper,                       ///< Upper limit for the bins
    135     int n                              ///< Number of bins
     135    psS32 n                              ///< Number of bins
    136136);
    137137
     
    157157    const psVector* restrict in,       ///< Vector to analyse
    158158    const psVector* restrict mask,     ///< Mask dat for input vector
    159     unsigned int maskVal               ///< Mask value
     159    psU32 maskVal               ///< Mask value
    160160);
    161161
    162162/** Extracts the statistic value specified by stats->options.
    163163 *
    164  *  @return bool    If more than one statistic result is set in stats->options,
     164 *  @return psBool    If more than one statistic result is set in stats->options,
    165165 *                  false is returned and the value parameter is not set,
    166166 *                  otherwise true is returned.
    167167 */
    168 bool p_psGetStatValue(
     168psBool p_psGetStatValue(
    169169    const psStats* stats,
    170170    ///< the statistic struct to operate on
  • trunk/psLib/src/mathtypes/psImage.c

    r2105 r2204  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-14 01:22:59 $
     12 *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929static void imageFree(psImage* image);
    3030
    31 psImage* psImageAlloc(unsigned int numCols,
    32                       unsigned int numRows,
     31psImage* psImageAlloc(psU32 numCols,
     32                      psU32 numRows,
    3333                      const psElemType type)
    3434{
    35     int area = 0;
    36     int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
    37     int rowSize = numCols * elementSize;        // row size in bytes.
     35    psS32 area = 0;
     36    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     37    psS32 rowSize = numCols * elementSize;        // row size in bytes.
    3838
    3939    area = numCols * numRows;
     
    5151    p_psMemSetDeallocator(image, (psFreeFcn) imageFree);
    5252
    53     image->data.V = psAlloc(sizeof(void *) * numRows);
     53    image->data.V = psAlloc(sizeof(psPtr ) * numRows);
    5454
    5555    image->rawDataBuffer = psAlloc(area * elementSize);
     
    5757    // set the row pointers.
    5858    image->data.V[0] = image->rawDataBuffer;
    59     for (int i = 1; i < numRows; i++) {
    60         image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
    61     }
    62 
    63     *(int *)&image->col0 = 0;
    64     *(int *)&image->row0 = 0;
    65     *(unsigned int *)&image->numCols = numCols;
    66     *(unsigned int *)&image->numRows = numRows;
     59    for (psS32 i = 1; i < numRows; i++) {
     60        image->data.V[i] = (psPtr )((int8_t *) image->data.V[i - 1] + rowSize);
     61    }
     62
     63    *(psS32 *)&image->col0 = 0;
     64    *(psS32 *)&image->row0 = 0;
     65    *(psU32 *)&image->numCols = numCols;
     66    *(psU32 *)&image->numRows = numRows;
    6767    *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE;
    6868    *(psElemType* ) & image->type.type = type;
     
    8181    if (image->type.type == PS_TYPE_PTR) {
    8282        // 2-D array of pointers -- must dereference elements
    83         unsigned int oldNumRows = image->numRows;
    84         unsigned int oldNumCols = image->numCols;
    85         psPTR* rowPtr;
    86 
    87         for (unsigned int row = 0; row < oldNumRows; row++) {
     83        psU32 oldNumRows = image->numRows;
     84        psU32 oldNumCols = image->numCols;
     85        psPtr* rowPtr;
     86
     87        for (psU32 row = 0; row < oldNumRows; row++) {
    8888            rowPtr = image->data.PTR[row];
    89             for (unsigned int col = 0; col < oldNumCols; col++) {
     89            for (psU32 col = 0; col < oldNumCols; col++) {
    9090                psMemDecrRefCounter(rowPtr[col]);
    9191            }
     
    105105
    106106psImage* psImageRecycle(psImage* old,
    107                         unsigned int numCols,
    108                         unsigned int numRows,
     107                        psU32 numCols,
     108                        psU32 numRows,
    109109                        const psElemType type)
    110110{
    111     int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
    112     int rowSize = numCols * elementSize;        // row size in bytes.
     111    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     112    psS32 rowSize = numCols * elementSize;        // row size in bytes.
    113113
    114114    if (old == NULL) {
     
    128128        // 2-D array of pointers -- must
    129129        // dereference
    130         unsigned int oldNumRows = old->numRows;
    131         unsigned int oldNumCols = old->numCols;
    132         psPTR* rowPtr;
    133 
    134         for (unsigned int row = 0; row < oldNumRows; row++) {
     130        psU32 oldNumRows = old->numRows;
     131        psU32 oldNumCols = old->numCols;
     132        psPtr* rowPtr;
     133
     134        for (psU32 row = 0; row < oldNumRows; row++) {
    135135            rowPtr = old->data.PTR[row];
    136             for (unsigned int col = 0; col < oldNumCols; col++) {
     136            for (psU32 col = 0; col < oldNumCols; col++) {
    137137                psMemDecrRefCounter(rowPtr[col]);
    138138                rowPtr[col] = NULL;
     
    149149    old->rawDataBuffer = psRealloc(old->data.V[0],
    150150                                   numCols * numRows * elementSize);
    151     old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
     151    old->data.V = (psPtr *)psRealloc(old->data.V, numRows * sizeof(psPtr ));
    152152
    153153    // recreate the row pointers
    154154    old->data.V[0] = old->rawDataBuffer;
    155     for (int i = 1; i < numRows; i++) {
    156         old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
    157     }
    158 
    159     *(unsigned int *)&old->numCols = numCols;
    160     *(unsigned int *)&old->numRows = numRows;
     155    for (psS32 i = 1; i < numRows; i++) {
     156        old->data.V[i] = (psPtr )((int8_t *) old->data.V[i - 1] + rowSize);
     157    }
     158
     159    *(psU32 *)&old->numCols = numCols;
     160    *(psU32 *)&old->numRows = numRows;
    161161    *(psElemType* ) & old->type.type = type;
    162162
     
    169169{
    170170    psElemType inDatatype;
    171     int elementSize;
    172     int elements;
    173     int numRows;
    174     int numCols;
     171    psS32 elementSize;
     172    psS32 elements;
     173    psS32 numRows;
     174    psS32 numCols;
    175175
    176176    if (input == NULL || input->data.V == NULL) {
     
    218218    // datatype.
    219219    if (type == inDatatype) {
    220         for (int row=0;row<numRows;row++) {
     220        for (psS32 row=0;row<numRows;row++) {
    221221            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
    222222        }
     
    227227        ps##INTYPE *in; \
    228228        ps##OUTTYPE *out; \
    229         for(int row=0;row<numRows;row++) { \
     229        for(psS32 row=0;row<numRows;row++) { \
    230230            in = IN->data.INTYPE[row]; \
    231231            out = OUT->data.OUTTYPE[row]; \
    232             for (int col=0;col<numCols;col++) { \
     232            for (psS32 col=0;col<numCols;col++) { \
    233233                *(out++) = *(in++); \
    234234            } \
     
    331331}
    332332
    333 int psImageFreeChildren(psImage* image)
     333psS32 psImageFreeChildren(psImage* image)
    334334{
    335     int numFreed = 0;
     335    psS32 numFreed = 0;
    336336
    337337    if (image == NULL) {
     
    345345        // orphan the children first
    346346        // (so psFree doesn't try to modify the parent's children array while I'm using it)
    347         for (int i=0;i<numFreed;i++) {
     347        for (psS32 i=0;i<numFreed;i++) {
    348348            children[i]->parent = NULL;
    349349        }
     
    366366                              float y,
    367367                              const psImage* mask,
    368                               unsigned int maskVal,
     368                              psU32 maskVal,
    369369                              psC64 unexposedValue,
    370370                              psImageInterpolateMode mode)
     
    438438        float y, \
    439439        const psImage* mask, \
    440         unsigned int maskVal, \
     440        psU32 maskVal, \
    441441        psF64 unexposedValue) \
    442442{ \
    443     int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \
    444     int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \
    445     int lastX = input->numCols - 1; \
    446     int lastY = input->numRows - 1; \
     443    psS32 intX = (psS32) round((psF64)(x) - 0.5 + FLT_EPSILON); \
     444    psS32 intY = (psS32) round((psF64)(y) - 0.5 + FLT_EPSILON); \
     445    psS32 lastX = input->numCols - 1; \
     446    psS32 lastY = input->numRows - 1; \
    447447    \
    448448    if ((intX < 0) || \
     
    463463        float y, \
    464464        const psImage* mask, \
    465         unsigned int maskVal, \
     465        psU32 maskVal, \
    466466        psC64 unexposedValue) \
    467467{ \
    468     int intX = (int) round((psF64)(x) - 0.5); \
    469     int intY = (int) round((psF64)(y) - 0.5); \
    470     int lastX = input->numCols - 1; \
    471     int lastY = input->numRows - 1; \
     468    psS32 intX = (psS32) round((psF64)(x) - 0.5); \
     469    psS32 intY = (psS32) round((psF64)(y) - 0.5); \
     470    psS32 lastX = input->numCols - 1; \
     471    psS32 lastY = input->numRows - 1; \
    472472    \
    473473    if ((intX < 0) || \
     
    501501        float y, \
    502502        const psImage* mask, \
    503         unsigned int maskVal, \
     503        psU32 maskVal, \
    504504        psF64 unexposedValue) \
    505505{ \
     
    508508    psF64 fracX = x - 0.5 - floorX; \
    509509    psF64 fracY = y - 0.5 - floorY; \
    510     int intFloorX = (int) floorX; \
    511     int intFloorY = (int) floorY; \
    512     int lastX = input->numCols - 1; \
    513     int lastY = input->numRows - 1; \
     510    psS32 intFloorX = (psS32) floorX; \
     511    psS32 intFloorY = (psS32) floorY; \
     512    psS32 lastX = input->numCols - 1; \
     513    psS32 lastY = input->numRows - 1; \
    514514    ps##TYPE V00; \
    515515    ps##TYPE V01; \
    516516    ps##TYPE V10; \
    517517    ps##TYPE V11; \
    518     bool valid00 = false; \
    519     bool valid01 = false; \
    520     bool valid10 = false; \
    521     bool valid11 = false; \
     518    psBool valid00 = false; \
     519    psBool valid01 = false; \
     520    psBool valid10 = false; \
     521    psBool valid11 = false; \
    522522    \
    523523    if (intFloorY >= 0 && intFloorY <= lastY) { \
     
    556556    \
    557557    psF64 V0; \
    558     bool valid0 = true; \
     558    psBool valid0 = true; \
    559559    if (valid00 && valid10) { \
    560560        V0 = V00*(1-fracX)+V10*fracX; \
     
    568568    \
    569569    psF64 V1; \
    570     bool valid1 = true; \
     570    psBool valid1 = true; \
    571571    if (valid01 && valid11) { \
    572572        V1 = V01*(1-fracX)+V11*fracX; \
     
    595595        float y, \
    596596        const psImage* mask, \
    597         unsigned int maskVal, \
     597        psU32 maskVal, \
    598598        psC64 unexposedValue) \
    599599{ \
     
    602602    psF64 fracX = x - 0.5 - floorX; \
    603603    psF64 fracY = y - 0.5 - floorY; \
    604     int intFloorX = (int) floorX; \
    605     int intFloorY = (int) floorY; \
    606     int lastX = input->numCols - 1; \
    607     int lastY = input->numRows - 1; \
     604    psS32 intFloorX = (psS32) floorX; \
     605    psS32 intFloorY = (psS32) floorY; \
     606    psS32 lastX = input->numCols - 1; \
     607    psS32 lastY = input->numRows - 1; \
    608608    ps##TYPE V00; \
    609609    ps##TYPE V01; \
    610610    ps##TYPE V10; \
    611611    ps##TYPE V11; \
    612     bool valid00 = false; \
    613     bool valid01 = false; \
    614     bool valid10 = false; \
    615     bool valid11 = false; \
     612    psBool valid00 = false; \
     613    psBool valid01 = false; \
     614    psBool valid10 = false; \
     615    psBool valid11 = false; \
    616616    \
    617617    if (intFloorY >= 0 && intFloorY <= lastY) { \
     
    650650    \
    651651    psC64 V0; \
    652     bool valid0 = true; \
     652    psBool valid0 = true; \
    653653    if (valid00 && valid10) { \
    654654        V0 = V00*(1-fracX)+V10*fracX; \
     
    662662    \
    663663    psC64 V1; \
    664     bool valid1 = true; \
     664    psBool valid1 = true; \
    665665    if (valid01 && valid11) { \
    666666        V0 = V01*(1-fracX)+V11*fracX; \
  • trunk/psLib/src/mathtypes/psImage.h

    r2105 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-14 01:22:59 $
     13 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4747{
    4848    const psType type;                 ///< Image data type and dimension.
    49     const unsigned int numCols;        ///< Number of columns in image
    50     const unsigned int numRows;        ///< Number of rows in image.
    51     const int col0;                    ///< Column position relative to parent.
    52     const int row0;                    ///< Row position relative to parent.
     49    const psU32 numCols;        ///< Number of columns in image
     50    const psU32 numRows;        ///< Number of rows in image.
     51    const psS32 col0;                    ///< Column position relative to parent.
     52    const psS32 row0;                    ///< Row position relative to parent.
    5353
    5454    union {
     
    6565        psC32** C32;                   ///< Single-precision complex data.
    6666        psC64** C64;                   ///< Double-precision complex data.
    67         psPTR** PTR;                   ///< Void pointers.
    68         psPTR*  V;                     ///< Pointer to data.
     67        psPtr** PTR;                   ///< Void pointers.
     68        psPtr*  V;                     ///< Pointer to data.
    6969    } data;                            ///< Union for data types.
    7070    const struct psImage* parent;      ///< Parent, if a subimage.
    7171    psArray* children;                 ///< Children of this region.
    7272
    73     void* rawDataBuffer;
     73    psPtr rawDataBuffer;
    7474}
    7575psImage;
     
    8484 */
    8585psImage* psImageAlloc(
    86     unsigned int numCols,              ///< Number of rows in image.
    87     unsigned int numRows,              ///< Number of columns in image.
     86    psU32 numCols,              ///< Number of rows in image.
     87    psU32 numRows,              ///< Number of columns in image.
    8888    const psElemType type              ///< Type of data for image.
    8989);
     
    9696psImage* psImageRecycle(
    9797    psImage* old,                      ///< the psImage to recycle by resizing image buffer
    98     unsigned int numCols,              ///< the desired number of columns in image
    99     unsigned int numRows,              ///< the desired number of rows in image
     98    psU32 numCols,              ///< the desired number of columns in image
     99    psU32 numRows,              ///< the desired number of rows in image
    100100    const psElemType type              ///< the desired datatype of the image
    101101);
     
    115115/** Frees all children of a psImage.
    116116 *
    117  *  @return int      Number of children freed.
     117 *  @return psS32      Number of children freed.
    118118 *
    119119 */
    120 int psImageFreeChildren(
     120psS32 psImageFreeChildren(
    121121    psImage* image                     ///< psImage in which all children shall be deallocated
    122122);
     
    132132    float y,                           ///< row location ot derive value of
    133133    const psImage* mask,               ///< if not NULL, the mask of the input image
    134     unsigned int maskVal,              ///< the mask value
     134    psU32 maskVal,              ///< the mask value
    135135    psC64 unexposedValue,              ///< return value if x,y location is not in image.
    136136    psImageInterpolateMode mode        ///< interpolation mode
     
    143143        float y,                       /**< row location ot derive value of */ \
    144144        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    145         unsigned int maskVal,          /**< the mask value */ \
     145        psU32 maskVal,          /**< the mask value */ \
    146146        psF64 unexposedValue           /**< return value if x,y location is not in image. */ \
    147147                                                 ); \
     
    151151        float y,                       /**< row location ot derive value of */ \
    152152        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    153         unsigned int maskVal,          /**< the mask value */ \
     153        psU32 maskVal,          /**< the mask value */ \
    154154        psF64 unexposedValue           /**< return value if x,y location is not in image. */ \
    155155                                                     );
     
    161161        float y,                       /**< row location ot derive value of */ \
    162162        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    163         unsigned int maskVal,          /**< the mask value */ \
     163        psU32 maskVal,          /**< the mask value */ \
    164164        psC64 unexposedValue           /**< return value if x,y location is not in image. */ \
    165165                                                 ); \
     
    169169        float y,                       /**< row location ot derive value of */ \
    170170        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    171         unsigned int maskVal,          /**< the mask value */ \
     171        psU32 maskVal,          /**< the mask value */ \
    172172        psC64 unexposedValue           /**< return value if x,y location is not in image. */ \
    173173                                                     );
  • trunk/psLib/src/mathtypes/psVector.c

    r2006 r2204  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-07 19:51:30 $
     12*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:31 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242// FUNCTION IMPLEMENTATION - PUBLIC
    4343
    44 psVector* psVectorAlloc(unsigned int nalloc, psElemType elemType)
     44psVector* psVectorAlloc(psU32 nalloc, psElemType elemType)
    4545{
    4646    psVector* psVec = NULL;
    47     int elementSize = 0;
     47    psS32 elementSize = 0;
    4848
    4949    elementSize = PSELEMTYPE_SIZEOF(elemType);
     
    6464}
    6565
    66 psVector* psVectorRealloc(psVector* restrict in, unsigned int nalloc)
    67 {
    68     int elementSize = 0;
     66psVector* psVectorRealloc(psVector* restrict in, psU32 nalloc)
     67{
     68    psS32 elementSize = 0;
    6969    psElemType elemType;
    7070
     
    8888}
    8989
    90 psVector* psVectorRecycle(psVector* restrict in, unsigned int n, psElemType type)
    91 {
    92     int byteSize;
     90psVector* psVectorRecycle(psVector* restrict in, psU32 n, psElemType type)
     91{
     92    psS32 byteSize;
    9393
    9494    if (in == NULL) {
     
    129129    }
    130130
    131     int nElements = in->n;
     131    psS32 nElements = in->n;
    132132
    133133    out = psVectorRecycle(out, nElements, type);
     
    136136        ps##INTYPE *inVec = in->data.INTYPE; \
    137137        ps##OUTTYPE *outVec = out->data.OUTTYPE; \
    138         for (int col=0;col<nElements;col++) { \
     138        for (psS32 col=0;col<nElements;col++) { \
    139139            *(outVec++) = *(inVec++); \
    140140        } \
     
    225225psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector)
    226226{
    227     int N = 0;
    228     int elSize = 0;
    229     void *inVec = NULL;
    230     void *outVec = NULL;
     227    psS32 N = 0;
     228    psS32 elSize = 0;
     229    psPtr inVec = NULL;
     230    psPtr outVec = NULL;
    231231    psElemType inType = 0;
    232232
     
    311311psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector)
    312312{
    313     int N = 0;
     313    psS32 N = 0;
    314314    psVector* tmpVector = NULL;
    315315    psElemType inType = 0;
     
    350350        ps##TYPE* tmpVec = tmpVector->data.TYPE;                              \
    351351        ps##TYPE  diff;                                                       \
    352         for(int i=0; i<N; i++) {                                              \
    353             for(int j=0; j<N; j++) {                                          \
     352        for(psS32 i=0; i<N; i++) {                                              \
     353            for(psS32 j=0; j<N; j++) {                                          \
    354354                diff = absfcn(tmpVec[i] - inVec[j]);                          \
    355355                if(diff < maxError) {                                         \
  • trunk/psLib/src/mathtypes/psVector.h

    r1982 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-06 21:30:52 $
     13 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333{
    3434    psType type;                ///< Type of data.
    35     unsigned int nalloc;        ///< Total number of elements available.
    36     unsigned int n;             ///< Number of elements in use.
     35    psU32 nalloc;        ///< Total number of elements available.
     36    psU32 n;             ///< Number of elements in use.
    3737
    3838    union {
     
    4949        psC32* C32;             ///< Single-precision complex data.
    5050        psC64* C64;             ///< Double-precision complex data.
    51         psPTR V;                ///< Pointer to data.
     51        psPtr V;                ///< Pointer to data.
    5252    } data;                     ///< Union for data types.
    5353}
     
    6969 */
    7070psVector* psVectorAlloc(
    71     unsigned int nalloc,               ///< Total number of elements to make available.
     71    psU32 nalloc,               ///< Total number of elements to make available.
    7272    psElemType dataType                ///< Type of data to be held by vector.
    7373);
     
    8484psVector* psVectorRealloc(
    8585    psVector* restrict psVec,          ///< Vector to reallocate.
    86     unsigned int nalloc                ///< Total number of elements to make available.
     86    psU32 nalloc                ///< Total number of elements to make available.
    8787);
    8888
     
    101101    ///< taken to preserve the values.
    102102
    103     unsigned int nalloc,               ///< Total number of elements to make available.
     103    psU32 nalloc,               ///< Total number of elements to make available.
    104104    psElemType type                    ///< the datatype of the returned vector
    105105);
  • trunk/psLib/src/sys/psError.c

    r1905 r2204  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *   
    12  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-27 20:38:02 $
     12 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#define MAX_ERROR_STACK_SIZE 64
    2727static psErr* errorStack[MAX_ERROR_STACK_SIZE];
    28 static unsigned int errorStackSize = 0;
     28static psU32 errorStackSize = 0;
    2929pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER;
    3030
     
    8484{
    8585    pthread_mutex_lock(&lockErrorStack);
    86     for (int lcv=0;lcv<errorStackSize;lcv++) {
     86    for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    8787        p_psMemSetPersistent(errorStack[lcv]->msg,false);
    8888        p_psMemSetPersistent(errorStack[lcv]->name,false);
     
    9494}
    9595
    96 psErrorCode psErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...)
     96psErrorCode psErrorMsg(const char *name, psErrorCode code, psBool new, const char* fmt, ...)
    9797{
    9898    char errMsg[1024];
     
    131131}
    132132
    133 psErr* psErrorGet(int which)
     133psErr* psErrorGet(psS32 which)
    134134{
    135135    psErr* result;
     
    180180        vfprintf(fd,fmt,va);
    181181
    182         for (int lcv=0;lcv<errorStackSize;lcv++) {
     182        for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    183183            if(errorStack[lcv]->code >= PS_ERR_BASE) {
    184184                fprintf(fd," -> %s: %s\n     %s\n",
  • trunk/psLib/src/sys/psError.h

    r1869 r2204  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-23 22:18:13 $
     14 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151 */
    5252psErr* psErrorGet(
    53     int which                          ///< position in the error stack. 0 is last error on stack.
     53    psS32 which                          ///< position in the error stack. 0 is last error on stack.
    5454);
    5555
     
    121121    const char *name,                  ///< Name of error in the form aaa.bbb.ccc
    122122    psErrorCode code,                  ///< Error class code
    123     bool new,                          ///< true if error originates at this location
     123    psBool new,                          ///< true if error originates at this location
    124124    const char* fmt,                   ///< printf style formatting statement defining error message
    125125    ...
  • trunk/psLib/src/sys/psErrorCodes.c

    r2129 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-14 21:14:58 $
     9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959    // first, search the static error codes
    6060
    61     int n = 0;
     61    psS32 n = 0;
    6262    while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES &&
    6363            staticErrorCodes[n].code != code) {
     
    8888static void freeErrorDescription(psErrorDescription* err)
    8989{
    90     psFree((void*)err->description);
     90    psFree((psPtr)err->description);
    9191}
    9292
     
    125125
    126126void psErrorRegister(const psErrorDescription* errors,
    127                      int nerror)
     127                     psS32 nerror)
    128128{
    129129    if (nerror < 1) {
     
    143143    }
    144144
    145     for (int i=0;i<nerror;i++) {
     145    for (psS32 i=0;i<nerror;i++) {
    146146        psErrorDescription* err = psErrorDescriptionAlloc(
    147147                                      errors[i].code, errors[i].description);
    148148        p_psMemSetPersistent(err,true);
    149         p_psMemSetPersistent((void*)err->description,true);
     149        p_psMemSetPersistent((psPtr)err->description,true);
    150150        if (! psListAdd(dynamicErrorCodes,
    151151                        PS_LIST_HEAD,
     
    162162}
    163163
    164 bool p_psErrorUnregister(psErrorCode code)
     164psBool p_psErrorUnregister(psErrorCode code)
    165165{
    166166    // Check input argument is non-negative
     
    179179    }
    180180
    181     return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(void*)desc);
     181    return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(psPtr)desc);
    182182}
  • trunk/psLib/src/sys/psErrorCodes.h

    r2129 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-14 21:14:58 $
     9 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#ifndef PS_ERROR_CODES_H
    1616#define PS_ERROR_CODES_H
     17
     18#include "psType.h"
    1719
    1820/* N.B., lines between '//~Start' and '//~End' are automatic generated from
     
    9395void psErrorRegister(
    9496    const psErrorDescription* errors,  ///< Array of error codes to register
    95     int nerror                         ///< number of errors in input array
     97    psS32 nerror                         ///< number of errors in input array
    9698);
    9799
    98100/** Clears error codes registered via psErrorRegister.
    99101 *
    100  *  @return bool    TRUE if given errorcode was removed, otherwise FALSE.
     102 *  @return psBool    TRUE if given errorcode was removed, otherwise FALSE.
    101103 */
    102 bool p_psErrorUnregister(
     104psBool p_psErrorUnregister(
    103105    psErrorCode code                   ///< the error code to find and remove
    104106);
  • trunk/psLib/src/sys/psLogMsg.c

    r1807 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *
    13  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-14 20:01:52 $
     13 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919/*****************************************************************************
    2020NOTES: currently, the prototype code has the following global variables:
    21     static int p_psGlobalLogDest;
    22     static int p_psGlobalLogLevel;
    23     static int p_psLogTime;
    24     static int p_psLogHost;
    25     static int p_psLogLevel;
    26     static int p_psLogName;
    27     static int p_psLogMsg;
     21    static psS32 p_psGlobalLogDest;
     22    static psS32 p_psGlobalLogLevel;
     23    static psS32 p_psLogTime;
     24    static psS32 p_psLogHost;
     25    static psS32 p_psLogLevel;
     26    static psS32 p_psLogName;
     27    static psS32 p_psLogMsg;
    2828 *****************************************************************************/
    2929#include <limits.h>
     
    3434#include <time.h>
    3535#include <unistd.h>
    36 #include <stdbool.h>
    3736
    3837#include "psLogMsg.h"
     
    4948
    5049static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
    51 static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
    52 static bool logTime = true;     // Flag to include time info
    53 static bool logHost = true;     // Flag to include host info
    54 static bool logLevel = true;    // Flag to include level info
    55 static bool logName = true;     // Flag to include name info
    56 static bool logMsg = true;      // Flag to include message info
     50static psS32 globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
     51static psBool logTime = true;     // Flag to include time info
     52static psBool logHost = true;     // Flag to include host info
     53static psBool logLevel = true;    // Flag to include level info
     54static psBool logName = true;     // Flag to include name info
     55static psBool logMsg = true;      // Flag to include message info
    5756
    5857/*****************************************************************************
    5958psLogSetLevel(): Set the current log level and return old level.
    6059Input:
    61  level (int): the new log level.
     60 level (psS32): the new log level.
    6261Output:
    6362 none
     
    6564 The old log level.
    6665 *****************************************************************************/
    67 int psLogSetLevel(int level)
     66psS32 psLogSetLevel(psS32 level)
    6867{
    6968    // Save old global log level for changing it.
    70     int oldLevel = globalLogLevel;
     69    psS32 oldLevel = globalLogLevel;
    7170
    7271    if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
     
    8685 
    8786Input:
    88  dest (int): the new log destination
     87 dest (psS32): the new log destination
    8988Output:
    9089 None.
     
    9291 An integer specifying the old log destination.
    9392 *****************************************************************************/
    94 bool psLogSetDestination(const char *dest)
     93psBool psLogSetDestination(const char *dest)
    9594{
    9695    char protocol[5];
     
    245244 NULL.
    246245 *****************************************************************************/
    247 void psLogMsgV(const char *name, int level, const char *fmt, va_list ap)
    248 {
    249     static int first = 1;       // Flag for calling gethostname()
     246void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap)
     247{
     248    static psS32 first = 1;       // Flag for calling gethostname()
    250249    static char hostname[HOST_NAME_MAX + 1];
    251250
     
    254253    char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0
    255254    char *head_ptr = head;      // where we've got to in head
    256     int maxLength = MAX_LOG_LINE_LENGTH;
     255    psS32 maxLength = MAX_LOG_LINE_LENGTH;
    257256    time_t clock = time(NULL);  // The current time.
    258257    struct tm *utc = gmtime(&clock);    // The current gm time.
     
    375374 NULL
    376375 *****************************************************************************/
    377 void psLogMsg(const char *name, int level, const char *fmt, ...)
     376void psLogMsg(const char *name, psS32 level, const char *fmt, ...)
    378377{
    379378    va_list ap;
  • trunk/psLib/src/sys/psLogMsg.h

    r1807 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *
    13  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-14 20:01:52 $
     13 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#define PS_LOG_MSG_H
    2020#include <stdarg.h>
    21 #include <stdbool.h>
     21
     22#include "psType.h"
    2223
    2324/** @addtogroup LogTrace
     
    3132 *  argument which can specify more general log destinations.
    3233 *
    33  *  @return int     true if set successfully, otherwise false.
     34 *  @return psS32     true if set successfully, otherwise false.
    3435 */
    35 bool psLogSetDestination(
     36psBool psLogSetDestination(
    3637    const char *dest                   ///< Specifies where to send messages.
    3738);
     
    4344 *  be displayed.
    4445 *
    45  *  @return int    old logging level
     46 *  @return psS32    old logging level
    4647 */
    47 int psLogSetLevel(
    48     int level                          ///< Specifies the system log level
     48psS32 psLogSetLevel(
     49    psS32 level                          ///< Specifies the system log level
    4950);
    5051
     
    6869void psLogMsg(
    6970    const char *name,                  ///< name of the log source
    70     int myLevel,                       ///< severity level of this log message
     71    psS32 myLevel,                       ///< severity level of this log message
    7172    const char *fmt,                   ///< printf-style format command
    7273    ...
     
    7980void psLogMsgV(
    8081    const char *name,                  ///< name of the log source
    81     int myLevel,                       ///< severity level of this log message
     82    psS32 myLevel,                       ///< severity level of this log message
    8283    const char *fmt,                   ///< printf-style format command
    8384    va_list ap                         ///< varargs argument list
  • trunk/psLib/src/sys/psMemory.c

    r1840 r2204  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-09-21 22:30:19 $
     10*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-10-27 00:57:31 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <stdlib.h>
    1919#include <stdio.h>
    20 #include <stdbool.h>
    2120#include <stdint.h>
    2221
     
    2827#include "psSysUtilsErrors.h"
    2928
    30 #define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
     29#define P_PS_MEMMAGIC (psPtr )0xdeadbeef   // Magic number in psMemBlock header
    3130
    3231#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
    3332
    34 static int checkMemBlock(const psMemBlock* m, const char *funcName);
     33static psS32 checkMemBlock(const psMemBlock* m, const char *funcName);
    3534static psMemBlock* lastMemBlockAllocated = NULL;
    3635static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
     
    3938static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    4039
    41 static int recycleBins = 13;
    42 static int recycleBinSize[14] = {
    43                                     8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
    44                                 };
     40static psS32 recycleBins = 13;
     41static psS32 recycleBinSize[14] = {
     42                                      8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
     43                                  };
    4544
    4645// N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
     
    6160 *  Default memExhausted callback.
    6261 */
    63 static void *memExhaustedCallbackDefault(size_t size)
    64 {
    65     void *ptr = NULL;
     62static psPtr memExhaustedCallbackDefault(size_t size)
     63{
     64    psPtr ptr = NULL;
    6665
    6766    pthread_mutex_lock(&recycleMemBlockListMutex);
    68     int level = recycleBins - 1;
     67    psS32 level = recycleBins - 1;
    6968
    7069    while (level >= 0 && ptr == NULL) {
     
    9897}
    9998
    100 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno)
     99static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
    101100{
    102101    if (ptr->refCounter < 1) {
     
    223222 */
    224223
    225 static int checkMemBlock(const psMemBlock* m, const char *funcName)
     224static psS32 checkMemBlock(const psMemBlock* m, const char *funcName)
    226225{
    227226    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     
    248247        return 1;
    249248    }
    250     if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
     249    if (*(psPtr *)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
    251250        psErrorMsg(PS_ERRORNAME_DOMAIN "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
    252251                   PS_ERRORTEXT_psMemory_OVERFLOW,
     
    258257}
    259258
    260 int psMemCheckCorruption(bool abort_on_error)
    261 {
    262     int nbad = 0;               // number of bad blocks
    263     bool failure = false;
     259psS32 psMemCheckCorruption(psBool abort_on_error)
     260{
     261    psS32 nbad = 0;               // number of bad blocks
     262    psBool failure = false;
    264263
    265264    // get exclusive access to the memBlock list to avoid it changing on us while we use it.
     
    289288}
    290289
    291 void *p_psAlloc(size_t size, const char *file, int lineno)
     290psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
    292291{
    293292
     
    297296    if (size < P_PS_LARGE_BLOCK_SIZE) {
    298297        // find the bin we need.
    299         int level = 0;
     298        psS32 level = 0;
    300299
    301300        while (size > recycleBinSize[level]) {
     
    323322
    324323    if (ptr == NULL) {
    325         ptr = malloc(sizeof(psMemBlock) + size + sizeof(void *));
     324        ptr = malloc(sizeof(psMemBlock) + size + sizeof(psPtr ));
    326325
    327326        if (ptr == NULL) {
     
    332331        }
    333332
    334         ptr->startblock = P_PS_MEMMAGIC;
    335         ptr->endblock = P_PS_MEMMAGIC;
     333        *(psPtr*)&ptr->startblock = P_PS_MEMMAGIC;
     334        *(psPtr*)&ptr->endblock = P_PS_MEMMAGIC;
    336335        ptr->userMemorySize = size;
    337336        pthread_mutex_init(&ptr->refCounterMutex, NULL);
     
    345344    ptr->freeFcn = NULL;
    346345    ptr->persistent = false;
    347     *(unsigned int *)&ptr->lineno = lineno;
    348     *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     346    *(psU32 *)&ptr->lineno = lineno;
     347    *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
    349348    ptr->previousBlock = NULL;
    350349
     
    371370}
    372371
    373 void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
     372psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
    374373{
    375374    if (vptr == NULL) {
     
    377376    } else {
    378377        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    379         bool isBlockLast = false;
     378        psBool isBlockLast = false;
    380379
    381380        if (checkMemBlock(ptr, __func__) != 0) {
     
    389388        isBlockLast = (ptr == lastMemBlockAllocated);
    390389
    391         ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
     390        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(psPtr ));
    392391
    393392        if (ptr == NULL) {
     
    399398
    400399        ptr->userMemorySize = size;
    401         *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     400        *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
    402401
    403402        if (isBlockLast) {
     
    423422}
    424423
    425 void p_psFree(void *vptr, const char *file, int lineno)
     424void p_psFree(psPtr vptr, const char *file, psS32 lineno)
    426425{
    427426    if (vptr == NULL) {
     
    444443 * Check for memory leaks.
    445444 */
    446 int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
    447 {
    448     int nleak = 0;
    449     int j = 0;
     445psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
     446{
     447    psS32 nleak = 0;
     448    psS32 j = 0;
    450449    psMemBlock* topBlock = lastMemBlockAllocated;
    451450
     
    499498 */
    500499// return refCounter
    501 psReferenceCount psMemGetRefCounter(void *vptr)
     500psReferenceCount psMemGetRefCounter(psPtr vptr)
    502501{
    503502    psMemBlock* ptr;
    504     unsigned int refCount;
     503    psU32 refCount;
    505504
    506505    if (vptr == NULL) {
     
    522521
    523522// increment and return refCounter
    524 void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
     523psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno)
    525524{
    526525    psMemBlock* ptr;
     
    544543
    545544// decrement and return refCounter
    546 void *p_psMemDecrRefCounter(void *vptr, const char *file, int lineno)
     545psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno)
    547546{
    548547    if (vptr == NULL) {
     
    593592        if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) {
    594593
    595             int level = 1;
     594            psS32 level = 1;
    596595
    597596            while (ptr->userMemorySize >= recycleBinSize[level]) {
     
    635634}
    636635
    637 void p_psMemSetDeallocator(void *vptr, psFreeFcn freeFcn)
     636void p_psMemSetDeallocator(psPtr vptr, psFreeFcn freeFcn)
    638637{
    639638    if (vptr == NULL) {
     
    650649
    651650}
    652 psFreeFcn p_psMemGetDeallocator(void *vptr)
     651psFreeFcn p_psMemGetDeallocator(psPtr vptr)
    653652{
    654653    if (vptr == NULL) {
     
    665664}
    666665
    667 bool p_psMemGetPersistent(void *vptr)
     666psBool p_psMemGetPersistent(psPtr vptr)
    668667{
    669668    if (vptr == NULL) {
     
    680679}
    681680
    682 void p_psMemSetPersistent(void *vptr,bool value)
     681void p_psMemSetPersistent(psPtr vptr,psBool value)
    683682{
    684683    if (vptr == NULL) {
  • trunk/psLib/src/sys/psMemory.h

    r1810 r2204  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-14 23:48:25 $
     14 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222
    2323#include <stdio.h>                     // needed for FILE
    24 #include <stdbool.h>
    2524#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
     25
     26#include "psType.h"
    2627
    2728/** @addtogroup MemoryManagement
     
    4849
    4950/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    50 typedef unsigned long psMemoryId;
     51typedef psU64 psMemoryId;
    5152
    5253/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    53 typedef unsigned long psReferenceCount;
     54typedef psU64 psReferenceCount;
    5455
    5556/// typedef for deallocator.
    56 typedef void (*psFreeFcn) (void *ptr);
     57typedef void (*psFreeFcn) (psPtr ptr);
    5758
    5859/** Book-keeping data for storage allocator.
     
    6364typedef struct psMemBlock
    6465{
    65     const void *startblock;            ///< initialised to p_psMEMMAGIC
     66    const psPtr startblock;            ///< initialised to p_psMEMMAGIC
    6667    struct psMemBlock* previousBlock;  ///< previous block in allocation list
    6768    struct psMemBlock* nextBlock;      ///< next block allocation list
     
    7071    const psMemoryId id;               ///< a unique ID for this allocation
    7172    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    72     const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     73    const psS32 lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
    7374    pthread_mutex_t refCounterMutex;   ///< mutex to ensure exclusive access to reference counter
    7475    psReferenceCount refCounter;       ///< how many times pointer is referenced
    75     bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
    76     const void *endblock;              ///< initialised to p_psMEMMAGIC
     76    psBool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
     77    const psPtr endblock;              ///< initialised to p_psMEMMAGIC
    7778}
    7879psMemBlock;
     
    106107    const psMemBlock* ptr,             ///< the pointer to the problematic memory block.
    107108    const char *file,                  ///< the file in which the problem originated
    108     int lineno                         ///< the line number in which the problem originated
     109    psS32 lineno                         ///< the line number in which the problem originated
    109110);
    110111
    111112/** prototype of a callback function used when memory runs out
    112113 *
    113  *  @return void* pointer to requested buffer of the size size_t, or NULL if memory could not
     114 *  @return psPtr pointer to requested buffer of the size size_t, or NULL if memory could not
    114115 *          be found.
    115116 *
     
    117118 *  @ingroup memCallback
    118119 */
    119 typedef void *(*psMemExhaustedCallback) (
     120typedef psPtr (*psMemExhaustedCallback) (
    120121    size_t size                        ///< the size of buffer required
    121122);
     
    123124/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    124125 *
    125  *  @return void* pointer to the allocated buffer. This will not be NULL.
     126 *  @return psPtr pointer to the allocated buffer. This will not be NULL.
    126127 *  @see psFree
    127128 */
    128129#ifdef DOXYGEN
    129 void *psAlloc(size_t size       ///< Size required
     130psPtr psAlloc(size_t size       ///< Size required
    130131             );
    131132#else
    132133
    133 void *p_psAlloc(size_t size,    ///< Size required
     134psPtr p_psAlloc(size_t size,    ///< Size required
    134135                const char *file,       ///< File of call
    135                 int lineno      ///< Line number of call
     136                psS32 lineno      ///< Line number of call
    136137               );
    137138
     
    148149 */
    149150void p_psMemSetDeallocator(
    150     void *ptr,                         ///< the memory block to operate on
     151    psPtr ptr,                         ///< the memory block to operate on
    151152    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
    152153);
     
    162163 */
    163164psFreeFcn p_psMemGetDeallocator(
    164     void *ptr                          ///< the memory block
     165    psPtr ptr                          ///< the memory block
    165166);
    166167
     
    176177 */
    177178void p_psMemSetPersistent(
    178     void *ptr,                         ///< the memory block to operate on
    179     bool value                         ///< true if memory is persistent, otherwise false
     179    psPtr ptr,                         ///< the memory block to operate on
     180    psBool value                         ///< true if memory is persistent, otherwise false
    180181);
    181182
     
    187188 *  Memory marked as persistent is excluded from memory leak checks.
    188189 *
    189  *  @return bool    true if memory is marked persistent, otherwise false.
    190  */
    191 bool p_psMemGetPersistent(
    192     void *ptr                          ///< the memory block to check.
     190 *  @return psBool    true if memory is marked persistent, otherwise false.
     191 */
     192psBool p_psMemGetPersistent(
     193    psPtr ptr                          ///< the memory block to check.
    193194);
    194195
     
    196197/** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
    197198 *
    198  *  @return void* pointer to resized buffer. This will not be NULL.
     199 *  @return psPtr pointer to resized buffer. This will not be NULL.
    199200 *  @see psAlloc, psFree
    200201 */
    201202#ifdef DOXYGEN
    202 void *psRealloc(
    203     void *ptr                          ///< Pointer to re-allocate
     203psPtr psRealloc(
     204    psPtr ptr                          ///< Pointer to re-allocate
    204205    size_t size,                       ///< Size required
    205206);
    206207#else
    207208
    208 void *p_psRealloc(
    209     void *ptr,                         ///< Pointer to re-allocate
     209psPtr p_psRealloc(
     210    psPtr ptr,                         ///< Pointer to re-allocate
    210211    size_t size,                       ///< Size required
    211212    const char *file,                  ///< File of call
    212     int lineno                         ///< Line number of call
     213    psS32 lineno                         ///< Line number of call
    213214);
    214215
     
    224225#ifdef DOXYGEN
    225226void psFree(
    226     void *ptr,                         ///< Pointer to free, if NULL, function returns immediately.
     227    psPtr ptr,                         ///< Pointer to free, if NULL, function returns immediately.
    227228);
    228229#else
    229230
    230231void p_psFree(
    231     void *ptr,                        ///< Pointer to free
     232    psPtr ptr,                        ///< Pointer to free
    232233    const char *file,                 ///< File of call
    233     int lineno                        ///< Line number of call
     234    psS32 lineno                        ///< Line number of call
    234235);
    235236
     
    248249 *  If memory leaks are found, the Memory Problem callback will be called as well.
    249250 *
    250  *  return int  number of memory blocks found as 'leaks', i.e., the number of currently allocated memory
     251 *  return psS32  number of memory blocks found as 'leaks', i.e., the number of currently allocated memory
    251252 *              blocks above id0 that have not been freed.
    252253 *  @see psAlloc, psFree, psgetMemId, psMemProblemCallbackSet
    253254 *  @ingroup memTracing
    254255 */
    255 int psMemCheckLeaks(
     256psS32 psMemCheckLeaks(
    256257    psMemoryId id0,                    ///< don't list blocks with id < id0
    257258    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
     
    264265 *  @ingroup memTracing
    265266 */
    266 int psMemCheckCorruption(
    267     bool abort_on_error                ///< Abort on detecting corruption?
     267psS32 psMemCheckCorruption(
     268    psBool abort_on_error                ///< Abort on detecting corruption?
    268269);
    269270
     
    273274 */
    274275psReferenceCount psMemGetRefCounter(
    275     void *vptr                         ///< Pointer to get refCounter for
     276    psPtr vptr                         ///< Pointer to get refCounter for
    276277);
    277278
     
    281282 */
    282283#ifdef DOXYGEN
    283 void *psMemIncrRefCounter(
    284     void *vptr                         ///< Pointer to increment refCounter, and return
    285 );
    286 #else
    287 
    288 void *p_psMemIncrRefCounter(
    289     void *vptr,                        ///< Pointer to increment refCounter, and return
     284psPtr psMemIncrRefCounter(
     285    psPtr vptr                         ///< Pointer to increment refCounter, and return
     286);
     287#else
     288
     289psPtr p_psMemIncrRefCounter(
     290    psPtr vptr,                        ///< Pointer to increment refCounter, and return
    290291    const char *file,                  ///< File of call
    291     int lineno                         ///< Line number of call
     292    psS32 lineno                         ///< Line number of call
    292293);
    293294
     
    299300 *  @ingroup memRefCount
    300301 *
    301  *  @return void*    the pointer deremented in refCount, or NULL if pointer is
     302 *  @return psPtr    the pointer deremented in refCount, or NULL if pointer is
    302303 *                   fully dereferenced.
    303304 */
    304305#ifdef DOXYGEN
    305 void* psMemDecrRefCounter(
    306     void* vptr                         ///< Pointer to decrement refCounter, and return
    307 );
    308 #else
    309 
    310 void *p_psMemDecrRefCounter(
    311     void *vptr,                        ///< Pointer to decrement refCounter, and return
     306psPtr psMemDecrRefCounter(
     307    psPtr vptr                         ///< Pointer to decrement refCounter, and return
     308);
     309#else
     310
     311psPtr p_psMemDecrRefCounter(
     312    psPtr vptr,                        ///< Pointer to decrement refCounter, and return
    312313    const char *file,                  ///< File of call
    313     int lineno                         ///< Line number of call
     314    psS32 lineno                         ///< Line number of call
    314315);
    315316
  • trunk/psLib/src/sys/psString.c

    r1969 r2204  
    99 *  @author Eric Van Alst, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-06 01:05:41 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131}
    3232
    33 char *psStringNCopy(const char *str, int nChar)
     33char *psStringNCopy(const char *str, psS32 nChar)
    3434{
    3535    char *returnValue = NULL;
  • trunk/psLib/src/sys/psString.h

    r1448 r2204  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-10 01:55:34 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#define PS_STRING_H
    2020
     21#include "psType.h"
    2122
    2223/** This macro will convert the argument to a quoted string */
     
    6263    /**< Input string of characters to copy */
    6364
    64     int nChar
     65    psS32 nChar
    6566    /**< Number of bytes to allocate for string copy */
    6667);
  • trunk/psLib/src/sys/psTrace.c

    r1834 r2204  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-20 22:03:35 $
     11 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434 
    3535    PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the
    36     intermediate components of a long name.  Ie. the "B" in .A.B.C
     36    intermediate components of a psS64 name.  Ie. the "B" in .A.B.C
    3737 
    3838 *****************************************************************************/
     
    5656
    5757static void componentFree(p_psComponent* comp);
    58 static p_psComponent* componentAlloc(const char *name, int level);
     58static p_psComponent* componentAlloc(const char *name, psS32 level);
    5959
    6060/*****************************************************************************
    6161componentAlloc(): allocate memory for a new node, and initialize members.
    6262 *****************************************************************************/
    63 static p_psComponent* componentAlloc(const char *name, int level)
     63static p_psComponent* componentAlloc(const char *name, psS32 level)
    6464{
    6565    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
     
    6868    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
    6969    comp->name = psStringCopy(name);
    70     p_psMemSetPersistent((void*)comp->name,true);
     70    p_psMemSetPersistent((psPtr)comp->name,true);
    7171    comp->level = level;
    7272    comp->n = 0;
     
    8686
    8787    if (comp->subcomp != NULL) {
    88         for (int i = 0; i < comp->n; i++) {
     88        for (psS32 i = 0; i < comp->n; i++) {
    8989            p_psMemSetPersistent(comp->subcomp[i],false);
    9090            psFree(comp->subcomp[i]);
     
    9494    }
    9595
    96     p_psMemSetPersistent((void*)comp->name,false);
    97     psFree((void*)comp->name);
     96    p_psMemSetPersistent((psPtr)comp->name,false);
     97    psFree((psPtr)comp->name);
    9898}
    9999
     
    115115void p_psTraceReset(p_psComponent* currentNode)
    116116{
    117     int i = 0;
     117    psS32 i = 0;
    118118
    119119    if (NULL == currentNode) {
     
    149149to ANSI-C.
    150150 *****************************************************************************/
    151 static bool componentAdd(const char *addNodeName, int level)
    152 {
    153     int i = 0;                  // Loop index variable.
     151static psBool componentAdd(const char *addNodeName, psS32 level)
     152{
     153    psS32 i = 0;                  // Loop index variable.
    154154    char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
    155155    char *pname = name;
    156156    char *firstComponent = NULL;        // first component of name
    157157    p_psComponent* currentNode = cRoot;
    158     int nodeExists = 0;
     158    psS32 nodeExists = 0;
    159159
    160160    // XXX: Verify that this is the correct behavior.
     
    240240 zero
    241241*****************************************************************************/
    242 bool psTraceSetLevel(const char *comp,   // component of interest
    243                      int level)  // desired trace level
     242psBool psTraceSetLevel(const char *comp,   // component of interest
     243                       psS32 level)  // desired trace level
    244244{
    245245    char *compName = NULL;
     
    299299 The trace level of the "name" component.
    300300 *****************************************************************************/
    301 static int doGetTraceLevel(const char *aname)
     301static psS32 doGetTraceLevel(const char *aname)
    302302{
    303303    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
     
    305305    char *firstComponent = NULL;        // first component of name
    306306    p_psComponent* currentNode = cRoot;
    307     int i = 0;
    308     int defaultLevel = 0;
     307    psS32 i = 0;
     308    psS32 defaultLevel = 0;
    309309
    310310    if (NULL == currentNode) {
     
    365365 The level of "name" in the root component tree.
    366366 *****************************************************************************/
    367 int psTraceGetLevel(const char *name)
     367psS32 psTraceGetLevel(const char *name)
    368368{
    369369    char *compName = NULL;
    370     int traceLevel;
     370    psS32 traceLevel;
    371371
    372372    if (cRoot == NULL) {
     
    401401 *****************************************************************************/
    402402static void doPrintTraceLevels(const p_psComponent* comp,
    403                                int depth,
    404                                int defLevel)
    405 {
    406     int i = 0;
     403                               psS32 depth,
     404                               psS32 defLevel)
     405{
     406    psS32 i = 0;
    407407
    408408    if (comp->name[0] == '\0') {
     
    472472 *****************************************************************************/
    473473void p_psTrace(const char *comp,        // component being traced
    474                int level,       // desired trace level
     474               psS32 level,       // desired trace level
    475475               ...)             // arguments
    476476{
    477477    char *fmt = NULL;
    478478    va_list ap;
    479     int i = 0;
     479    psS32 i = 0;
    480480
    481481    if (NULL == comp) {
  • trunk/psLib/src/sys/psTrace.h

    r2202 r2204  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 23:14:04 $
     11 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    {
    5151        const char *name;           // last part of name of component
    52         int level;                  // trace level for this component
    53         int n;                      // number of subcomponents
     52        psS32 level;                  // trace level for this component
     53        psS32 n;                      // number of subcomponents
    5454        struct p_psComponent* *subcomp;     // next level of subcomponents
    5555    }
     
    5959/// Send a trace message
    6060void p_psTrace(const char *facil,       ///< facilty of interest
    61                int myLevel,     ///< desired trace level
     61               psS32 myLevel,     ///< desired trace level
    6262               ...)             ///< trace message arguments
    6363;
     
    6565
    6666/// Set trace level
    67 bool psTraceSetLevel(const char *facil,     ///< facilty of interest
    68                      int level)     ///< desired trace level
     67psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
     68                       psS32 level)     ///< desired trace level
    6969;
    7070
    7171/// Get the trace level
    72 int psTraceGetLevel(const char *facil)     ///< facilty of interest
     72psS32 psTraceGetLevel(const char *facil)     ///< facilty of interest
    7373;
    7474
  • trunk/psLib/src/sys/psType.h

    r1984 r2204  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-10-06 21:40:13 $
     13*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:31 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include <stdint.h>
    2424#include <float.h>
     25#include <stdbool.h>
    2526
    2627/// @addtogroup DataContainer
     
    5253typedef float _Complex psC32;          ///< complex with 32-bit floating point Real and Imagary numbers
    5354typedef double _Complex psC64;         ///< complex with 64-bit floating point Real and Imagary numbers
    54 typedef void *psPTR;                   ///< void pointer
     55typedef void* psPtr;                   ///< void pointer
     56typedef bool psBool;                   ///< boolean value
    5557
    5658typedef enum {
     
    6062    PS_TYPE_S64 = 0x0108,              ///< Long integer.
    6163    PS_TYPE_U8 = 0x0301,               ///< Unsigned character.
    62     PS_TYPE_U16 = 0x0302,              ///< Unsigned short integer.
     64    PS_TYPE_U16 = 0x0302,              ///< Unsigned psS16 integer.
    6365    PS_TYPE_U32 = 0x0304,              ///< Unsigned integer.
    64     PS_TYPE_U64 = 0x0308,              ///< Unsigned long integer.
     66    PS_TYPE_U64 = 0x0308,              ///< Unsigned psS64 integer.
    6567    PS_TYPE_F32 = 0x0404,              ///< Single-precision Floating point.
    6668    PS_TYPE_F64 = 0x0408,              ///< Double-precision floating point.
     
    115117#define PS_TYPE_C32_NAME "psC32"
    116118#define PS_TYPE_C64_NAME "psC64"
    117 #define PS_TYPE_PTR_NAME "psPTR"
     119#define PS_TYPE_PTR_NAME "psPtr"
    118120
    119121#define PS_TYPE_NAME(value,type) \
     
    183185#define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
    184186/// Macro to determine the storage size, in bytes, of the psElemType.
    185 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
     187#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(psPtr) :(x & 0xFF) )
    186188
    187189/** Dimensions of a data type.
  • trunk/psLib/src/sysUtils/psError.c

    r1905 r2204  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *   
    12  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-27 20:38:02 $
     12 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#define MAX_ERROR_STACK_SIZE 64
    2727static psErr* errorStack[MAX_ERROR_STACK_SIZE];
    28 static unsigned int errorStackSize = 0;
     28static psU32 errorStackSize = 0;
    2929pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER;
    3030
     
    8484{
    8585    pthread_mutex_lock(&lockErrorStack);
    86     for (int lcv=0;lcv<errorStackSize;lcv++) {
     86    for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    8787        p_psMemSetPersistent(errorStack[lcv]->msg,false);
    8888        p_psMemSetPersistent(errorStack[lcv]->name,false);
     
    9494}
    9595
    96 psErrorCode psErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...)
     96psErrorCode psErrorMsg(const char *name, psErrorCode code, psBool new, const char* fmt, ...)
    9797{
    9898    char errMsg[1024];
     
    131131}
    132132
    133 psErr* psErrorGet(int which)
     133psErr* psErrorGet(psS32 which)
    134134{
    135135    psErr* result;
     
    180180        vfprintf(fd,fmt,va);
    181181
    182         for (int lcv=0;lcv<errorStackSize;lcv++) {
     182        for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    183183            if(errorStack[lcv]->code >= PS_ERR_BASE) {
    184184                fprintf(fd," -> %s: %s\n     %s\n",
  • trunk/psLib/src/sysUtils/psError.h

    r1869 r2204  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-23 22:18:13 $
     14 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151 */
    5252psErr* psErrorGet(
    53     int which                          ///< position in the error stack. 0 is last error on stack.
     53    psS32 which                          ///< position in the error stack. 0 is last error on stack.
    5454);
    5555
     
    121121    const char *name,                  ///< Name of error in the form aaa.bbb.ccc
    122122    psErrorCode code,                  ///< Error class code
    123     bool new,                          ///< true if error originates at this location
     123    psBool new,                          ///< true if error originates at this location
    124124    const char* fmt,                   ///< printf style formatting statement defining error message
    125125    ...
  • trunk/psLib/src/sysUtils/psErrorCodes.c

    r2129 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-14 21:14:58 $
     9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959    // first, search the static error codes
    6060
    61     int n = 0;
     61    psS32 n = 0;
    6262    while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES &&
    6363            staticErrorCodes[n].code != code) {
     
    8888static void freeErrorDescription(psErrorDescription* err)
    8989{
    90     psFree((void*)err->description);
     90    psFree((psPtr)err->description);
    9191}
    9292
     
    125125
    126126void psErrorRegister(const psErrorDescription* errors,
    127                      int nerror)
     127                     psS32 nerror)
    128128{
    129129    if (nerror < 1) {
     
    143143    }
    144144
    145     for (int i=0;i<nerror;i++) {
     145    for (psS32 i=0;i<nerror;i++) {
    146146        psErrorDescription* err = psErrorDescriptionAlloc(
    147147                                      errors[i].code, errors[i].description);
    148148        p_psMemSetPersistent(err,true);
    149         p_psMemSetPersistent((void*)err->description,true);
     149        p_psMemSetPersistent((psPtr)err->description,true);
    150150        if (! psListAdd(dynamicErrorCodes,
    151151                        PS_LIST_HEAD,
     
    162162}
    163163
    164 bool p_psErrorUnregister(psErrorCode code)
     164psBool p_psErrorUnregister(psErrorCode code)
    165165{
    166166    // Check input argument is non-negative
     
    179179    }
    180180
    181     return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(void*)desc);
     181    return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(psPtr)desc);
    182182}
  • trunk/psLib/src/sysUtils/psErrorCodes.h

    r2129 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-14 21:14:58 $
     9 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#ifndef PS_ERROR_CODES_H
    1616#define PS_ERROR_CODES_H
     17
     18#include "psType.h"
    1719
    1820/* N.B., lines between '//~Start' and '//~End' are automatic generated from
     
    9395void psErrorRegister(
    9496    const psErrorDescription* errors,  ///< Array of error codes to register
    95     int nerror                         ///< number of errors in input array
     97    psS32 nerror                         ///< number of errors in input array
    9698);
    9799
    98100/** Clears error codes registered via psErrorRegister.
    99101 *
    100  *  @return bool    TRUE if given errorcode was removed, otherwise FALSE.
     102 *  @return psBool    TRUE if given errorcode was removed, otherwise FALSE.
    101103 */
    102 bool p_psErrorUnregister(
     104psBool p_psErrorUnregister(
    103105    psErrorCode code                   ///< the error code to find and remove
    104106);
  • trunk/psLib/src/sysUtils/psLogMsg.c

    r1807 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *
    13  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-14 20:01:52 $
     13 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919/*****************************************************************************
    2020NOTES: currently, the prototype code has the following global variables:
    21     static int p_psGlobalLogDest;
    22     static int p_psGlobalLogLevel;
    23     static int p_psLogTime;
    24     static int p_psLogHost;
    25     static int p_psLogLevel;
    26     static int p_psLogName;
    27     static int p_psLogMsg;
     21    static psS32 p_psGlobalLogDest;
     22    static psS32 p_psGlobalLogLevel;
     23    static psS32 p_psLogTime;
     24    static psS32 p_psLogHost;
     25    static psS32 p_psLogLevel;
     26    static psS32 p_psLogName;
     27    static psS32 p_psLogMsg;
    2828 *****************************************************************************/
    2929#include <limits.h>
     
    3434#include <time.h>
    3535#include <unistd.h>
    36 #include <stdbool.h>
    3736
    3837#include "psLogMsg.h"
     
    4948
    5049static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
    51 static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
    52 static bool logTime = true;     // Flag to include time info
    53 static bool logHost = true;     // Flag to include host info
    54 static bool logLevel = true;    // Flag to include level info
    55 static bool logName = true;     // Flag to include name info
    56 static bool logMsg = true;      // Flag to include message info
     50static psS32 globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
     51static psBool logTime = true;     // Flag to include time info
     52static psBool logHost = true;     // Flag to include host info
     53static psBool logLevel = true;    // Flag to include level info
     54static psBool logName = true;     // Flag to include name info
     55static psBool logMsg = true;      // Flag to include message info
    5756
    5857/*****************************************************************************
    5958psLogSetLevel(): Set the current log level and return old level.
    6059Input:
    61  level (int): the new log level.
     60 level (psS32): the new log level.
    6261Output:
    6362 none
     
    6564 The old log level.
    6665 *****************************************************************************/
    67 int psLogSetLevel(int level)
     66psS32 psLogSetLevel(psS32 level)
    6867{
    6968    // Save old global log level for changing it.
    70     int oldLevel = globalLogLevel;
     69    psS32 oldLevel = globalLogLevel;
    7170
    7271    if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
     
    8685 
    8786Input:
    88  dest (int): the new log destination
     87 dest (psS32): the new log destination
    8988Output:
    9089 None.
     
    9291 An integer specifying the old log destination.
    9392 *****************************************************************************/
    94 bool psLogSetDestination(const char *dest)
     93psBool psLogSetDestination(const char *dest)
    9594{
    9695    char protocol[5];
     
    245244 NULL.
    246245 *****************************************************************************/
    247 void psLogMsgV(const char *name, int level, const char *fmt, va_list ap)
    248 {
    249     static int first = 1;       // Flag for calling gethostname()
     246void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap)
     247{
     248    static psS32 first = 1;       // Flag for calling gethostname()
    250249    static char hostname[HOST_NAME_MAX + 1];
    251250
     
    254253    char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0
    255254    char *head_ptr = head;      // where we've got to in head
    256     int maxLength = MAX_LOG_LINE_LENGTH;
     255    psS32 maxLength = MAX_LOG_LINE_LENGTH;
    257256    time_t clock = time(NULL);  // The current time.
    258257    struct tm *utc = gmtime(&clock);    // The current gm time.
     
    375374 NULL
    376375 *****************************************************************************/
    377 void psLogMsg(const char *name, int level, const char *fmt, ...)
     376void psLogMsg(const char *name, psS32 level, const char *fmt, ...)
    378377{
    379378    va_list ap;
  • trunk/psLib/src/sysUtils/psLogMsg.h

    r1807 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *
    13  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-14 20:01:52 $
     13 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#define PS_LOG_MSG_H
    2020#include <stdarg.h>
    21 #include <stdbool.h>
     21
     22#include "psType.h"
    2223
    2324/** @addtogroup LogTrace
     
    3132 *  argument which can specify more general log destinations.
    3233 *
    33  *  @return int     true if set successfully, otherwise false.
     34 *  @return psS32     true if set successfully, otherwise false.
    3435 */
    35 bool psLogSetDestination(
     36psBool psLogSetDestination(
    3637    const char *dest                   ///< Specifies where to send messages.
    3738);
     
    4344 *  be displayed.
    4445 *
    45  *  @return int    old logging level
     46 *  @return psS32    old logging level
    4647 */
    47 int psLogSetLevel(
    48     int level                          ///< Specifies the system log level
     48psS32 psLogSetLevel(
     49    psS32 level                          ///< Specifies the system log level
    4950);
    5051
     
    6869void psLogMsg(
    6970    const char *name,                  ///< name of the log source
    70     int myLevel,                       ///< severity level of this log message
     71    psS32 myLevel,                       ///< severity level of this log message
    7172    const char *fmt,                   ///< printf-style format command
    7273    ...
     
    7980void psLogMsgV(
    8081    const char *name,                  ///< name of the log source
    81     int myLevel,                       ///< severity level of this log message
     82    psS32 myLevel,                       ///< severity level of this log message
    8283    const char *fmt,                   ///< printf-style format command
    8384    va_list ap                         ///< varargs argument list
  • trunk/psLib/src/sysUtils/psMemory.c

    r1840 r2204  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-09-21 22:30:19 $
     10*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-10-27 00:57:31 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <stdlib.h>
    1919#include <stdio.h>
    20 #include <stdbool.h>
    2120#include <stdint.h>
    2221
     
    2827#include "psSysUtilsErrors.h"
    2928
    30 #define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
     29#define P_PS_MEMMAGIC (psPtr )0xdeadbeef   // Magic number in psMemBlock header
    3130
    3231#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
    3332
    34 static int checkMemBlock(const psMemBlock* m, const char *funcName);
     33static psS32 checkMemBlock(const psMemBlock* m, const char *funcName);
    3534static psMemBlock* lastMemBlockAllocated = NULL;
    3635static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
     
    3938static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    4039
    41 static int recycleBins = 13;
    42 static int recycleBinSize[14] = {
    43                                     8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
    44                                 };
     40static psS32 recycleBins = 13;
     41static psS32 recycleBinSize[14] = {
     42                                      8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
     43                                  };
    4544
    4645// N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
     
    6160 *  Default memExhausted callback.
    6261 */
    63 static void *memExhaustedCallbackDefault(size_t size)
    64 {
    65     void *ptr = NULL;
     62static psPtr memExhaustedCallbackDefault(size_t size)
     63{
     64    psPtr ptr = NULL;
    6665
    6766    pthread_mutex_lock(&recycleMemBlockListMutex);
    68     int level = recycleBins - 1;
     67    psS32 level = recycleBins - 1;
    6968
    7069    while (level >= 0 && ptr == NULL) {
     
    9897}
    9998
    100 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno)
     99static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
    101100{
    102101    if (ptr->refCounter < 1) {
     
    223222 */
    224223
    225 static int checkMemBlock(const psMemBlock* m, const char *funcName)
     224static psS32 checkMemBlock(const psMemBlock* m, const char *funcName)
    226225{
    227226    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     
    248247        return 1;
    249248    }
    250     if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
     249    if (*(psPtr *)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
    251250        psErrorMsg(PS_ERRORNAME_DOMAIN "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
    252251                   PS_ERRORTEXT_psMemory_OVERFLOW,
     
    258257}
    259258
    260 int psMemCheckCorruption(bool abort_on_error)
    261 {
    262     int nbad = 0;               // number of bad blocks
    263     bool failure = false;
     259psS32 psMemCheckCorruption(psBool abort_on_error)
     260{
     261    psS32 nbad = 0;               // number of bad blocks
     262    psBool failure = false;
    264263
    265264    // get exclusive access to the memBlock list to avoid it changing on us while we use it.
     
    289288}
    290289
    291 void *p_psAlloc(size_t size, const char *file, int lineno)
     290psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
    292291{
    293292
     
    297296    if (size < P_PS_LARGE_BLOCK_SIZE) {
    298297        // find the bin we need.
    299         int level = 0;
     298        psS32 level = 0;
    300299
    301300        while (size > recycleBinSize[level]) {
     
    323322
    324323    if (ptr == NULL) {
    325         ptr = malloc(sizeof(psMemBlock) + size + sizeof(void *));
     324        ptr = malloc(sizeof(psMemBlock) + size + sizeof(psPtr ));
    326325
    327326        if (ptr == NULL) {
     
    332331        }
    333332
    334         ptr->startblock = P_PS_MEMMAGIC;
    335         ptr->endblock = P_PS_MEMMAGIC;
     333        *(psPtr*)&ptr->startblock = P_PS_MEMMAGIC;
     334        *(psPtr*)&ptr->endblock = P_PS_MEMMAGIC;
    336335        ptr->userMemorySize = size;
    337336        pthread_mutex_init(&ptr->refCounterMutex, NULL);
     
    345344    ptr->freeFcn = NULL;
    346345    ptr->persistent = false;
    347     *(unsigned int *)&ptr->lineno = lineno;
    348     *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     346    *(psU32 *)&ptr->lineno = lineno;
     347    *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
    349348    ptr->previousBlock = NULL;
    350349
     
    371370}
    372371
    373 void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
     372psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
    374373{
    375374    if (vptr == NULL) {
     
    377376    } else {
    378377        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    379         bool isBlockLast = false;
     378        psBool isBlockLast = false;
    380379
    381380        if (checkMemBlock(ptr, __func__) != 0) {
     
    389388        isBlockLast = (ptr == lastMemBlockAllocated);
    390389
    391         ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
     390        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(psPtr ));
    392391
    393392        if (ptr == NULL) {
     
    399398
    400399        ptr->userMemorySize = size;
    401         *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     400        *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
    402401
    403402        if (isBlockLast) {
     
    423422}
    424423
    425 void p_psFree(void *vptr, const char *file, int lineno)
     424void p_psFree(psPtr vptr, const char *file, psS32 lineno)
    426425{
    427426    if (vptr == NULL) {
     
    444443 * Check for memory leaks.
    445444 */
    446 int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
    447 {
    448     int nleak = 0;
    449     int j = 0;
     445psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
     446{
     447    psS32 nleak = 0;
     448    psS32 j = 0;
    450449    psMemBlock* topBlock = lastMemBlockAllocated;
    451450
     
    499498 */
    500499// return refCounter
    501 psReferenceCount psMemGetRefCounter(void *vptr)
     500psReferenceCount psMemGetRefCounter(psPtr vptr)
    502501{
    503502    psMemBlock* ptr;
    504     unsigned int refCount;
     503    psU32 refCount;
    505504
    506505    if (vptr == NULL) {
     
    522521
    523522// increment and return refCounter
    524 void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
     523psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno)
    525524{
    526525    psMemBlock* ptr;
     
    544543
    545544// decrement and return refCounter
    546 void *p_psMemDecrRefCounter(void *vptr, const char *file, int lineno)
     545psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno)
    547546{
    548547    if (vptr == NULL) {
     
    593592        if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) {
    594593
    595             int level = 1;
     594            psS32 level = 1;
    596595
    597596            while (ptr->userMemorySize >= recycleBinSize[level]) {
     
    635634}
    636635
    637 void p_psMemSetDeallocator(void *vptr, psFreeFcn freeFcn)
     636void p_psMemSetDeallocator(psPtr vptr, psFreeFcn freeFcn)
    638637{
    639638    if (vptr == NULL) {
     
    650649
    651650}
    652 psFreeFcn p_psMemGetDeallocator(void *vptr)
     651psFreeFcn p_psMemGetDeallocator(psPtr vptr)
    653652{
    654653    if (vptr == NULL) {
     
    665664}
    666665
    667 bool p_psMemGetPersistent(void *vptr)
     666psBool p_psMemGetPersistent(psPtr vptr)
    668667{
    669668    if (vptr == NULL) {
     
    680679}
    681680
    682 void p_psMemSetPersistent(void *vptr,bool value)
     681void p_psMemSetPersistent(psPtr vptr,psBool value)
    683682{
    684683    if (vptr == NULL) {
  • trunk/psLib/src/sysUtils/psMemory.h

    r1810 r2204  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-14 23:48:25 $
     14 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222
    2323#include <stdio.h>                     // needed for FILE
    24 #include <stdbool.h>
    2524#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
     25
     26#include "psType.h"
    2627
    2728/** @addtogroup MemoryManagement
     
    4849
    4950/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    50 typedef unsigned long psMemoryId;
     51typedef psU64 psMemoryId;
    5152
    5253/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    53 typedef unsigned long psReferenceCount;
     54typedef psU64 psReferenceCount;
    5455
    5556/// typedef for deallocator.
    56 typedef void (*psFreeFcn) (void *ptr);
     57typedef void (*psFreeFcn) (psPtr ptr);
    5758
    5859/** Book-keeping data for storage allocator.
     
    6364typedef struct psMemBlock
    6465{
    65     const void *startblock;            ///< initialised to p_psMEMMAGIC
     66    const psPtr startblock;            ///< initialised to p_psMEMMAGIC
    6667    struct psMemBlock* previousBlock;  ///< previous block in allocation list
    6768    struct psMemBlock* nextBlock;      ///< next block allocation list
     
    7071    const psMemoryId id;               ///< a unique ID for this allocation
    7172    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    72     const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     73    const psS32 lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
    7374    pthread_mutex_t refCounterMutex;   ///< mutex to ensure exclusive access to reference counter
    7475    psReferenceCount refCounter;       ///< how many times pointer is referenced
    75     bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
    76     const void *endblock;              ///< initialised to p_psMEMMAGIC
     76    psBool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
     77    const psPtr endblock;              ///< initialised to p_psMEMMAGIC
    7778}
    7879psMemBlock;
     
    106107    const psMemBlock* ptr,             ///< the pointer to the problematic memory block.
    107108    const char *file,                  ///< the file in which the problem originated
    108     int lineno                         ///< the line number in which the problem originated
     109    psS32 lineno                         ///< the line number in which the problem originated
    109110);
    110111
    111112/** prototype of a callback function used when memory runs out
    112113 *
    113  *  @return void* pointer to requested buffer of the size size_t, or NULL if memory could not
     114 *  @return psPtr pointer to requested buffer of the size size_t, or NULL if memory could not
    114115 *          be found.
    115116 *
     
    117118 *  @ingroup memCallback
    118119 */
    119 typedef void *(*psMemExhaustedCallback) (
     120typedef psPtr (*psMemExhaustedCallback) (
    120121    size_t size                        ///< the size of buffer required
    121122);
     
    123124/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    124125 *
    125  *  @return void* pointer to the allocated buffer. This will not be NULL.
     126 *  @return psPtr pointer to the allocated buffer. This will not be NULL.
    126127 *  @see psFree
    127128 */
    128129#ifdef DOXYGEN
    129 void *psAlloc(size_t size       ///< Size required
     130psPtr psAlloc(size_t size       ///< Size required
    130131             );
    131132#else
    132133
    133 void *p_psAlloc(size_t size,    ///< Size required
     134psPtr p_psAlloc(size_t size,    ///< Size required
    134135                const char *file,       ///< File of call
    135                 int lineno      ///< Line number of call
     136                psS32 lineno      ///< Line number of call
    136137               );
    137138
     
    148149 */
    149150void p_psMemSetDeallocator(
    150     void *ptr,                         ///< the memory block to operate on
     151    psPtr ptr,                         ///< the memory block to operate on
    151152    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
    152153);
     
    162163 */
    163164psFreeFcn p_psMemGetDeallocator(
    164     void *ptr                          ///< the memory block
     165    psPtr ptr                          ///< the memory block
    165166);
    166167
     
    176177 */
    177178void p_psMemSetPersistent(
    178     void *ptr,                         ///< the memory block to operate on
    179     bool value                         ///< true if memory is persistent, otherwise false
     179    psPtr ptr,                         ///< the memory block to operate on
     180    psBool value                         ///< true if memory is persistent, otherwise false
    180181);
    181182
     
    187188 *  Memory marked as persistent is excluded from memory leak checks.
    188189 *
    189  *  @return bool    true if memory is marked persistent, otherwise false.
    190  */
    191 bool p_psMemGetPersistent(
    192     void *ptr                          ///< the memory block to check.
     190 *  @return psBool    true if memory is marked persistent, otherwise false.
     191 */
     192psBool p_psMemGetPersistent(
     193    psPtr ptr                          ///< the memory block to check.
    193194);
    194195
     
    196197/** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
    197198 *
    198  *  @return void* pointer to resized buffer. This will not be NULL.
     199 *  @return psPtr pointer to resized buffer. This will not be NULL.
    199200 *  @see psAlloc, psFree
    200201 */
    201202#ifdef DOXYGEN
    202 void *psRealloc(
    203     void *ptr                          ///< Pointer to re-allocate
     203psPtr psRealloc(
     204    psPtr ptr                          ///< Pointer to re-allocate
    204205    size_t size,                       ///< Size required
    205206);
    206207#else
    207208
    208 void *p_psRealloc(
    209     void *ptr,                         ///< Pointer to re-allocate
     209psPtr p_psRealloc(
     210    psPtr ptr,                         ///< Pointer to re-allocate
    210211    size_t size,                       ///< Size required
    211212    const char *file,                  ///< File of call
    212     int lineno                         ///< Line number of call
     213    psS32 lineno                         ///< Line number of call
    213214);
    214215
     
    224225#ifdef DOXYGEN
    225226void psFree(
    226     void *ptr,                         ///< Pointer to free, if NULL, function returns immediately.
     227    psPtr ptr,                         ///< Pointer to free, if NULL, function returns immediately.
    227228);
    228229#else
    229230
    230231void p_psFree(
    231     void *ptr,                        ///< Pointer to free
     232    psPtr ptr,                        ///< Pointer to free
    232233    const char *file,                 ///< File of call
    233     int lineno                        ///< Line number of call
     234    psS32 lineno                        ///< Line number of call
    234235);
    235236
     
    248249 *  If memory leaks are found, the Memory Problem callback will be called as well.
    249250 *
    250  *  return int  number of memory blocks found as 'leaks', i.e., the number of currently allocated memory
     251 *  return psS32  number of memory blocks found as 'leaks', i.e., the number of currently allocated memory
    251252 *              blocks above id0 that have not been freed.
    252253 *  @see psAlloc, psFree, psgetMemId, psMemProblemCallbackSet
    253254 *  @ingroup memTracing
    254255 */
    255 int psMemCheckLeaks(
     256psS32 psMemCheckLeaks(
    256257    psMemoryId id0,                    ///< don't list blocks with id < id0
    257258    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
     
    264265 *  @ingroup memTracing
    265266 */
    266 int psMemCheckCorruption(
    267     bool abort_on_error                ///< Abort on detecting corruption?
     267psS32 psMemCheckCorruption(
     268    psBool abort_on_error                ///< Abort on detecting corruption?
    268269);
    269270
     
    273274 */
    274275psReferenceCount psMemGetRefCounter(
    275     void *vptr                         ///< Pointer to get refCounter for
     276    psPtr vptr                         ///< Pointer to get refCounter for
    276277);
    277278
     
    281282 */
    282283#ifdef DOXYGEN
    283 void *psMemIncrRefCounter(
    284     void *vptr                         ///< Pointer to increment refCounter, and return
    285 );
    286 #else
    287 
    288 void *p_psMemIncrRefCounter(
    289     void *vptr,                        ///< Pointer to increment refCounter, and return
     284psPtr psMemIncrRefCounter(
     285    psPtr vptr                         ///< Pointer to increment refCounter, and return
     286);
     287#else
     288
     289psPtr p_psMemIncrRefCounter(
     290    psPtr vptr,                        ///< Pointer to increment refCounter, and return
    290291    const char *file,                  ///< File of call
    291     int lineno                         ///< Line number of call
     292    psS32 lineno                         ///< Line number of call
    292293);
    293294
     
    299300 *  @ingroup memRefCount
    300301 *
    301  *  @return void*    the pointer deremented in refCount, or NULL if pointer is
     302 *  @return psPtr    the pointer deremented in refCount, or NULL if pointer is
    302303 *                   fully dereferenced.
    303304 */
    304305#ifdef DOXYGEN
    305 void* psMemDecrRefCounter(
    306     void* vptr                         ///< Pointer to decrement refCounter, and return
    307 );
    308 #else
    309 
    310 void *p_psMemDecrRefCounter(
    311     void *vptr,                        ///< Pointer to decrement refCounter, and return
     306psPtr psMemDecrRefCounter(
     307    psPtr vptr                         ///< Pointer to decrement refCounter, and return
     308);
     309#else
     310
     311psPtr p_psMemDecrRefCounter(
     312    psPtr vptr,                        ///< Pointer to decrement refCounter, and return
    312313    const char *file,                  ///< File of call
    313     int lineno                         ///< Line number of call
     314    psS32 lineno                         ///< Line number of call
    314315);
    315316
  • trunk/psLib/src/sysUtils/psString.c

    r1969 r2204  
    99 *  @author Eric Van Alst, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-06 01:05:41 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131}
    3232
    33 char *psStringNCopy(const char *str, int nChar)
     33char *psStringNCopy(const char *str, psS32 nChar)
    3434{
    3535    char *returnValue = NULL;
  • trunk/psLib/src/sysUtils/psString.h

    r1448 r2204  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-10 01:55:34 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#define PS_STRING_H
    2020
     21#include "psType.h"
    2122
    2223/** This macro will convert the argument to a quoted string */
     
    6263    /**< Input string of characters to copy */
    6364
    64     int nChar
     65    psS32 nChar
    6566    /**< Number of bytes to allocate for string copy */
    6667);
  • trunk/psLib/src/sysUtils/psTrace.c

    r1834 r2204  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-20 22:03:35 $
     11 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434 
    3535    PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the
    36     intermediate components of a long name.  Ie. the "B" in .A.B.C
     36    intermediate components of a psS64 name.  Ie. the "B" in .A.B.C
    3737 
    3838 *****************************************************************************/
     
    5656
    5757static void componentFree(p_psComponent* comp);
    58 static p_psComponent* componentAlloc(const char *name, int level);
     58static p_psComponent* componentAlloc(const char *name, psS32 level);
    5959
    6060/*****************************************************************************
    6161componentAlloc(): allocate memory for a new node, and initialize members.
    6262 *****************************************************************************/
    63 static p_psComponent* componentAlloc(const char *name, int level)
     63static p_psComponent* componentAlloc(const char *name, psS32 level)
    6464{
    6565    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
     
    6868    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
    6969    comp->name = psStringCopy(name);
    70     p_psMemSetPersistent((void*)comp->name,true);
     70    p_psMemSetPersistent((psPtr)comp->name,true);
    7171    comp->level = level;
    7272    comp->n = 0;
     
    8686
    8787    if (comp->subcomp != NULL) {
    88         for (int i = 0; i < comp->n; i++) {
     88        for (psS32 i = 0; i < comp->n; i++) {
    8989            p_psMemSetPersistent(comp->subcomp[i],false);
    9090            psFree(comp->subcomp[i]);
     
    9494    }
    9595
    96     p_psMemSetPersistent((void*)comp->name,false);
    97     psFree((void*)comp->name);
     96    p_psMemSetPersistent((psPtr)comp->name,false);
     97    psFree((psPtr)comp->name);
    9898}
    9999
     
    115115void p_psTraceReset(p_psComponent* currentNode)
    116116{
    117     int i = 0;
     117    psS32 i = 0;
    118118
    119119    if (NULL == currentNode) {
     
    149149to ANSI-C.
    150150 *****************************************************************************/
    151 static bool componentAdd(const char *addNodeName, int level)
    152 {
    153     int i = 0;                  // Loop index variable.
     151static psBool componentAdd(const char *addNodeName, psS32 level)
     152{
     153    psS32 i = 0;                  // Loop index variable.
    154154    char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
    155155    char *pname = name;
    156156    char *firstComponent = NULL;        // first component of name
    157157    p_psComponent* currentNode = cRoot;
    158     int nodeExists = 0;
     158    psS32 nodeExists = 0;
    159159
    160160    // XXX: Verify that this is the correct behavior.
     
    240240 zero
    241241*****************************************************************************/
    242 bool psTraceSetLevel(const char *comp,   // component of interest
    243                      int level)  // desired trace level
     242psBool psTraceSetLevel(const char *comp,   // component of interest
     243                       psS32 level)  // desired trace level
    244244{
    245245    char *compName = NULL;
     
    299299 The trace level of the "name" component.
    300300 *****************************************************************************/
    301 static int doGetTraceLevel(const char *aname)
     301static psS32 doGetTraceLevel(const char *aname)
    302302{
    303303    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
     
    305305    char *firstComponent = NULL;        // first component of name
    306306    p_psComponent* currentNode = cRoot;
    307     int i = 0;
    308     int defaultLevel = 0;
     307    psS32 i = 0;
     308    psS32 defaultLevel = 0;
    309309
    310310    if (NULL == currentNode) {
     
    365365 The level of "name" in the root component tree.
    366366 *****************************************************************************/
    367 int psTraceGetLevel(const char *name)
     367psS32 psTraceGetLevel(const char *name)
    368368{
    369369    char *compName = NULL;
    370     int traceLevel;
     370    psS32 traceLevel;
    371371
    372372    if (cRoot == NULL) {
     
    401401 *****************************************************************************/
    402402static void doPrintTraceLevels(const p_psComponent* comp,
    403                                int depth,
    404                                int defLevel)
    405 {
    406     int i = 0;
     403                               psS32 depth,
     404                               psS32 defLevel)
     405{
     406    psS32 i = 0;
    407407
    408408    if (comp->name[0] == '\0') {
     
    472472 *****************************************************************************/
    473473void p_psTrace(const char *comp,        // component being traced
    474                int level,       // desired trace level
     474               psS32 level,       // desired trace level
    475475               ...)             // arguments
    476476{
    477477    char *fmt = NULL;
    478478    va_list ap;
    479     int i = 0;
     479    psS32 i = 0;
    480480
    481481    if (NULL == comp) {
  • trunk/psLib/src/sysUtils/psTrace.h

    r2202 r2204  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 23:14:04 $
     11 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    {
    5151        const char *name;           // last part of name of component
    52         int level;                  // trace level for this component
    53         int n;                      // number of subcomponents
     52        psS32 level;                  // trace level for this component
     53        psS32 n;                      // number of subcomponents
    5454        struct p_psComponent* *subcomp;     // next level of subcomponents
    5555    }
     
    5959/// Send a trace message
    6060void p_psTrace(const char *facil,       ///< facilty of interest
    61                int myLevel,     ///< desired trace level
     61               psS32 myLevel,     ///< desired trace level
    6262               ...)             ///< trace message arguments
    6363;
     
    6565
    6666/// Set trace level
    67 bool psTraceSetLevel(const char *facil,     ///< facilty of interest
    68                      int level)     ///< desired trace level
     67psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
     68                       psS32 level)     ///< desired trace level
    6969;
    7070
    7171/// Get the trace level
    72 int psTraceGetLevel(const char *facil)     ///< facilty of interest
     72psS32 psTraceGetLevel(const char *facil)     ///< facilty of interest
    7373;
    7474
  • trunk/psLib/src/sysUtils/psType.h

    r1984 r2204  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-10-06 21:40:13 $
     13*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:31 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include <stdint.h>
    2424#include <float.h>
     25#include <stdbool.h>
    2526
    2627/// @addtogroup DataContainer
     
    5253typedef float _Complex psC32;          ///< complex with 32-bit floating point Real and Imagary numbers
    5354typedef double _Complex psC64;         ///< complex with 64-bit floating point Real and Imagary numbers
    54 typedef void *psPTR;                   ///< void pointer
     55typedef void* psPtr;                   ///< void pointer
     56typedef bool psBool;                   ///< boolean value
    5557
    5658typedef enum {
     
    6062    PS_TYPE_S64 = 0x0108,              ///< Long integer.
    6163    PS_TYPE_U8 = 0x0301,               ///< Unsigned character.
    62     PS_TYPE_U16 = 0x0302,              ///< Unsigned short integer.
     64    PS_TYPE_U16 = 0x0302,              ///< Unsigned psS16 integer.
    6365    PS_TYPE_U32 = 0x0304,              ///< Unsigned integer.
    64     PS_TYPE_U64 = 0x0308,              ///< Unsigned long integer.
     66    PS_TYPE_U64 = 0x0308,              ///< Unsigned psS64 integer.
    6567    PS_TYPE_F32 = 0x0404,              ///< Single-precision Floating point.
    6668    PS_TYPE_F64 = 0x0408,              ///< Double-precision floating point.
     
    115117#define PS_TYPE_C32_NAME "psC32"
    116118#define PS_TYPE_C64_NAME "psC64"
    117 #define PS_TYPE_PTR_NAME "psPTR"
     119#define PS_TYPE_PTR_NAME "psPtr"
    118120
    119121#define PS_TYPE_NAME(value,type) \
     
    183185#define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
    184186/// Macro to determine the storage size, in bytes, of the psElemType.
    185 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
     187#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(psPtr) :(x & 0xFF) )
    186188
    187189/** Dimensions of a data type.
  • trunk/psLib/src/types/psArray.c

    r1920 r2204  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-28 23:26:48 $
     11 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242
    4343/*****************************************************************************/
    44 psArray* psArrayAlloc(unsigned int nalloc)
     44psArray* psArrayAlloc(psU32 nalloc)
    4545{
    4646    psArray* psArr = NULL;
     
    5454
    5555    // Create vector data array
    56     psArr->data = psAlloc(nalloc * sizeof(psPTR));
     56    psArr->data = psAlloc(nalloc * sizeof(psPtr));
    5757
    5858    return psArr;
    5959}
    6060
    61 psArray* psArrayRealloc(psArray* restrict in, unsigned int nalloc)
     61psArray* psArrayRealloc(psArray* restrict in, psU32 nalloc)
    6262{
    6363    if (in == NULL) {
     
    6565    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
    6666        if (nalloc < in->n) {
    67             for (int i = nalloc; i < in->n; i++) {      // For reduction in vector size
     67            for (psS32 i = nalloc; i < in->n; i++) {      // For reduction in vector size
    6868                psFree(in->data[i]);
    6969            }
     
    7171        }
    7272        // Realloc after decrementation to avoid accessing freed array elements
    73         in->data = psRealloc(in->data, nalloc * sizeof(psPTR));
     73        in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
    7474        in->nalloc = nalloc;
    7575    }
     
    8989}
    9090
    91 bool psArrayRemove(psArray* psArr,
    92                    psPTR data)
     91psBool psArrayRemove(psArray* psArr,
     92                     psPtr data)
    9393{
    94     bool success = false;
     94    psBool success = false;
    9595
    9696    if (psArr == NULL) {
     
    9898    }
    9999
    100     int n = psArr->n;
    101     psPTR* psArrData = psArr->data;
    102     for (int i = n-1; i<0; i--) {
     100    psS32 n = psArr->n;
     101    psPtr* psArrData = psArr->data;
     102    for (psS32 i = n-1; i<0; i--) {
    103103        if (psArrData[i] == data) {
    104             memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPTR));
     104            memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPtr));
    105105            n--;
    106106            success = true;
     
    119119    }
    120120
    121     for (int i = 0; i < psArr->n; i++) {
     121    for (psS32 i = 0; i < psArr->n; i++) {
    122122        psFree(psArr->data[i]);
    123123        psArr->data[i] = NULL;
     
    131131    }
    132132
    133     qsort(in->data, in->n, sizeof(psPTR), (int (*)(const void *, const void *))compare);
     133    qsort(in->data, in->n, sizeof(psPtr), (int (*)(const void* , const void*))compare);
    134134
    135135    return in;
  • trunk/psLib/src/types/psArray.h

    r1920 r2204  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-28 23:26:48 $
     14 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#ifndef PS_ARRAY_H
    2121#define PS_ARRAY_H
    22 
    23 #include<stdbool.h>
    2422
    2523#include "psType.h"
     
    3634typedef struct
    3735{
    38     unsigned int nalloc;        ///< Total number of elements available.
    39     unsigned int n;             ///< Number of elements in use.
    40     psPTR* data;                ///< An Array of pointer elements
     36    psU32 nalloc;        ///< Total number of elements available.
     37    psU32 n;             ///< Number of elements in use.
     38    psPtr* data;                ///< An Array of pointer elements
    4139}
    4240psArray;
     
    5755 */
    5856psArray* psArrayAlloc(
    59     unsigned int nalloc                ///< Total number of elements to make available.
     57    psU32 nalloc                ///< Total number of elements to make available.
    6058);
    6159
     
    7068psArray* psArrayRealloc(
    7169    psArray* restrict psArr,           ///< array to reallocate.
    72     unsigned int nalloc                ///< Total number of elements to make available.
     70    psU32 nalloc                ///< Total number of elements to make available.
    7371);
    7472
     
    8179 *
    8280 */
    83 bool psArrayRemove(
     81psBool psArrayRemove(
    8482    psArray* psArr,                    ///< array to operate on
    85     psPTR data                         ///< the data pointer to remove from psArray
     83    psPtr data                         ///< the data pointer to remove from psArray
    8684);
    8785
  • trunk/psLib/src/types/psBitSet.c

    r1842 r2204  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-21 23:17:52 $
     13 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121#include <ctype.h>
    2222#include <math.h>
    23 #include <stdbool.h>
    2423
    2524#include "psBitSet.h"
     
    4847 *  @return  char*: Pointer to byte in which bit is contained.
    4948 */
    50 static char mask(int bit)
     49static char mask(psS32 bit)
    5150{
    5251    char mask = (char)0x01;
     
    6766}
    6867
    69 psBitSet* psBitSetAlloc(int n)
    70 {
    71     int numBytes = 0;
     68psBitSet* psBitSetAlloc(psS32 n)
     69{
     70    psS32 numBytes = 0;
    7271    psBitSet* newObj = NULL;
    7372
     
    9594
    9695psBitSet* psBitSetSet(psBitSet* inBitSet,
    97                       int bit)
     96                      psS32 bit)
    9897{
    9998    char *byte = NULL;
     
    120119
    121120psBitSet* psBitSetClear(psBitSet* inBitSet,
    122                         int bit)
     121                        psS32 bit)
    123122{
    124123    char *byte = NULL;
     
    144143}
    145144
    146 bool psBitSetTest(const psBitSet* inBitSet,
    147                   int bit)
     145psBool psBitSetTest(const psBitSet* inBitSet,
     146                    psS32 bit)
    148147{
    149148    char *byte = NULL;
     
    173172                     const psBitSet* restrict inBitSet2)
    174173{
    175     int i = 0;
    176     int n = 0;
     174    psS32 i = 0;
     175    psS32 n = 0;
    177176    char* outBits = NULL;
    178177    char* inBits1 = NULL;
    179178    char* inBits2 = NULL;
    180     int op = UNKNOWN_OP;
     179    psS32 op = UNKNOWN_OP;
    181180
    182181    if (inBitSet1 == NULL) {
     
    198197
    199198    // make operator all caps
    200     int tempStrLen = strlen(operator);
     199    psS32 tempStrLen = strlen(operator);
    201200    char* tempStr = psAlloc(tempStrLen+1);
    202201
    203     for (int lcv=0;lcv<tempStrLen;lcv++) {
     202    for (psS32 lcv=0;lcv<tempStrLen;lcv++) {
    204203        tempStr[lcv] = (char)toupper(operator[lcv]);
    205204    }
     
    308307char *psBitSetToString(const psBitSet* restrict inBitSet)
    309308{
    310     int i = 0;
    311     int numBits = inBitSet->n * 8;
     309    psS32 i = 0;
     310    psS32 numBits = inBitSet->n * 8;
    312311    char *outString = psAlloc((size_t) numBits + 1);
    313312
  • trunk/psLib/src/types/psBitSet.h

    r1807 r2204  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-14 20:01:52 $
     14 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#ifndef PSBITSET_H
    2121#define PSBITSET_H
     22
     23#include "psType.h"
    2224
    2325/// @addtogroup BitSet
     
    3537typedef struct
    3638{
    37     int n;                             ///< Number of bytes in the array
     39    psS32 n;                             ///< Number of bytes in the array
    3840    char *bits;                        ///< Aray of bytes holding bits
    3941}
     
    5456/*@null@*/
    5557psBitSet* psBitSetAlloc(
    56     int n                              ///< Number of bits in psBitSet array
     58    psS32 n                              ///< Number of bits in psBitSet array
    5759);
    5860
     
    6870    /* @returned@ */
    6971    psBitSet* restrict inMask,         ///< Pointer to psBitSet to be set.
    70     int bit                            ///< Bit to be set.
     72    psS32 bit                            ///< Bit to be set.
    7173);
    7274
     
    8284    /* @returned@ */
    8385    psBitSet* restrict inMask,         ///< Pointer to psBitSet to be cleared.
    84     int bit                            ///< Bit to be cleared.
     86    psS32 bit                            ///< Bit to be cleared.
    8587);
    8688
     
    9597 */
    9698
    97 bool psBitSetTest(
     99psBool psBitSetTest(
    98100    const psBitSet* restrict inMask,   ///< Pointer psBitSet to be tested.
    99     int bit                            ///< Bit to be tested.
     101    psS32 bit                            ///< Bit to be tested.
    100102);
    101103
  • trunk/psLib/src/types/psHash.c

    r1842 r2204  
    1111*  @author George Gusciora, MHPCC
    1212*
    13 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-09-21 23:17:53 $
     13*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:31 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#include <stdio.h>
    2020#include <string.h>
    21 #include <stdbool.h>
    2221#include "psHash.h"
    2322#include "psMemory.h"
     
    2928#include "psCollectionsErrors.h"
    3029
    31 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);
     30static psHashBucket* hashBucketAlloc(const char *key, psPtr data, psHashBucket* next);
    3231static void hashBucketFree(psHashBucket* bucket);
    33 static void *doHashWork(psHash* table, const char *key, void *data, bool remove
     32static psPtr doHashWork(psHash* table, const char *key, psPtr data, psBool remove
    3433                           );
    3534static void hashFree(psHash* table);
     
    4544psList* psHashKeyList(psHash* table)
    4645{
    47     int i = 0;                  // Loop index variable
     46    psS32 i = 0;                  // Loop index variable
    4847    psList* myLinkList = NULL;  // The output data structure
    4948    psHashBucket* ptr = NULL;   // Used to step thru linked list.
     
    8584 *****************************************************************************/
    8685static psHashBucket* hashBucketAlloc(const char *key,
    87                                      void *data,
     86                                     psPtr data,
    8887                                     psHashBucket* next)
    8988{
     
    135134    The new hash table.
    136135 *****************************************************************************/
    137 psHash* psHashAlloc(int nbucket)        // initial number of buckets
    138 {
    139     int i = 0;                  // loop index variable
     136psHash* psHashAlloc(psS32 nbucket)        // initial number of buckets
     137{
     138    psS32 i = 0;                  // loop index variable
    140139
    141140    // Create the new hash table.
     
    172171static void hashFree(psHash* table)
    173172{
    174     int i = 0;                  // Loop index variable.
     173    psS32 i = 0;                  // Loop index variable.
    175174
    176175    if (table == NULL) {
     
    212211there is little common code between those functions.
    213212  *****************************************************************************/
    214 static void *doHashWork(psHash* table,
     213static psPtr doHashWork(psHash* table,
    215214                        const char *key,
    216                         void *data, bool remove
     215                        psPtr data, psBool remove
    217216                           )
    218217{
    219     long int hash = 1;          // This will contain an integer value
     218    psS64 hash = 1;          // This will contain an integer value
    220219
    221220    // "hashed" from the key.
     
    236235    }
    237236    // NOTE: This is the originally supplied hash function.
    238     // for (int i = 0, len = strlen(key); i < len; i++) {
     237    // for (psS32 i = 0, len = strlen(key); i < len; i++) {
    239238    // hash = (hash << 1) ^ key[i];
    240239    // }
     
    273272                    // of removing an item from a single-linked list.
    274273
    275                     void *data = ptr->data;
     274                    psPtr data = ptr->data;
    276275
    277276                    optr->next = ptr->next;
     
    344343    boolean value defining success or failure
    345344 *****************************************************************************/
    346 bool psHashAdd(psHash* table,
    347                const char *key,
    348                void *data)
     345psBool psHashAdd(psHash* table,
     346                 const char *key,
     347                 psPtr data)
    349348{
    350349    if (table == NULL) {
     
    380379    The data associated with that key.
    381380 *****************************************************************************/
    382 void *psHashLookup(psHash* table,      // table to lookup key in
     381psPtr psHashLookup(psHash* table,      // table to lookup key in
    383382                   const char *key)     // key to lookup
    384383{
     
    409408    boolean value defining success or failure
    410409 *****************************************************************************/
    411 bool psHashRemove(psHash* table,
    412                   const char *key)
    413 {
    414     void *data = NULL;
    415     bool retVal = false;
     410psBool psHashRemove(psHash* table,
     411                    const char *key)
     412{
     413    psPtr data = NULL;
     414    psBool retVal = false;
    416415
    417416    if (table == NULL) {
  • trunk/psLib/src/types/psHash.h

    r1441 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *   
    13  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-09 23:40:55 $
     13 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222 *  \{
    2323 */
    24 #include<stdbool.h>
    2524
    2625#include "psList.h"
     
    3029{
    3130    char *key;                  ///< key for this item of data
    32     void *data;                 ///< the data itself
     31    psPtr data;                 ///< the data itself
    3332    struct psHashBucket* next;  ///< list of other possible keys
    3433}
     
    4039typedef struct psHash
    4140{
    42     int nbucket;                ///< Number of buckets in hash table.
     41    psS32 nbucket;                ///< Number of buckets in hash table.
    4342    psHashBucket* *buckets;     ///< The bucket data.
    4443}
     
    4645
    4746/// Allocate hash buckets in table.
    48 psHash* psHashAlloc(int nbucket ///< The number of buckets to allocate.
     47psHash* psHashAlloc(psS32 nbucket ///< The number of buckets to allocate.
    4948                   );
    5049
    5150/// Insert entry into table.
    52 bool psHashAdd(psHash* table,  ///< table to insert in
    53                const char *key, ///< key to use
    54                void *data       ///< data to insert
    55               );
     51psBool psHashAdd(psHash* table,  ///< table to insert in
     52                 const char *key, ///< key to use
     53                 psPtr data       ///< data to insert
     54                );
    5655
    5756/// Lookup key in table.
    58 void *psHashLookup(psHash* table,      ///< table to lookup key in
     57psPtr psHashLookup(psHash* table,      ///< table to lookup key in
    5958                   const char *key      ///< key to lookup
    6059                  );
    6160
    6261/// Remove key from table.
    63 bool psHashRemove(psHash* table,       ///< table to lookup key in
    64                   const char *key       ///< key to lookup
    65                  );
     62psBool psHashRemove(psHash* table,       ///< table to lookup key in
     63                    const char *key       ///< key to lookup
     64                   );
    6665
    6766/// List all keys in table.
  • trunk/psLib/src/types/psList.c

    r1807 r2204  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-14 20:01:52 $
     8 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:31 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1313
    1414#include <stdlib.h>
    15 #include <stdbool.h>
    1615#include <stdio.h>
    1716#include <pthread.h>                       // we need a mutex to make this stuff thread safe.
     
    2625#include "psCollectionsErrors.h"
    2726
    28 #define ITER_INIT_HEAD ((void *)1)         // next iteration should return head
    29 #define ITER_INIT_TAIL ((void *)2)         // next iteration should return tail
     27#define ITER_INIT_HEAD ((psPtr )1)         // next iteration should return head
     28#define ITER_INIT_TAIL ((psPtr )2)         // next iteration should return tail
    3029
    3130// private functions.
    3231static psListElem* listGetIterator(psList* list);
    33 static int listGetIteratorIndex(psList* list);
    34 static void listSetIterator(psList* list, int where, bool lockList);
     32static psS32 listGetIteratorIndex(psList* list);
     33static void listSetIterator(psList* list, psS32 where, psBool lockList);
    3534static void listFree(psList* list);
    3635
    37 psList* psListAlloc(void *data)
     36psList* psListAlloc(psPtr data)
    3837{
    3938    psList* list = psAlloc(sizeof(psList));
     
    8281}
    8382
    84 bool psListAdd(psList* list, int location, void *data)
     83psBool psListAdd(psList* list, psS32 location, psPtr data)
    8584{
    8685    psListElem* position;
    8786    psListElem* elem;
    88     int cursorIndex = 0;
     87    psS32 cursorIndex = 0;
    8988
    9089    if (list == NULL) {
     
    168167 * Remove an element from a list
    169168 */
    170 bool psListRemove(psList* list, int location, void *data)
     169psBool psListRemove(psList* list, psS32 location, psPtr data)
    171170{
    172171    psListElem* elem = NULL;    // element to remove
    173     int cursorIndex = 0;
     172    psS32 cursorIndex = 0;
    174173
    175174    if (list == NULL) {
     
    184183        // search list for the data item.
    185184
    186         int i = 0;              // index
     185        psS32 i = 0;              // index
    187186
    188187        for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) {
     
    247246}
    248247
    249 void psListSetIterator(psList* list, int where)
     248void psListSetIterator(psList* list, psS32 where)
    250249{
    251250    listSetIterator(list, where, true);
    252251}
    253252
    254 static void listSetIterator(psList* list, int where, bool lockList)
     253static void listSetIterator(psList* list, psS32 where, psBool lockList)
    255254{
    256255    psListElem* cursor;
    257     int position;
     256    psS32 position;
    258257
    259258    if (list == NULL) {
     
    272271    }
    273272
    274     if (where >= (int)list->size) {
     273    if (where >= (psS32)list->size) {
    275274        list->iter = NULL;
    276275        if (lockList) {
     
    323322            }
    324323
    325             int position = listGetIteratorIndex(list);
     324            psS32 position = listGetIteratorIndex(list);
    326325
    327326            if (where < position) {
    328                 int diff = position - where;
    329 
    330                 for (int count = 0; count < diff; count++) {
     327                psS32 diff = position - where;
     328
     329                for (psS32 count = 0; count < diff; count++) {
    331330                    listSetIterator(list, PS_LIST_PREVIOUS, false);
    332331                }
    333332            } else {
    334                 int diff = where - position;
    335 
    336                 for (int count = 0; count < diff; count++) {
     333                psS32 diff = where - position;
     334
     335                for (psS32 count = 0; count < diff; count++) {
    337336                    listSetIterator(list, PS_LIST_NEXT, false);
    338337                }
     
    363362}
    364363
    365 int listGetIteratorIndex(psList* list)
     364psS32 listGetIteratorIndex(psList* list)
    366365{
    367366    if (list->iter == ITER_INIT_HEAD) {
     
    374373}
    375374
    376 void *psListGet(psList* list, int location)
     375psPtr psListGet(psList* list, psS32 location)
    377376{
    378377    psListElem* element;
     
    391390 * and now return the previous/next element of the list
    392391 */
    393 void *psListGetNext(psList* list)
     392psPtr psListGetNext(psList* list)
    394393{
    395394    return psListGet(list, PS_LIST_NEXT);
    396395}
    397396
    398 void *psListGetPrevious(psList* list)
     397psPtr psListGetPrevious(psList* list)
    399398{
    400399    return psListGet(list, PS_LIST_PREVIOUS);
    401400}
    402401
    403 void *psListGetCurrent(psList* list)
     402psPtr psListGetCurrent(psList* list)
    404403{
    405404    return psListGet(list, PS_LIST_CURRENT);
     
    412411{
    413412    psListElem* ptr;
    414     unsigned int n;
     413    psU32 n;
    415414    psArray* restrict arr;
    416415
     
    429428    ptr = list->head;
    430429    n = list->size;
    431     for (int i = 0; i < n; i++) {
     430    for (psS32 i = 0; i < n; i++) {
    432431        arr->data[i] = psMemIncrRefCounter(ptr->data);
    433432        ptr = ptr->next;
     
    439438psList* psArrayToList(psArray* arr)
    440439{
    441     unsigned int n;
     440    psU32 n;
    442441    psList* list;               // list of elements
    443442
     
    448447    list = psListAlloc(NULL);
    449448    n = arr->n;
    450     for (int i = 0; i < n; i++) {
     449    for (psS32 i = 0; i < n; i++) {
    451450        psListAdd(list, PS_LIST_TAIL, arr->data[i]);
    452451    }
  • trunk/psLib/src/types/psList.h

    r1747 r2204  
    1010 *  @ingroup LinkedList
    1111 *
    12  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-09 02:23:27 $
     12 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717
    1818#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
    19 #include <stdbool.h>                   // we use the bool type.
    2019
    2120#include "psCompare.h"
     
    4645    struct psListElem* prev;           ///< previous link in list
    4746    struct psListElem* next;           ///< next link in list
    48     void *data;                        ///< real data item
     47    psPtr data;                        ///< real data item
    4948}
    5049psListElem;
     
    5756typedef struct
    5857{
    59     unsigned int size;                 ///< number of elements on list
     58    psU32 size;                 ///< number of elements on list
    6059    psListElem* head;                  ///< first element on list (may be NULL)
    6160    psListElem* tail;                  ///< last element on list (may be NULL)
    6261    psListElem* iter;                  ///< iteration cursor
    63     unsigned int iterIndex;            ///< the numeric position of the iteration cursor in the list
     62    psU32 iterIndex;            ///< the numeric position of the iteration cursor in the list
    6463    pthread_mutex_t lock;              ///< mutex to lock a node during changes
    6564}
     
    7170 */
    7271psList* psListAlloc(
    73     void *data
     72    psPtr data
    7473    ///< initial data item; may be NULL if no an empty psList is desired
    7574)
     
    8180 *                      NULL, the return value will also be NULL.
    8281 */
    83 bool psListAdd(
     82psBool psListAdd(
    8483    psList* restrict list,             ///< list to add to (if NULL, nothing is done)
    85     int location,                      ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
    86     void *data                         ///< data item to add.  If NULL, list is not modified.
     84    psS32 location,                      ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     85    psPtr data                         ///< data item to add.  If NULL, list is not modified.
    8786);
    8887
    8988/** Remove an item from a list.  If location parameter is PS_LIST_UNKNOWN,
    9089 *
    91  *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
     90 *  @return psBool        TRUE if element is successfully removed, otherwise FALSE.
    9291 */
    93 bool psListRemove(
     92psBool psListRemove(
    9493    psList* restrict list,
    9594    ///< list to remove element from
    96     int location,
     95    psS32 location,
    9796    ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
    98     void *data
     97    psPtr data
    9998    ///< if location is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
    10099);
     
    102101/** Retrieve an item from a list.
    103102 *
    104  *  @return void*       the item corresponding to the location parameter.  If
     103 *  @return psPtr       the item corresponding to the location parameter.  If
    105104 *                      location is invalid (e.g., a numbered index greater
    106105 *                      than the list size or if the list is empty), a
    107106 *                      NULL is returned.
    108107 */
    109 void *psListGet(
     108psPtr psListGet(
    110109    psList* restrict list,             ///< list to retrieve element from
    111     int location                       ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
     110    psS32 location                       ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
    112111);
    113112
     
    118117void psListSetIterator(
    119118    psList* restrict list,             ///< list to retrieve element from
    120     int location                       ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
     119    psS32 location                       ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    121120);
    122121
     
    124123 *  the next list position.
    125124 *
    126  *  @return void*       the data item next on the list or NULL if the iterator
     125 *  @return psPtr       the data item next on the list or NULL if the iterator
    127126 *                      is already pointing to the last element or the list
    128127 *                      parameter was NULL.
    129128 */
    130 void *psListGetNext(
     129psPtr psListGetNext(
    131130    psList* restrict list              ///< list to retrieve element from
    132131);
     
    135134 *  not move the iterator location.
    136135 *
    137  *  @return void*       the data item cooresponding to current iterator
     136 *  @return psPtr       the data item cooresponding to current iterator
    138137 *                      cursor position of the list, or NULL if either the
    139138 *                      iterator is not valid or list parameter was NULL.
    140139 */
    141 void *psListGetCurrent(
     140psPtr psListGetCurrent(
    142141    psList* restrict list              ///< list to retrieve element from
    143142);
     
    146145 *  iterator to the previous list position.
    147146 *
    148  *  @return void*       the data item previous on the list or NULL if the iterator
     147 *  @return psPtr       the data item previous on the list or NULL if the iterator
    149148 *                      is already pointing to the first element or the list
    150149 *                      parameter was NULL.
    151150 */
    152 void *psListGetPrevious(
     151psPtr psListGetPrevious(
    153152    psList* restrict list              ///< list to retrieve element from
    154153);
  • trunk/psLib/src/types/psMetadata.c

    r2040 r2204  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2004-10-09 03:05:53 $
     14*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2004-10-27 00:57:30 $
    1616*
    1717*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959/*****************************************************************************/
    6060
    61 static int metadataId = 0;
     61static psS32 metadataId = 0;
    6262
    6363/*****************************************************************************/
     
    143143
    144144    // Set metadata item unique id
    145     *(int *)(&metadataItem->id) = ++metadataId;
     145    *(psS32 *)(&metadataItem->id) = ++metadataId;
    146146
    147147    // Set metadata item type
     
    154154        break;
    155155    case PS_META_BOOL:
    156         metadataItem->data.B = (bool)va_arg(argPtr, int);
     156        metadataItem->data.B = (psBool)va_arg(argPtr, psS32);
    157157        break;
    158158    case PS_META_S32:
     
    215215}
    216216
    217 bool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, int location )
     217psBool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, psS32 location )
    218218{
    219219    char * key = NULL;
     
    337337}
    338338
    339 bool psMetadataAdd(psMetadata* restrict md, int where, const char *name, psMetadataType type,
    340                    const char *comment, ...)
     339psBool psMetadataAdd(psMetadata* restrict md, psS32 where, const char *name, psMetadataType type,
     340                     const char *comment, ...)
    341341{
    342342    va_list argPtr;
     
    359359}
    360360
    361 bool psMetadataRemove(psMetadata* restrict md, int where, const char *restrict key)
    362 {
    363     int numChildren = 0;
     361psBool psMetadataRemove(psMetadata* restrict md, psS32 where, const char *restrict key)
     362{
     363    psS32 numChildren = 0;
    364364    psList* mdList = NULL;
    365365    psHash* mdTable = NULL;
     
    471471}
    472472
    473 psMetadataItem* psMetadataGet(psMetadata* restrict md, int where)
     473psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where)
    474474{
    475475    psList* mdList = NULL;
     
    497497}
    498498
    499 bool psMetadataSetIterator(psMetadata* restrict md, int where)
     499psBool psMetadataSetIterator(psMetadata* restrict md, psS32 where)
    500500{
    501501    psList* mdList = NULL;
     
    517517}
    518518
    519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, int which)
     519psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, psS32 which)
    520520{
    521521    psList* mdList = NULL;
     
    553553}
    554554
    555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, int which)
     555psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, psS32 which)
    556556{
    557557    psList* mdList = NULL;
  • trunk/psLib/src/types/psMetadata.h

    r1970 r2204  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-10-06 01:06:27 $
     13*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:30 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838    PS_META_F32,                       ///< Single-precision float data.
    3939    PS_META_F64,                       ///< Double-precision float data.
    40     PS_META_STR,                       ///< String data (Stored in as void *).
    41     PS_META_VEC,                       ///< Vector data (Stored in as void *).
    42     PS_META_IMG,                       ///< Image data (Stored in as void *).
    43     PS_META_JPEG,                      ///< JPEG data (Stored in as void *).
    44     PS_META_PNG,                       ///< PNG data (Stored in as void *).
    45     PS_META_ASTROM,                    ///< Astrometric coefficients (Stored in as void *).
    46     PS_META_UNKNOWN,                   ///< Other data (Stored in as void *).
     40    PS_META_STR,                       ///< String data (Stored in as psPtr ).
     41    PS_META_VEC,                       ///< Vector data (Stored in as psPtr ).
     42    PS_META_IMG,                       ///< Image data (Stored in as psPtr ).
     43    PS_META_JPEG,                      ///< JPEG data (Stored in as psPtr ).
     44    PS_META_PNG,                       ///< PNG data (Stored in as psPtr ).
     45    PS_META_ASTROM,                    ///< Astrometric coefficients (Stored in as psPtr ).
     46    PS_META_UNKNOWN,                   ///< Other data (Stored in as psPtr ).
    4747    PS_META_NTYPE                      ///< Number of types. Must be last.
    4848} psMetadataType;
     
    5555typedef struct psMetadataItem
    5656{
    57     const int id;                      ///< Unique ID for metadata item.
     57    const psS32 id;                      ///< Unique ID for metadata item.
    5858    char *restrict name;               ///< Name of metadata item.
    5959    psMetadataType type;               ///< Type of metadata item.
    6060    union {
    61         bool B;                        ///< boolean data
     61        psBool B;                        ///< boolean data
    6262        psS32 S32;                     ///< Signed 32-bit integer data.
    6363        psF32 F32;                     ///< Single-precision float data.
    6464        psF64 F64;                     ///< Double-precision float data.
    65         psPTR V;                       ///< Pointer to other type of data.
     65        psPtr V;                       ///< Pointer to other type of data.
    6666    } data;                            ///< Union for data types.
    6767    char *comment;                     ///< Optional comment ("", not NULL).
     
    144144 *  @return bool: True for success, false for failure.
    145145 */
    146 bool psMetadataAddItem(
     146psBool psMetadataAddItem(
    147147    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    148148    psMetadataItem* restrict item,     ///< Metadata item to be added.
    149     int location                       ///< Location to be added.
     149    psS32 location                       ///< Location to be added.
    150150);
    151151
     
    156156 * @return bool: True for success, false for failure.
    157157 */
    158 bool psMetadataAdd(
    159     psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    160     int where,                         ///< Location to be added.
     158psBool psMetadataAdd(
     159    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
     160    psS32 where,                         ///< Location to be added.
    161161    const char *name,                  ///< Name of metadata item.
    162162    psMetadataType type,               ///< Type of metadata item.
     
    175175 * @return bool: True for success, false for failure.
    176176 */
    177 bool psMetadataRemove(
    178     psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    179     int where,                         ///< Location to be removed.
     177psBool psMetadataRemove(
     178    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
     179    psS32 where,                         ///< Location to be removed.
    180180    const char *restrict key           ///< Name of metadata key.
    181181);
     
    203203psMetadataItem* psMetadataGet(
    204204    psMetadata* restrict md,           ///< Metadata collection to insert metadat item.
    205     int where                          ///< Location to be retrieved.
     205    psS32 where                          ///< Location to be retrieved.
    206206);
    207207
     
    213213 * @return void: void.
    214214 */
    215 bool psMetadataSetIterator(
     215psBool psMetadataSetIterator(
    216216    psMetadata* restrict md,           ///< Metadata collection to iterate.
    217     int where                          ///< Location of iterator.
     217    psS32 where                          ///< Location of iterator.
    218218);
    219219
     
    227227    psMetadata* restrict md,           ///< Metadata collection to iterate.
    228228    const char *restrict match,        ///< Beginning of key name.
    229     int which                          ///< Iterator to be used.
     229    psS32 which                          ///< Iterator to be used.
    230230);
    231231
     
    239239    psMetadata* restrict md,           ///< Metadata collection to iterate.
    240240    const char *restrict match,        ///< Beginning of key name.
    241     int which                          ///< Iterator to be used.
     241    psS32 which                          ///< Iterator to be used.
    242242);
    243243
  • trunk/psLib/src/types/psMetadataConfig.c

    r2014 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-08 00:43:12 $
     11*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104/** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string
    105105 *  must be null terminated. */
    106 bool ignoreLine(char *inString)
     106psBool ignoreLine(char *inString)
    107107{
    108108    while(*inString!='\0' && *inString!='#') {
     
    119119/** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null
    120120 *  terminated copy of the original input string. */
    121 char *cleanString(char *inString, int sLen)
     121char *cleanString(char *inString, psS32 sLen)
    122122{
    123123    char *ptrB = NULL;
     
    149149
    150150/** Count repeat occurances of a single character within a line. The input string must be null terminated. */
    151 int repeatedChars(char *inString, char ch)
    152 {
    153     int count = 0;
     151psS32 repeatedChars(char *inString, char ch)
     152{
     153    psS32 count = 0;
    154154
    155155
     
    166166/** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location
    167167 * the beginning of the string. Tokens are newly allocated null terminated strings. */
    168 char* getToken(char **inString, char *delimiter, int *status)
     168char* getToken(char **inString, char *delimiter, psS32 *status)
    169169{
    170170    char *cleanToken = NULL;
    171     int sLen = 0;
     171    psS32 sLen = 0;
    172172
    173173
     
    195195/** Returns single parsed value as a double precision number. The input string must be cleaned and null
    196196 * terminated. */
    197 double parseValue(char *inString, int *status)
     197double parseValue(char *inString, psS32 *status)
    198198{
    199199    char *end = NULL;
     
    212212
    213213/** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */
    214 bool parseBool(char *inString, int *status)
    215 {
    216     bool value = false;
     214psBool parseBool(char *inString, psS32 *status)
     215{
     216    psBool value = false;
    217217
    218218
     
    229229
    230230/** Returns parsed vector filled with with data. The input string must be null terminated. */
    231 psVector* parseVector(char *inString, psElemType elemType, int *status)
     231psVector* parseVector(char *inString, psElemType elemType, psS32 *status)
    232232{
    233233    char *end = NULL;
    234234    char *saveValue = NULL;
    235     int i = 0;
    236     int numValues = 0;
     235    psS32 i = 0;
     236    psS32 numValues = 0;
    237237    double value = 0.0;
    238238    psVector *vec = NULL;
     
    341341
    342342
    343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, int extNum, char *fileName)
    344 {
    345     bool tempBool;
    346     bool success;
     343psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName)
     344{
     345    psBool tempBool;
     346    psBool success;
    347347    char keyType;
    348348    char keyName[FITS_LINE_SIZE];
     
    350350    char keyComment[FITS_LINE_SIZE];
    351351    char fitsErr[MAX_STRING_LENGTH];
    352     int i;
    353     int hduType = 0;
    354     int status = 0;
    355     int numKeys = 0;
    356     int keyNum = 0;
     352    psS32 i;
     353    psS32 hduType = 0;
     354    psS32 status = 0;
     355    psS32 numKeys = 0;
     356    psS32 keyNum = 0;
    357357    psMetadataType metadataItemType;
    358358    fitsfile *fd = NULL;
     
    449449
    450450
    451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)
    452 {
    453     bool tempBool;
     451psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite)
     452{
     453    psBool tempBool;
    454454    char *line = NULL;
    455455    char *strName = NULL;
     
    458458    char *strComment = NULL;
    459459    char *linePtr = NULL;
    460     int status = 0;
    461     int lineCount = 0;
    462     int failedLines = 0;
     460    psS32 status = 0;
     461    psS32 lineCount = 0;
     462    psS32 failedLines = 0;
    463463    psF64 tempDbl = 0.0;
    464464    psS32 tempInt = 0.0;
  • trunk/psLib/src/types/psMetadataConfig.h

    r1973 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-06 01:17:39 $
     11*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    psMetadata* output,                ///< Resulting metadata from read.
    5151    char *extName,                     ///< File name extension string.
    52     int extNum,                        ///< File name extension number. Starts at 1.
     52    psS32 extNum,                        ///< File name extension number. Starts at 1.
    5353    char *fileName                     ///< Name of file to read.
    5454);
     
    5858 *  Loads pre-defined settings by parsing a configuration file into a psMetadata structure.
    5959 *
    60  *  @return int : Number of lines that failed to be read.
     60 *  @return psS32 : Number of lines that failed to be read.
    6161 */
    62 int psMetadataParseConfig(
     62psS32 psMetadataParseConfig(
    6363    psMetadata** md,                   ///< Resulting metadata from read.
    6464    char *fileName,                    ///< Name of file to read.
    65     bool overwrite                     ///< Allow overwrite of duplicate specifications.
     65    psBool overwrite                     ///< Allow overwrite of duplicate specifications.
    6666);
    6767
  • trunk/psLib/src/xml/psXML.c

    r2014 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-08 00:43:12 $
     11*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    104104/** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string
    105105 *  must be null terminated. */
    106 bool ignoreLine(char *inString)
     106psBool ignoreLine(char *inString)
    107107{
    108108    while(*inString!='\0' && *inString!='#') {
     
    119119/** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null
    120120 *  terminated copy of the original input string. */
    121 char *cleanString(char *inString, int sLen)
     121char *cleanString(char *inString, psS32 sLen)
    122122{
    123123    char *ptrB = NULL;
     
    149149
    150150/** Count repeat occurances of a single character within a line. The input string must be null terminated. */
    151 int repeatedChars(char *inString, char ch)
    152 {
    153     int count = 0;
     151psS32 repeatedChars(char *inString, char ch)
     152{
     153    psS32 count = 0;
    154154
    155155
     
    166166/** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location
    167167 * the beginning of the string. Tokens are newly allocated null terminated strings. */
    168 char* getToken(char **inString, char *delimiter, int *status)
     168char* getToken(char **inString, char *delimiter, psS32 *status)
    169169{
    170170    char *cleanToken = NULL;
    171     int sLen = 0;
     171    psS32 sLen = 0;
    172172
    173173
     
    195195/** Returns single parsed value as a double precision number. The input string must be cleaned and null
    196196 * terminated. */
    197 double parseValue(char *inString, int *status)
     197double parseValue(char *inString, psS32 *status)
    198198{
    199199    char *end = NULL;
     
    212212
    213213/** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */
    214 bool parseBool(char *inString, int *status)
    215 {
    216     bool value = false;
     214psBool parseBool(char *inString, psS32 *status)
     215{
     216    psBool value = false;
    217217
    218218
     
    229229
    230230/** Returns parsed vector filled with with data. The input string must be null terminated. */
    231 psVector* parseVector(char *inString, psElemType elemType, int *status)
     231psVector* parseVector(char *inString, psElemType elemType, psS32 *status)
    232232{
    233233    char *end = NULL;
    234234    char *saveValue = NULL;
    235     int i = 0;
    236     int numValues = 0;
     235    psS32 i = 0;
     236    psS32 numValues = 0;
    237237    double value = 0.0;
    238238    psVector *vec = NULL;
     
    341341
    342342
    343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, int extNum, char *fileName)
    344 {
    345     bool tempBool;
    346     bool success;
     343psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName)
     344{
     345    psBool tempBool;
     346    psBool success;
    347347    char keyType;
    348348    char keyName[FITS_LINE_SIZE];
     
    350350    char keyComment[FITS_LINE_SIZE];
    351351    char fitsErr[MAX_STRING_LENGTH];
    352     int i;
    353     int hduType = 0;
    354     int status = 0;
    355     int numKeys = 0;
    356     int keyNum = 0;
     352    psS32 i;
     353    psS32 hduType = 0;
     354    psS32 status = 0;
     355    psS32 numKeys = 0;
     356    psS32 keyNum = 0;
    357357    psMetadataType metadataItemType;
    358358    fitsfile *fd = NULL;
     
    449449
    450450
    451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)
    452 {
    453     bool tempBool;
     451psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite)
     452{
     453    psBool tempBool;
    454454    char *line = NULL;
    455455    char *strName = NULL;
     
    458458    char *strComment = NULL;
    459459    char *linePtr = NULL;
    460     int status = 0;
    461     int lineCount = 0;
    462     int failedLines = 0;
     460    psS32 status = 0;
     461    psS32 lineCount = 0;
     462    psS32 failedLines = 0;
    463463    psF64 tempDbl = 0.0;
    464464    psS32 tempInt = 0.0;
  • trunk/psLib/src/xml/psXML.h

    r1973 r2204  
    99*  @author Ross Harman, MHPCC
    1010*
    11 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-06 01:17:39 $
     11*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:30 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    psMetadata* output,                ///< Resulting metadata from read.
    5151    char *extName,                     ///< File name extension string.
    52     int extNum,                        ///< File name extension number. Starts at 1.
     52    psS32 extNum,                        ///< File name extension number. Starts at 1.
    5353    char *fileName                     ///< Name of file to read.
    5454);
     
    5858 *  Loads pre-defined settings by parsing a configuration file into a psMetadata structure.
    5959 *
    60  *  @return int : Number of lines that failed to be read.
     60 *  @return psS32 : Number of lines that failed to be read.
    6161 */
    62 int psMetadataParseConfig(
     62psS32 psMetadataParseConfig(
    6363    psMetadata** md,                   ///< Resulting metadata from read.
    6464    char *fileName,                    ///< Name of file to read.
    65     bool overwrite                     ///< Allow overwrite of duplicate specifications.
     65    psBool overwrite                     ///< Allow overwrite of duplicate specifications.
    6666);
    6767
  • trunk/psLib/test/FullUnitTest

    r1602 r2204  
    1919#  RETURN : integer number of tests which failed
    2020#
    21 #  $Revision: 1.14 $  $Name: not supported by cvs2svn $
    22 #  $Date: 2004-08-20 00:51:22 $
     21#  $Revision: 1.15 $  $Name: not supported by cvs2svn $
     22#  $Date: 2004-10-27 00:57:31 $
    2323#
    2424#  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929use Cwd;
    3030
    31 # Provides functions for handling long command line options
     31# Provides functions for handling psS64 command line options
    3232use Getopt::Long;
    3333
  • trunk/psLib/test/astronomy/tst_psAstrometry.c

    r2096 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-13 23:58:20 $
     7 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717#include "pslib.h"
    1818
    19 static int testExposureAlloc(void);
    20 static int testObservatoryAlloc(void);
    21 static int testFPAAlloc(void);
    22 static int testChipAlloc(void);
    23 static int testCellAlloc(void);
    24 static int testReadoutAlloc(void);
     19static psS32 testExposureAlloc(void);
     20static psS32 testObservatoryAlloc(void);
     21static psS32 testFPAAlloc(void);
     22static psS32 testChipAlloc(void);
     23static psS32 testCellAlloc(void);
     24static psS32 testReadoutAlloc(void);
    2525
    2626testDescription tests[] = {
     
    3434                          };
    3535
    36 int main(int argc, char* argv[])
     36psS32 main(psS32 argc, char* argv[])
    3737{
    3838    psLogSetLevel(PS_LOG_INFO);
     
    4141}
    4242
    43 static int testExposureAlloc(void)
     43static psS32 testExposureAlloc(void)
    4444{
    4545    psTime* now = psTimeGetTime(PS_TIME_UTC);
     
    123123}
    124124
    125 static int testObservatoryAlloc(void)
     125static psS32 testObservatoryAlloc(void)
    126126{
    127127    char* name = "The Kaiser Royal Observatory";
     
    173173}
    174174
    175 static int testFPAAlloc(void)
     175static psS32 testFPAAlloc(void)
    176176{
    177177
     
    220220    }
    221221
    222     for (int lcv=0; lcv < 8; lcv++) {
     222    for (psS32 lcv=0; lcv < 8; lcv++) {
    223223        if (fpa->chips->data[lcv] != NULL) {
    224224            psLogMsg(__func__,PS_LOG_ERROR,
     
    307307    */
    308308
    309     for (int lcv=0; lcv < 8; lcv++) {
     309    for (psS32 lcv=0; lcv < 8; lcv++) {
    310310        fpa->chips->data[lcv] = psAlloc(4);
    311311    }
     
    329329}
    330330
    331 static int testChipAlloc(void)
     331static psS32 testChipAlloc(void)
    332332{
    333333    char* name = "The Kaiser Royal Observatory";
     
    372372    }
    373373
    374     for (int lcv=0; lcv < 8; lcv++) {
     374    for (psS32 lcv=0; lcv < 8; lcv++) {
    375375        if (chip->cells->data[lcv] != NULL) {
    376376            psLogMsg(__func__,PS_LOG_ERROR,
     
    477477}
    478478
    479 static int testCellAlloc(void)
     479static psS32 testCellAlloc(void)
    480480{
    481481    char* name = "The Kaiser Royal Observatory";
     
    522522    }
    523523
    524     for (int lcv=0; lcv < 8; lcv++) {
     524    for (psS32 lcv=0; lcv < 8; lcv++) {
    525525        if (cell1->readouts->data[lcv] != NULL) {
    526526            psLogMsg(__func__,PS_LOG_ERROR,
     
    641641}
    642642
    643 static int testReadoutAlloc(void)
     643static psS32 testReadoutAlloc(void)
    644644{
    645645    psImage* image = psImageAlloc(64,64,PS_TYPE_S8);
  • trunk/psLib/test/astronomy/tst_psAstrometry01.c

    r2109 r2204  
    55*  @author GLG, MHPCC
    66*
    7 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2004-10-14 02:05:00 $
     7*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2004-10-27 00:57:31 $
    99*
    1010*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1414#include "pslib.h"
    1515
    16 static int test1( void );
    17 static int test2( void );
    18 static int test3( void );
     16static psS32 test1( void );
     17static psS32 test2( void );
     18static psS32 test3( void );
    1919
    2020testDescription tests[] = {
     
    115115psFPA *genSystem()
    116116{
    117     int i;
    118     int j;
    119     int k;
     117    psS32 i;
     118    psS32 j;
     119    psS32 k;
    120120    psImage *tmpImage;
    121121    //    psTime* now = psTimeGetTime(PS_TIME_UTC);
     
    170170            for (k=0;k<NUM_READOUTS;k++) {
    171171                tmpImage = psImageAlloc(READOUT_NUM_COLS, READOUT_NUM_ROWS, PS_TYPE_F32);
    172                 for (int row=0;row<READOUT_NUM_ROWS;row++) {
    173                     for(int col=0;col<READOUT_NUM_COLS;col++) {
     172                for (psS32 row=0;row<READOUT_NUM_ROWS;row++) {
     173                    for(psS32 col=0;col<READOUT_NUM_COLS;col++) {
    174174                        tmpImage->data.F32[row][col] = (float) ((i * (CHIP_WIDTH + CHIP_GAP)) +
    175175                                                                (j * (CELL_WIDTH + CELL_GAP)));
     
    185185}
    186186
    187 int main( int argc, char* argv[] )
     187psS32 main( psS32 argc, char* argv[] )
    188188{
    189189    psLogSetLevel( PS_LOG_INFO );
     
    201201#define Y0  60.0
    202202
    203 int test1( void )
    204 {
    205     int i;
    206     int j;
     203psS32 test1( void )
     204{
     205    psS32 i;
     206    psS32 j;
    207207    psFixedPattern *tmp = NULL;
    208208    float x0 = X0;
     
    212212    psImage *x = psImageAlloc(X_NUM_COLS, X_NUM_ROWS, PS_TYPE_F64);
    213213    psImage *y = psImageAlloc(Y_NUM_COLS, Y_NUM_ROWS, PS_TYPE_F64);
    214     int testStatus = 0;
    215     int numPixels = 0;
     214    psS32 testStatus = 0;
     215    psS32 numPixels = 0;
    216216
    217217    for (i=0;i<X_NUM_ROWS;i++) {
     
    295295}
    296296
    297 int test2()
    298 {
    299     int testStatus = 0;
     297psS32 test2()
     298{
     299    psS32 testStatus = 0;
    300300
    301301    psTime* now = psTimeGetTime(PS_TIME_UTC);
     
    371371}
    372372
    373 int printCell(psCell *cell)
     373psS32 printCell(psCell *cell)
    374374{
    375375    psReadout **readouts = (psReadout **) cell->readouts->data;
     
    377377
    378378    printf("-------------------------------\n");
    379     for (int i = 0; i < readout->image->numRows ; i++) {
    380         for (int j = 0; j < readout->image->numCols ; j++) {
     379    for (psS32 i = 0; i < readout->image->numRows ; i++) {
     380        for (psS32 j = 0; j < readout->image->numCols ; j++) {
    381381            printf("(%.1f) ", readout->image->data.F32[i][j]);
    382382        }
     
    415415 
    416416 *****************************************************************************/
    417 int test3( void )
    418 {
    419     int x;
    420     int y;
     417psS32 test3( void )
     418{
     419    psS32 x;
     420    psS32 y;
    421421    psPlane fpaCoord;
    422422    psFPA *myFPA = genSystem();
     
    426426    psPlane testCoord;
    427427
    428     int xReadout = 0;
    429     int xFPA = 0;
    430     for (int chip=0;chip<NUM_CHIPS;chip++) {
    431         for (int cell=0;cell<NUM_CELLS;cell++) {
     428    psS32 xReadout = 0;
     429    psS32 xFPA = 0;
     430    for (psS32 chip=0;chip<NUM_CHIPS;chip++) {
     431        for (psS32 cell=0;cell<NUM_CELLS;cell++) {
    432432            for(x=0;x<CELL_WIDTH;x++) {
    433433                for (y=0;y<CELL_HEIGHT;y++) {
     
    444444                        psCoordChipToCell(&cellCoord, &chipCoord, myCell);
    445445
    446                         if (x != (int) cellCoord.x) {
     446                        if (x != (psS32) cellCoord.x) {
    447447                            printf("ERROR: x coord was %f, should be %d\n", cellCoord.x, x);
    448448                        }
    449                         if (y != (int) cellCoord.y) {
     449                        if (y != (psS32) cellCoord.y) {
    450450                            printf("ERROR: y coord was %f, should be %d\n", cellCoord.y, y);
    451451                        }
  • trunk/psLib/test/astronomy/tst_psCoord.c

    r2201 r2204  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-10-26 22:51:56 $
     8*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-10-27 00:57:31 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#include "pslib.h"
    1616
    17 static int test1( void );
    18 static int test1b( void );
    19 static int test1c( void );
    20 static int test2( void );
    21 static int test3( void );
    22 static int test4( void );
    23 static int test5( void );
    24 static int test6( void );
    25 static int test7( void );
    26 static int test8( void );
    27 static int test20( void );
    28 static int test21( void );
    29 static int test40( void );
    30 static int test41( void );
     17static psS32 test1( void );
     18static psS32 test1b( void );
     19static psS32 test1c( void );
     20static psS32 test2( void );
     21static psS32 test3( void );
     22static psS32 test4( void );
     23static psS32 test5( void );
     24static psS32 test6( void );
     25static psS32 test7( void );
     26static psS32 test8( void );
     27static psS32 test20( void );
     28static psS32 test21( void );
     29static psS32 test40( void );
     30static psS32 test41( void );
    3131
    3232testDescription tests[] = {
     
    5656
    5757
    58 int main( int argc, char* argv[] )
     58psS32 main( psS32 argc, char* argv[] )
    5959{
    6060    psLogSetLevel( PS_LOG_INFO );
     
    8787#define X0_SMALL 2.0
    8888
    89 int test1( void )
     89psS32 test1( void )
    9090{
    9191    float tmpF32;
    92     int testStatus = 0;
     92    psS32 testStatus = 0;
    9393    psSphereTransform *myST = psSphereTransformAlloc(NPLAT, X0_BIG, X0_SMALL);
    9494
     
    122122#define NY_TERMS 4
    123123#define NZ_TERMS 5
    124 int test1b( void )
    125 {
    126     int testStatus = 0;
     124psS32 test1b( void )
     125{
     126    psS32 testStatus = 0;
    127127    psPlaneTransform *myPT = psPlaneTransformAlloc(NX_TERMS, NY_TERMS);
    128128
     
    148148    return(testStatus);
    149149}
    150 int test1c( void )
    151 {
    152     int testStatus = 0;
     150psS32 test1c( void )
     151{
     152    psS32 testStatus = 0;
    153153    psPlaneDistort *myPD = psPlaneDistortAlloc(NW_TERMS, NX_TERMS, NY_TERMS, NZ_TERMS);
    154154
     
    195195#define N 10
    196196// We do a simple identity transformation on a few x,y pairs.
    197 int test2( void )
    198 {
    199     int i;
    200     int testStatus = 0;
     197psS32 test2( void )
     198{
     199    psS32 i;
     200    psS32 testStatus = 0;
    201201    psPlane in;
    202202    psPlane out;
     
    235235// We do a simple identity transformation on a few x,y pairs.  For x and y,
    236236// we add in the COLOR and MAGNITUDE.
    237 int test3( void )
    238 {
    239     int i;
    240     int testStatus = 0;
     237psS32 test3( void )
     238{
     239    psS32 i;
     240    psS32 testStatus = 0;
    241241    psPlane in;
    242242    psPlane out;
     
    277277#define DEG_INC 30.0
    278278// We do a simple identity transformation on a few RA, DEC pairs.
    279 int test4( void )
    280 {
    281     int testStatus = 0;
     279psS32 test4( void )
     280{
     281    psS32 testStatus = 0;
    282282    psSphere in;
    283283    psSphere out;
     
    315315}
    316316
    317 int test5( void )
    318 {
    319     int testStatus = 0;
     317psS32 test5( void )
     318{
     319    psS32 testStatus = 0;
    320320    psTime* now = psTimeGetTime(PS_TIME_UTC);
    321321    struct tm *tm_time = psTimeToTM(now);
     
    354354
    355355
    356 int test6( void )
    357 {
    358     int testStatus = 0;
     356psS32 test6( void )
     357{
     358    psS32 testStatus = 0;
    359359    psTime* now = psTimeGetTime(PS_TIME_UTC);
    360360    struct tm *tm_time = psTimeToTM(now);
     
    393393
    394394
    395 int test7( void )
    396 {
    397     int testStatus = 0;
     395psS32 test7( void )
     396{
     397    psS32 testStatus = 0;
    398398    // XXX: This test code is simply a copy of the original source code.
    399399    double phi = 62.6;
     
    426426}
    427427
    428 int test8( void )
    429 {
    430     int testStatus = 0;
     428psS32 test8( void )
     429{
     430    psS32 testStatus = 0;
    431431    // XXX: This test code is simply a copy of the original source code.
    432432    double phi = -62.6;
     
    459459}
    460460
    461 int test20( void )
    462 {
    463     int testStatus = 0;
     461psS32 test20( void )
     462{
     463    psS32 testStatus = 0;
    464464    psSphere in;
    465465    double R;
     
    553553
    554554#define SPACE_INC 10.0
    555 int test21( void )
    556 {
    557     int testStatus = 0;
     555psS32 test21( void )
     556{
     557    psS32 testStatus = 0;
    558558    psPlane in;
    559559    double R;
     
    649649}
    650650
    651 int test40( void )
    652 {
    653     int testStatus = 0;
     651psS32 test40( void )
     652{
     653    psS32 testStatus = 0;
    654654    psSphere position1;
    655655    psSphere position2;
     
    714714}
    715715
    716 int test41( void )
    717 {
    718     int testStatus = 0;
     716psS32 test41( void )
     717{
     718    psS32 testStatus = 0;
    719719    psSphere position1;
    720720    psSphere *position2;
  • trunk/psLib/test/astronomy/tst_psMetadataIO.c

    r1986 r2204  
    1313*  @author  Ross Harman, MHPCC
    1414*
    15 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    16 *  @date  $Date: 2004-10-06 22:51:31 $
     15*  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     16*  @date  $Date: 2004-10-27 00:57:31 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8080        vec = (psVector*)metadataItem->data.V;
    8181        printf("Key Value: ");
    82         for(int i=0; i<vec->nalloc;i++) {
     82        for(psS32 i=0; i<vec->nalloc;i++) {
    8383            printf("%d ", vec->data.S32[i]);
    8484        }
     
    103103static void printMetadataTable(psHash *mdTable)
    104104{
    105     int i;
     105    psS32 i;
    106106    psHashBucket* ptr = NULL;
    107107    for(i=0; i<mdTable->nbucket; i++) {
     
    123123
    124124
    125 int main(int argc, char* argv[])
     125psS32 main(psS32 argc, char* argv[])
    126126{
    127127    // Test A - Read config file with overwrite set true
    128128    printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true");
    129129    psMetadata *metadata1 = NULL;
    130     int failedLines1 = 0;
     130    psS32 failedLines1 = 0;
    131131    failedLines1 = psMetadataParseConfig(&metadata1, "test.config", true);
    132132    printf("Failed lines: %d Expected: 6\n", failedLines1);
     
    138138    printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false");
    139139    psMetadata *metadata2 = NULL;
    140     int failedLines2 = 0;
     140    psS32 failedLines2 = 0;
    141141    failedLines2 = psMetadataParseConfig(&metadata2, "test.config", false);
    142142    printf("Failed lines: %d Expected: 7", failedLines2);
     
    148148    printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata");
    149149    psMetadata *metadata3 = psMetadataAlloc();
    150     int failedLines3 = 0;
     150    psS32 failedLines3 = 0;
    151151    failedLines3 = psMetadataParseConfig(&metadata3, "test.config", false);
    152152    printf("Failed lines: %d Expected: 7", failedLines3);
     
    176176    psMemCheckLeaks(0, NULL, stdout);
    177177    psMemCheckCorruption(0);
    178     int nBad = psMemCheckCorruption(0);
     178    psS32 nBad = psMemCheckCorruption(0);
    179179    if(nBad) {
    180180        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psMetadata_01.c

    r2153 r2204  
    1717*  @author  Ross Harman, MHPCC
    1818*
    19 *  @version $Revision: 1.12 $  $Name: not supported by cvs2svn $
    20 *  @date  $Date: 2004-10-15 19:26:31 $
     19*  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
     20*  @date  $Date: 2004-10-27 00:57:33 $
    2121*
    2222*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9696static void printMetadataTable(psHash *mdTable)
    9797{
    98     int i;
     98    psS32 i;
    9999    psHashBucket* ptr = NULL;
    100100    for(i=0; i<mdTable->nbucket; i++) {
     
    116116
    117117
    118 int main(int argc, char* argv[])
     118psS32 main(psS32 argc, char* argv[])
    119119{
    120120    psMetadata *metadata1 = NULL;
     
    262262    psMemCheckLeaks(0, NULL, stdout);
    263263    psMemCheckCorruption(0);
    264     int nBad = psMemCheckCorruption(0);
     264    psS32 nBad = psMemCheckCorruption(0);
    265265    if(nBad) {
    266266        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psMetadata_02.c

    r2012 r2204  
    1414*  @author  Ross Harman, MHPCC
    1515*
    16 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    17 *  @date  $Date: 2004-10-07 22:31:31 $
     16*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     17*  @date  $Date: 2004-10-27 00:57:33 $
    1818*
    1919*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161
    62 int main( int argc, char* argv[] )
     62psS32 main( psS32 argc, char* argv[] )
    6363{
    6464    psMetadataItem *item1 = NULL;
     
    136136    psMemCheckLeaks(0, NULL, stdout);
    137137    psMemCheckCorruption(0);
    138     int nBad = psMemCheckCorruption(0);
     138    psS32 nBad = psMemCheckCorruption(0);
    139139    if(nBad) {
    140140        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psMetadata_03.c

    r2018 r2204  
    1414*  @author  Ross Harman, MHPCC
    1515*
    16 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    17 *  @date  $Date: 2004-10-08 01:33:14 $
     16*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     17*  @date  $Date: 2004-10-27 00:57:33 $
    1818*
    1919*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161
    62 int main( int argc, char* argv[] )
     62psS32 main( psS32 argc, char* argv[] )
    6363{
    6464    psMetadataItem *item1 = NULL;
     
    231231    }
    232232    psMemCheckCorruption(0);
    233     int nBad = psMemCheckCorruption(0);
     233    psS32 nBad = psMemCheckCorruption(0);
    234234    if(nBad) {
    235235        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psMetadata_04.c

    r2023 r2204  
    1818*  @author  Ross Harman, MHPCC
    1919*
    20 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    21 *  @date  $Date: 2004-10-08 20:53:21 $
     20*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     21*  @date  $Date: 2004-10-27 00:57:33 $
    2222*
    2323*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464
    6565
    66 int main( int argc, char* argv[] )
     66psS32 main( psS32 argc, char* argv[] )
    6767{
    6868    psMetadataItem *item1 = NULL;
     
    201201    }
    202202    psMemCheckCorruption(0);
    203     int nBad = psMemCheckCorruption(0);
     203    psS32 nBad = psMemCheckCorruption(0);
    204204    if(nBad) {
    205205        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psMetadata_05.c

    r2049 r2204  
    2222*  @author  Ross Harman, MHPCC
    2323*
    24 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    25 *  @date  $Date: 2004-10-12 01:40:32 $
     24*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     25*  @date  $Date: 2004-10-27 00:57:33 $
    2626*
    2727*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6868
    6969
    70 int main( int argc, char* argv[] )
     70psS32 main( psS32 argc, char* argv[] )
    7171{
    72     long data;
     72    psS64 data;
    7373    psF32 fpdata;
    7474    psMetadataItem *item1 = NULL;
     
    271271    }
    272272    psMemCheckCorruption(0);
    273     int nBad = psMemCheckCorruption(0);
     273    psS32 nBad = psMemCheckCorruption(0);
    274274    if(nBad) {
    275275        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psMetadata_06.c

    r2050 r2204  
    1313*  @author  Ross Harman, MHPCC
    1414*
    15 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    16 *  @date  $Date: 2004-10-12 01:54:00 $
     15*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     16*  @date  $Date: 2004-10-27 00:57:33 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959
    6060
    61 int main( int argc, char* argv[] )
     61psS32 main( psS32 argc, char* argv[] )
    6262{
    6363    psMetadataItem *item1a = NULL;
     
    134134    }
    135135    psMemCheckCorruption(0);
    136     int nBad = psMemCheckCorruption(0);
     136    psS32 nBad = psMemCheckCorruption(0);
    137137    if(nBad) {
    138138        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psTime_01.c

    r2048 r2204  
    2323 *  @author  Ross Harman, MHPCC
    2424 *
    25  *  @version $Revision: 1.12 $  $Name: not supported by cvs2svn $
    26  *  @date  $Date: 2004-10-12 01:34:09 $
     25 *  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
     26 *  @date  $Date: 2004-10-27 00:57:33 $
    2727 *
    2828 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434#include <string.h>
    3535
    36 int main(int argc, char* argv[])
     36psS32 main(psS32 argc, char* argv[])
    3737{
    3838    psTime *testTime;
     
    5555    // Test B - Print test time
    5656    printPositiveTestHeader(stdout,"psTime", "Print test time");
    57     printf("Test time: Seconds = %ld Microseconds = %ld\n", (long)testTime->sec, (long)testTime->usec);
     57    printf("Test time: Seconds = %ld Microseconds = %ld\n", (psS64)testTime->sec, (psS64)testTime->usec);
    5858    printFooter(stdout, "psTime", "Print test time", true);
    5959
     
    7575    psTime *timeD = NULL;
    7676    timeD = psTimeFromISOTime(isoString);
    77     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeD->sec, (psU32)timeD->usec);
     77    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeD->sec, (psU32)timeD->usec);
    7878    psFree(isoString);
    7979    psFree(timeD);
     
    9090    timeE = psTimeConvert(timeE, PS_TIME_UTC);
    9191    psFree(timeE);
    92     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeE->sec, (psU32)timeE->usec);
     92    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeE->sec, (psU32)timeE->usec);
    9393    printFooter(stdout, "psTime", "Convert psTime time to UTC time", true);
    9494
     
    103103    timeF = psTimeConvert(timeF, PS_TIME_TAI);
    104104    psFree(timeF);
    105     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeF->sec, (psU32)timeF->usec);
     105    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeF->sec, (psU32)timeF->usec);
    106106    printFooter(stdout, "psTime", "Convert UTC time to psTime", true);
    107107
     
    119119    psTime *timeH = NULL;
    120120    timeH = psTimeFromMJD(mjdTime);
    121     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeH->sec, (psU32)timeH->usec);
     121    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeH->sec, (psU32)timeH->usec);
    122122    psFree(timeH);
    123123    printFooter(stdout, "psTime", "Convert MJD time to psTime", true);
     
    136136    psTime *timeJ = NULL;
    137137    timeJ = psTimeFromJD(jdTime);
    138     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeJ->sec, (psU32)timeJ->usec);
     138    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeJ->sec, (psU32)timeJ->usec);
    139139    psFree(timeJ);
    140140    printFooter(stdout, "psTime", "Convert JD time to psTime", true);
     
    145145    struct timeval timevalTime;
    146146    timevalTime = psTimeToTimeval(testTime);
    147     printf("timevalTime: Seconds = %ld Microseconds = %ld\n", (long)timevalTime.tv_sec, (long)timevalTime.tv_usec);
     147    printf("timevalTime: Seconds = %ld Microseconds = %ld\n", (psS64)timevalTime.tv_sec, (psS64)timevalTime.tv_usec);
    148148    printFooter(stdout, "psTime", "Convert psTime to timeval time", true);
    149149
     
    153153    psTime *timeL = NULL;
    154154    timeL = psTimeFromTimeval(&timevalTime);
    155     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeL->sec, (psU32)timeL->usec);
     155    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeL->sec, (psU32)timeL->usec);
    156156    psFree(timeL);
    157157    printFooter(stdout, "psTime", "Convert timeval time to psTime", true);
     
    176176    psTime *timeN = NULL;
    177177    timeN = psTimeFromTM(tmTime);
    178     printf("psTime: Seconds = %ld Microseconds = %d\n", (long)timeN->sec, (psU32)timeN->usec);
     178    printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeN->sec, (psU32)timeN->usec);
    179179    psFree(timeN);
    180180    psFree(tmTime);
     
    198198    psMemCheckLeaks(0, NULL, stdout);
    199199    psMemCheckCorruption(0);
    200     int nBad = psMemCheckCorruption(0);
     200    psS32 nBad = psMemCheckCorruption(0);
    201201    if(nBad) {
    202202        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psTime_02.c

    r2177 r2204  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-10-20 20:02:46 $
     12 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-10-27 00:57:33 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psTest.h"
    2121
    22 int main(int argc, char* argv[])
     22psS32 main(psS32 argc, char* argv[])
    2323{
    2424
     
    4444    psMemCheckLeaks(0, NULL, stdout);
    4545    psMemCheckCorruption(0);
    46     int nBad = psMemCheckCorruption(0);
     46    psS32 nBad = psMemCheckCorruption(0);
    4747    if(nBad) {
    4848        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/astronomy/tst_psTime_03.c

    r2177 r2204  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-10-20 20:03:10 $
     14 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-10-27 00:57:33 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323
    2424#define PRINT_TIME(TEXT,TIME) \
    25 printf("%s Seconds = %ld Microseconds = %u\n", TEXT, (long int)TIME->sec, TIME->usec);
     25printf("%s Seconds = %ld Microseconds = %u\n", TEXT, (psS64)TIME->sec, TIME->usec);
    2626
    27 int main(int argc, char* argv[])
     27psS32 main(psS32 argc, char* argv[])
    2828{
    2929
     
    135135    psMemCheckLeaks(0, NULL, stdout);
    136136    psMemCheckCorruption(0);
    137     int nBad = psMemCheckCorruption(0);
     137    psS32 nBad = psMemCheckCorruption(0);
    138138    if(nBad) {
    139139        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psArray.c

    r1920 r2204  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-09-28 23:26:49 $
     14 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-10-27 00:57:33 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626typedef struct
    2727{
    28     int x;
     28    psS32 x;
    2929    float y;
    3030}
     
    3232
    3333
    34 int main(int argc,
    35          char* argv[])
     34psS32 main(psS32 argc,
     35           char* argv[])
    3636{
    3737    // Create array of pointers
     
    5151    // Test B - Add data to void pointer array
    5252    printPositiveTestHeader(stdout, "psArray", "Add data to void pointer array");
    53     for(int i = 0; i < 5; i++) {
     53    for(psS32 i = 0; i < 5; i++) {
    5454        testStruct *ts = psAlloc(sizeof(testStruct));
    5555        ts->x = 10*i;
     
    6060    }
    6161
    62     for(int i = 0; i < 5; i++) {
     62    for(psS32 i = 0; i < 5; i++) {
    6363        testStruct *ts = (testStruct*)psArr->data[i];
    6464        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
     
    8585    psArr = psArrayRealloc(psArr,10);
    8686    printf("Adding more elements to void pointer array...\n");
    87     for(int i = 5; i < 10; i++) {
     87    for(psS32 i = 5; i < 10; i++) {
    8888        testStruct *ts = psAlloc(sizeof(testStruct));
    8989        ts->x = 10*i;
     
    9494        psMemIncrRefCounter(ts);
    9595    }
    96     for(int i = 0; i < 10; i++) {
     96    for(psS32 i = 0; i < 10; i++) {
    9797        testStruct *ts = (testStruct*)psArr->data[i];
    9898        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
     
    118118    printPositiveTestHeader(stdout,"psArray","Reallocate void pointer array smaller");
    119119    psArr = psArrayRealloc(psArr,3);
    120     for(int i = 0; i < 3; i++) {
     120    for(psS32 i = 0; i < 3; i++) {
    121121        testStruct *ts = (testStruct*)psArr->data[i];
    122122        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
     
    142142    printPositiveTestHeader(stdout, "psArray", "Free void pointer array");
    143143    psFree(psArr);
    144     for(int i = 0; i < 10; i++) {
     144    for(psS32 i = 0; i < 10; i++) {
    145145        psFree(mySt[i]);
    146146    }
    147147    psMemCheckLeaks(0, NULL, stdout);
    148     int nBad = psMemCheckCorruption(0);
     148    psS32 nBad = psMemCheckCorruption(0);
    149149    if(nBad) {
    150150        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psBitSet.c

    r1807 r2204  
    1717 *  @author  Ross Harman, MHPCC
    1818 *
    19  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    20  *  @date  $Date: 2004-09-14 20:01:52 $
     19 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     20 *  @date  $Date: 2004-10-27 00:57:33 $
    2121 *
    2222 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psTest.h"
    2828
    29 static int testBitSet01a(void);
    30 static int testBitSet01b(void);
    31 static int testBitSet01c(void);
    32 static int testBitSet02(void);
    33 static int testBitSet03(void);
    34 static int testBitSet04(void);
    35 static int testBitSet05(void);
    36 static int testBitSet06(void);
     29static psS32 testBitSet01a(void);
     30static psS32 testBitSet01b(void);
     31static psS32 testBitSet01c(void);
     32static psS32 testBitSet02(void);
     33static psS32 testBitSet03(void);
     34static psS32 testBitSet04(void);
     35static psS32 testBitSet05(void);
     36static psS32 testBitSet06(void);
    3737
    3838testDescription tests[] = {
     
    5050
    5151
    52 int main( int argc, char* argv[] )
     52psS32 main( psS32 argc, char* argv[] )
    5353{
    5454    psLogSetLevel( PS_LOG_INFO );
     
    5757}
    5858
    59 int testBitSet01a(void)
     59psS32 testBitSet01a(void)
    6060{
    6161    psErr* err;
     
    109109}
    110110
    111 int testBitSet01b(void)
     111psS32 testBitSet01b(void)
    112112{
    113113    char *binOut = NULL;
     
    212212}
    213213
    214 static int testBitSet01c(void)
     214static psS32 testBitSet01c(void)
    215215{
    216216    psBitSet* bs = psBitSetAlloc(24);
     
    275275}
    276276
    277 int testBitSet02()
     277psS32 testBitSet02()
    278278{
    279279    char *binOut1 = NULL;
     
    284284    psBitSet* bs2 = psBitSetAlloc(24);
    285285    psBitSet* and = psBitSetAlloc(24);
    286     for(int i=0; i<24; i++) {
     286    for(psS32 i=0; i<24; i++) {
    287287        if ((i & 2) == 0) {
    288288            bs1 = psBitSetSet(bs1, i);
     
    312312    }
    313313
    314     for(int i=0; i<24; i++) {
    315         bool truth = psBitSetTest(and,i);
    316         bool res = psBitSetTest(outbs,i);
     314    for(psS32 i=0; i<24; i++) {
     315        psBool truth = psBitSetTest(and,i);
     316        psBool res = psBitSetTest(outbs,i);
    317317        if ( res != truth) {
    318318            binOut1 = psBitSetToString(bs1);
     
    331331        psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result");
    332332    }
    333     for(int i=0; i<24; i++) {
    334         bool truth = psBitSetTest(and,i);
    335         bool res = psBitSetTest(outbs,i);
     333    for(psS32 i=0; i<24; i++) {
     334        psBool truth = psBitSetTest(and,i);
     335        psBool res = psBitSetTest(outbs,i);
    336336        if ( res != truth) {
    337337            binOut1 = psBitSetToString(bs1);
     
    351351}
    352352
    353 static int testBitSet03(void)
     353static psS32 testBitSet03(void)
    354354{
    355355    char *binOut1 = NULL;
     
    360360    psBitSet* bs2 = psBitSetAlloc(24);
    361361    psBitSet* or = psBitSetAlloc(24);
    362     for(int i=0; i<24; i++) {
     362    for(psS32 i=0; i<24; i++) {
    363363        if ((i/2) % 2) {
    364364            bs1 = psBitSetSet(bs1, i);
     
    389389    }
    390390
    391     for(int i=0; i<24; i++) {
    392         bool truth = psBitSetTest(or,i);
    393         bool res = psBitSetTest(outbs,i);
     391    for(psS32 i=0; i<24; i++) {
     392        psBool truth = psBitSetTest(or,i);
     393        psBool res = psBitSetTest(outbs,i);
    394394        if ( res != truth) {
    395395            binOut1 = psBitSetToString(bs1);
     
    408408        psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result");
    409409    }
    410     for(int i=0; i<24; i++) {
    411         bool truth = psBitSetTest(or,i);
    412         bool res = psBitSetTest(outbs,i);
     410    for(psS32 i=0; i<24; i++) {
     411        psBool truth = psBitSetTest(or,i);
     412        psBool res = psBitSetTest(outbs,i);
    413413        if ( res != truth) {
    414414            binOut1 = psBitSetToString(bs1);
     
    429429}
    430430
    431 static int testBitSet04(void)
     431static psS32 testBitSet04(void)
    432432{
    433433    char *binOut1 = NULL;
     
    438438    psBitSet* bs2 = psBitSetAlloc(24);
    439439    psBitSet* xor = psBitSetAlloc(24);
    440     for(int i=0; i<24; i++) {
     440    for(psS32 i=0; i<24; i++) {
    441441        if ((i/2) % 2) {
    442442            bs1 = psBitSetSet(bs1, i);
     
    467467    }
    468468
    469     for(int i=0; i<24; i++) {
    470         bool truth = psBitSetTest(xor,i);
    471         bool res = psBitSetTest(outbs,i);
     469    for(psS32 i=0; i<24; i++) {
     470        psBool truth = psBitSetTest(xor,i);
     471        psBool res = psBitSetTest(outbs,i);
    472472        if ( res != truth) {
    473473            binOut1 = psBitSetToString(bs1);
     
    486486        psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result");
    487487    }
    488     for(int i=0; i<24; i++) {
    489         bool truth = psBitSetTest(xor,i);
    490         bool res = psBitSetTest(outbs,i);
     488    for(psS32 i=0; i<24; i++) {
     489        psBool truth = psBitSetTest(xor,i);
     490        psBool res = psBitSetTest(outbs,i);
    491491        if ( res != truth) {
    492492            binOut1 = psBitSetToString(bs1);
     
    507507}
    508508
    509 static int testBitSet05(void)
     509static psS32 testBitSet05(void)
    510510{
    511511    char *binOut1 = NULL;
     
    514514    psBitSet* bs1 = psBitSetAlloc(24);
    515515    psBitSet* not = psBitSetAlloc(24);
    516     for(int i=0; i<24; i++) {
     516    for(psS32 i=0; i<24; i++) {
    517517        if (i % 2) {
    518518            bs1 = psBitSetSet(bs1, i);
     
    538538    }
    539539
    540     for(int i=0; i<24; i++) {
    541         bool truth = psBitSetTest(not,i);
    542         bool res = psBitSetTest(outbs,i);
     540    for(psS32 i=0; i<24; i++) {
     541        psBool truth = psBitSetTest(not,i);
     542        psBool res = psBitSetTest(outbs,i);
    543543        if ( res != truth) {
    544544            binOut1 = psBitSetToString(bs1);
     
    556556        psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result");
    557557    }
    558     for(int i=0; i<24; i++) {
    559         bool truth = psBitSetTest(not,i);
    560         bool res = psBitSetTest(outbs,i);
     558    for(psS32 i=0; i<24; i++) {
     559        psBool truth = psBitSetTest(not,i);
     560        psBool res = psBitSetTest(outbs,i);
    561561        if ( res != truth) {
    562562            binOut1 = psBitSetToString(bs1);
     
    575575}
    576576
    577 static int testBitSet06(void)
     577static psS32 testBitSet06(void)
    578578{
    579579    psErr* err;
  • trunk/psLib/test/collections/tst_psHash00.c

    r1421 r2204  
    88#include "psHash.h"
    99#define NUM_HASH_TABLE_BUCKETS 10
    10 int main()
     10psS32 main()
    1111{
    1212    psHash *myHashTable = NULL;
    13     int testStatus      = true;
    14     int i               = 0;
    15     int currentId = psMemGetId();
    16     int memLeaks        = 0;
     13    psS32 testStatus      = true;
     14    psS32 i               = 0;
     15    psS32 currentId = psMemGetId();
     16    psS32 memLeaks        = 0;
    1717    printPositiveTestHeader(stdout,
    1818                            "psHash functions",
  • trunk/psLib/test/collections/tst_psHash01.c

    r1811 r2204  
    77#include "psHash.h"
    88#define NUM_HASH_TABLE_BUCKETS 100
    9 int imGlobal = 0;
     9psS32 imGlobal = 0;
    1010
    1111typedef struct
     
    3232}
    3333
    34 int main()
     34psS32 main()
    3535{
    3636    psHash *myHashTable = NULL;
    37     int testStatus      = true;
    38     int currentId = psMemGetId();
     37    psS32 testStatus      = true;
     38    psS32 currentId = psMemGetId();
    3939    ID* id = NULL;
    40     int memLeaks        = 0;
     40    psS32 memLeaks        = 0;
    4141
    4242    printPositiveTestHeader(stdout,
  • trunk/psLib/test/collections/tst_psHash02.c

    r1421 r2204  
    1212#include "psHash.h"
    1313#define NUM_HASH_TABLE_BUCKETS 100
    14 int imGlobal = 0;
     14psS32 imGlobal = 0;
    1515
    1616typedef struct
     
    3636}
    3737
    38 int main()
     38psS32 main()
    3939{
    4040    psHash *myHashTable = NULL;
    41     int testStatus      = true;
    42     int i               = 0;
     41    psS32 testStatus      = true;
     42    psS32 i               = 0;
    4343    ID *id = NULL;
    4444    char *myKeys[] = {"ENTRY00", "ENTRY01", "ENTRY02", "ENTRY03", NULL
     
    4646    char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL
    4747                     };
    48     int currentId = psMemGetId();
    49     int memLeaks        = 0;
     48    psS32 currentId = psMemGetId();
     49    psS32 memLeaks        = 0;
    5050
    5151    printPositiveTestHeader(stdout,
  • trunk/psLib/test/collections/tst_psHash03.c

    r1811 r2204  
    1111#include "psMemory.h"
    1212#define NUM_HASH_TABLE_BUCKETS 100
    13 int imGlobal = 0;
    14 int currentId = 0;
     13psS32 imGlobal = 0;
     14psS32 currentId = 0;
    1515
    1616typedef struct
     
    2727    psMemBlock **memBlocks = NULL;
    2828    psMemBlock *tmp = NULL;
    29     int numBlocks = 0;
     29    psS32 numBlocks = 0;
    3030
    3131    numBlocks = psMemCheckLeaks(currentId, &memBlocks, NULL);
     
    3636    if (memBlocks != NULL) {
    3737        for (tmp = *memBlocks; tmp != NULL; tmp = tmp->nextBlock) {
    38             printf("%d ", (int) tmp->id);
     38            printf("%d ", (psS32) tmp->id);
    3939        }
    4040    }
     
    6262}
    6363
    64 int main()
     64psS32 main()
    6565{
    6666    psHash *myHashTable = NULL;
    67     int testStatus      = true;
    68     int i               = 0;
    69     int TotalKeys       = 0;
    70     bool retVal         = false;
     67    psS32 testStatus      = true;
     68    psS32 i               = 0;
     69    psS32 TotalKeys       = 0;
     70    psBool retVal         = false;
    7171    ID *id = NULL;
    7272    ID *ids[4];
     
    7575    char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL
    7676                     };
    77     int memLeaks        = 0;
     77    psS32 memLeaks        = 0;
    7878
    7979    currentId = psMemGetId();
  • trunk/psLib/test/collections/tst_psHash04.c

    r1421 r2204  
    77#include "psHash.h"
    88#define NUM_HASH_TABLE_BUCKETS 100
    9 int imGlobal = 0;
     9psS32 imGlobal = 0;
    1010
    1111typedef struct
     
    3232}
    3333
    34 int main()
     34psS32 main()
    3535{
    3636    psHash *myHashTable = NULL;
    37     int testStatus      = true;
    38     int i               = 0;
     37    psS32 testStatus      = true;
     38    psS32 i               = 0;
    3939    char *myKeys[] = {"ENTRY00", "ENTRY01", "ENTRY02", "ENTRY03", NULL
    4040                     };
    4141    char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL
    4242                     };
    43     int currentId = psMemGetId();
    44     int memLeaks        = 0;
     43    psS32 currentId = psMemGetId();
     44    psS32 memLeaks        = 0;
    4545    psList *myLinkList = NULL;
    4646    psListElem *tmp = NULL;
  • trunk/psLib/test/collections/tst_psList.c

    r1749 r2204  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-09 02:24:59 $
     8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:33 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818
    1919
    20 static int testListAlloc(void);
    21 static int testListAdd(void);
    22 static int testListGet(void);
    23 static int testListRemove(void);
    24 static int testListConvert(void);
    25 static int testListIterator(void);
    26 static int testListFree(void);
    27 static int testListSort(void);
     20static psS32 testListAlloc(void);
     21static psS32 testListAdd(void);
     22static psS32 testListGet(void);
     23static psS32 testListRemove(void);
     24static psS32 testListConvert(void);
     25static psS32 testListIterator(void);
     26static psS32 testListFree(void);
     27static psS32 testListSort(void);
    2828
    2929testDescription tests[] = {
     
    3939                          };
    4040
    41 int main(int argc, char* argv[])
     41psS32 main(psS32 argc, char* argv[])
    4242{
    4343    psLogSetLevel(PS_LOG_INFO);
     
    5050}
    5151
    52 int testListAlloc(void)
     52psS32 testListAlloc(void)
    5353{
    5454    psList* list;
    55     int ref;
     55    psS32 ref;
    5656    float* data;
    5757
     
    117117}
    118118
    119 int testListAdd(void)
     119psS32 testListAdd(void)
    120120{
    121121    psList* list = NULL;
    122     int* data = NULL;
     122    psS32* data = NULL;
    123123
    124124    psLogMsg(__func__,PS_LOG_INFO,"psListAdd shall add an element to list");
     
    134134    */
    135135
    136     data = psAlloc(sizeof(int));
     136    data = psAlloc(sizeof(psS32));
    137137    *data = 1;
    138138
     
    161161
    162162    //  3. where is PS_LIST_HEAD or PS_LIST_TAIL
    163     data = psAlloc(sizeof(int));
     163    data = psAlloc(sizeof(psS32));
    164164    *data = 2;
    165165    if ( ! psListAdd(list,PS_LIST_HEAD,data) ) {
     
    181181
    182182    // verify that the head is the inserted data item
    183     if (*(int*)list->head->data != 2) {
     183    if (*(psS32*)list->head->data != 2) {
    184184        psError(__func__,"psListAdd with PS_LIST_HEAD didn't insert at the head.");
    185185        return 5;
    186186    }
    187187
    188     data = psAlloc(sizeof(int));
     188    data = psAlloc(sizeof(psS32));
    189189    *data = 3;
    190190    if ( ! psListAdd(list,PS_LIST_TAIL,data) ) {
     
    205205
    206206    // verify that the head is still the same
    207     if (*(int*)list->head->data != 2) {
     207    if (*(psS32*)list->head->data != 2) {
    208208        psError(__func__,"psListAdd with PS_LIST_TAIL modified the head.");
    209209        return 7;
     
    211211
    212212    // verify that the tail is the data item inserted
    213     if (*(int*)list->tail->data != 3) {
     213    if (*(psS32*)list->tail->data != 3) {
    214214        psError(__func__,"psListAdd with PS_LIST_TAIL didn't insert at the tail.");
    215215        return 8;
     
    218218    // 4. where is not PS_LIST_* but <0
    219219
    220     data = psAlloc(sizeof(int));
     220    data = psAlloc(sizeof(psS32));
    221221    *data = 4;
    222222    psLogMsg(__func__,PS_LOG_INFO,"Following should error with invalid insert location");
     
    239239
    240240    // 5. where is >0
    241     data = psAlloc(sizeof(int));
     241    data = psAlloc(sizeof(psS32));
    242242    *data = 5;
    243243
     
    253253    psFree(data);
    254254    // verify that the size incremented
    255     if (list->size != 4 || *(int*)list->head->next->data != 5) {
     255    if (list->size != 4 || *(psS32*)list->head->next->data != 5) {
    256256        printListInt(list);
    257257        psError(__func__,"psListAdd didn't insert to position #1.");
     
    259259    }
    260260
    261     data = psAlloc(sizeof(int));
     261    data = psAlloc(sizeof(psS32));
    262262    *data = 6;
    263263    if ( ! psListAdd(list,3,data) ) {
     
    271271    psFree(data);
    272272    // verify that the size incremented
    273     if (list->size != 5  || *(int *)list->head->next->next->next->data != 6) {
     273    if (list->size != 5  || *(psS32 *)list->head->next->next->next->data != 6) {
    274274        printListInt(list);
    275275        psError(__func__,"psListAdd didn't insert to position #4.");
     
    277277    }
    278278
    279     data = psAlloc(sizeof(int));
     279    data = psAlloc(sizeof(psS32));
    280280    *data = 7;
    281281    if ( ! psListAdd(list,2,data) ) {
     
    289289    psFree(data);
    290290    // verify that the size incremented
    291     if (list->size != 6  || *(int *)list->head->next->next->data != 7) {
     291    if (list->size != 6  || *(psS32 *)list->head->next->next->data != 7) {
    292292        printListInt(list);
    293293        psError(__func__,"psListAdd didn't insert to position #2.");
     
    295295    }
    296296
    297     data = psAlloc(sizeof(int));
     297    data = psAlloc(sizeof(psS32));
    298298    *data = 7;
    299299    psLogMsg(__func__,PS_LOG_INFO,"Following should be a warning.");
     
    325325void printListInt(psList* list)
    326326{
    327     int* data = NULL;
    328     bool first = true;
     327    psS32* data = NULL;
     328    psBool first = true;
    329329
    330330    psListSetIterator(list,PS_LIST_HEAD);
     
    333333    while ( data != NULL ) {
    334334        if (!first) {
    335             printf(", %d",*(int*)data);
     335            printf(", %d",*(psS32*)data);
    336336        } else {
    337             printf("%d",*(int*)data);
     337            printf("%d",*(psS32*)data);
    338338            first = false;
    339339        }
     
    345345
    346346
    347 int testListGet(void)
     347psS32 testListGet(void)
    348348{
    349349    psList* list = NULL;
    350     int* data;
     350    psS32* data;
    351351
    352352    /*
     
    371371
    372372    // create a list
    373     data = psAlloc(sizeof(int));
     373    data = psAlloc(sizeof(psS32));
    374374    *data = 0;
    375375    list = psListAlloc(data);
    376376    psFree(data);
    377377
    378     data = psAlloc(sizeof(int));
     378    data = psAlloc(sizeof(psS32));
    379379    *data = 1;
    380380    psListAdd(list,PS_LIST_TAIL,data);
    381381    psFree(data);
    382382
    383     data = psAlloc(sizeof(int));
     383    data = psAlloc(sizeof(psS32));
    384384    *data = 2;
    385385    psListAdd(list,PS_LIST_TAIL,data);
    386386    psFree(data);
    387387
    388     data = psAlloc(sizeof(int));
     388    data = psAlloc(sizeof(psS32));
    389389    *data = 3;
    390390    psListAdd(list,PS_LIST_TAIL,data);
     
    392392
    393393    //  2. which>0 and which<list.n.
    394     data = (int*)psListGet(list,3);
     394    data = (psS32*)psListGet(list,3);
    395395    if (data == NULL || *data != 3) {
    396396        psError(__func__,"psListGet failed with which=3");
    397397        return 2;
    398398    }
    399     data = (int*)psListGet(list,1);
     399    data = (psS32*)psListGet(list,1);
    400400    if (data == NULL || *data != 1) {
    401401        psError(__func__,"psListGet failed with which=1");
     
    404404
    405405    //  3. which>=list.n.
    406     data = (int*)psListGet(list,5);
     406    data = (psS32*)psListGet(list,5);
    407407    if (data != NULL) {
    408408        psError(__func__,"psListGet failed with which=5");
    409409        return 4;
    410410    }
    411     data = (int*)psListGet(list,4);
     411    data = (psS32*)psListGet(list,4);
    412412    if (data != NULL) {
    413413        psError(__func__,"psListGet failed with which=4");
     
    416416
    417417    //  4. which=PS_LIST_HEAD
    418     data = (int*)psListGet(list,PS_LIST_HEAD);
     418    data = (psS32*)psListGet(list,PS_LIST_HEAD);
    419419    if (data == NULL || *data != 0) {
    420420        psError(__func__,"psListGet failed with which=PS_LIST_HEAD");
     
    423423
    424424    //  5. which=PS_LIST_NEXT
    425     data = (int*)psListGet(list,PS_LIST_NEXT);
     425    data = (psS32*)psListGet(list,PS_LIST_NEXT);
    426426    if (data == NULL || *data != 1) {
    427427        psError(__func__,"psListGet failed with which=PS_LIST_NEXT");
     
    430430
    431431    //  6. which=PS_LIST_TAIL
    432     data = (int*)psListGet(list,PS_LIST_TAIL);
     432    data = (psS32*)psListGet(list,PS_LIST_TAIL);
    433433    if (data == NULL || *data != 3) {
    434434        psError(__func__,"psListGet failed with which=PS_LIST_TAIL");
     
    437437
    438438    //  7. which=PS_LIST_PREV
    439     data = (int*)psListGet(list,PS_LIST_PREVIOUS);
     439    data = (psS32*)psListGet(list,PS_LIST_PREVIOUS);
    440440    if (data == NULL || *data != 2) {
    441441        psError(__func__,"psListGet failed with which=PS_LIST_PREV");
     
    448448}
    449449
    450 int testListRemove(void)
     450psS32 testListRemove(void)
    451451{
    452452    psList* list = NULL;
    453     int* data;
     453    psS32* data;
    454454
    455455    /*
     
    480480    list = psListAlloc(NULL);
    481481
    482     for (int lcv=0;lcv<15;lcv++) {
    483         data = psAlloc(sizeof(int));
     482    for (psS32 lcv=0;lcv<15;lcv++) {
     483        data = psAlloc(sizeof(psS32));
    484484        *data = lcv;
    485485        psListAdd(list,PS_LIST_TAIL,data);
     
    682682}
    683683
    684 int testListConvert(void)
     684psS32 testListConvert(void)
    685685{
    686686
    687687    psList* list = NULL;
    688688    psArray* arr = NULL;
    689     int* data;
     689    psS32* data;
    690690
    691691    /*
    692692        array=psListToArray(list) shall take each element of the list, increment
    693         their reference, and insert them into the returned fresh void* array.
     693        their reference, and insert them into the returned fresh psPtr array.
    694694        The list shall not be changed, except for the element reference increment.
    695695    */
     
    699699    // create a list
    700700    list = psListAlloc(NULL);
    701     for (int lcv=0;lcv<15;lcv++) {
    702         data = psAlloc(sizeof(int));
     701    for (psS32 lcv=0;lcv<15;lcv++) {
     702        data = psAlloc(sizeof(psS32));
    703703        *data = lcv;
    704704        psListAdd(list,PS_LIST_TAIL,data);
     
    712712        return 1;
    713713    }
    714     for (int i=0;i<arr->n;i++) {
    715         if (i != *(int*)arr->data[i]) {
     714    for (psS32 i=0;i<arr->n;i++) {
     715        if (i != *(psS32*)arr->data[i]) {
    716716            psError(__func__,"Element %d of array is incorrect (%d).",
    717                     i,*(int*)arr->data[i]);
     717                    i,*(psS32*)arr->data[i]);
    718718            return 1;
    719719        }
    720         if (i != *(int*)psListGet(list,i)) {
     720        if (i != *(psS32*)psListGet(list,i)) {
    721721            psError(__func__,"Element %d of list is incorrect (%d).",
    722                     i,*(int*)arr->data[i]);
     722                    i,*(psS32*)arr->data[i]);
    723723            return 1;
    724724        }
     
    738738    arr = psArrayAlloc(15);
    739739    arr->n = arr->nalloc;
    740     for (int lcv=0;lcv<15;lcv++) {
    741         data = psAlloc(sizeof(int));
     740    for (psS32 lcv=0;lcv<15;lcv++) {
     741        data = psAlloc(sizeof(psS32));
    742742        *data = lcv;
    743743        arr->data[lcv] = data;
     
    750750        return 1;
    751751    }
    752     for (int i=0;i<arr->n;i++) {
    753         if (i != *(int*)arr->data[i]) {
     752    for (psS32 i=0;i<arr->n;i++) {
     753        if (i != *(psS32*)arr->data[i]) {
    754754            psError(__func__,"Element %d of array is incorrect (%d).",
    755                     i,*(int*)arr->data[i]);
     755                    i,*(psS32*)arr->data[i]);
    756756            return 1;
    757757        }
    758         if (i != *(int*)psListGet(list,i)) {
     758        if (i != *(psS32*)psListGet(list,i)) {
    759759            psError(__func__,"Element %d of list is incorrect (%d).",
    760                     i,*(int*)arr->data[i]);
     760                    i,*(psS32*)arr->data[i]);
    761761            return 1;
    762762        }
     
    810810}
    811811
    812 int testListIterator(void)
     812psS32 testListIterator(void)
    813813{
    814814    psList* list = NULL;
    815     int* data;
     815    psS32* data;
    816816
    817817    psLogMsg(__func__,PS_LOG_INFO," psListSetIterator/psListGetNext/psListGetPrev"
     
    837837    // create a list
    838838    list = psListAlloc(NULL);
    839     for (int lcv=0;lcv<15;lcv++) {
    840         data = psAlloc(sizeof(int));
     839    for (psS32 lcv=0;lcv<15;lcv++) {
     840        data = psAlloc(sizeof(psS32));
    841841        *data = lcv;
    842842        psListAdd(list,PS_LIST_TAIL,data);
     
    852852    // 3. set list.cursor to list.tail if where=PS_LIST_TAIL
    853853    psListSetIterator(list,PS_LIST_TAIL);
    854     if (*(int*)psListGetCurrent(list) != 14) {
     854    if (*(psS32*)psListGetCurrent(list) != 14) {
    855855        psError(__func__,"Didn't successfully move cursor to tail.");
    856856        return 1;
     
    859859    // 2. set list.cursor to list.head if where=PS_LIST_HEAD
    860860    psListSetIterator(list,PS_LIST_HEAD);
    861     if (*(int*)psListGetCurrent(list) != 0) {
     861    if (*(psS32*)psListGetCurrent(list) != 0) {
    862862        psError(__func__,"Didn't successfully move cursor to head.");
    863863        return 2;
     
    866866    // 4. set list.cursor to list.cursor->next if where=PS_LIST_NEXT
    867867    psListSetIterator(list,PS_LIST_NEXT);
    868     if (*(int*)psListGetCurrent(list) != 1) {
     868    if (*(psS32*)psListGetCurrent(list) != 1) {
    869869        psError(__func__,"Didn't successfully move cursor to next.");
    870870        return 3;
    871871    }
    872872    psListSetIterator(list,PS_LIST_NEXT);
    873     if (*(int*)psListGetCurrent(list) != 2) {
     873    if (*(psS32*)psListGetCurrent(list) != 2) {
    874874        psError(__func__,"Didn't successfully move cursor to next twice.");
    875875        return 4;
     
    878878    // 5. set list.cursor to list.cursor->prev if where=PS_LIST_PREV
    879879    psListSetIterator(list,PS_LIST_PREVIOUS);
    880     if (*(int*)psListGetCurrent(list) != 1) {
     880    if (*(psS32*)psListGetCurrent(list) != 1) {
    881881        psError(__func__,"Didn't successfully move cursor to previous.");
    882882        return 5;
    883883    }
    884884    psListSetIterator(list,PS_LIST_PREVIOUS);
    885     if (*(int*)psListGetCurrent(list) != 0) {
     885    if (*(psS32*)psListGetCurrent(list) != 0) {
    886886        psError(__func__,"Didn't successfully move cursor to previous twice.");
    887887        return 6;
     
    892892    psLogMsg(__func__,PS_LOG_INFO,"Following should error with 'Can't move to an unknown position.'");
    893893    psListSetIterator(list,PS_LIST_UNKNOWN);
    894     if (*(int*)psListGetCurrent(list) != 1) {
     894    if (*(psS32*)psListGetCurrent(list) != 1) {
    895895        psError(__func__,"PS_LIST_UNKNOWN moved cursor.");
    896896        return 7;
    897897    }
    898898    psListSetIterator(list,PS_LIST_CURRENT);
    899     if (*(int*)psListGetCurrent(list) != 1) {
     899    if (*(psS32*)psListGetCurrent(list) != 1) {
    900900        psError(__func__,"PS_LIST_CURRENT moved cursor.");
    901901        return 8;
     
    903903
    904904    // test psListGetPrevious/Next
    905     if (*(int*)psListGetNext(list) != 2) {
     905    if (*(psS32*)psListGetNext(list) != 2) {
    906906        psError(__func__,"psListGetNext didn't move cursor to next.");
    907907        return 9;
    908908    }
    909     if (*(int*)psListGetNext(list) != 3) {
     909    if (*(psS32*)psListGetNext(list) != 3) {
    910910        psError(__func__,"psListGetNext didn't move cursor to next.");
    911911        return 10;
    912912    }
    913     if (*(int*)psListGetPrevious(list) != 2) {
     913    if (*(psS32*)psListGetPrevious(list) != 2) {
    914914        psError(__func__,"psListGetPrevious didn't move cursor to previous.");
    915915        return 11;
    916916    }
    917     if (*(int*)psListGetPrevious(list) != 1) {
     917    if (*(psS32*)psListGetPrevious(list) != 1) {
    918918        psError(__func__,"psListGetPrevious didn't move cursor to previous.");
    919919        return 12;
    920920    }
    921     if (*(int*)psListGetPrevious(list) != 0) {
     921    if (*(psS32*)psListGetPrevious(list) != 0) {
    922922        psError(__func__,"psListGetPrevious didn't move cursor to previous..");
    923923        return 13;
     
    939939}
    940940
    941 int testListFree(void)
     941psS32 testListFree(void)
    942942{
    943943    float* data[15];
     
    954954
    955955    list = psListAlloc(NULL);
    956     for (int lcv=0;lcv<15;lcv++) {
    957         data[lcv] = psAlloc(sizeof(int));
     956    for (psS32 lcv=0;lcv<15;lcv++) {
     957        data[lcv] = psAlloc(sizeof(psS32));
    958958        *data[lcv] = lcv;
    959959        psListAdd(list,PS_LIST_TAIL,data[lcv]);
     
    987987    */
    988988
    989     for (int i=0;i<15;i++) {
     989    for (psS32 i=0;i<15;i++) {
    990990        if (psMemGetRefCounter(data[i]) != 1) {
    991991            psError(__func__,"pslistFree didn't decrement the data item's reference counter");
     
    998998}
    999999
    1000 int testListSort(void)
     1000psS32 testListSort(void)
    10011001{
    10021002    psList* list;
     
    10041004    list = psListAlloc(NULL);
    10051005
    1006     for (int lcv=0;lcv<15;lcv++) {
    1007         float* data = psAlloc(sizeof(int));
     1006    for (psS32 lcv=0;lcv<15;lcv++) {
     1007        float* data = psAlloc(sizeof(psS32));
    10081008        if (lcv < 7) {
    10091009            *data = 13-lcv*2;
     
    10701070    list = psListAlloc(NULL);
    10711071
    1072     for (int lcv=0;lcv<15;lcv++) {
    1073         psU32* data = psAlloc(sizeof(int));
     1072    for (psS32 lcv=0;lcv<15;lcv++) {
     1073        psU32* data = psAlloc(sizeof(psS32));
    10741074        if (lcv < 7) {
    10751075            *data = 13-lcv*2;
  • trunk/psLib/test/collections/tst_psMetadataIO.c

    r1986 r2204  
    1313*  @author  Ross Harman, MHPCC
    1414*
    15 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    16 *  @date  $Date: 2004-10-06 22:51:31 $
     15*  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     16*  @date  $Date: 2004-10-27 00:57:31 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8080        vec = (psVector*)metadataItem->data.V;
    8181        printf("Key Value: ");
    82         for(int i=0; i<vec->nalloc;i++) {
     82        for(psS32 i=0; i<vec->nalloc;i++) {
    8383            printf("%d ", vec->data.S32[i]);
    8484        }
     
    103103static void printMetadataTable(psHash *mdTable)
    104104{
    105     int i;
     105    psS32 i;
    106106    psHashBucket* ptr = NULL;
    107107    for(i=0; i<mdTable->nbucket; i++) {
     
    123123
    124124
    125 int main(int argc, char* argv[])
     125psS32 main(psS32 argc, char* argv[])
    126126{
    127127    // Test A - Read config file with overwrite set true
    128128    printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true");
    129129    psMetadata *metadata1 = NULL;
    130     int failedLines1 = 0;
     130    psS32 failedLines1 = 0;
    131131    failedLines1 = psMetadataParseConfig(&metadata1, "test.config", true);
    132132    printf("Failed lines: %d Expected: 6\n", failedLines1);
     
    138138    printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false");
    139139    psMetadata *metadata2 = NULL;
    140     int failedLines2 = 0;
     140    psS32 failedLines2 = 0;
    141141    failedLines2 = psMetadataParseConfig(&metadata2, "test.config", false);
    142142    printf("Failed lines: %d Expected: 7", failedLines2);
     
    148148    printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata");
    149149    psMetadata *metadata3 = psMetadataAlloc();
    150     int failedLines3 = 0;
     150    psS32 failedLines3 = 0;
    151151    failedLines3 = psMetadataParseConfig(&metadata3, "test.config", false);
    152152    printf("Failed lines: %d Expected: 7", failedLines3);
     
    176176    psMemCheckLeaks(0, NULL, stdout);
    177177    psMemCheckCorruption(0);
    178     int nBad = psMemCheckCorruption(0);
     178    psS32 nBad = psMemCheckCorruption(0);
    179179    if(nBad) {
    180180        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psMetadata_01.c

    r2153 r2204  
    1717*  @author  Ross Harman, MHPCC
    1818*
    19 *  @version $Revision: 1.12 $  $Name: not supported by cvs2svn $
    20 *  @date  $Date: 2004-10-15 19:26:31 $
     19*  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
     20*  @date  $Date: 2004-10-27 00:57:33 $
    2121*
    2222*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9696static void printMetadataTable(psHash *mdTable)
    9797{
    98     int i;
     98    psS32 i;
    9999    psHashBucket* ptr = NULL;
    100100    for(i=0; i<mdTable->nbucket; i++) {
     
    116116
    117117
    118 int main(int argc, char* argv[])
     118psS32 main(psS32 argc, char* argv[])
    119119{
    120120    psMetadata *metadata1 = NULL;
     
    262262    psMemCheckLeaks(0, NULL, stdout);
    263263    psMemCheckCorruption(0);
    264     int nBad = psMemCheckCorruption(0);
     264    psS32 nBad = psMemCheckCorruption(0);
    265265    if(nBad) {
    266266        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psMetadata_02.c

    r2012 r2204  
    1414*  @author  Ross Harman, MHPCC
    1515*
    16 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    17 *  @date  $Date: 2004-10-07 22:31:31 $
     16*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     17*  @date  $Date: 2004-10-27 00:57:33 $
    1818*
    1919*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161
    62 int main( int argc, char* argv[] )
     62psS32 main( psS32 argc, char* argv[] )
    6363{
    6464    psMetadataItem *item1 = NULL;
     
    136136    psMemCheckLeaks(0, NULL, stdout);
    137137    psMemCheckCorruption(0);
    138     int nBad = psMemCheckCorruption(0);
     138    psS32 nBad = psMemCheckCorruption(0);
    139139    if(nBad) {
    140140        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psMetadata_03.c

    r2018 r2204  
    1414*  @author  Ross Harman, MHPCC
    1515*
    16 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    17 *  @date  $Date: 2004-10-08 01:33:14 $
     16*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     17*  @date  $Date: 2004-10-27 00:57:33 $
    1818*
    1919*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161
    62 int main( int argc, char* argv[] )
     62psS32 main( psS32 argc, char* argv[] )
    6363{
    6464    psMetadataItem *item1 = NULL;
     
    231231    }
    232232    psMemCheckCorruption(0);
    233     int nBad = psMemCheckCorruption(0);
     233    psS32 nBad = psMemCheckCorruption(0);
    234234    if(nBad) {
    235235        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psMetadata_04.c

    r2023 r2204  
    1818*  @author  Ross Harman, MHPCC
    1919*
    20 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    21 *  @date  $Date: 2004-10-08 20:53:21 $
     20*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     21*  @date  $Date: 2004-10-27 00:57:33 $
    2222*
    2323*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6464
    6565
    66 int main( int argc, char* argv[] )
     66psS32 main( psS32 argc, char* argv[] )
    6767{
    6868    psMetadataItem *item1 = NULL;
     
    201201    }
    202202    psMemCheckCorruption(0);
    203     int nBad = psMemCheckCorruption(0);
     203    psS32 nBad = psMemCheckCorruption(0);
    204204    if(nBad) {
    205205        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psMetadata_05.c

    r2049 r2204  
    2222*  @author  Ross Harman, MHPCC
    2323*
    24 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    25 *  @date  $Date: 2004-10-12 01:40:32 $
     24*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     25*  @date  $Date: 2004-10-27 00:57:33 $
    2626*
    2727*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6868
    6969
    70 int main( int argc, char* argv[] )
     70psS32 main( psS32 argc, char* argv[] )
    7171{
    72     long data;
     72    psS64 data;
    7373    psF32 fpdata;
    7474    psMetadataItem *item1 = NULL;
     
    271271    }
    272272    psMemCheckCorruption(0);
    273     int nBad = psMemCheckCorruption(0);
     273    psS32 nBad = psMemCheckCorruption(0);
    274274    if(nBad) {
    275275        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psMetadata_06.c

    r2050 r2204  
    1313*  @author  Ross Harman, MHPCC
    1414*
    15 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    16 *  @date  $Date: 2004-10-12 01:54:00 $
     15*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     16*  @date  $Date: 2004-10-27 00:57:33 $
    1717*
    1818*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959
    6060
    61 int main( int argc, char* argv[] )
     61psS32 main( psS32 argc, char* argv[] )
    6262{
    6363    psMetadataItem *item1a = NULL;
     
    134134    }
    135135    psMemCheckCorruption(0);
    136     int nBad = psMemCheckCorruption(0);
     136    psS32 nBad = psMemCheckCorruption(0);
    137137    if(nBad) {
    138138        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psVector.c

    r1920 r2204  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2004-09-28 23:26:49 $
     16 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2004-10-27 00:57:33 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424#include "psTest.h"
    2525
    26 int main(int argc,
    27          char* argv[])
     26psS32 main(psS32 argc,
     27           char* argv[])
    2828{
    2929
     
    4040    // Test B - Add data to integer vector
    4141    printPositiveTestHeader(stdout, "psVector", "Add data to S32 vector");
    42     for(int i = 0; i < 5; i++) {
     42    for(psS32 i = 0; i < 5; i++) {
    4343        psVec->data.S32[i] = i*10;
    4444        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
     
    5353    psVec = psVectorRealloc(psVec,10);
    5454    printf("Adding more elements to S32 vector...\n");
    55     for(int i = 5; i < 10; i++) {
     55    for(psS32 i = 5; i < 10; i++) {
    5656        psVec->data.S32[i] = i*10;
    5757        psVec->n++;
     
    6767    psVec = psVectorRealloc(psVec,3);
    6868    printf("Vector size = %d\n", psVec->nalloc);
    69     for(int i = 0; i < 3; i++) {
     69    for(psS32 i = 0; i < 3; i++) {
    7070        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
    7171    }
     
    7878    printPositiveTestHeader(stdout, "psVector", "Free S32 vector");
    7979    psFree(psVec);
    80     int leaks = psMemCheckLeaks(0, NULL, stdout);
     80    psS32 leaks = psMemCheckLeaks(0, NULL, stdout);
    8181    if(leaks != 0) {
    8282        printf("ERROR: Found %d memory leaks\n",leaks);
    8383    }
    84     int nBad = psMemCheckCorruption(0);
     84    psS32 nBad = psMemCheckCorruption(0);
    8585    if(nBad) {
    8686        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psVectorSort_01.c

    r1406 r2204  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-08-06 22:34:05 $
     12 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-10-27 00:57:33 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psTest.h"
    2121
    22 int main(int argc,
    23          char* argv[])
     22psS32 main(psS32 argc,
     23           char* argv[])
    2424{
    2525    psVector *in = NULL;
     
    4141    in->data.F32[5] = 5.0f;
    4242    in->data.F32[6] = -20.0f;
    43     for(int i=0; i<7; i++) {
     43    for(psS32 i=0; i<7; i++) {
    4444        printf("vec[%d] = %f\n", i, in->data.F32[i]);
    4545    }
     
    5151    tempVec = out;
    5252    out = psVectorSort(out, in);
    53     for(int i=0; i<7; i++) {
     53    for(psS32 i=0; i<7; i++) {
    5454        printf("vec[%d] = %f\n", i, out->data.F32[i]);
    5555    }
     
    6363    printPositiveTestHeader(stdout,"psVectorSort", "Sort input float vector into itself");
    6464    in = psVectorSort(in, in);
    65     for(int i=0; i<7; i++) {
     65    for(psS32 i=0; i<7; i++) {
    6666        printf("vec[%d] = %f\n", i, out->data.F32[i]);
    6767    }
     
    7474    psFree(out);
    7575    psMemCheckLeaks(0, NULL, stdout);
    76     int nBad = psMemCheckCorruption(0);
     76    psS32 nBad = psMemCheckCorruption(0);
    7777    if(nBad) {
    7878        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psVectorSort_02.c

    r1406 r2204  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-08-06 22:34:05 $
     12 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-10-27 00:57:33 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psTest.h"
    2121
    22 int main(int argc,
    23          char* argv[])
     22psS32 main(psS32 argc,
     23           char* argv[])
    2424{
    2525    psVector *in = NULL;
     
    3636    in->data.F32[3] = 1.0f;
    3737    in->data.F32[4] = 5.0f;
    38     for(int i=0; i<5; i++) {
     38    for(psS32 i=0; i<5; i++) {
    3939        printf("arr[%d] = %f\n", i, in->data.F32[i]);
    4040    }
     
    4545    printPositiveTestHeader(stdout,"psVectorSortIndex", "Create sorted index vector");
    4646    out = psVectorSortIndex(out, in);
    47     for(int i=0; i<5; i++) {
     47    for(psS32 i=0; i<5; i++) {
    4848        printf("arr[%d] = %d\n", i, out->data.U32[i]);
    4949    }
     
    6161    psFree(in);
    6262    psFree(out);
    63     int nLeaks = psMemCheckLeaks(0, NULL, stdout);
     63    psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout);
    6464    if(nLeaks) {
    6565        printf("ERROR: Found %d memory leaks\n", nLeaks);
    6666    }
    67     int nBad = psMemCheckCorruption(0);
     67    psS32 nBad = psMemCheckCorruption(0);
    6868    if(nBad) {
    6969        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psVectorSort_03.c

    r1406 r2204  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-08-06 22:34:05 $
     14 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-10-27 00:57:33 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psTest.h"
    2323
    24 int main(int argc,
    25          char* argv[])
     24psS32 main(psS32 argc,
     25           char* argv[])
    2626{
    2727    psVector *in = NULL;
     
    3737    out->n = 6;
    3838    in->n = 5;
    39     for(int i=0; i<5; i++) {
     39    for(psS32 i=0; i<5; i++) {
    4040        printf("arr[%d] = %f\n", i, in->data.F32[i]);
    4141    }
     
    5555    out2 = psVectorAlloc(5, PS_TYPE_F64);
    5656    out2->n = 5;
    57     for(int j=0; j<5; j++) {
     57    for(psS32 j=0; j<5; j++) {
    5858        printf("vec[%d] = %f\n", j, in2->data.F32[j]);
    5959    }
     
    7272    psFree(out);
    7373    psFree(out2);
    74     int nLeaks = psMemCheckLeaks(0, NULL, stdout);
     74    psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout);
    7575    if(nLeaks) {
    7676        printf("ERROR: Found %d memory leaks\n", nLeaks);
    7777    }
    78     int nBad = psMemCheckCorruption(0);
     78    psS32 nBad = psMemCheckCorruption(0);
    7979    if(nBad) {
    8080        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/collections/tst_psVectorSort_04.c

    r1406 r2204  
    99 *  @author  Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    12  *  @date  $Date: 2004-08-06 22:34:05 $
     11 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     12 *  @date  $Date: 2004-10-27 00:57:33 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#include "psTest.h"
    2020
    21 int main(int argc,
    22          char* argv[])
     21psS32 main(psS32 argc,
     22           char* argv[])
    2323{
    2424    psVector *badIn = NULL;
     
    3434    printPositiveTestHeader(stdout, "psVectorSort", "Free vectors");
    3535    psFree(goodOut);
    36     int nLeaks = psMemCheckLeaks(0, NULL, stdout);
     36    psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout);
    3737    if(nLeaks) {
    3838        printf("ERROR: Found %d memory blocks\n", nLeaks);
    3939    }
    40     int nBad = psMemCheckCorruption(0);
     40    psS32 nBad = psMemCheckCorruption(0);
    4141    if(nBad) {
    4242        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/dataManip/tst_psFunc00.c

    r1985 r2204  
    2222#define CN 6
    2323#define DN 8
    24 int main()
     24psS32 main()
    2525{
    2626    psPolynomial1D *my1DPoly = NULL;
     
    3232    psDPolynomial3D *my3DPolyD = NULL;
    3333    psDPolynomial4D *my4DPolyD = NULL;
    34     int testStatus      = true;
    35     int memLeaks        = 0;
    36     int a               = 0;
    37     int b               = 0;
    38     int c               = 0;
    39     int d               = 0;
    40     int currentId       = 0;
     34    psS32 testStatus      = true;
     35    psS32 memLeaks        = 0;
     36    psS32 a               = 0;
     37    psS32 b               = 0;
     38    psS32 c               = 0;
     39    psS32 d               = 0;
     40    psS32 currentId       = 0;
    4141
    4242    currentId       = psMemGetId();
  • trunk/psLib/test/dataManip/tst_psFunc01.c

    r1811 r2204  
    1313#define MY_STDEV 2.0
    1414#define N 30
    15 int main()
     15psS32 main()
    1616{
    17     int testStatus = true;
     17    psS32 testStatus = true;
    1818    float x = 0.0;
    19     int  memLeaks;
    20     int  currentId = psMemGetId();
     19    psS32  memLeaks;
     20    psS32  currentId = psMemGetId();
    2121    psVector *myGaussData = NULL;
    2222    printPositiveTestHeader(stdout,
     
    5252
    5353    myGaussData = psGaussianDev(MY_MEAN, MY_STDEV, N);
    54     for (int i = 0; i < N ; i++) {
     54    for (psS32 i = 0; i < N ; i++) {
    5555        printf("Gaussian Deviate [%d] is %f\n", i, myGaussData->data.F32[i]);
    5656    }
  • trunk/psLib/test/dataManip/tst_psFunc02.c

    r1946 r2204  
    1414#define CUBIC 3
    1515
    16 int main()
     16psS32 main()
    1717{
    18     int testStatus = true;
    19     int memLeaks=0;
    20     int i;
    21     int  currentId = psMemGetId();
     18    psS32 testStatus = true;
     19    psS32 memLeaks=0;
     20    psS32 i;
     21    psS32  currentId = psMemGetId();
    2222    psSpline1D *tmpSpline;
    2323
  • trunk/psLib/test/dataManip/tst_psFunc03.c

    r1946 r2204  
    1515#define CUBIC 3
    1616
    17 int main()
     17psS32 main()
    1818{
    19     int testStatus = true;
    20     int memLeaks=0;
    21     int i;
    22     int  currentId = psMemGetId();
     19    psS32 testStatus = true;
     20    psS32 memLeaks=0;
     21    psS32 i;
     22    psS32  currentId = psMemGetId();
    2323    psSpline1D *tmpSpline;
    2424    psVector *bounds;
  • trunk/psLib/test/dataManip/tst_psFunc04.c

    r1982 r2204  
    1717#define N 8
    1818
    19 int t00()
     19psS32 t00()
    2020{
    21     int testStatus = true;
    22     int memLeaks=0;
    23     int i;
     21    psS32 testStatus = true;
     22    psS32 memLeaks=0;
     23    psS32 i;
    2424    float x;
    2525    float y;
    26     int  currentId = psMemGetId();
     26    psS32  currentId = psMemGetId();
    2727    psSpline1D *tmpSpline;
    2828    psVector *data;
     
    6969}
    7070
    71 int t01()
     71psS32 t01()
    7272{
    73     int testStatus = true;
    74     int memLeaks=0;
    75     int i;
     73    psS32 testStatus = true;
     74    psS32 memLeaks=0;
     75    psS32 i;
    7676    float x;
    7777    float y;
    78     int  currentId = psMemGetId();
     78    psS32  currentId = psMemGetId();
    7979    psSpline1D *tmpSpline;
    8080    psVector *data;
     
    121121}
    122122
    123 int main()
     123psS32 main()
    124124{
    125125    t00();
  • trunk/psLib/test/dataManip/tst_psFunc05.c

    r1991 r2204  
    1818#define SPLINE_ORDER 1
    1919
    20 int main()
     20psS32 main()
    2121{
    22     int testStatus = true;
    23     int memLeaks=0;
    24     int i;
    25     int  currentId = psMemGetId();
     22    psS32 testStatus = true;
     23    psS32 memLeaks=0;
     24    psS32 i;
     25    psS32  currentId = psMemGetId();
    2626    psSpline1D *tmpSpline;
    2727    psVector *data;
  • trunk/psLib/test/dataManip/tst_psFunc07.c

    r1985 r2204  
    3232}
    3333
    34 int t00()
     34psS32 t00()
    3535{
    36     int testStatus = true;
    37     int memLeaks=0;
    38     int  currentId = psMemGetId();
    39     int i;
     36    psS32 testStatus = true;
     37    psS32 memLeaks=0;
     38    psS32  currentId = psMemGetId();
     39    psS32 i;
    4040    psSpline1D *tmpSpline = NULL;
    4141    psVector *x = NULL;
     
    101101
    102102// This is the F64 version of the above test code.
    103 int t01()
     103psS32 t01()
    104104{
    105     int testStatus = true;
    106     int memLeaks=0;
    107     int  currentId = psMemGetId();
    108     int i;
     105    psS32 testStatus = true;
     106    psS32 memLeaks=0;
     107    psS32  currentId = psMemGetId();
     108    psS32 i;
    109109    psSpline1D *tmpSpline = NULL;
    110110    psVector *x = NULL;
     
    169169}
    170170
    171 int main()
     171psS32 main()
    172172{
    173173    t00();
  • trunk/psLib/test/dataManip/tst_psHist00.c

    r1811 r2204  
    1010#define UPPER 30.0
    1111
    12 int main()
     12psS32 main()
    1313{
    1414    psHistogram *myHist = NULL;
    15     int testStatus      = true;
    16     int memLeaks        = 0;
    17     int i               = 0;
    18     int nb              = 0;
    19     int numBins         = 0;
    20     int currentId       = 0;
     15    psS32 testStatus      = true;
     16    psS32 memLeaks        = 0;
     17    psS32 i               = 0;
     18    psS32 nb              = 0;
     19    psS32 numBins         = 0;
     20    psS32 currentId       = 0;
    2121
    2222    currentId       = psMemGetId();
  • trunk/psLib/test/dataManip/tst_psHist01.c

    r1811 r2204  
    1010#define UPPER 30.0
    1111
    12 int main()
     12psS32 main()
    1313{
    1414    psHistogram *myHist = NULL;
    1515    psVector *myBounds  = NULL;
    16     int testStatus      = true;
    17     int memLeaks        = 0;
    18     int i               = 0;
    19     int nb              = 0;
    20     int numBins         = 0;
    21     int currentId       = 0;
     16    psS32 testStatus      = true;
     17    psS32 memLeaks        = 0;
     18    psS32 i               = 0;
     19    psS32 nb              = 0;
     20    psS32 numBins         = 0;
     21    psS32 currentId       = 0;
    2222
    2323    currentId       = psMemGetId();
  • trunk/psLib/test/dataManip/tst_psHist02.c

    r1811 r2204  
    1414#define NUM_DATA 10000
    1515
    16 int main()
     16psS32 main()
    1717{
    1818    psHistogram * myHist = NULL;
     
    2020    psVector *myData = NULL;
    2121    psVector *myMask = NULL;
    22     int testStatus = true;
    23     int memLeaks = 0;
    24     int nb = 0;
    25     int numBins = 0;
    26     int i = 0;
    27     int currentId = 0;
     22    psS32 testStatus = true;
     23    psS32 memLeaks = 0;
     24    psS32 nb = 0;
     25    psS32 numBins = 0;
     26    psS32 i = 0;
     27    psS32 currentId = 0;
    2828
    2929    currentId = psMemGetId();
  • trunk/psLib/test/dataManip/tst_psHist03.c

    r1824 r2204  
    1212#define NUM_DATA 20
    1313
    14 int main()
     14psS32 main()
    1515{
    1616    psHistogram *myHist = NULL;
    1717    psVector *myBounds  = NULL;
    1818    psVector *myData = psVectorAlloc( NUM_DATA, PS_TYPE_F32 );
    19     int testStatus      = true;
    20     int memLeaks        = 0;
    21     int i               = 0;
    22     int nb              = 0;
    23     int numBins         = 0;
    24     int currentId       = 0;
     19    psS32 testStatus      = true;
     20    psS32 memLeaks        = 0;
     21    psS32 i               = 0;
     22    psS32 nb              = 0;
     23    psS32 numBins         = 0;
     24    psS32 currentId       = 0;
    2525
    2626    currentId       = psMemGetId();
  • trunk/psLib/test/dataManip/tst_psMatrix01.c

    r1406 r2204  
    1111*  @author  Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    14 *  @date  $Date: 2004-08-06 22:34:06 $
     13*  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     14*  @date  $Date: 2004-10-27 00:57:33 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222
    2323#define PRINT_MATRIX(IMAGE)                         \
    24 for(int i=IMAGE->numRows-1; i>-1; i--) {        \
    25     for(int j=0; j<IMAGE->numCols; j++) {       \
     24for(psS32 i=IMAGE->numRows-1; i>-1; i--) {        \
     25    for(psS32 j=0; j<IMAGE->numCols; j++) {       \
    2626        printf("%f ", IMAGE->data.F64[i][j]);   \
    2727    }                                          \
     
    2929}
    3030
    31 int main( int argc,
    32           char* argv[] )
     31psS32 main( psS32 argc,
     32            char* argv[] )
    3333{
    3434    psImage * tempImage = NULL;
     
    7979    psFree( outImage );
    8080    psFree( outImageNull );
    81     int nLeaks = psMemCheckLeaks( 0, NULL, stdout );
     81    psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout );
    8282    if ( nLeaks != 0 ) {
    8383        printf( "ERROR: Found %d memory leaks\n", nLeaks );
    8484    }
    85     int nBad = psMemCheckCorruption( 0 );
     85    psS32 nBad = psMemCheckCorruption( 0 );
    8686    if ( nBad ) {
    8787        printf( "ERROR: Found %d bad memory blocks\n", nBad );
  • trunk/psLib/test/dataManip/tst_psMatrix02.c

    r1406 r2204  
    1313 *  @author  Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-08-06 22:34:06 $
     15 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-10-27 00:57:33 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psTest.h"
    2424
    25 int main(int argc,
    26          char* argv[])
     25psS32 main(psS32 argc,
     26           char* argv[])
    2727{
    2828    psImage *nullImage = NULL;
  • trunk/psLib/test/dataManip/tst_psMatrix03.c

    r1406 r2204  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2004-08-06 22:34:06 $
     16 *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2004-10-27 00:57:33 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525
    2626#define PRINT_MATRIX(IMAGE)                     \
    27 for(int i=IMAGE->numRows-1; i>-1; i--) {        \
    28     for(int j=0; j<IMAGE->numCols; j++) {       \
     27for(psS32 i=IMAGE->numRows-1; i>-1; i--) {        \
     28    for(psS32 j=0; j<IMAGE->numCols; j++) {       \
    2929        printf("%f ", IMAGE->data.F64[i][j]);   \
    3030    }                                           \
     
    3333\
    3434#define PRINT_VECTOR(VECTOR)                    \
    35 for(int i=0; i<VECTOR->n; i++) {                \
     35for(psS32 i=0; i<VECTOR->n; i++) {                \
    3636    printf("%f\n", VECTOR->data.F64[i]);        \
    3737}
    3838
    3939
    40 int main(int argc,
    41          char* argv[])
     40psS32 main(psS32 argc,
     41           char* argv[])
    4242{
    4343    psImage *luImage = NULL;
     
    112112    psFree(inVector);
    113113    psMemCheckLeaks(0, NULL, stdout);
    114     int nBad = psMemCheckCorruption(0);
     114    psS32 nBad = psMemCheckCorruption(0);
    115115    if(nBad) {
    116116        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/dataManip/tst_psMatrix04.c

    r1406 r2204  
    1313 *  @author  Ross Harman, MHPCC
    1414 *
    15  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-08-06 22:34:06 $
     15 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-10-27 00:57:33 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424
    2525#define PRINT_MATRIX(IMAGE)                         \
    26 for(int i=IMAGE->numRows-1; i>-1; i--) {            \
    27     for(int j=0; j<IMAGE->numCols; j++) {           \
     26for(psS32 i=IMAGE->numRows-1; i>-1; i--) {            \
     27    for(psS32 j=0; j<IMAGE->numCols; j++) {           \
    2828        printf("%f ", IMAGE->data.F64[i][j]);       \
    2929    }                                               \
     
    3232
    3333
    34 int main(int argc,
    35          char* argv[])
     34psS32 main(psS32 argc,
     35           char* argv[])
    3636{
    3737    float det = 0.0f;
     
    8787    psFree(det2);
    8888    psMemCheckLeaks(0, NULL, stdout);
    89     int nBad = psMemCheckCorruption(0);
     89    psS32 nBad = psMemCheckCorruption(0);
    9090    if(nBad) {
    9191        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/dataManip/tst_psMatrix05.c

    r1406 r2204  
    1010*  @author  Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13 *  @date  $Date: 2004-08-06 22:34:06 $
     12*  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13*  @date  $Date: 2004-10-27 00:57:33 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121
    2222#define PRINT_MATRIX(IMAGE)                         \
    23 for(int i=0; i<IMAGE->numRows; i++) {           \
    24     for(int j=0; j<IMAGE->numCols; j++) {       \
     23for(psS32 i=0; i<IMAGE->numRows; i++) {           \
     24    for(psS32 j=0; j<IMAGE->numCols; j++) {       \
    2525        printf("%f ", IMAGE->data.F64[i][j]);   \
    2626    }                                          \
     
    2929
    3030
    31 int main( int argc,
    32           char* argv[] )
     31psS32 main( psS32 argc,
     32            char* argv[] )
    3333{
    3434    psImage * outImage = NULL;
     
    6868    psFree( inImage1 );
    6969    psFree( inImage2 );
    70     int nLeaks = psMemCheckLeaks( 0, NULL, stdout );
     70    psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout );
    7171    if ( nLeaks != 0 ) {
    7272        printf( "ERROR: Found %d memory leaks\n", nLeaks );
    7373    }
    74     int nBad = psMemCheckCorruption( 0 );
     74    psS32 nBad = psMemCheckCorruption( 0 );
    7575    if ( nBad ) {
    7676        printf( "ERROR: Found %d bad memory blocks\n", nBad );
  • trunk/psLib/test/dataManip/tst_psMatrix06.c

    r1406 r2204  
    1010*  @author  Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13 *  @date  $Date: 2004-08-06 22:34:06 $
     12*  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13*  @date  $Date: 2004-10-27 00:57:33 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121
    2222#define PRINT_MATRIX(IMAGE)                         \
    23 for(int i=0; i<IMAGE->numRows; i++) {           \
    24     for(int j=0; j<IMAGE->numCols; j++) {       \
     23for(psS32 i=0; i<IMAGE->numRows; i++) {           \
     24    for(psS32 j=0; j<IMAGE->numCols; j++) {       \
    2525        printf("%f ", IMAGE->data.F64[i][j]);   \
    2626    }                                          \
     
    2929
    3030
    31 int main( int argc,
    32           char* argv[] )
     31psS32 main( psS32 argc,
     32            char* argv[] )
    3333{
    3434    psImage * outImage = NULL;
     
    7676    psFree( outImage );
    7777    psFree( inImage );
    78     int nLeaks = psMemCheckLeaks( 0, NULL, stdout );
     78    psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout );
    7979    if ( nLeaks != 0 ) {
    8080        printf( "ERROR: Found %d memory leaks\n", nLeaks );
    8181    }
    82     int nBad = psMemCheckCorruption( 0 );
     82    psS32 nBad = psMemCheckCorruption( 0 );
    8383    if ( nBad ) {
    8484        printf( "ERROR: Found %d bad memory blocks\n", nBad );
  • trunk/psLib/test/dataManip/tst_psMatrix07.c

    r1406 r2204  
    1616 *  @author  Ross Harman, MHPCC
    1717 *
    18  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    19  *  @date  $Date: 2004-08-06 22:34:06 $
     18 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     19 *  @date  $Date: 2004-10-27 00:57:33 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727
    2828#define PRINT_MATRIX(IMAGE)                         \
    29 for(int i=0; i<IMAGE->numRows; i++) {               \
    30     for(int j=0; j<IMAGE->numCols; j++) {           \
     29for(psS32 i=0; i<IMAGE->numRows; i++) {               \
     30    for(psS32 j=0; j<IMAGE->numCols; j++) {           \
    3131        printf("%f ", IMAGE->data.F64[i][j]);       \
    3232    }                                               \
     
    3535
    3636#define PRINT_VECTOR(VECTOR)                        \
    37 for(int i=0; i<VECTOR->n; i++) {                    \
     37for(psS32 i=0; i<VECTOR->n; i++) {                    \
    3838    printf("%f\n", VECTOR->data.F64[i]);            \
    3939}
    4040
    4141
    42 int main(int argc,
    43          char* argv[])
     42psS32 main(psS32 argc,
     43           char* argv[])
    4444{
    4545    psVector *v1 = NULL;
     
    169169    psFree(badImage);
    170170    psMemCheckLeaks(0, NULL, stdout);
    171     int nBad = psMemCheckCorruption(0);
     171    psS32 nBad = psMemCheckCorruption(0);
    172172    if(nBad) {
    173173        printf("ERROR: Found %d bad memory blocks\n", nBad);
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic01.c

    r1648 r2204  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-08-27 23:31:22 $
     12 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-10-27 00:57:33 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424    printf("%f+%fi ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE));                               \
    2525} else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) {                                                     \
    26     printf("%d ", (int)SCALAR->data.TYPE);                                                               \
     26    printf("%d ", (psS32)SCALAR->data.TYPE);                                                               \
    2727} else {                                                                                                 \
    2828    printf("%f ", (double)SCALAR->data.TYPE);                                                            \
     
    3131
    3232#define PRINT_VECTOR(VECTOR,TYPE)                                                                            \
    33 for(int i=0; i<VECTOR->n; i++) {                                                                         \
     33for(psS32 i=0; i<VECTOR->n; i++) {                                                                         \
    3434    if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                    \
    3535        printf("%f+%fi ", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));                     \
    3636    } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                 \
    37         printf("%d ", (int)VECTOR->data.TYPE[i]);                                                        \
     37        printf("%d ", (psS32)VECTOR->data.TYPE[i]);                                                        \
    3838    } else {                                                                                             \
    3939        printf("%f ", (double)VECTOR->data.TYPE[i]);                                                     \
     
    4444
    4545#define PRINT_MATRIX(IMAGE,TYPE)                                                                             \
    46 for(int i=IMAGE->numRows-1; i>-1; i--) {                                                                 \
    47     for(int j=0; j<IMAGE->numCols; j++) {                                                                \
     46for(psS32 i=IMAGE->numRows-1; i>-1; i--) {                                                                 \
     47    for(psS32 j=0; j<IMAGE->numCols; j++) {                                                                \
    4848        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                 \
    4949            printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));             \
    5050        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                              \
    51             printf("%d ", (int)IMAGE->data.TYPE[i][j]);                                                  \
     51            printf("%d ", (psS32)IMAGE->data.TYPE[i][j]);                                                  \
    5252        } else {                                                                                         \
    5353            printf("%f ", (double)IMAGE->data.TYPE[i][j]);                                               \
     
    6161#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                                                          \
    6262psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                         \
    63 for(int i=0; i<SIZE; i++) {                                                                              \
     63for(psS32 i=0; i<SIZE; i++) {                                                                              \
    6464    NAME->data.TYPE[i] = VALUE;                                                                          \
    6565}                                                                                                        \
     
    6969#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
    7070psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                      \
    71 for(int i=0; i<NAME->numRows; i++) {                                                                     \
    72     for(int j=0; j<NAME->numCols; j++) {                                                                 \
     71for(psS32 i=0; i<NAME->numRows; i++) {                                                                     \
     72    for(psS32 j=0; j<NAME->numCols; j++) {                                                                 \
    7373        NAME->data.TYPE[i][j] = VALUE;                                                                   \
    7474    }                                                                                                    \
     
    7878#define CHECK_MEMORY                                                                                         \
    7979psMemCheckLeaks(0, NULL, stdout);                                                                        \
    80 int nBad = psMemCheckCorruption(0);                                                                      \
     80psS32 nBad = psMemCheckCorruption(0);                                                                      \
    8181if(nBad) {                                                                                               \
    8282    printf("ERROR: Found %d bad memory blocks\n", nBad);                                                 \
     
    8484
    8585
    86 int main(int argc, char* argv[])
     86psS32 main(psS32 argc, char* argv[])
    8787{
    8888
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic02.c

    r2057 r2204  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-10-12 20:50:40 $
     12 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-10-27 00:57:33 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424
    2525#define CHECK_VECTOR(VECTOR,TYPE,TRUTH)                                                                      \
    26 for(int i=0; i<VECTOR->n; i++) {                                                                             \
     26for(psS32 i=0; i<VECTOR->n; i++) {                                                                             \
    2727    if(cabs(VECTOR->data.TYPE[i])-cabs(TRUTH) > FLT_EPSILON){                                                \
    2828        printf("ERROR:Truth and calculated values don't match for vector operation:\n");                     \
     
    3131            printf("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH));                                  \
    3232        } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                 \
    33             printf("Truth: %d\n", (int)(VECTOR->data.TYPE[i]));                                              \
    34             printf("Calculated: %d\n", (int)(TRUTH));                                                        \
     33            printf("Truth: %d\n", (psS32)(VECTOR->data.TYPE[i]));                                              \
     34            printf("Calculated: %d\n", (psS32)(TRUTH));                                                        \
    3535        } else {                                                                                             \
    3636            printf("Truth: %.2f\n", (double)(VECTOR->data.TYPE[i]));                                         \
     
    4343
    4444#define CHECK_MATRIX(IMAGE,TYPE,TRUTH)                                                                       \
    45 for(int i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
    46     for(int j=0; j<IMAGE->numCols; j++) {                                                                    \
     45for(psS32 i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
     46    for(psS32 j=0; j<IMAGE->numCols; j++) {                                                                    \
    4747        if(cabs(IMAGE->data.TYPE[i][j])-cabs(TRUTH) > FLT_EPSILON){                                          \
    4848            printf("ERROR:Truth and calculated values don't match for matrix operation:\n");                 \
     
    5151                printf("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH));                              \
    5252            } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                              \
    53                 printf("Truth: %d\n", (int)(IMAGE->data.TYPE[i][j]));                                        \
    54                 printf("Calculated: %d\n", (int)(TRUTH));                                                    \
     53                printf("Truth: %d\n", (psS32)(IMAGE->data.TYPE[i][j]));                                        \
     54                printf("Calculated: %d\n", (psS32)(TRUTH));                                                    \
    5555            } else {                                                                                         \
    5656                printf("Truth: %.2f\n", (double)(IMAGE->data.TYPE[i][j]));                                   \
     
    6666#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                                                          \
    6767psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                             \
    68 for(int i=0; i<SIZE; i++) {                                                                                  \
     68for(psS32 i=0; i<SIZE; i++) {                                                                                  \
    6969    NAME->data.TYPE[i] = VALUE;                                                                              \
    7070}                                                                                                            \
     
    7474#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
    7575psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                          \
    76 for(int i=0; i<NAME->numRows; i++) {                                                                         \
    77     for(int j=0; j<NAME->numCols; j++) {                                                                     \
     76for(psS32 i=0; i<NAME->numRows; i++) {                                                                         \
     77    for(psS32 j=0; j<NAME->numCols; j++) {                                                                     \
    7878        NAME->data.TYPE[i][j] = VALUE;                                                                       \
    7979    }                                                                                                        \
     
    8686    return 50; \
    8787} \
    88 int nBad = psMemCheckCorruption(0); \
     88psS32 nBad = psMemCheckCorruption(0); \
    8989if(nBad) { \
    9090    psError(__func__,"ERROR: Found %d bad memory blocks\n", nBad); \
     
    9393
    9494
    95 int main( int argc, char* argv[] )
     95psS32 main( psS32 argc, char* argv[] )
    9696{
    9797
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic03.c

    r2053 r2204  
    1515 *  @author  Ross Harman, MHPCC
    1616 *
    17  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    18  *  @date  $Date: 2004-10-12 19:18:20 $
     17 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     18 *  @date  $Date: 2004-10-27 00:57:33 $
    1919 *
    2020 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727
    2828#define PRINT_VECTOR(VECTOR,TYPE)                                                                            \
    29 for(int i=0; i<VECTOR->n; i++) {                                                                         \
     29for(psS32 i=0; i<VECTOR->n; i++) {                                                                         \
    3030    if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                    \
    3131        printf("%f+%fi ", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));                     \
    3232    } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                 \
    33         printf("%d ", (int)VECTOR->data.TYPE[i]);                                                        \
     33        printf("%d ", (psS32)VECTOR->data.TYPE[i]);                                                        \
    3434    } else {                                                                                             \
    3535        printf("%f ", (double)VECTOR->data.TYPE[i]);                                                     \
     
    4040
    4141#define PRINT_MATRIX(IMAGE,TYPE)                                                                             \
    42 for(int i=IMAGE->numRows-1; i>-1; i--) {                                                                 \
    43     for(int j=0; j<IMAGE->numCols; j++) {                                                                \
     42for(psS32 i=IMAGE->numRows-1; i>-1; i--) {                                                                 \
     43    for(psS32 j=0; j<IMAGE->numCols; j++) {                                                                \
    4444        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                 \
    4545            printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));             \
    4646        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                              \
    47             printf("%d ", (int)IMAGE->data.TYPE[i][j]);                                                  \
     47            printf("%d ", (psS32)IMAGE->data.TYPE[i][j]);                                                  \
    4848        } else {                                                                                         \
    4949            printf("%f ", (double)IMAGE->data.TYPE[i][j]);                                               \
     
    5757#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                                                          \
    5858psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                         \
    59 for(int i=0; i<SIZE; i++) {                                                                              \
     59for(psS32 i=0; i<SIZE; i++) {                                                                              \
    6060    NAME->data.TYPE[i] = VALUE;                                                                          \
    6161}                                                                                                        \
     
    6565#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
    6666psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                      \
    67 for(int i=0; i<NAME->numRows; i++) {                                                                     \
    68     for(int j=0; j<NAME->numCols; j++) {                                                                 \
     67for(psS32 i=0; i<NAME->numRows; i++) {                                                                     \
     68    for(psS32 j=0; j<NAME->numCols; j++) {                                                                 \
    6969        NAME->data.TYPE[i][j] = VALUE;                                                                   \
    7070    }                                                                                                    \
     
    7272
    7373
    74 int main(int argc, char* argv[])
     74psS32 main(psS32 argc, char* argv[])
    7575{
    7676    CREATE_AND_SET_IMAGE(image1,F64,0,3,3);
  • trunk/psLib/test/dataManip/tst_psMinimize00.c

    r1811 r2204  
    3636float myFuncDeriv(const psVector *restrict myData,
    3737                  const psVector *restrict myParams,
    38                   int whichParamDeriv)
     38                  psS32 whichParamDeriv)
    3939{
    4040    float x = myData->data.F32[0];
     
    6565
    6666
    67 int main()
     67psS32 main()
    6868{
    6969    psImage *domain = NULL;
     
    7474    psVector *tmpVecPtr = NULL;
    7575    float chiSq = 0.0;
    76     int i = 0;
    77     int j = 0;
    78     int currentId = psMemGetId();
    79     int testStatus = true;
    80     int memLeaks = 0;
     76    psS32 i = 0;
     77    psS32 j = 0;
     78    psS32 currentId = psMemGetId();
     79    psS32 testStatus = true;
     80    psS32 memLeaks = 0;
    8181    psVector *theParams = NULL;
    8282
  • trunk/psLib/test/dataManip/tst_psMinimize01.c

    r1811 r2204  
    3535float myFuncDeriv(const psVector *restrict myData,
    3636                  const psVector *restrict myParams,
    37                   int whichParamDeriv)
     37                  psS32 whichParamDeriv)
    3838{
    3939    float x = myData->data.F32[0];
     
    5858}
    5959
    60 int main()
     60psS32 main()
    6161{
    6262    psImage *domain = NULL;
     
    6767    psVector *tmpVecPtr = NULL;
    6868    float chiSq = 0.0;
    69     int i = 0;
     69    psS32 i = 0;
    7070    psVector *theParams = NULL;
    71     int currentId = psMemGetId();
    72     int testStatus = true;
    73     int memLeaks = 0;
     71    psS32 currentId = psMemGetId();
     72    psS32 testStatus = true;
     73    psS32 memLeaks = 0;
    7474
    7575    domain = psImageAlloc(DATA_WIDTH, NUM_DATA, PS_TYPE_F32);
  • trunk/psLib/test/dataManip/tst_psMinimize02.c

    r1811 r2204  
    3434float myFuncDeriv0(const psVector *restrict myParams,
    3535                   const psVector *restrict myCoords,
    36                    int whichParamDeriv)
     36                   psS32 whichParamDeriv)
    3737{
    3838    float P0 = myCoords->data.F32[0];
     
    7575float myFuncDeriv(const psVector *restrict myParams,
    7676                  const psVector *restrict myCoords,
    77                   int whichParamDeriv)
     77                  psS32 whichParamDeriv)
    7878{
    7979    float x = myCoords->data.F32[0];
     
    104104
    105105
    106 int main()
     106psS32 main()
    107107{
    108108    psVector *initialGuess = NULL;
    109109    psVector *paramMask = NULL;
    110110    psVector *coord = NULL;
    111     int i = 0;
    112     int currentId = psMemGetId();
    113     int testStatus = true;
    114     int memLeaks = 0;
     111    psS32 i = 0;
     112    psS32 currentId = psMemGetId();
     113    psS32 testStatus = true;
     114    psS32 memLeaks = 0;
    115115    psVector *theParams = NULL;
    116116
  • trunk/psLib/test/dataManip/tst_psMinimize03.c

    r1811 r2204  
    3434float myFuncDeriv0(const psVector *restrict myParams,
    3535                   const psVector *restrict myCoords,
    36                    int whichParamDeriv)
     36                   psS32 whichParamDeriv)
    3737{
    3838    float P0 = myCoords->data.F32[0];
     
    7575float myFuncDeriv(const psVector *restrict myParams,
    7676                  const psVector *restrict myCoords,
    77                   int whichParamDeriv)
     77                  psS32 whichParamDeriv)
    7878{
    7979    float x = myCoords->data.F32[0];
     
    104104
    105105
    106 int main()
     106psS32 main()
    107107{
    108108    psVector *initialGuess = NULL;
    109109    psVector *paramMask = NULL;
    110110    psVector *coord = NULL;
    111     int i = 0;
    112     int currentId = psMemGetId();
    113     int testStatus = true;
    114     int memLeaks = 0;
     111    psS32 i = 0;
     112    psS32 currentId = psMemGetId();
     113    psS32 testStatus = true;
     114    psS32 memLeaks = 0;
    115115    psVector *theParams = NULL;
    116116
  • trunk/psLib/test/dataManip/tst_psMinimize04.c

    r2090 r2204  
    3333}
    3434
    35 int t00()
     35psS32 t00()
    3636{
    3737    psPolynomial1D *myPoly = NULL;
     
    3939    psVector *y = NULL;
    4040    psVector *yErr = NULL;
    41     int i = 0;
    42     int currentId = psMemGetId();
    43     int testStatus = true;
    44     int memLeaks = 0;
     41    psS32 i = 0;
     42    psS32 currentId = psMemGetId();
     43    psS32 testStatus = true;
     44    psS32 memLeaks = 0;
    4545    double expectData;
    4646    double actualData;
     
    101101}
    102102
    103 int t01()
     103psS32 t01()
    104104{
    105105    psPolynomial1D *myPoly = NULL;
    106106    psVector *x = NULL;
    107107    psVector *y = NULL;
    108     int i = 0;
    109     int currentId = psMemGetId();
    110     int testStatus = true;
    111     int memLeaks = 0;
     108    psS32 i = 0;
     109    psS32 currentId = psMemGetId();
     110    psS32 testStatus = true;
     111    psS32 memLeaks = 0;
    112112    double expectData;
    113113    double actualData;
     
    164164}
    165165
    166 int t02()
     166psS32 t02()
    167167{
    168168    psPolynomial1D *myPoly = NULL;
    169169    psVector *y = NULL;
    170     int i = 0;
    171     int currentId = psMemGetId();
    172     int testStatus = true;
    173     int memLeaks = 0;
     170    psS32 i = 0;
     171    psS32 currentId = psMemGetId();
     172    psS32 testStatus = true;
     173    psS32 memLeaks = 0;
    174174    double expectData;
    175175    double actualData;
     
    223223}
    224224
    225 int t03()
    226 {
    227     int currentId = psMemGetId();
    228     int testStatus = true;
    229     int memLeaks = 0;
     225psS32 t03()
     226{
     227    psS32 currentId = psMemGetId();
     228    psS32 testStatus = true;
     229    psS32 memLeaks = 0;
    230230    psPolynomial1D *myPoly = NULL;
    231231
     
    257257
    258258
    259 int main()
     259psS32 main()
    260260{
    261261    t00();
  • trunk/psLib/test/dataManip/tst_psMinimize04_F32.c

    r2091 r2204  
    3333}
    3434
    35 int t00()
     35psS32 t00()
    3636{
    3737    psPolynomial1D *myPoly = NULL;
     
    3939    psVector *y = NULL;
    4040    psVector *yErr = NULL;
    41     int i = 0;
    42     int currentId = psMemGetId();
    43     int testStatus = true;
    44     int memLeaks = 0;
     41    psS32 i = 0;
     42    psS32 currentId = psMemGetId();
     43    psS32 testStatus = true;
     44    psS32 memLeaks = 0;
    4545    float expectData;
    4646    float actualData;
     
    100100}
    101101
    102 int t01()
     102psS32 t01()
    103103{
    104104    psPolynomial1D *myPoly = NULL;
    105105    psVector *x = NULL;
    106106    psVector *y = NULL;
    107     int i = 0;
    108     int currentId = psMemGetId();
    109     int testStatus = true;
    110     int memLeaks = 0;
     107    psS32 i = 0;
     108    psS32 currentId = psMemGetId();
     109    psS32 testStatus = true;
     110    psS32 memLeaks = 0;
    111111    float expectData;
    112112    float actualData;
     
    163163}
    164164
    165 int t02()
     165psS32 t02()
    166166{
    167167    psPolynomial1D *myPoly = NULL;
    168168    psVector *y = NULL;
    169     int i = 0;
    170     int currentId = psMemGetId();
    171     int testStatus = true;
    172     int memLeaks = 0;
     169    psS32 i = 0;
     170    psS32 currentId = psMemGetId();
     171    psS32 testStatus = true;
     172    psS32 memLeaks = 0;
    173173    float expectData;
    174174    float actualData;
     
    222222}
    223223
    224 int t03()
    225 {
    226     int currentId = psMemGetId();
    227     int testStatus = true;
    228     int memLeaks = 0;
     224psS32 t03()
     225{
     226    psS32 currentId = psMemGetId();
     227    psS32 testStatus = true;
     228    psS32 memLeaks = 0;
    229229
    230230    printPositiveTestHeader(stdout,
     
    251251
    252252
    253 int main()
     253psS32 main()
    254254{
    255255    t00();
  • trunk/psLib/test/dataManip/tst_psMinimize04b.c

    r2089 r2204  
    2626}
    2727
    28 int t00()
     28psS32 t00()
    2929{
    3030    psPolynomial1D *myPoly = NULL;
     
    3232    psVector *y = NULL;
    3333    psVector *yErr = NULL;
    34     int i = 0;
    35     int currentId = psMemGetId();
    36     int testStatus = true;
    37     int memLeaks = 0;
     34    psS32 i = 0;
     35    psS32 currentId = psMemGetId();
     36    psS32 testStatus = true;
     37    psS32 memLeaks = 0;
    3838
    3939    myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB);
     
    9595
    9696
    97 int t01()
     97psS32 t01()
    9898{
    9999    psPolynomial1D *myPoly = NULL;
    100100    psVector *x = NULL;
    101101    psVector *y = NULL;
    102     int i = 0;
    103     int currentId = psMemGetId();
    104     int testStatus = true;
    105     int memLeaks = 0;
     102    psS32 i = 0;
     103    psS32 currentId = psMemGetId();
     104    psS32 testStatus = true;
     105    psS32 memLeaks = 0;
    106106
    107107    myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB);
     
    155155
    156156
    157 int t02()
     157psS32 t02()
    158158{
    159159    psPolynomial1D *myPoly = NULL;
    160160    psVector *x = NULL;
    161161    psVector *y = NULL;
    162     int i = 0;
    163     int currentId = psMemGetId();
    164     int testStatus = true;
    165     int memLeaks = 0;
     162    psS32 i = 0;
     163    psS32 currentId = psMemGetId();
     164    psS32 testStatus = true;
     165    psS32 memLeaks = 0;
    166166
    167167    myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB);
     
    214214}
    215215
    216 int t03()
    217 {
    218     psPolynomial1D *myPoly = NULL;
    219     int currentId = psMemGetId();
    220     int testStatus = true;
    221     int memLeaks = 0;
     216psS32 t03()
     217{
     218    psPolynomial1D *myPoly = NULL;
     219    psS32 currentId = psMemGetId();
     220    psS32 testStatus = true;
     221    psS32 memLeaks = 0;
    222222
    223223    printPositiveTestHeader(stdout,
     
    244244}
    245245
    246 int main()
     246psS32 main()
    247247{
    248248    t00();
  • trunk/psLib/test/dataManip/tst_psMinimize04b_F32.c

    r2086 r2204  
    2626}
    2727
    28 int t00()
     28psS32 t00()
    2929{
    3030    psPolynomial1D *myPoly = NULL;
     
    3232    psVector *y = NULL;
    3333    psVector *yErr = NULL;
    34     int i = 0;
    35     int currentId = psMemGetId();
    36     int testStatus = true;
    37     int memLeaks = 0;
     34    psS32 i = 0;
     35    psS32 currentId = psMemGetId();
     36    psS32 testStatus = true;
     37    psS32 memLeaks = 0;
    3838
    3939    myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB);
     
    9595
    9696
    97 int t01()
     97psS32 t01()
    9898{
    9999    psPolynomial1D *myPoly = NULL;
    100100    psVector *x = NULL;
    101101    psVector *y = NULL;
    102     int i = 0;
    103     int currentId = psMemGetId();
    104     int testStatus = true;
    105     int memLeaks = 0;
     102    psS32 i = 0;
     103    psS32 currentId = psMemGetId();
     104    psS32 testStatus = true;
     105    psS32 memLeaks = 0;
    106106
    107107    myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB);
     
    155155
    156156
    157 int t02()
     157psS32 t02()
    158158{
    159159    psPolynomial1D *myPoly = NULL;
    160160    psVector *x = NULL;
    161161    psVector *y = NULL;
    162     int i = 0;
    163     int currentId = psMemGetId();
    164     int testStatus = true;
    165     int memLeaks = 0;
     162    psS32 i = 0;
     163    psS32 currentId = psMemGetId();
     164    psS32 testStatus = true;
     165    psS32 memLeaks = 0;
    166166
    167167    myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB);
     
    214214}
    215215
    216 int t03()
    217 {
    218     psPolynomial1D *myPoly = NULL;
    219     int currentId = psMemGetId();
    220     int testStatus = true;
    221     int memLeaks = 0;
     216psS32 t03()
     217{
     218    psPolynomial1D *myPoly = NULL;
     219    psS32 currentId = psMemGetId();
     220    psS32 testStatus = true;
     221    psS32 memLeaks = 0;
    222222
    223223    printPositiveTestHeader(stdout,
     
    244244}
    245245
    246 int main()
     246psS32 main()
    247247{
    248248    t00();
  • trunk/psLib/test/dataManip/tst_psMinimize05.c

    r2081 r2204  
    1515#define ERROR_TOLERANCE 0.10
    1616float expectedParm[NUM_PARAMS];
    17 int testStatus = true;
     17psS32 testStatus = true;
    1818
    1919/*****************************************************************************
     
    3232    float coordData = 0.0;
    3333    float expData = 0.0;
    34     int i;
     34    psS32 i;
    3535
    3636    for (i=0;i<N;i++) {
     
    6262
    6363
    64 int t00()
    65 {
    66     int currentId = psMemGetId();
    67     int memLeaks = 0;
    68     int i = 0;
     64psS32 t00()
     65{
     66    psS32 currentId = psMemGetId();
     67    psS32 memLeaks = 0;
     68    psS32 i = 0;
    6969    psArray *myCoords;
    7070    psVector *myParams;
     
    8181    myCoords = psArrayAlloc(N);
    8282    for (i=0;i<N;i++) {
    83         myCoords->data[i] = (psPTR *) psVectorAlloc(2, PS_TYPE_F32);
     83        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
    8484        ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
    8585        ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
     
    137137}
    138138
    139 int t01()
    140 {
    141     int currentId = psMemGetId();
    142     int memLeaks = 0;
    143     int i = 0;
     139psS32 t01()
     140{
     141    psS32 currentId = psMemGetId();
     142    psS32 memLeaks = 0;
     143    psS32 i = 0;
    144144    psArray *myCoords;
    145145    psVector *myParams;
     
    154154    myCoords = psArrayAlloc(N);
    155155    for (i=0;i<N;i++) {
    156         myCoords->data[i] = (psPTR *) psVectorAlloc(2, PS_TYPE_F32);
     156        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
    157157        ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
    158158        ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
     
    208208}
    209209
    210 int t02()
    211 {
    212     int currentId = psMemGetId();
    213     int memLeaks = 0;
    214     int i = 0;
     210psS32 t02()
     211{
     212    psS32 currentId = psMemGetId();
     213    psS32 memLeaks = 0;
     214    psS32 i = 0;
    215215    psArray *myCoords;
    216216    psVector *myParams;
     
    227227    myCoords = psArrayAlloc(N);
    228228    for (i=0;i<N;i++) {
    229         myCoords->data[i] = (psPTR *) psVectorAlloc(2, PS_TYPE_F32);
     229        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
    230230        ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
    231231        ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
     
    269269}
    270270
    271 int main()
     271psS32 main()
    272272{
    273273    t00();
  • trunk/psLib/test/dataManip/tst_psMinimize06.c

    r2202 r2204  
    1212#define NUM_PARAMS 3
    1313float expectedParm[NUM_PARAMS];
    14 int testStatus = true;
     14psS32 testStatus = true;
    1515
    1616/*****************************************************************************
     
    2929{
    3030    psVector *sum = psVectorAlloc(myCoords->n, PS_TYPE_F32);
    31     int i;
    32     int j;
     31    psS32 i;
     32    psS32 j;
    3333
    3434
     
    5252}
    5353
    54 int t01()
     54psS32 t01()
    5555{
    56     int currentId = psMemGetId();
    57     int memLeaks = 0;
    58     int i = 0;
     56    psS32 currentId = psMemGetId();
     57    psS32 memLeaks = 0;
     58    psS32 i = 0;
    5959    psArray *myCoords;
    6060    psVector *myParams;
     
    7373
    7474    for (i=0;i<N;i++) {
    75         myCoords->data[i] = (psPTR *) psVectorAlloc(2, PS_TYPE_F32);
     75        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
    7676        ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
    7777        ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
     
    115115}
    116116
    117 int main()
     117psS32 main()
    118118{
    119119    t01();
  • trunk/psLib/test/dataManip/tst_psStats00.c

    r1811 r2204  
    88#define N 10
    99
    10 int main()
     10psS32 main()
    1111{
    1212    psStats *myStats    = NULL;
    1313    psStats *myStats2    = NULL;
    14     int testStatus      = true;
    15     int globalTestStatus = true;
    16     int i               = 0;
     14    psS32 testStatus      = true;
     15    psS32 globalTestStatus = true;
     16    psS32 i               = 0;
    1717    psVector *myVector  = NULL;
    1818    psVector *maskVector= NULL;
     
    2020    float realMeanNoMask   = 0.0;
    2121    float realMeanWithMask = 0.0;
    22     int count           = 0;
    23     int currentId       = psMemGetId();
    24     int memLeaks        = 0;
     22    psS32 count           = 0;
     23    psS32 currentId       = psMemGetId();
     24    psS32 memLeaks        = 0;
    2525
    2626    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats01.c

    r1811 r2204  
    88#define N 10
    99
    10 int main()
     10psS32 main()
    1111{
    1212    psStats *myStats    = NULL;
    13     int testStatus      = true;
    14     int globalTestStatus = true;
    15     int i               = 0;
     13    psS32 testStatus      = true;
     14    psS32 globalTestStatus = true;
     15    psS32 i               = 0;
    1616    psVector *myVector  = NULL;
    1717    psVector *maskVector= NULL;
     
    1919    float realMaxNoMask   = 0.0;
    2020    float realMaxWithMask = 0.0;
    21     int currentId       = psMemGetId();
    22     int memLeaks        = 0;
     21    psS32 currentId       = psMemGetId();
     22    psS32 memLeaks        = 0;
    2323
    2424    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats02.c

    r1811 r2204  
    88#define N 10
    99
    10 int main()
     10psS32 main()
    1111{
    1212    psStats *myStats    = NULL;
    13     int testStatus      = true;
    14     int globalTestStatus = true;
    15     int i               = 0;
     13    psS32 testStatus      = true;
     14    psS32 globalTestStatus = true;
     15    psS32 i               = 0;
    1616    psVector *myVector  = NULL;
    1717    psVector *maskVector= NULL;
     
    1919    float realMinNoMask   = 1e99;
    2020    float realMinWithMask = 1e99;
    21     int currentId       = psMemGetId();
    22     int memLeaks        = 0;
     21    psS32 currentId       = psMemGetId();
     22    psS32 memLeaks        = 0;
    2323
    2424    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats03.c

    r1811 r2204  
    99#define N ((4 * N1) + 1)
    1010
    11 int main()
     11psS32 main()
    1212{
    1313    psStats *myStats    = NULL;
    14     int testStatus      = true;
    15     int globalTestStatus = true;
    16     int i               = 0;
     14    psS32 testStatus      = true;
     15    psS32 globalTestStatus = true;
     16    psS32 i               = 0;
    1717    psVector *myVector  = NULL;
    1818    psVector *maskVector= NULL;
     
    2020    float realMedianWithMask = (float) (N-3)/4;
    2121    float realMedianNoMask = (float) (N-1)/2;
    22     int currentId       = psMemGetId();
    23     int memLeaks        = 0;
     22    psS32 currentId       = psMemGetId();
     23    psS32 memLeaks        = 0;
    2424
    2525    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats04.c

    r1406 r2204  
    1212#define N ((4 * N1) + 1)
    1313
    14 int main()
     14psS32 main()
    1515{
    1616    psStats *myStats    = NULL;
    17     int testStatus      = true;
    18     int i               = 0;
     17    psS32 testStatus      = true;
     18    psS32 i               = 0;
    1919    psVector *myVector  = NULL;
    2020    psVector *maskVector= NULL;
  • trunk/psLib/test/dataManip/tst_psStats05.c

    r1900 r2204  
    88#define MISC_FLOAT_NUMBER 345.0
    99
    10 int main()
     10psS32 main()
    1111{
    1212    psStats *myStats    = NULL;
    13     int testStatus      = true;
    14     int currentId       = psMemGetId();
    15     int memLeaks        = 0;
     13    psS32 testStatus      = true;
     14    psS32 currentId       = psMemGetId();
     15    psS32 memLeaks        = 0;
    1616
    1717    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats06.c

    r1811 r2204  
    1212#define N 15
    1313
    14 int main()
     14psS32 main()
    1515{
    1616    psStats *myStats    = NULL;
    17     int testStatus      = true;
    18     int globalTestStatus = true;
    19     int i               = 0;
     17    psS32 testStatus      = true;
     18    psS32 globalTestStatus = true;
     19    psS32 i               = 0;
    2020    psVector *myVector  = NULL;
    2121    psVector *maskVector= NULL;
     
    2626    float realStdevNoMask   = 4.472136;
    2727    float realStdevWithMask = 2.160247;
    28     int count           = 0;
    29     int currentId       = psMemGetId();
    30     int memLeaks        = 0;
     28    psS32 count           = 0;
     29    psS32 currentId       = psMemGetId();
     30    psS32 memLeaks        = 0;
    3131
    3232    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats07.c

    r2198 r2204  
    1515#define ERROR_TOLERANCE 0.10
    1616
    17 int t00()
     17psS32 t00()
    1818{
    1919    psStats * myStats = NULL;
    20     int testStatus = true;
    21     int globalTestStatus = true;
    22     int i = 0;
     20    psS32 testStatus = true;
     21    psS32 globalTestStatus = true;
     22    psS32 i = 0;
    2323    psVector *myVector = NULL;
    2424    psVector *maskVector = NULL;
     
    2626    // They must be changed if we adjust the number of data points.
    2727    // We don't really know that they are correct.
    28     int count = 0;
    29     int currentId = psMemGetId();
    30     int memLeaks = 0;
     28    psS32 count = 0;
     29    psS32 currentId = psMemGetId();
     30    psS32 memLeaks = 0;
    3131    float realMeanNoMask = MEAN;
    3232    float realMedianNoMask = MEAN;
     
    3535    float realLQNoMask = MEAN - ( 0.6 * STDEV );
    3636    float realUQNoMask = MEAN + ( 0.6 * STDEV );
    37     int realN50NoMask = N / 4;
    38     int realNfitNoMask = N / 4;
     37    psS32 realN50NoMask = N / 4;
     38    psS32 realNfitNoMask = N / 4;
    3939
    4040    psTraceSetLevel(".psLib.dataManip.psStats", 10);
     
    253253
    254254
    255 int t01()
     255psS32 t01()
    256256{
    257257    psStats * myStats = NULL;
    258     int testStatus = true;
    259     int globalTestStatus = true;
    260     int i = 0;
     258    psS32 testStatus = true;
     259    psS32 globalTestStatus = true;
     260    psS32 i = 0;
    261261    psVector *myVector = NULL;
    262262    psVector *maskVector = NULL;
     
    264264    // A: They must be changed if we adjust the number of data points.
    265265    // B: We don't really know that they are correct.
    266     int count = 0;
    267     int currentId = psMemGetId();
    268     int memLeaks = 0;
     266    psS32 count = 0;
     267    psS32 currentId = psMemGetId();
     268    psS32 memLeaks = 0;
    269269    float realMeanWithMask = MEAN;
    270270    float realMedianWithMask = MEAN;
     
    273273    float realLQWithMask = MEAN;
    274274    float realUQWithMask = MEAN;
    275     int realN50WithMask = N / 4;
    276     int realNfitWithMask = N / 4;
     275    psS32 realN50WithMask = N / 4;
     276    psS32 realNfitWithMask = N / 4;
    277277
    278278    psTraceSetLevel(".psLib.dataManip.psStats", 10);
     
    487487}
    488488
    489 int main()
     489psS32 main()
    490490{
    491491    t00();
  • trunk/psLib/test/dataManip/tst_psStats08.c

    r1811 r2204  
    1313#define N (8 * N1) // Don't change this (N must be a multiple of 8)
    1414
    15 int main()
     15psS32 main()
    1616{
    1717    psStats *myStats    = NULL;
    18     int testStatus      = true;
    19     int globalTestStatus = true;
    20     int i               = 0;
     18    psS32 testStatus      = true;
     19    psS32 globalTestStatus = true;
     20    psS32 i               = 0;
    2121    psVector *myVector  = NULL;
    2222    psVector *maskVector= NULL;
     
    2828    float realLQWithMask   = N/8.0;
    2929    float realUQWithMask   = 3.0 * (N/8.0);
    30     int count           = 0;
    31     int currentId       = psMemGetId();
    32     int memLeaks        = 0;
     30    psS32 count           = 0;
     31    psS32 currentId       = psMemGetId();
     32    psS32 memLeaks        = 0;
    3333
    3434    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psStats09.c

    r1811 r2204  
    1616#define MY_RANGE 2.0
    1717
    18 int main()
     18psS32 main()
    1919{
    2020    psStats *myStats    = NULL;
    21     int testStatus      = true;
    22     int globalTestStatus = true;
    23     int i               = 0;
     21    psS32 testStatus      = true;
     22    psS32 globalTestStatus = true;
     23    psS32 i               = 0;
    2424    psVector *maskVector= NULL;
    2525    psVector *myGaussData  = NULL;
     
    3131    //    float realclippedMeanWithMask  = 0.0;
    3232    //    float realclippedStdevWithMask = 0.0;
    33     int count           = 0;
    34     int currentId       = psMemGetId();
    35     int memLeaks        = 0;
     33    psS32 count           = 0;
     34    psS32 currentId       = psMemGetId();
     35    psS32 memLeaks        = 0;
    3636
    3737    /*************************************************************************/
  • trunk/psLib/test/dataManip/tst_psVectorFFT.c

    r1406 r2204  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-08-06 22:34:06 $
     8*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-10-27 00:57:33 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#define GENIMAGE(img,c,r,TYP, valueFcn) \
    2121img = psImageAlloc(c,r,PS_TYPE_##TYP); \
    22 for (unsigned int row=0;row<r;row++) { \
     22for (psU32 row=0;row<r;row++) { \
    2323    ps##TYP* imgRow = img->data.TYP[row]; \
    24     for (unsigned int col=0;col<c;col++) { \
     24    for (psU32 col=0;col<c;col++) { \
    2525        imgRow[col] = (ps##TYP)(valueFcn); \
    2626    } \
    2727}
    2828
    29 static int testVectorFFT( void );
    30 static int testVectorRealImaginary( void );
    31 static int testVectorComplex( void );
    32 static int testVectorConjugate( void );
    33 static int testVectorPowerSpectrum( void );
     29static psS32 testVectorFFT( void );
     30static psS32 testVectorRealImaginary( void );
     31static psS32 testVectorComplex( void );
     32static psS32 testVectorConjugate( void );
     33static psS32 testVectorPowerSpectrum( void );
    3434
    3535testDescription tests[] = {
     
    5454                          };
    5555
    56 int main( int argc, char* argv[] )
     56psS32 main( psS32 argc, char* argv[] )
    5757{
    5858    psLogSetLevel( PS_LOG_INFO );
     
    6161}
    6262
    63 int testVectorFFT( void )
     63psS32 testVectorFFT( void )
    6464{
    6565    psVector * vec = NULL;
     
    7878    vec = psVectorAlloc( 100, PS_TYPE_F32 );
    7979    vec->n = vec->nalloc;
    80     for ( unsigned int n = 0; n < 100; n++ ) {
     80    for ( psU32 n = 0; n < 100; n++ ) {
    8181        vec->data.F32[ n ] = sinf( ( psF32 ) n / 50.0f * M_PI );
    8282    }
     
    9191
    9292    // 3. verify that the only significant component cooresponds to the freqency of the input in step 1.
    93     for ( unsigned int n = 0; n < 100; n++ ) {
     93    for ( psU32 n = 0; n < 100; n++ ) {
    9494        if ( n == 1 || n == 99 ) {
    9595            if ( fabsf( cabsf( vec2->data.C32[ n ] ) - 50.0f ) > 0.1f ) {
     
    111111        return 4;
    112112    }
    113     for ( unsigned int n = 0; n < 100; n++ ) {
     113    for ( psU32 n = 0; n < 100; n++ ) {
    114114        psF32 val = sinf( ( psF32 ) n / 50.0f * M_PI );
    115115        psF32 vecVal = crealf( vec3->data.C32[ n ] ) / 100;
     
    128128}
    129129
    130 int testVectorRealImaginary( void )
     130psS32 testVectorRealImaginary( void )
    131131{
    132132    psVector * vec = NULL;
     
    143143    vec = psVectorAlloc( 100, PS_TYPE_C32 );
    144144    vec->n = vec->nalloc;
    145     for ( unsigned int n = 0; n < 100; n++ ) {
     145    for ( psU32 n = 0; n < 100; n++ ) {
    146146        vec->data.C32[ n ] = n + I * ( n * 2 );
    147147    }
     
    171171
    172172    // 3. compare results to the real/imaginary components of input
    173     for ( unsigned int n = 0; n < 100; n++ ) {
     173    for ( psU32 n = 0; n < 100; n++ ) {
    174174        psF32 r = n;
    175175        psF32 i = ( n * 2 );
     
    193193}
    194194
    195 int testVectorComplex( void )
     195psS32 testVectorComplex( void )
    196196{
    197197    psVector * vec = NULL;
     
    220220    vec->n = vec->nalloc;
    221221    vec2->n = vec2->nalloc;
    222     for ( unsigned int n = 0; n < 100; n++ ) {
     222    for ( psU32 n = 0; n < 100; n++ ) {
    223223        vec->data.F32[ n ] = n;
    224224        vec2->data.F32[ n ] = ( n * 2 );
     
    237237    // 4. call psVectorReal and psVectorImaginary on step 2 results (not needed, just use crealf/cimagf)
    238238    // 5. compare step 4 results to input.
    239     for ( unsigned int n = 0; n < 100; n++ ) {
     239    for ( psU32 n = 0; n < 100; n++ ) {
    240240        if ( fabsf( crealf( vec3->data.C32[ n ] ) - n ) > FLT_EPSILON ||
    241241                fabsf( cimagf( vec3->data.C32[ n ] ) - ( n * 2 ) ) > FLT_EPSILON ) {
     
    278278}
    279279
    280 int testVectorConjugate( void )
     280psS32 testVectorConjugate( void )
    281281{
    282282    psVector * vec = NULL;
     
    293293    vec = psVectorAlloc( 100, PS_TYPE_C32 );
    294294    vec->n = vec->nalloc;
    295     for ( unsigned int n = 0; n < 100; n++ ) {
     295    for ( psU32 n = 0; n < 100; n++ ) {
    296296        vec->data.C32[ n ] = n + I * ( n * 2 );
    297297    }
     
    307307
    308308    // 4. verify each value is conjugate of input (a+bi -> a-bi)
    309     for ( unsigned int n = 0; n < 100; n++ ) {
     309    for ( psU32 n = 0; n < 100; n++ ) {
    310310        if ( fabsf( crealf( vec->data.C32[ n ] ) - crealf( vec2->data.C32[ n ] ) ) > FLT_EPSILON ||
    311311                fabsf( cimagf( vec->data.C32[ n ] ) + cimagf( vec2->data.C32[ n ] ) ) > FLT_EPSILON ) {
     
    322322}
    323323
    324 int testVectorPowerSpectrum( void )
     324psS32 testVectorPowerSpectrum( void )
    325325{
    326326    psVector * vec = NULL;
     
    338338    vec = psVectorAlloc( 100, PS_TYPE_C32 );
    339339    vec->n = vec->nalloc;
    340     for ( unsigned int n = 0; n < 100; n++ ) {
     340    for ( psU32 n = 0; n < 100; n++ ) {
    341341        vec->data.C32[ n ] = n + I * sinf( ( ( psF32 ) n ) / 50.f * M_PI );
    342342    }
     
    365365    };
    366366
    367     for ( unsigned int n = 1; n < 50; n++ ) {
     367    for ( psU32 n = 1; n < 50; n++ ) {
    368368        val = ( cabsf( vec->data.C32[ n ] ) * cabsf( vec->data.C32[ n ] ) +
    369369                cabsf( vec->data.C32[ 100 - n ] ) * cabsf( vec->data.C32[ 100 - n ] ) ) / 100 / 100;
  • trunk/psLib/test/image/tst_psImage.c

    r1929 r2204  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-29 20:17:58 $
     8 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:33 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121#include "psType.h"
    2222
    23 static int testImageAlloc(void);
    24 static int testImageCopy(void);
     23static psS32 testImageAlloc(void);
     24static psS32 testImageCopy(void);
    2525
    2626testDescription tests[] = {
     
    3131                          };
    3232
    33 int main(int argc, char* argv[])
     33psS32 main(psS32 argc, char* argv[])
    3434{
    3535    psLogSetLevel(PS_LOG_INFO);
     
    3838}
    3939
    40 int testImageAlloc(void)
     40psS32 testImageAlloc(void)
    4141{
    4242    psImage* image = NULL;
    43     unsigned int sizes = 6;
    44     unsigned int numCols[] = {
    45                                  0,1,1,100,100,150
    46                              };
    47     unsigned int numRows[] = {
    48                                  0,1,100,1,150,100
    49                              };
    50     unsigned int types = 13;
     43    psU32 sizes = 6;
     44    psU32 numCols[] = {
     45                          0,1,1,100,100,150
     46                      };
     47    psU32 numRows[] = {
     48                          0,1,100,1,150,100
     49                      };
     50    psU32 types = 13;
    5151    psElemType type[] = { PS_TYPE_S8, PS_TYPE_S16, PS_TYPE_S32, PS_TYPE_S64,
    5252                          PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_U32, PS_TYPE_U64,
     
    5656    psLogMsg(__func__,PS_LOG_INFO,"#546 - psImageAlloc shall allocate memory for a psImage structure");
    5757
    58     for (unsigned int t=0;t<types;t++) {
     58    for (psU32 t=0;t<types;t++) {
    5959        psLogMsg(__func__,PS_LOG_INFO,"Testing psImage with type %xh",type[t]);
    6060
    61         for (unsigned int i=0;i<sizes;i++) {
     61        for (psU32 i=0;i<sizes;i++) {
    6262
    6363            if (numRows[i] == 0 || numCols[i] == 0) {
     
    112112            switch (type[t]) {
    113113            case PS_TYPE_U16: {
    114                     unsigned int rows = numRows[i];
    115                     unsigned int cols = numCols[i];
    116 
    117                     for (int r=0;r<rows;r++) {
    118                         for (int c=0;c<cols;c++) {
     114                    psU32 rows = numRows[i];
     115                    psU32 cols = numCols[i];
     116
     117                    for (psS32 r=0;r<rows;r++) {
     118                        for (psS32 c=0;c<cols;c++) {
    119119                            image->data.U16[r][c] = 2*c+r;
    120120                        }
    121121                    }
    122                     for (int r=0;r<rows;r++) {
    123                         for (int c=0;c<cols;c++) {
     122                    for (psS32 r=0;r<rows;r++) {
     123                        for (psS32 c=0;c<cols;c++) {
    124124                            if (image->data.U16[r][c] != 2*c+r) {
    125125                                psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r);
     
    132132                break;
    133133            case PS_TYPE_F32: {
    134                     unsigned int rows = numRows[i];
    135                     unsigned int cols = numCols[i];
    136 
    137                     for (int r=0;r<rows;r++) {
    138                         for (int c=0;c<cols;c++) {
     134                    psU32 rows = numRows[i];
     135                    psU32 cols = numCols[i];
     136
     137                    for (psS32 r=0;r<rows;r++) {
     138                        for (psS32 c=0;c<cols;c++) {
    139139                            image->data.F32[r][c] = 2.0f*c+r;
    140140                        }
    141141                    }
    142                     for (int r=0;r<rows;r++) {
    143                         for (int c=0;c<cols;c++) {
     142                    for (psS32 r=0;r<rows;r++) {
     143                        for (psS32 c=0;c<cols;c++) {
    144144                            if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) {
    145145                                psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r);
     
    152152                break;
    153153            case PS_TYPE_F64: {
    154                     unsigned int rows = numRows[i];
    155                     unsigned int cols = numCols[i];
    156 
    157                     for (int r=0;r<rows;r++) {
    158                         for (int c=0;c<cols;c++) {
     154                    psU32 rows = numRows[i];
     155                    psU32 cols = numCols[i];
     156
     157                    for (psS32 r=0;r<rows;r++) {
     158                        for (psS32 c=0;c<cols;c++) {
    159159                            image->data.F64[r][c] = 2.0f*c+r;
    160160                        }
    161161                    }
    162                     for (int r=0;r<rows;r++) {
    163                         for (int c=0;c<cols;c++) {
     162                    for (psS32 r=0;r<rows;r++) {
     163                        for (psS32 c=0;c<cols;c++) {
    164164                            if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) {
    165165                                psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r);
     
    172172                break;
    173173            case PS_TYPE_C32: {
    174                     unsigned int rows = numRows[i];
    175                     unsigned int cols = numCols[i];
    176 
    177                     for (int r=0;r<rows;r++) {
    178                         for (int c=0;c<cols;c++) {
     174                    psU32 rows = numRows[i];
     175                    psU32 cols = numCols[i];
     176
     177                    for (psS32 r=0;r<rows;r++) {
     178                        for (psS32 c=0;c<cols;c++) {
    179179                            image->data.C32[r][c] = r + I * c;
    180180                        }
    181181                    }
    182                     for (int r=0;r<rows;r++) {
    183                         for (int c=0;c<cols;c++) {
     182                    for (psS32 r=0;r<rows;r++) {
     183                        for (psS32 c=0;c<cols;c++) {
    184184                            if (fabsf(crealf(image->data.C32[r][c]) - r) > FLT_EPSILON ||
    185185                                    fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) {
     
    193193                break;
    194194            case PS_TYPE_PTR: {
    195                     unsigned int rows = numRows[i];
    196                     unsigned int cols = numCols[i];
     195                    psU32 rows = numRows[i];
     196                    psU32 cols = numCols[i];
    197197                    psImage* temp = psImageAlloc(1,1,PS_TYPE_F32);
    198198
    199                     for (int r=0;r<rows;r++) {
    200                         for (int c=0;c<cols;c++) {
     199                    for (psS32 r=0;r<rows;r++) {
     200                        for (psS32 c=0;c<cols;c++) {
    201201                            image->data.PTR[r][c] = psMemIncrRefCounter(temp);
    202202                        }
    203203                    }
    204                     for (int r=0;r<rows;r++) {
    205                         for (int c=0;c<cols;c++) {
     204                    for (psS32 r=0;r<rows;r++) {
     205                        for (psS32 c=0;c<cols;c++) {
    206206                            if (image->data.PTR[r][c] != temp) {
    207207                                psError(__func__, "Could not set pixel in pointer image at (%d,%d): %x %x",
     
    218218            default: {
    219219                    // ignore type and just use as byte bucket.
    220                     unsigned int rows = numRows[i];
    221                     unsigned int cols = numCols[i]*PSELEMTYPE_SIZEOF(type[t]);
    222 
    223                     for (int r=0;r<rows;r++) {
    224                         for (int c=0;c<cols;c++) {
     220                    psU32 rows = numRows[i];
     221                    psU32 cols = numCols[i]*PSELEMTYPE_SIZEOF(type[t]);
     222
     223                    for (psS32 r=0;r<rows;r++) {
     224                        for (psS32 c=0;c<cols;c++) {
    225225                            image->data.U8[r][c] = (uint8_t)(r + c);
    226226                        }
    227227                    }
    228                     for (int r=0;r<rows;r++) {
    229                         for (int c=0;c<cols;c++) {
     228                    for (psS32 r=0;r<rows;r++) {
     229                        for (psS32 c=0;c<cols;c++) {
    230230                            if (image->data.U8[r][c] != (uint8_t)(r + c)) {
    231231                                psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)",
     
    253253}
    254254
    255 int testImageCopy(void)
     255psS32 testImageCopy(void)
    256256{
    257257    psImage* img = NULL;
     
    259259    psImage* img3 = NULL;
    260260    psImage* img4 = NULL;
    261     unsigned int c = 128;
    262     unsigned int r = 256;
     261    psU32 c = 128;
     262    psU32 r = 256;
    263263
    264264    img = psImageAlloc(c,r,PS_TYPE_F32);
     
    296296        return 4;
    297297    }
    298     for (unsigned int row=0;row<r;row++) {
     298    for (psU32 row=0;row<r;row++) {
    299299        psF32* imgInRow = img->data.F32[row];
    300300        psF32* imgOutRow = img4->data.F32[row];
     
    324324        return 2; \
    325325    } \
    326     for (unsigned int row=0;row<r;row++) { \
     326    for (psU32 row=0;row<r;row++) { \
    327327        ps##IN* imgRow = img->data.IN[row]; \
    328328        ps##OUT* img2Row = img2->data.OUT[row]; \
    329         for (unsigned int col=0;col<c;col++) { \
     329        for (psU32 col=0;col<c;col++) { \
    330330            if (abs(imgRow[col] - (ps##IN)(row+col)) > 0.5) { \
    331331                psError(__func__,"Input image was changed at %d,%d!", \
  • trunk/psLib/test/image/tst_psImageConvolve.c

    r2068 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-13 01:22:38 $
     7 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:33 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psType.h"
    2121
    22 static int testKernelAlloc(void);
    23 static int testKernelGenerate(void);
    24 //static int testImageConvolve(void);
     22static psS32 testKernelAlloc(void);
     23static psS32 testKernelGenerate(void);
     24//static psS32 testImageConvolve(void);
    2525
    2626testDescription tests[] = {
     
    3131                          };
    3232
    33 int main(int argc, char* argv[])
     33psS32 main(psS32 argc, char* argv[])
    3434{
    3535    psLogSetLevel(PS_LOG_INFO);
     
    3838}
    3939
    40 static int testKernelAlloc(void)
     40static psS32 testKernelAlloc(void)
    4141{
    42     int numCases = 4;
    43     int xMin[] = { -5,  0,-10,  5};
    44     int xMax[] = {  0,  5, -5, 10};
    45     int yMin[] = { -4,  0, -8,  4};
    46     int yMax[] = {  0,  4, -4,  8};
    47     int i;
     42    psS32 numCases = 4;
     43    psS32 xMin[] = { -5,  0,-10,  5};
     44    psS32 xMax[] = {  0,  5, -5, 10};
     45    psS32 yMin[] = { -4,  0, -8,  4};
     46    psS32 yMax[] = {  0,  4, -4,  8};
     47    psS32 i;
    4848    psKernel* k;
    4949
     
    7373        }
    7474
    75         for (int j=yMin[i]; j<yMax[i]; j++) {
     75        for (psS32 j=yMin[i]; j<yMax[i]; j++) {
    7676            if (k->kernel[j]+xMin[i] != k->image->data.PS_TYPE_KERNEL_DATA[j-yMin[i]]) {
    7777                psError(__func__,"The kernel pointer was set wrong for row %d.",
     
    115115}
    116116
    117 static int testKernelGenerate(void)
     117static psS32 testKernelGenerate(void)
    118118{
    119     int size = 4;
    120     int t[] = { 1, 2, 8, 10 };
    121     int x[] = { 0, 1, 0, -1 };
    122     int y[] = { 2, 1, -1, -2 };
     119    psS32 size = 4;
     120    psS32 t[] = { 1, 2, 8, 10 };
     121    psS32 x[] = { 0, 1, 0, -1 };
     122    psS32 y[] = { 2, 1, -1, -2 };
    123123    psKernelType sum;
    124124
     
    127127    psVector* tVec = psVectorAlloc(size,PS_TYPE_U32);
    128128
    129     for (int i = 0; i < size; i++) {
     129    for (psS32 i = 0; i < size; i++) {
    130130        xVec->data.U32[i] = x[i];
    131131        yVec->data.U32[i] = y[i];
     
    148148
    149149    sum = 0.0;
    150     for (int y = result->yMin; y <= result->yMax; y++) {
    151         for (int x = result->xMin; x <= result->xMax; x++) {
     150    for (psS32 y = result->yMin; y <= result->yMax; y++) {
     151        for (psS32 x = result->xMin; x <= result->xMax; x++) {
    152152            sum += result->kernel[y][x];
    153153        }
     
    182182    tVec = psVectorAlloc(size,PS_TYPE_S16);
    183183
    184     for (int i = 0; i < size; i++) {
     184    for (psS32 i = 0; i < size; i++) {
    185185        xVec->data.S16[i] = x[i];
    186186        yVec->data.S16[i] = y[i];
     
    203203
    204204    sum = 0.0;
    205     for (int y = result->yMin; y <= result->yMax; y++) {
    206         for (int x = result->xMin; x <= result->xMax; x++) {
     205    for (psS32 y = result->yMin; y <= result->yMax; y++) {
     206        for (psS32 x = result->xMin; x <= result->xMax; x++) {
    207207            sum += result->kernel[y][x];
    208208        }
     
    236236    tVec = psVectorAlloc(size,PS_TYPE_F32);
    237237
    238     for (int i = 0; i < size; i++) {
     238    for (psS32 i = 0; i < size; i++) {
    239239        xVec->data.F32[i] = x[i]+0.1;
    240240        yVec->data.F32[i] = y[i]+0.2;
     
    291291
    292292/*
    293 static int testImageConvolve(void)
     293static psS32 testImageConvolve(void)
    294294{
    295     const int r = 200;
    296     const int c = 300;
    297     int sum;
     295    const psS32 r = 200;
     296    const psS32 c = 300;
     297    psS32 sum;
    298298 
    299299    // approximate a normalized gaussian kernel.
     
    312312    psKernel* nsk = psKernelAlloc(0,2,0,2);
    313313    sum = 0.0;
    314     for (int i=0;i<2;i++) {
    315         for (int j=0;j<2;j++) {
     314    for (psS32 i=0;i<2;i++) {
     315        for (psS32 j=0;j<2;j++) {
    316316            nsk->kernel[i][j] = i+j;
    317317            sum = i+j;
    318318        }
    319319    }
    320     for (int i=0;i<2;i++) {
    321         for (int j=0;j<2;j++) {
     320    for (psS32 i=0;i<2;i++) {
     321        for (psS32 j=0;j<2;j++) {
    322322            nsk->kernel[i][j] /= sum;
    323323        }
     
    356356 
    357357    // test values
    358     for (int i=-1;i<1;i++) {
    359         for (int j=-1;j<1;j++) {
     358    for (psS32 i=-1;i<1;i++) {
     359        for (psS32 j=-1;j<1;j++) {
    360360            if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) {
    361361                psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     
    423423    psImageWriteSection(out2,0,0,0,NULL,0,"out2.fits");
    424424    // test values
    425     for (int i=-1;i<1;i++) {
    426         for (int j=-1;j<1;j++) {
     425    for (psS32 i=-1;i<1;i++) {
     426        for (psS32 j=-1;j<1;j++) {
    427427            if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) {
    428428                psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
  • trunk/psLib/test/image/tst_psImageExtraction.c

    r2156 r2204  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-10-15 20:00:56 $
     8*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-10-27 00:57:33 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include "psType.h"
    1919
    20 static int testImageSlice(void);
    21 static int testImageSubset(void);
    22 static int testImageSubsection(void);
    23 static int testImageTrim(void);
    24 static int testImageCut(void);
    25 static int testImageRadialCut(void);
     20static psS32 testImageSlice(void);
     21static psS32 testImageSubset(void);
     22static psS32 testImageSubsection(void);
     23static psS32 testImageTrim(void);
     24static psS32 testImageCut(void);
     25static psS32 testImageRadialCut(void);
    2626
    2727
     
    3737                          };
    3838
    39 int main( int argc, char* argv[] )
     39psS32 main( psS32 argc, char* argv[] )
    4040{
    4141    return ! runTestSuite( stderr, "psImage", tests, argc, argv );
    4242}
    4343
    44 int testImageSlice(void)
     44psS32 testImageSlice(void)
    4545{
    46     const int r = 200;
    47     const int c = 300;
    48     const int m = r / 2 -1;
    49     const int n = r / 4 -1;
     46    const psS32 r = 200;
     47    const psS32 c = 300;
     48    const psS32 m = r / 2 -1;
     49    const psS32 n = r / 4 -1;
    5050    psVector* out = NULL;
    5151    psImage* image;
     
    6868     */
    6969
    70     for ( int row = 0;row < r;row++ ) {
     70    for ( psS32 row = 0;row < r;row++ ) {
    7171        psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row];
    72         for ( int col = 0;col < c;col++ ) {
     72        for ( psS32 col = 0;col < c;col++ ) {
    7373            maskRow[ col ] = 0;
    7474        }
     
    7777    #define PSIMAGESLICE_TEST1(TYPE,M,N,DIRECTION,TRUTH_SIZE,TRUTHPIX_X,TRUTHPIX_Y,TESTNUM) \
    7878    image = psImageAlloc( c, r, PS_TYPE_##TYPE ); \
    79     for ( int row = 0;row < r;row++ ) { \
     79    for ( psS32 row = 0;row < r;row++ ) { \
    8080        ps##TYPE *imageRow = image->data.TYPE[ row ]; \
    8181        ps##TYPE rowOffset = row * 2; \
    82         for ( int col = 0;col < c;col++ ) { \
     82        for ( psS32 col = 0;col < c;col++ ) { \
    8383            imageRow[ col ] = col + rowOffset; \
    8484        } \
     
    9898    } \
    9999    \
    100     for (int i=0;i<out->n;i++) { \
     100    for (psS32 i=0;i<out->n;i++) { \
    101101        if (fabs(out->data.F64[i]-image->data.TYPE[r/10+TRUTHPIX_Y][c/10+TRUTHPIX_X]) > 1.0/(psF64)r) { \
    102102            psError(__func__,"Improper result at position %d.  Got %g, expected %g",i, \
     
    363363
    364364// #547: psImageSubset shall create child image of a specified size from a parent psImage structure
    365 int testImageSubset(void)
     365psS32 testImageSubset(void)
    366366{
    367367    psImage preSubsetStruct;
     
    370370    psImage* subset2 = NULL;
    371371    psImage* subset3 = NULL;
    372     int c = 128;
    373     int r = 256;
     372    psS32 c = 128;
     373    psS32 r = 256;
    374374
    375375    original = psImageAlloc(c,r,PS_TYPE_U32);
    376     for (int row=0;row<r;row++) {
    377         for (int col=0;col<c;col++) {
     376    for (psS32 row=0;row<r;row++) {
     377        for (psS32 col=0;col<c;col++) {
    378378            original->data.F32[row][col] = row*1000+col;
    379379        }
     
    404404             "row member, if the input psImage structure image contains known values.");
    405405
    406     for (int row=0;row<r/2;row++) {
    407         for (int col=0;col<c/2;col++) {
     406    for (psS32 row=0;row<r/2;row++) {
     407        for (psS32 col=0;col<c/2;col++) {
    408408            if (subset2->data.U32[row][col] != original->data.U32[row+r/4][col+c/4]) {
    409409                psError(__func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).",
     
    596596
    597597// #730: psImageSubsection shall create child image of a specified size from a parent psImage structure
    598 int testImageSubsection(void)
     598psS32 testImageSubsection(void)
    599599{
    600600    psImage* original;
    601601    psImage* subset;
    602     int c = 128;
    603     int r = 256;
    604     int i;
    605     int numRegions = 4;
    606     int x1[] = {  0, 32, 64, 32};
    607     int x2[] = { 32, 64,127, 64};
    608     int y1[] = {  0, 32, 32,128};
    609     int y2[] = { 32, 64, 64,255};
     602    psS32 c = 128;
     603    psS32 r = 256;
     604    psS32 i;
     605    psS32 numRegions = 4;
     606    psS32 x1[] = {  0, 32, 64, 32};
     607    psS32 x2[] = { 32, 64,127, 64};
     608    psS32 y1[] = {  0, 32, 32,128};
     609    psS32 y2[] = { 32, 64, 64,255};
    610610
    611611    original = psImageAlloc(c,r,PS_TYPE_U32);
    612     for (int row=0;row<r;row++) {
    613         for (int col=0;col<c;col++) {
     612    for (psS32 row=0;row<r;row++) {
     613        for (psS32 col=0;col<c;col++) {
    614614            original->data.F32[row][col] = row*1000+col;
    615615        }
     
    664664        }
    665665
    666         int numCols = x2[i]-x1[i]+1;
    667         int numRows = y2[i]-y1[i]+1;
     666        psS32 numCols = x2[i]-x1[i]+1;
     667        psS32 numRows = y2[i]-y1[i]+1;
    668668        if (subset->numCols != numCols || subset->numRows != numRows) {
    669669            psError(__func__,"psImageSubsection output size was not proper(%dx%d, should be %dx%d).",
     
    672672        }
    673673
    674         for (int row=0;row<numRows;row++) {
    675             for (int col=0;col<numCols;col++) {
     674        for (psS32 row=0;row<numRows;row++) {
     675            for (psS32 col=0;col<numCols;col++) {
    676676                if (subset->data.U32[row][col] != original->data.U32[row+y1[i]][col+x1[i]]) {
    677677                    psError(__func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).",
     
    751751}
    752752
    753 static int testImageTrim(void)
     753static psS32 testImageTrim(void)
    754754{
    755     int r = 200;
    756     int c = 300;
    757     int qtrR = r/4;
    758     int qtrC = c/4;
    759     int halfR = r/2;
    760     int halfC = c/2;
     755    psS32 r = 200;
     756    psS32 c = 300;
     757    psS32 qtrR = r/4;
     758    psS32 qtrC = c/4;
     759    psS32 halfR = r/2;
     760    psS32 halfC = c/2;
    761761
    762762    psImage* image = psImageAlloc(c,r,PS_TYPE_F32);
    763     for (int row = 0; row < image->numRows; row++) {
    764         for (int col = 0; col < image->numCols; col++) {
     763    for (psS32 row = 0; row < image->numRows; row++) {
     764        for (psS32 col = 0; col < image->numCols; col++) {
    765765            image->data.F32[row][col] = (psF32)col + (psF32)row/1000.0f;
    766766        }
     
    792792    }
    793793
    794     for (int row = 0; row < image2->numRows; row++) {
    795         for (int col = 0; col < image2->numCols; col++) {
     794    for (psS32 row = 0; row < image2->numRows; row++) {
     795        for (psS32 col = 0; col < image2->numCols; col++) {
    796796            if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) {
    797797                psLogMsg(__func__,PS_LOG_ERROR,
     
    830830    }
    831831
    832     for (int row = 0; row < image2->numRows; row++) {
    833         for (int col = 0; col < image2->numCols; col++) {
     832    for (psS32 row = 0; row < image2->numRows; row++) {
     833        for (psS32 col = 0; col < image2->numCols; col++) {
    834834            if (fabsf(image2->data.F32[row][col] -
    835835                      image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) {
     
    869869    }
    870870
    871     for (int row = 0; row < image2->numRows; row++) {
    872         for (int col = 0; col < image2->numCols; col++) {
     871    for (psS32 row = 0; row < image2->numRows; row++) {
     872        for (psS32 col = 0; col < image2->numCols; col++) {
    873873            if (fabsf(image2->data.F32[row][col] -
    874874                      image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) {
     
    10141014}
    10151015
    1016 static int testImageCut(void)
     1016static psS32 testImageCut(void)
    10171017{
    1018     int c = 300;
    1019     int r = 200;
    1020     int numPoints = 15;
     1018    psS32 c = 300;
     1019    psS32 r = 200;
     1020    psS32 numPoints = 15;
    10211021    float startCol[] = { 40,150, 40,  0,280, 40,280, -1,300, 20, 20, 20, 20, 20, 20};
    10221022    float endCol[] =   {240,150,240,299, 40,240, 40,240,240, -1,300,240,240,240,240};
    10231023    float startRow[] = { 20, 10,100,  0, 20,180,180, 10, 10, 10, 10, -1,200, 10, 10};
    10241024    float endRow[] =   {160,180,100,199,160, 10, 10,180,180,180,180,180,180, -1,200};
    1025     bool success[] = {true,true,true,true,true,true,true,false,false,false,false,false,false,false,false};
    1026     unsigned int length = 100;
     1025    psBool success[] = {true,true,true,true,true,true,true,false,false,false,false,false,false,false,false};
     1026    psU32 length = 100;
    10271027
    10281028    psImage* image = psImageAlloc(c,r,PS_TYPE_F32);
    10291029    psImage* mask = psImageAlloc(c,r,PS_TYPE_MASK);
    1030     for (int row = 0; row < image->numRows; row++) {
    1031         for (int col = 0; col < image->numCols; col++) {
     1030    for (psS32 row = 0; row < image->numRows; row++) {
     1031        for (psS32 col = 0; col < image->numCols; col++) {
    10321032            image->data.F32[row][col] = (psF32)col + (psF32)row/1000.0f;
    10331033            if ((row & 0x0F) == 0) {
     
    10421042
    10431043    psVector* result = NULL;
    1044     for (int n = 0; n < numPoints; n++) {
     1044    for (psS32 n = 0; n < numPoints; n++) {
    10451045        psVector* orig = result;
    10461046        if (! success[n]) {
     
    10831083            float deltaCol = (endCol[n]-startCol[n])/(length-1);
    10841084            psF32 truth;
    1085             for (int i = 0; i < length; i++) {
     1085            for (psS32 i = 0; i < length; i++) {
    10861086                float x = (float)startCol[n]+(float)i*deltaCol;
    10871087                float y = (float)startRow[n]+(float)i*deltaRow;
     
    11771177}
    11781178
    1179 static int testImageRadialCut(void)
     1179static psS32 testImageRadialCut(void)
    11801180{
    1181     int c = 300;
    1182     int r = 200;
    1183     int centerX = c/2;
    1184     int centerY = r/2;
     1181    psS32 c = 300;
     1182    psS32 r = 200;
     1183    psS32 centerX = c/2;
     1184    psS32 centerY = r/2;
    11851185    psErr* err = NULL;
    11861186
    11871187    psImage* image = psImageAlloc(c,r,PS_TYPE_F32);
    11881188    psImage* mask = psImageAlloc(c,r,PS_TYPE_MASK);
    1189     for (int row = 0; row < image->numRows; row++) {
    1190         for (int col = 0; col < image->numCols; col++) {
     1189    for (psS32 row = 0; row < image->numRows; row++) {
     1190        for (psS32 col = 0; col < image->numCols; col++) {
    11911191            image->data.F32[row][col] = sqrtf((col-centerX)*(col-centerX)+(row-centerY)*(row-centerY));
    11921192            if ((row & 0x0F) == 0) {
     
    12001200    psStats* stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    12011201    psVector* radii = psVectorAlloc(10,PS_TYPE_F32);
    1202     for (int i=0; i < 10; i++) {
     1202    for (psS32 i=0; i < 10; i++) {
    12031203        radii->data.F32[i] = 10+i*10;
    12041204    }
     
    12201220    }
    12211221
    1222     for (int i=0; i < 9; i++) {
     1222    for (psS32 i=0; i < 9; i++) {
    12231223        if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) {
    12241224            psLogMsg(__func__,PS_LOG_ERROR,
     
    12451245    }
    12461246
    1247     for (int i=0; i < 9; i++) {
     1247    for (psS32 i=0; i < 9; i++) {
    12481248        if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) {
    12491249            psLogMsg(__func__,PS_LOG_ERROR,
  • trunk/psLib/test/image/tst_psImageFFT.c

    r2078 r2204  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-13 19:50:12 $
     8 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:33 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020#define GENIMAGE(img,c,r,TYP, valueFcn) \
    2121img = psImageAlloc(c,r,PS_TYPE_##TYP); \
    22 for (unsigned int row=0;row<r;row++) { \
     22for (psU32 row=0;row<r;row++) { \
    2323    ps##TYP* imgRow = img->data.TYP[row]; \
    24     for (unsigned int col=0;col<c;col++) { \
     24    for (psU32 col=0;col<c;col++) { \
    2525        imgRow[col] = (ps##TYP)(valueFcn); \
    2626    } \
    2727}
    2828
    29 static int testImageFFT(void);
    30 static int testImageRealImaginary(void);
    31 static int testImageComplex(void);
    32 static int testImageConjugate(void);
    33 static int testImagePowerSpectrum(void);
     29static psS32 testImageFFT(void);
     30static psS32 testImageRealImaginary(void);
     31static psS32 testImageComplex(void);
     32static psS32 testImageConjugate(void);
     33static psS32 testImagePowerSpectrum(void);
    3434
    3535testDescription tests[] = {
     
    5454                          };
    5555
    56 int main(int argc, char* argv[])
     56psS32 main(psS32 argc, char* argv[])
    5757{
    5858    psLogSetLevel(PS_LOG_INFO);
     
    6161}
    6262
    63 int testImageFFT(void)
     63psS32 testImageFFT(void)
    6464{
    6565    psImage* img = NULL;
    6666    psImage* img2 = NULL;
    6767    psImage* img3 = NULL;
    68     unsigned int m = 128;
    69     unsigned int n = 64;
     68    psU32 m = 128;
     69    psU32 n = 64;
    7070    psImage* img4 = NULL;
    7171    psImage* img5 = NULL;
     
    9595
    9696    // 3. verify that the only significant component cooresponds to the freqency of the input in step 1.
    97     for (unsigned int row=0;row<n;row++) {
     97    for (psU32 row=0;row<n;row++) {
    9898        psC32* img2Row = img2->data.C32[row];
    99         for (unsigned int col=0;col<m;col++) {
     99        for (psU32 col=0;col<m;col++) {
    100100            psF32 mag = cabsf(img2Row[col])/m/n;
    101101            if (mag > 0.1f) {
     
    130130    }
    131131
    132     for (unsigned int row=0;row<n;row++) {
     132    for (psU32 row=0;row<n;row++) {
    133133        psC32* img3Row = img3->data.C32[row];
    134134        psF32* imgRow = img->data.F32[row];
    135         for (unsigned int col=0;col<m;col++) {
     135        for (psU32 col=0;col<m;col++) {
    136136            psF32 pixel = creal(img3Row[col])/m/n;
    137137            if (fabsf(pixel-imgRow[col]) > 0.1) {
     
    159159    }
    160160
    161     for (unsigned int row=0;row<n;row++) {
     161    for (psU32 row=0;row<n;row++) {
    162162        psF32* img3Row = img3->data.F32[row];
    163163        psF32* imgRow = img->data.F32[row];
    164         for (unsigned int col=0;col<m;col++) {
     164        for (psU32 col=0;col<m;col++) {
    165165            psF32 pixel = img3Row[col]/m/n;
    166166            if (fabsf(pixel-imgRow[col]) > 0.1) {
     
    209209}
    210210
    211 int testImageRealImaginary(void)
     211psS32 testImageRealImaginary(void)
    212212{
    213213    psImage* img = NULL;
    214214    psImage* img2 = NULL;
    215215    psImage* img3 = NULL;
    216     unsigned int m = 128;
    217     unsigned int n = 64;
     216    psU32 m = 128;
     217    psU32 n = 64;
    218218
    219219    /*
     
    250250
    251251    // 3. compare results to the real/imaginary components of input
    252     for (unsigned int row=0;row<n;row++) {
     252    for (psU32 row=0;row<n;row++) {
    253253        psF32* img2Row = img2->data.F32[row];
    254254        psF32* img3Row = img3->data.F32[row];
    255         for (unsigned int col=0;col<m;col++) {
     255        for (psU32 col=0;col<m;col++) {
    256256            if (fabsf(img2Row[col] - row) > FLT_EPSILON) {
    257257                psError(__func__,"psImageReal didn't return the real portion at n=%d",
     
    274274}
    275275
    276 int testImageComplex(void)
     276psS32 testImageComplex(void)
    277277{
    278278    psImage* img = NULL;
    279279    psImage* img2 = NULL;
    280280    psImage* img3 = NULL;
    281     unsigned int m = 128;
    282     unsigned int n = 64;
     281    psU32 m = 128;
     282    psU32 n = 64;
    283283
    284284    /*
     
    314314    // 4. call psImageReal and psImageImaginary on step 2 results (not needed, just use crealf/cimagf)
    315315    // 5. compare step 4 results to input.
    316     for (unsigned int row=0;row<n;row++) {
     316    for (psU32 row=0;row<n;row++) {
    317317        psC32* img3Row = img3->data.C32[row];
    318         for (unsigned int col=0;col<m;col++) {
     318        for (psU32 col=0;col<m;col++) {
    319319            if (fabsf(crealf(img3Row[col]) - row) > FLT_EPSILON ||
    320320                    fabsf(cimagf(img3Row[col]) - col) > FLT_EPSILON) {
     
    358358}
    359359
    360 int testImageConjugate(void)
     360psS32 testImageConjugate(void)
    361361{
    362362    psImage* img = NULL;
    363363    psImage* img2 = NULL;
    364     unsigned int m = 128;
    365     unsigned int n = 64;
     364    psU32 m = 128;
     365    psU32 n = 64;
    366366
    367367    /*
     
    385385
    386386    // 4. verify each value is conjugate of input (a+bi -> a-bi)
    387     for (unsigned int row=0;row<n;row++) {
     387    for (psU32 row=0;row<n;row++) {
    388388        psC32* img2Row = img2->data.C32[row];
    389         for (unsigned int col=0;col<m;col++) {
     389        for (psU32 col=0;col<m;col++) {
    390390            if (fabsf(crealf(img2Row[col]) - row) > FLT_EPSILON ||
    391391                    fabsf(cimagf(img2Row[col]) + col) > FLT_EPSILON) {
     
    403403}
    404404
    405 int testImagePowerSpectrum(void)
     405psS32 testImagePowerSpectrum(void)
    406406{
    407407    psImage* img = NULL;
    408408    psImage* img2 = NULL;
    409     unsigned int m = 128;
    410     unsigned int n = 64;
     409    psU32 m = 128;
     410    psU32 n = 64;
    411411
    412412    /*
     
    430430
    431431    // 4. verify the values are the square of the absolute values of the original
    432     for (unsigned int row=0;row<n;row++) {
     432    for (psU32 row=0;row<n;row++) {
    433433        psC32* imgRow = img->data.C32[row];
    434434        psF32* img2Row = img2->data.F32[row];
    435         for (unsigned int col=0;col<m;col++) {
     435        for (psU32 col=0;col<m;col++) {
    436436            psF32 power = cabs(imgRow[col]);
    437437            power *= power/n/n/m/m;
  • trunk/psLib/test/image/tst_psImageIO.c

    r1942 r2204  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-02 02:09:21 $
     8 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:33 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525#define GENIMAGE(img,c,r,TYP, valueFcn) \
    2626img = psImageAlloc(c,r,PS_TYPE_##TYP); \
    27 for (unsigned int row=0;row<r;row++) { \
     27for (psU32 row=0;row<r;row++) { \
    2828    ps##TYP* imgRow = img->data.TYP[row]; \
    29     for (unsigned int col=0;col<c;col++) { \
     29    for (psU32 col=0;col<c;col++) { \
    3030        imgRow[col] = (ps##TYP)(valueFcn); \
    3131    } \
    3232}
    3333
    34 static int testImageRead(void);
    35 static int testImageWrite(void);
     34static psS32 testImageRead(void);
     35static psS32 testImageWrite(void);
    3636
    3737testDescription tests[] = {
     
    4747                          };
    4848
    49 int main(int argc, char* argv[])
     49psS32 main(psS32 argc, char* argv[])
    5050{
    5151    psLogSetLevel(PS_LOG_INFO);
     
    5757}
    5858
    59 int testImageRead(void)
     59psS32 testImageRead(void)
    6060{
    61     int N = 256;
    62     int M = 128;
     61    psS32 N = 256;
     62    psS32 M = 128;
    6363    psImage* image = NULL;
    6464
     
    127127            return 6; \
    128128        } \
    129         for (unsigned int row = readN0; row < readN; row++) { \
     129        for (psU32 row = readN0; row < readN; row++) { \
    130130            ps##TYP* imgRow = img->data.TYP[row-readN0]; \
    131131            ps##TYP* img2Row = img2->data.TYP[row]; \
    132132            ps##TYP* img3Row = img3->data.TYP[row-readN0]; \
    133133            ps##TYP* img4Row = img4->data.TYP[row]; \
    134             for (unsigned int col = readM0; col < readM; col++) { \
     134            for (psU32 col = readM0; col < readM; col++) { \
    135135                if (fabsf(imgRow[col-readM0]-img2Row[col]) > FLT_EPSILON) { \
    136136                    psError(__func__,"Image changed in I/O operation at %d,%d,0 (%.2f vs %.2f) for %s", \
     
    155155            return 9; \
    156156        } \
    157         for (unsigned int row = readN0; row < readN; row++) { \
     157        for (psU32 row = readN0; row < readN; row++) { \
    158158            ps##TYP* imgRow = img->data.TYP[row-readN0]; \
    159159            ps##TYP* img2Row = img2->data.TYP[row]; \
    160160            ps##TYP* img3Row = img3->data.TYP[row-readN0]; \
    161161            ps##TYP* img4Row = img4->data.TYP[row]; \
    162             for (unsigned int col = readM0; col < readM; col++) { \
     162            for (psU32 col = readM0; col < readM; col++) { \
    163163                if (fabsf(imgRow[col-readM0]-img2Row[col]) > FLT_EPSILON) { \
    164164                    psError(__func__,"Image changed in I/O operation at %d,%d,0 (%.2f vs %.2f) for %s", \
     
    258258}
    259259
    260 int testImageWrite(void)
     260psS32 testImageWrite(void)
    261261{
    262262    psImage* img = NULL;
    263263    psImage* img2 = NULL;
    264     int m = 64;
    265     int n = 96;
     264    psS32 m = 64;
     265    psS32 n = 96;
    266266
    267267    /*
     
    318318        return 16;
    319319    }
    320     for (unsigned int row=0;row<n;row++) {
     320    for (psU32 row=0;row<n;row++) {
    321321        psF32* imgRow = img->data.F32[row];
    322         for (unsigned int col=0;col<m;col++) {
     322        for (psU32 col=0;col<m;col++) {
    323323            if (fabsf(imgRow[col] - (row+2*col)) > FLT_EPSILON) {
    324324                psError(__func__,"The image values were not overwritten at %d,%d (%.2f vs %.2f)",
  • trunk/psLib/test/image/tst_psImageManip.c

    r2105 r2204  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-14 01:22:59 $
     8 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 00:57:33 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psType.h"
    2626
    27 static int testImageClip(void);
    28 static int testImageClipNAN(void);
    29 static int testImageClipComplexRegion(void);
    30 static int testImageOverlay(void);
    31 static int testImageRebin(void);
    32 static int testImageRoll(void);
    33 static int testImageRotate(void);
    34 static int testImageShift(void);
    35 static int testImageShiftCase(int cols, int rows, float colShift,float rowShift);
    36 static int testImageResample(void);
     27static psS32 testImageClip(void);
     28static psS32 testImageClipNAN(void);
     29static psS32 testImageClipComplexRegion(void);
     30static psS32 testImageOverlay(void);
     31static psS32 testImageRebin(void);
     32static psS32 testImageRoll(void);
     33static psS32 testImageRotate(void);
     34static psS32 testImageShift(void);
     35static psS32 testImageShiftCase(psS32 cols, psS32 rows, float colShift,float rowShift);
     36static psS32 testImageResample(void);
    3737
    3838testDescription tests[] = {
     
    4949                          };
    5050
    51 int main(int argc, char* argv[])
     51psS32 main(psS32 argc, char* argv[])
    5252{
    5353    psLogSetLevel(PS_LOG_INFO);
     
    5757
    5858
    59 int testImageClip(void)
     59psS32 testImageClip(void)
    6060{
    6161    psImage* img = NULL;
    62     unsigned int c = 128;
    63     unsigned int r = 256;
     62    psU32 c = 128;
     63    psU32 r = 256;
    6464    psF64 min;
    6565    psF64 max;
    66     int numClipped = 0;
    67     int retVal;
     66    psS32 numClipped = 0;
     67    psS32 retVal;
    6868
    6969    psLogMsg(__func__,PS_LOG_INFO,
     
    9595    #define testImageClipByType(datatype) \
    9696    img = psImageAlloc(c,r,PS_TYPE_##datatype); \
    97     for (unsigned int row=0;row<r;row++) { \
     97    for (psU32 row=0;row<r;row++) { \
    9898        ps##datatype* imgRow = img->data.datatype[row]; \
    99         for (unsigned int col=0;col<c;col++) { \
     99        for (psU32 col=0;col<c;col++) { \
    100100            imgRow[col] = (ps##datatype)(row+col); \
    101101        } \
     
    107107    \
    108108    numClipped = 0; \
    109     for (unsigned int row=0;row<r;row++) { \
     109    for (psU32 row=0;row<r;row++) { \
    110110        ps##datatype* imgRow = img->data.datatype[row]; \
    111         for (unsigned int col=0;col<c;col++) { \
     111        for (psU32 col=0;col<c;col++) { \
    112112            ps##datatype value = (ps##datatype)(row+col); \
    113113            if (value < min) { \
     
    134134    #define testImageClipByComplexType(datatype) \
    135135    img = psImageAlloc(c,r,PS_TYPE_##datatype); \
    136     for (unsigned int row=0;row<r;row++) { \
     136    for (psU32 row=0;row<r;row++) { \
    137137        ps##datatype* imgRow = img->data.datatype[row]; \
    138         for (unsigned int col=0;col<c;col++) { \
     138        for (psU32 col=0;col<c;col++) { \
    139139            imgRow[col] = (ps##datatype)(row+I*col); \
    140140        } \
     
    146146    \
    147147    numClipped = 0; \
    148     for (unsigned int row=0;row<r;row++) { \
     148    for (psU32 row=0;row<r;row++) { \
    149149        ps##datatype* imgRow = img->data.datatype[row]; \
    150         for (unsigned int col=0;col<c;col++) { \
     150        for (psU32 col=0;col<c;col++) { \
    151151            ps##datatype value = row+I*col; \
    152152            if (cabs(value) < min) { \
     
    225225}
    226226
    227 int testImageClipNAN(void)
     227psS32 testImageClipNAN(void)
    228228{
    229229    psImage* img = NULL;
    230     unsigned int c = 128;
    231     unsigned int r = 256;
    232     int numClipped = 0;
    233     int retVal;
     230    psU32 c = 128;
     231    psU32 r = 256;
     232    psS32 numClipped = 0;
     233    psS32 retVal;
    234234
    235235    psLogMsg(__func__,PS_LOG_INFO,
     
    317317}
    318318
    319 int testImageClipComplexRegion(void)
     319psS32 testImageClipComplexRegion(void)
    320320{
    321321    psImage* img = NULL;
    322     unsigned int c = 1024;
    323     unsigned int r = 2048;
    324     int numClipped = 0;
    325     int retVal;
     322    psU32 c = 1024;
     323    psU32 r = 2048;
     324    psS32 numClipped = 0;
     325    psS32 retVal;
    326326
    327327    psLogMsg(__func__,PS_LOG_INFO,
     
    581581}
    582582
    583 int testImageOverlay(void)
     583psS32 testImageOverlay(void)
    584584{
    585585
     
    588588    psImage* img3 = NULL;
    589589    psImage* img4 = NULL;
    590     unsigned int c = 128;
    591     unsigned int r = 256;
    592     int retVal;
     590    psU32 c = 128;
     591    psU32 r = 256;
     592    psS32 retVal;
    593593
    594594    /*
     
    833833}
    834834
    835 static int testImageRebin(void)
     835static psS32 testImageRebin(void)
    836836{
    837837
     
    869869    memset(meanTruthWMask->data.F32[0],0,sizeof(psF32)*4*4); \
    870870    memset(maxTruth->data.F32[0],0,sizeof(psF32)*6*6); \
    871     for (int row = 0; row<16; row++) { \
     871    for (psS32 row = 0; row<16; row++) { \
    872872        ps##DATATYPE* inRow = in->data.DATATYPE[row]; \
    873873        psF32* meanTruthRow = meanTruth->data.F32[row/4]; \
     
    875875        psF32* maxTruthRow = maxTruth->data.F32[row/3]; \
    876876        psU8* maskRow = mask->data.U8[row]; \
    877         for (int col = 0; col<16; col++) { \
     877        for (psS32 col = 0; col<16; col++) { \
    878878            if(col != 15) { \
    879879                maskRow[col] = 0; \
     
    891891        } \
    892892    } \
    893     for (int row = 0; row<4; row++) { \
     893    for (psS32 row = 0; row<4; row++) { \
    894894        psF32* meanTruthRow = meanTruth->data.F32[row]; \
    895895        psF32* meanTruthWMaskRow = meanTruthWMask->data.F32[row]; \
    896         for (int col = 0; col<4; col++) { \
     896        for (psS32 col = 0; col<4; col++) { \
    897897            meanTruthRow[col] /= 16; \
    898898            if ( col == 3 ) { \
     
    915915        return 2; \
    916916    } \
    917     for (int row = 0; row<4; row++) { \
     917    for (psS32 row = 0; row<4; row++) { \
    918918        ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
    919919        psF32* truthRow = meanTruth->data.F32[row]; \
    920         for (int col = 0; col<4; col++) { \
     920        for (psS32 col = 0; col<4; col++) { \
    921921            if (fabsf((float)outRow[col]-(float)truthRow[col]) > FLT_EPSILON) { \
    922922                psError(__func__,"psImageRebin didn't produce the proper mean " \
     
    929929    stats.options = PS_STAT_SAMPLE_MEAN; \
    930930    out3 = psImageRebin(NULL,in,mask,1,4,&stats); \
    931     for (int row = 0; row<4; row++) { \
     931    for (psS32 row = 0; row<4; row++) { \
    932932        ps##DATATYPE* outRow = out3->data.DATATYPE[row]; \
    933933        psF32* truthRow = meanTruthWMask->data.F32[row]; \
    934         for ( int col = 0; col<4; col++) { \
    935             if(abs((int)outRow[col]-(int)truthRow[col]) > FLT_EPSILON) { \
     934        for ( psS32 col = 0; col<4; col++) { \
     935            if(abs((psS32)outRow[col]-(psS32)truthRow[col]) > FLT_EPSILON) { \
    936936                psError(__func__,"psImageRebin with mask didn't produce the proper mean " \
    937937                        "result at (%d,%d) [%f vs %f].", \
     
    957957        return 5; \
    958958    } \
    959     for (int row = 0; row<6; row++) { \
     959    for (psS32 row = 0; row<6; row++) { \
    960960        ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
    961961        psF32* truthRow = maxTruth->data.F32[row]; \
    962         for (int col = 0; col<6; col++) { \
     962        for (psS32 col = 0; col<6; col++) { \
    963963            if (fabsf((float)outRow[col]-(float)truthRow[col]) > FLT_EPSILON) { \
    964964                psError(__func__,"psImageRebin didn't produce the proper " \
     
    10821082}
    10831083
    1084 static int testImageRoll(void)
     1084static psS32 testImageRoll(void)
    10851085{
    10861086
     
    10881088    psImage* out;
    10891089    psImage* out2;
    1090     int rows = 64;
    1091     int cols = 64;
    1092     int rows1 = 8;
    1093     int cols1 = 8;
     1090    psS32 rows = 64;
     1091    psS32 cols = 64;
     1092    psS32 rows1 = 8;
     1093    psS32 cols1 = 8;
    10941094
    10951095    /*
     
    11081108
    11091109    in = psImageAlloc(cols,rows,PS_TYPE_F32);
    1110     for (int row=0;row<rows;row++) {
     1110    for (psS32 row=0;row<rows;row++) {
    11111111        psF32* inRow = in->data.F32[row];
    1112         for (int col=0;col<cols;col++) {
     1112        for (psS32 col=0;col<cols;col++) {
    11131113            inRow[col] = (psF32)row+(psF32)col/1000.0f;
    11141114        }
     
    11161116
    11171117    out = psImageRoll(NULL,in,0,0);
    1118     for (int row=0;row<rows;row++) {
     1118    for (psS32 row=0;row<rows;row++) {
    11191119        psF32* inRow = in->data.F32[row];
    11201120        psF32* outRow = out->data.F32[row];
    1121         for (int col=0;col<cols;col++) {
     1121        for (psS32 col=0;col<cols;col++) {
    11221122            if (inRow[col] != outRow[col]) {
    11231123                psError(__func__,"psImageRoll didn't produce expected result "
     
    11301130
    11311131    out2 = psImageRoll(out,in,cols/4,0);
    1132     for (int row=0;row<rows;row++) {
     1132    for (psS32 row=0;row<rows;row++) {
    11331133        psF32* inRow = in->data.F32[row];
    11341134        psF32* outRow = out->data.F32[row];
    1135         for (int col=0;col<cols;col++) {
     1135        for (psS32 col=0;col<cols;col++) {
    11361136            if (inRow[(col+cols/4) % cols] != outRow[col]) {
    11371137                psError(__func__,"psImageRoll didn't produce expected result "
     
    11511151
    11521152    out = psImageRoll(out,in,0,rows/4);
    1153     for (int row=0;row<rows;row++) {
     1153    for (psS32 row=0;row<rows;row++) {
    11541154        psF32* inRow = in->data.F32[(row+rows/4)%rows];
    11551155        psF32* outRow = out->data.F32[row];
    1156         for (int col=0;col<cols;col++) {
     1156        for (psS32 col=0;col<cols;col++) {
    11571157            if (inRow[col] != outRow[col]) {
    11581158                psError(__func__,"psImageRoll didn't produce expected result "
     
    11651165
    11661166    out = psImageRoll(out,in,cols/4,rows/4);
    1167     for (int row=0;row<rows;row++) {
     1167    for (psS32 row=0;row<rows;row++) {
    11681168        psF32* inRow = in->data.F32[(row+rows/4)%rows];
    11691169        psF32* outRow = out->data.F32[row];
    1170         for (int col=0;col<cols;col++) {
     1170        for (psS32 col=0;col<cols;col++) {
    11711171            if (inRow[(col+cols/4) % cols] != outRow[col]) {
    11721172                psError(__func__,"psImageRoll didn't produce expected result "
     
    11791179
    11801180    out = psImageRoll(out,in,-cols/4,0);
    1181     for (int row=0;row<rows;row++) {
     1181    for (psS32 row=0;row<rows;row++) {
    11821182        psF32* inRow = in->data.F32[row];
    11831183        psF32* outRow = out->data.F32[row];
    1184         for (int col=0;col<cols;col++) {
     1184        for (psS32 col=0;col<cols;col++) {
    11851185            if (inRow[(col+(cols-cols/4)) % cols] != outRow[col]) {
    11861186                psError(__func__,"psImageRoll didn't produce expected result "
     
    11931193
    11941194    out = psImageRoll(out,in,0,-rows/4);
    1195     for (int row=0;row<rows;row++) {
     1195    for (psS32 row=0;row<rows;row++) {
    11961196        psF32* inRow = in->data.F32[(row+rows-rows/4)%rows];
    11971197        psF32* outRow = out->data.F32[row];
    1198         for (int col=0;col<cols;col++) {
     1198        for (psS32 col=0;col<cols;col++) {
    11991199            if (inRow[col] != outRow[col]) {
    12001200                psError(__func__,"psImageRoll didn't produce expected result "
     
    12071207
    12081208    out = psImageRoll(out,in,-cols/4,-rows/4);
    1209     for (int row=0;row<rows;row++) {
     1209    for (psS32 row=0;row<rows;row++) {
    12101210        psF32* inRow = in->data.F32[(row+rows-rows/4)%rows];
    12111211        psF32* outRow = out->data.F32[row];
    1212         for (int col=0;col<cols;col++) {
     1212        for (psS32 col=0;col<cols;col++) {
    12131213            if (inRow[(col+cols-cols/4) % cols] != outRow[col]) {
    12141214                psError(__func__,"psImageRoll didn't produce expected result "
     
    12361236    in = psImageAlloc(rows1,cols1,PS_TYPE_##DATATYPE); \
    12371237    \
    1238     for (int row=0;row<rows1;row++) { \
     1238    for (psS32 row=0;row<rows1;row++) { \
    12391239        ps##DATATYPE* inRow = in->data.DATATYPE[row]; \
    1240         for (int col=0;col<cols1;col++) { \
     1240        for (psS32 col=0;col<cols1;col++) { \
    12411241            inRow[col] = (ps##DATATYPE)row+(ps##DATATYPE)col; \
    12421242        } \
     
    12441244    \
    12451245    out = psImageRoll(NULL,in,rows1/4,cols1/4); \
    1246     for (int row=0;row<rows1;row++) { \
     1246    for (psS32 row=0;row<rows1;row++) { \
    12471247        ps##DATATYPE* inRow = in->data.DATATYPE[(row+rows1/4)%rows1]; \
    12481248        ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
    1249         for (int col=0;col<cols1;col++) { \
     1249        for (psS32 col=0;col<cols1;col++) { \
    12501250            if (inRow[(col+cols1/4)%cols1] != outRow[col]) { \
    12511251                psError(__func__,"psImageRoll didn't produce expected result " \
     
    12701270}
    12711271
    1272 int testImageRotate(void)
     1272psS32 testImageRotate(void)
    12731273{
    12741274    /*
     
    13001300    psImage* fBiTruth = NULL;
    13011301    psImage* sBiTruth = NULL;
    1302     int rows = 64;
    1303     int cols = 64;
     1302    psS32 rows = 64;
     1303    psS32 cols = 64;
    13041304    psImage* fImg = psImageAlloc(cols,rows,PS_TYPE_F32);
    13051305    psImage* sImg = psImageAlloc(cols,rows,PS_TYPE_S16);
    13061306    psImage* s32Img = psImageAlloc(cols,rows,PS_TYPE_S32);
    13071307
    1308     for(int row=0;row<rows;row++) {
     1308    for(psS32 row=0;row<rows;row++) {
    13091309        psF32* fRow = fImg->data.F32[row];
    13101310        psS16* sRow = sImg->data.S16[row];
    13111311        psS32* s32Row = s32Img->data.S32[row];
    1312         for (int col=0;col<cols;col++) {
     1312        for (psS32 col=0;col<cols;col++) {
    13131313            fRow[col] = (psF32)(row)+(psF32)(col)/100.0f;
    13141314            sRow[col] = row-2*col;
     
    13361336        ("temp/sBiOut.fits");
    13371337    ;
    1338     int index = 0;
    1339     bool fail = false;
    1340     for (int rot=-180;rot<=180;rot+=45) {
     1338    psS32 index = 0;
     1339    psBool fail = false;
     1340    for (psS32 rot=-180;rot<=180;rot+=45) {
    13411341        psImage* oldOut = fOut;
    13421342        psImage* oldBiOut = fBiOut;
     
    13881388                fail = true;
    13891389            } else {
    1390                 for (int row=0;row<fTruth->numRows;row++) {
     1390                for (psS32 row=0;row<fTruth->numRows;row++) {
    13911391                    psF32* truthRow = fTruth->data.F32[row];
    13921392                    psF32* outRow = fOut->data.F32[row];
    1393                     for (int col=0;col<fTruth->numCols;col++) {
     1393                    for (psS32 col=0;col<fTruth->numCols;col++) {
    13941394                        if (fabsf(truthRow[col]-outRow[col]) > 1) {
    13951395                            psError(__func__,"Float Image mismatch (%f vs %f) at %d,%d.",
     
    14091409            if (sTruth->numRows != sOut->numRows ||
    14101410                    sTruth->numCols != sOut->numCols) {
    1411                 psError(__func__,"Rotated short image size did not match truth "
     1411                psError(__func__,"Rotated psS16 image size did not match truth "
    14121412                        "image for %d deg rotation.",rot);
    14131413                fail = true;
    14141414            } else {
    1415                 for (int row=0;row<sTruth->numRows;row++) {
     1415                for (psS32 row=0;row<sTruth->numRows;row++) {
    14161416                    psS16* truthRow = sTruth->data.S16[row];
    14171417                    psS16* outRow = sOut->data.S16[row];
    1418                     for (int col=0;col<sTruth->numCols;col++) {
     1418                    for (psS32 col=0;col<sTruth->numCols;col++) {
    14191419                        if (fabsf(truthRow[col]-outRow[col]) > 1) {
    14201420                            psError(__func__,"Short Image mismatch (%d vs %d) "
     
    14401440                fail = true;
    14411441            } else {
    1442                 for (int row=0;row<fBiTruth->numRows;row++) {
     1442                for (psS32 row=0;row<fBiTruth->numRows;row++) {
    14431443                    psF32* truthRow = fBiTruth->data.F32[row];
    14441444                    psF32* outRow = fBiOut->data.F32[row];
    1445                     for (int col=0;col<fBiTruth->numCols;col++) {
     1445                    for (psS32 col=0;col<fBiTruth->numCols;col++) {
    14461446                        if (fabsf(truthRow[col]-outRow[col]) > 1) {
    14471447                            psError(__func__,"Float Image mismatch (%f vs %f) at %d,%d. BILINEAR",
     
    14611461            if (sBiTruth->numRows != sBiOut->numRows ||
    14621462                    sBiTruth->numCols != sBiOut->numCols) {
    1463                 psError(__func__,"Rotated short image size did not match truth "
     1463                psError(__func__,"Rotated psS16 image size did not match truth "
    14641464                        "image for %d deg rotation. BILINEAR",rot);
    14651465                fail = true;
    14661466            } else {
    1467                 for (int row=0;row<sBiTruth->numRows;row++) {
     1467                for (psS32 row=0;row<sBiTruth->numRows;row++) {
    14681468                    psS16* truthRow = sBiTruth->data.S16[row];
    14691469                    psS16* outRow = sBiOut->data.S16[row];
    1470                     for (int col=0;col<sBiTruth->numCols;col++) {
     1470                    for (psS32 col=0;col<sBiTruth->numCols;col++) {
    14711471                        if (fabsf(truthRow[col]-outRow[col]) > 1) {
    14721472                            psError(__func__,"Short Image mismatch (%d vs %d) "
     
    15371537}
    15381538
    1539 static int testImageShift(void)
     1539static psS32 testImageShift(void)
    15401540{
    15411541    /* psImageShift:
     
    15581558    */
    15591559
    1560     int retVal=0;
     1560    psS32 retVal=0;
    15611561
    15621562    // integer shift
     
    16271627}
    16281628
    1629 static int testImageShiftCase(int cols,
    1630                               int rows,
    1631                               float colShift,
    1632                               float rowShift)
     1629static psS32 testImageShiftCase(psS32 cols,
     1630                                psS32 rows,
     1631                                float colShift,
     1632                                float rowShift)
    16331633{
    16341634    psImage* fOut = NULL;
     
    16431643    psImage* sBiOut = psImageAlloc(cols,rows,PS_TYPE_S16);
    16441644
    1645     for(int row=0;row<rows;row++) {
     1645    for(psS32 row=0;row<rows;row++) {
    16461646        psF32* fRow = fImg->data.F32[row];
    16471647        psS16* sRow = sImg->data.S16[row];
    1648         for (int col=0;col<cols;col++) {
     1648        for (psS32 col=0;col<cols;col++) {
    16491649            fRow[col] = (psF32)(row)+(psF32)(col)/100.0f;
    16501650            sRow[col] = row-2*col;
     
    16571657    sBiOut = psImageShift(sBiOut, sImg, colShift, rowShift, -1, PS_INTERPOLATE_BILINEAR);
    16581658
    1659     for(int row=0;row<rows;row++) {
     1659    for(psS32 row=0;row<rows;row++) {
    16601660        psF32* fRow = fOut->data.F32[row];
    16611661        psS16* sRow = sOut->data.S16[row];
     
    16631663        psS16* sBiRow = sBiOut->data.S16[row];
    16641664
    1665         for (int col=0;col<cols;col++) {
     1665        for (psS32 col=0;col<cols;col++) {
    16661666            psF32 fValue = psImagePixelInterpolate(fImg,col+colShift,
    16671667                                                   row+rowShift,NULL,0,NAN,PS_INTERPOLATE_FLAT);
     
    17071707}
    17081708
    1709 static int testImageResample(void)
     1709static psS32 testImageResample(void)
    17101710{
    17111711
    1712     int rows = 60;
    1713     int cols = 80;
     1712    psS32 rows = 60;
     1713    psS32 cols = 80;
    17141714    psImage* result = NULL;
    1715     int scale = 4;
     1715    psS32 scale = 4;
    17161716    psErr* err;
    17171717
    17181718    psImage* image = psImageAlloc(cols,rows,PS_TYPE_F32);
    1719     for(int row=0;row<rows;row++) {
     1719    for(psS32 row=0;row<rows;row++) {
    17201720        psF32* imageRow = image->data.F32[row];
    1721         for (int col=0;col<cols;col++) {
     1721        for (psS32 col=0;col<cols;col++) {
    17221722            imageRow[col] = row+2*col;
    17231723        }
     
    17531753
    17541754    psF32 truthValue;
    1755     for(int row=0;row<result->numRows;row++) {
    1756         for (int col=0;col<result->numCols;col++) {
     1755    for(psS32 row=0;row<result->numRows;row++) {
     1756        for (psS32 col=0;col<result->numCols;col++) {
    17571757            truthValue = psImagePixelInterpolate(image,
    17581758                                                 (float)col/(float)scale,(float)row/(float)scale,
  • trunk/psLib/test/image/tst_psImageStats00.c

    r1956 r2204  
    1414#define M 64
    1515
    16 int main()
     16psS32 main()
    1717{
    1818    psHistogram * myHist = NULL;
     
    2020    psImage *tmpImage = NULL;
    2121    psImage *tmpMask = NULL;
    22     int testStatus = true;
    23     int memLeaks = 0;
    24     int nb = 0;
    25     int i = 0;
    26     int j = 0;
    27     int IMAGE_X_SIZE = 0;
    28     int IMAGE_Y_SIZE = 0;
    29     int currentId = 0;
     22    psS32 testStatus = true;
     23    psS32 memLeaks = 0;
     24    psS32 nb = 0;
     25    psS32 i = 0;
     26    psS32 j = 0;
     27    psS32 IMAGE_X_SIZE = 0;
     28    psS32 IMAGE_Y_SIZE = 0;
     29    psS32 currentId = 0;
    3030
    3131    currentId = psMemGetId();
  • trunk/psLib/test/image/tst_psImageStats01.c

    r1944 r2204  
    1515#define M 64
    1616
    17 int main()
     17psS32 main()
    1818{
    1919    psStats * myStats = NULL;
     
    2121    psImage *tmpImage = NULL;
    2222    psImage *tmpMask = NULL;
    23     int testStatus = true;
    24     int memLeaks = 0;
    25     int nb = 0;
    26     int i = 0;
    27     int j = 0;
    28     int IMAGE_X_SIZE = 0;
    29     int IMAGE_Y_SIZE = 0;
    30     int currentId = 0;
     23    psS32 testStatus = true;
     24    psS32 memLeaks = 0;
     25    psS32 nb = 0;
     26    psS32 i = 0;
     27    psS32 j = 0;
     28    psS32 IMAGE_X_SIZE = 0;
     29    psS32 IMAGE_Y_SIZE = 0;
     30    psS32 currentId = 0;
    3131
    3232    currentId = psMemGetId();
  • trunk/psLib/test/image/tst_psImageStats02.c

    r2099 r2204  
    1818#define CHEBY_Y_DIM 8
    1919#define THRESHOLD 10
    20 int main()
     20psS32 main()
    2121{
    2222    psStats * myStats = NULL;
     
    2626    psPolynomial2D *my2DPoly = NULL;
    2727    psPolynomial2D *null2DPoly = NULL;
    28     int testStatus = true;
    29     int memLeaks = 0;
    30     int i = 0;
    31     int j = 0;
    32     int currentId = 0;
     28    psS32 testStatus = true;
     29    psS32 memLeaks = 0;
     30    psS32 i = 0;
     31    psS32 j = 0;
     32    psS32 currentId = 0;
    3333
    3434    currentId = psMemGetId();
  • trunk/psLib/test/image/tst_psImageStats03.c

    r1909 r2204  
    1313#define IMAGE_SIZE 10
    1414
    15 int main()
     15psS32 main()
    1616{
    1717    psImage *tmpImage   = NULL;
    18     int testStatus      = true;
    19     int memLeaks        = 0;
    20     int i               = 0;
    21     int j               = 0;
     18    psS32 testStatus      = true;
     19    psS32 memLeaks        = 0;
     20    psS32 i               = 0;
     21    psS32 j               = 0;
    2222    float pixel         = 0.0;
    2323    float x             = 0.0;
    2424    float y             = 0.0;
    25     int currentId       = psMemGetId();
     25    psS32 currentId       = psMemGetId();
    2626
    2727    /*************************************************************************/
  • trunk/psLib/test/psTest.c

    r1810 r2204  
    2828#define HEADER_BOTTOM "\\**********************************************************************************/\n\n"
    2929
    30 bool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName,
    31                      testDescription tests[], int argc, char * const argv[] )
    32 {
    33     bool success = true;
    34     bool runAll = true;
    35     bool useFork = true;
    36     bool found;
    37     int c;
    38     int n;
     30psBool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName,
     31                       testDescription tests[], psS32 argc, char * const argv[] )
     32{
     33    psBool success = true;
     34    psBool runAll = true;
     35    psBool useFork = true;
     36    psBool found;
     37    psS32 c;
     38    psS32 n;
    3939    extern char *optarg;
    4040
     
    6262                printf( "Testpoints:\n" );
    6363                runAll = false;
    64                 for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     64                for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    6565                    printf( "    %6d - %s \n", tests[ index ].testPointNumber,
    6666                            tests[ index ].testPointName );
     
    7070            case 't':
    7171                runAll = false;
    72                 for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     72                for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    7373                    if ( strcmp( optarg, tests[ index ].testPointName ) == 0 ) {
    7474                        success = p_runTest( fp,
     
    9090                }
    9191                found = false;
    92                 for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     92                for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    9393                    if ( n == tests[ index ].testPointNumber ) {
    9494                        found = true;
     
    116116
    117117    if ( runAll ) {
    118         for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     118        for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    119119            if ( ! tests[ index ].isDuplicateEntry ) {
    120120                success = p_runTest( fp,
     
    136136}
    137137
    138 bool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName,
    139                 testFcn fcn, int expectedReturn, bool useFork )
    140 {
    141     int childReturn = 0;
     138psBool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName,
     139                  testFcn fcn, psS32 expectedReturn, psBool useFork )
     140{
     141    psS32 childReturn = 0;
    142142    pid_t child;
    143143
     
    147147        child = fork();
    148148        if ( child == 0 ) {                   // I am the child process, run the test
    149             int currentId = psMemGetId();
    150             int retVal = fcn();
     149            psS32 currentId = psMemGetId();
     150            psS32 retVal = fcn();
    151151            if ( retVal == 0 ) { // only bother checking memory if test executed to end.
    152152                if ( psMemCheckLeaks( currentId, NULL, stderr ) != 0 ) {
     
    171171        }
    172172    } else {
    173         int currentId = psMemGetId();
     173        psS32 currentId = psMemGetId();
    174174        childReturn = fcn();
    175175        if ( childReturn == 0 ) { // only bother checking memory if test executed to end.
     
    215215                                const char* testPointName,
    216216                                const char* expectedError,
    217                                 int exitValue )
     217                                psS32 exitValue )
    218218{
    219219    char TP[ 80 ];
     
    235235                    const char* packageName,
    236236                    const char* testPointName,
    237                     bool success )
     237                    psBool success )
    238238{
    239239    if ( success ) {
  • trunk/psLib/test/psTest.h

    r1193 r2204  
    44
    55#include <stdio.h>
    6 #include <stdbool.h>
     6
     7#include "psType.h"
    78
    89#define printPositiveTestHeader(filePtr, packageName, testPointName) \
     
    1516p_printFooter(filePtr, __FILE__, packageName, testPointName, success)
    1617
    17 typedef int (*testFcn)(void);
     18typedef psS32 (*testFcn)(void);
    1819
    1920typedef struct
    2021{
    2122    testFcn     fcn;
    22     int         testPointNumber;
     23    psS32       testPointNumber;
    2324    const char* testPointName;
    24     int         expectedReturn;
    25     bool        isDuplicateEntry;
     25    psS32       expectedReturn;
     26    psBool      isDuplicateEntry;
    2627}
    2728testDescription;
     
    3637/////////////////////////// PRIVATE FUNCTIONS //////////////////////////////
    3738
    38 bool p_runTest(
     39psBool p_runTest(
    3940    FILE *fp,
    4041    const char* testPointFile,
     
    4243    const char* testPointName,
    4344    testFcn fcn,
    44     int expectedReturn,
    45     bool useFork
     45    psS32 expectedReturn,
     46    psBool useFork
    4647);
    4748
    48 bool p_runTestSuite(
     49psBool p_runTestSuite(
    4950    FILE *fp,
    5051    const char* testPointFile,
    5152    const char* packageName,
    5253    testDescription tests[],
    53     int argc,
     54    psS32 argc,
    5455    char * const argv[]
    5556);
     
    6869    const char* testPointName,
    6970    const char* expectedError,
    70     int exitValue
     71    psS32 exitValue
    7172);
    7273
     
    7677    const char* packageName,
    7778    const char* testPointName,
    78     bool success
     79    psBool success
    7980);
    8081
  • trunk/psLib/test/runTest

    r1602 r2204  
    3030#
    3131#  $Revison:  $  $Name: not supported by cvs2svn $
    32 #  $Date: 2004-08-20 00:51:22 $
     32#  $Date: 2004-10-27 00:57:31 $
    3333#
    3434#  Copyright 2004 Maui High Performance Computering Center, University of Hawaii
     
    3636################################################################################
    3737
    38 # Provides functions for handling long command line options
     38# Provides functions for handling psS64 command line options
    3939use Getopt::Long;
    4040
  • trunk/psLib/test/sysUtils/tst_psAbort.c

    r1701 r2204  
    88 *  @author  Eric Van Alst, MHPCC
    99 *
    10  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    11  *  @date  $Date: 2004-09-07 21:26:13 $
     10 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     11 *  @date  $Date: 2004-10-27 00:57:33 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717#include "psTest.h"
    1818
    19 static int testAbort00(void);
    20 static int testAbort01(void);
    21 static int testAbort02(void);
     19static psS32 testAbort00(void);
     20static psS32 testAbort01(void);
     21static psS32 testAbort02(void);
    2222
    2323testDescription tests[] = {
     
    2828                          };
    2929
    30 int main( int argc, char* argv[] )
     30psS32 main( psS32 argc, char* argv[] )
    3131{
    3232    psLogSetLevel( PS_LOG_INFO );
     
    3535}
    3636
    37 static int testAbort00(void)
     37static psS32 testAbort00(void)
    3838{
    39     int   intval = 1;
    40     long  longval = 2;
     39    psS32   intval = 1;
     40    psS64  longval = 2;
    4141    float floatval = 3.01;
    4242    char  charval = 'E';
     
    5454}
    5555
    56 static int testAbort01(void)
     56static psS32 testAbort01(void)
    5757{
    5858    // Test point #2 String values in abort message
     
    6565}
    6666
    67 static int testAbort02(void)
     67static psS32 testAbort02(void)
    6868{
    6969    // Test point #2 String values in abort message
  • trunk/psLib/test/sysUtils/tst_psError.c

    r2129 r2204  
    1313 *  @author  Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-10-14 21:14:58 $
     15 *  @version $Revision: 1.14 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-10-27 00:57:33 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psTest.h"
    2727
    28 static int testError00(void);
    29 static int testError01(void);
    30 static int testError02(void);
    31 static int testError03(void);
    32 static int testError04(void);
    33 static int testError05(void);
    34 static int testErrorRegister(void);
     28static psS32 testError00(void);
     29static psS32 testError01(void);
     30static psS32 testError02(void);
     31static psS32 testError03(void);
     32static psS32 testError04(void);
     33static psS32 testError05(void);
     34static psS32 testErrorRegister(void);
    3535
    3636// Function used in testError02 to verify the psErrorStackPrintV function
     
    5858                          };
    5959
    60 int main( int argc, char* argv[] )
     60psS32 main( psS32 argc, char* argv[] )
    6161{
    6262    psLogSetLevel( PS_LOG_INFO );
     
    6565}
    6666
    67 static int testError05(void)
     67static psS32 testError05(void)
    6868{
    6969    psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE;
     
    8181}
    8282
    83 static int testError04(void)
     83static psS32 testError04(void)
    8484{
    8585    psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE;
     
    134134}
    135135
    136 static int testError03(void)
     136static psS32 testError03(void)
    137137{
    138138    psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE;
     
    214214}
    215215
    216 static int testError02(void)
     216static psS32 testError02(void)
    217217{
    218218    psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE;
     
    228228}
    229229
    230 static int testError01(void)
     230static psS32 testError01(void)
    231231{
    232232    psErrorCode code=PS_ERR_BAD_PARAMETER_VALUE;
     
    277277}
    278278
    279 static int testError00(void)
    280 {
    281 
    282     int  intval=1;
    283     long longval = 2;
     279static psS32 testError00(void)
     280{
     281
     282    psS32  intval=1;
     283    psS64 longval = 2;
    284284    float floatval = 3.01;
    285285    char  charval = 'E';
     
    300300}
    301301
    302 static int testErrorRegister(void)
    303 {
    304 
    305     int numErr = 4;
     302static psS32 testErrorRegister(void)
     303{
     304
     305    psS32 numErr = 4;
    306306    psErrorDescription errDesc[] = { {PS_ERR_N_ERR_CLASSES+1,"first"},
    307307                                     {PS_ERR_N_ERR_CLASSES+2,"second"},
     
    314314    psErrorRegister(errDesc,numErr);
    315315
    316     for (int i = 0; i < numErr; i++) {
     316    for (psS32 i = 0; i < numErr; i++) {
    317317        const char* desc = psErrorCodeString(PS_ERR_N_ERR_CLASSES+1+i);
    318318        if (desc == NULL) {
  • trunk/psLib/test/sysUtils/tst_psLogMsg.c

    r1702 r2204  
    88#include "psTest.h"
    99
    10 static int testLogMsg00();
    11 static int testLogMsg01();
    12 static int testLogMsg02();
    13 static int testLogMsg03();
    14 static int testLogMsg04();
    15 static int testLogMsg05();
     10static psS32 testLogMsg00();
     11static psS32 testLogMsg01();
     12static psS32 testLogMsg02();
     13static psS32 testLogMsg03();
     14static psS32 testLogMsg04();
     15static psS32 testLogMsg05();
    1616
    1717testDescription tests[] = {
     
    3939                          };
    4040
    41 int main( int argc, char* argv[] )
     41psS32 main( psS32 argc, char* argv[] )
    4242{
    4343    psLogSetLevel( PS_LOG_INFO );
     
    4848
    4949static void myLogMsg(const char *name,
    50                      int level,
     50                     psS32 level,
    5151                     const char *fmt,
    5252                     ...)
     
    6060}
    6161
    62 static int testLogMsg00()
    63 {
    64     int i = 0;
     62static psS32 testLogMsg00()
     63{
     64    psS32 i = 0;
    6565
    6666    // Send a log messages for levels 0:9.  Only the first four messages
     
    7474}
    7575
    76 static int testLogMsg01()
    77 {
    78     int i = 0;
     76static psS32 testLogMsg01()
     77{
     78    psS32 i = 0;
    7979
    8080    // Send a log messages for levels 0:9.  Only the first four messages
     
    8888}
    8989
    90 static int testLogMsg02()
     90static psS32 testLogMsg02()
    9191{
    9292
    9393    psLogSetLevel(9);
    9494    // Send a log messages for levels 0:9.
    95     for (int i=0;i<10;i++) {
     95    for (psS32 i=0;i<10;i++) {
    9696        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
    9797    }
     
    105105}
    106106
    107 static int testLogMsg03()
    108 {
    109     int i;
     107static psS32 testLogMsg03()
     108{
     109    psS32 i;
    110110
    111111    fprintf(stderr,"------------- psLogSetFormat() -------------\n");
     
    161161
    162162
    163 int testLogMsg04()
     163psS32 testLogMsg04()
    164164{
    165165    psLogMsg("Under 15 chars", 0, "Hello World!\n");
     
    173173}
    174174
    175 int testLogMsg05()
    176 {
    177     int i = 0;
     175psS32 testLogMsg05()
     176{
     177    psS32 i = 0;
    178178    FILE* file;
    179179    char line[256];
  • trunk/psLib/test/sysUtils/tst_psMemory.c

    r1811 r2204  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-09-14 23:55:47 $
     8*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-10-27 00:57:33 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "pslib.h"
    2727
    28 static int TPFreeReferencedMemory( void );
    29 static int TPOutOfMemory( void );
    30 static int TPReallocOutOfMemory( void );
    31 static void* TPOutOfMemoryExhaustedCallback( size_t size );
    32 static int TPCheckBufferPositive( void );
    33 static int TPrealloc( void );
    34 static int TPallocCallback( void );
     28static psS32 TPFreeReferencedMemory( void );
     29static psS32 TPOutOfMemory( void );
     30static psS32 TPReallocOutOfMemory( void );
     31static psPtr TPOutOfMemoryExhaustedCallback( size_t size );
     32static psS32 TPCheckBufferPositive( void );
     33static psS32 TPrealloc( void );
     34static psS32 TPallocCallback( void );
    3535static psMemoryId memAllocateCallback( const psMemBlock *ptr );
    3636static psMemoryId memFreeCallback( const psMemBlock *ptr );
    37 static int TPcheckLeaks( void );
    38 static int TPmemCorruption( void );
    39 static int TPmultipleFree( void );
    40 void memProblemCallback( const psMemBlock *ptr, const char *file, int lineno );
    41 
    42 static int problemCallbackCalled = 0;
    43 static int allocCallbackCalled = 0;
    44 static int freeCallbackCalled = 0;
    45 static int exhaustedCallbackCalled = 0;
     37static psS32 TPcheckLeaks( void );
     38static psS32 TPmemCorruption( void );
     39static psS32 TPmultipleFree( void );
     40void memProblemCallback( const psMemBlock *ptr, const char *file, psS32 lineno );
     41
     42static psS32 problemCallbackCalled = 0;
     43static psS32 allocCallbackCalled = 0;
     44static psS32 freeCallbackCalled = 0;
     45static psS32 exhaustedCallbackCalled = 0;
    4646
    4747testDescription tests[] = {
     
    8181                          };
    8282
    83 int main( int argc, char* argv[] )
     83psS32 main( psS32 argc, char* argv[] )
    8484{
    8585    psLogSetLevel( PS_LOG_INFO );
     
    8989
    9090// Testpoint #449, psAlloc shall allocate memory blocks writeable by caller.
    91 int TPCheckBufferPositive( void )
    92 {
    93     int * mem;
    94     const int size = 100;
    95     int failed = 0;
     91psS32 TPCheckBufferPositive( void )
     92{
     93    psS32 * mem;
     94    const psS32 size = 100;
     95    psS32 failed = 0;
    9696
    9797    psLogMsg( __func__, PS_LOG_INFO, "psAlloc shall allocate memory blocks writeable by caller.\n" );
    9898
    99     mem = ( int* ) psAlloc( size * sizeof( int ) );
     99    mem = ( psS32* ) psAlloc( size * sizeof( psS32 ) );
    100100    if ( mem == NULL ) {
    101101        psError( __FILE__, "psAlloc returned a NULL value in %s!", __func__ );
     
    103103    }
    104104
    105     for ( int index = 0;index < size;index++ ) {
     105    for ( psS32 index = 0;index < size;index++ ) {
    106106        mem[ index ] = index;
    107107    }
    108108
    109     for ( int index = 0;index < size;index++ ) {
     109    for ( psS32 index = 0;index < size;index++ ) {
    110110        if ( mem[ index ] != index ) {
    111111            failed++;
     
    118118}
    119119
    120 int TPFreeReferencedMemory( void )
     120psS32 TPFreeReferencedMemory( void )
    121121{
    122122    // create memory
    123     int * mem;
    124     int ref = 0;
     123    psS32 * mem;
     124    psS32 ref = 0;
    125125
    126126    psLogMsg( __func__, PS_LOG_INFO, "memory reference count shall be incrementable/decrementable" );
    127127
    128     mem = ( int* ) psAlloc( 100 * sizeof( int ) );
     128    mem = ( psS32* ) psAlloc( 100 * sizeof( psS32 ) );
    129129
    130130    ref = psMemGetRefCounter( mem );
     
    170170// Bug/Task #562 regression test.  Upon requesting more memory than is available, psRealloc shall call
    171171// the psMemExhaustedCallback.
    172 int TPReallocOutOfMemory( void )
    173 {
    174     int * mem[ 100 ];
     172psS32 TPReallocOutOfMemory( void )
     173{
     174    psS32 * mem[ 100 ];
    175175    psMemExhaustedCallback cb;
    176176
    177     for ( int lcv = 0; lcv < 100; lcv++ ) {
     177    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    178178        mem[ lcv ] = NULL;
    179179    }
     
    186186    cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback );
    187187
    188     for ( int lcv = 0; lcv < 100; lcv++ ) {
    189         mem[ lcv ] = ( int* ) psAlloc( 10 );
    190     }
    191 
    192     for ( int lcv = 0; lcv < 100; lcv++ ) {
    193         mem[ lcv ] = ( int* ) psRealloc( mem[ lcv ], SIZE_MAX/2 - 1000 );
     188    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     189        mem[ lcv ] = ( psS32* ) psAlloc( 10 );
     190    }
     191
     192    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     193        mem[ lcv ] = ( psS32* ) psRealloc( mem[ lcv ], SIZE_MAX/2 - 1000 );
    194194    }
    195195
     
    201201    }
    202202
    203     for ( int lcv = 0; lcv < 100; lcv++ ) {
     203    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    204204        psFree( mem[ lcv ] );
    205205    }
     
    209209// Testpoint #450,  Upon requesting more memory than is available, psalloc shall call
    210210// the psMemExhaustedCallback.
    211 int TPOutOfMemory( void )
    212 {
    213     int * mem[ 100 ];
     211psS32 TPOutOfMemory( void )
     212{
     213    psS32 * mem[ 100 ];
    214214    psMemExhaustedCallback cb;
    215215
    216     for ( int lcv = 0; lcv < 100; lcv++ ) {
     216    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    217217        mem[ lcv ] = NULL;
    218218    }
     
    225225    cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback );
    226226
    227     for ( int lcv = 0; lcv < 100; lcv++ ) {
    228         mem[ lcv ] = ( int* ) psAlloc( SIZE_MAX/2 - 1000 );
     227    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
     228        mem[ lcv ] = ( psS32* ) psAlloc( SIZE_MAX/2 - 1000 );
    229229    }
    230230
     
    236236    }
    237237
    238     for ( int lcv = 0; lcv < 100; lcv++ ) {
     238    for ( psS32 lcv = 0; lcv < 100; lcv++ ) {
    239239        psFree( mem[ lcv ] );
    240240    }
     
    244244
    245245// Testpoint #451,  psRealloc shall increase/decrease memory buffer while preserving contents
    246 int TPrealloc( void )
    247 {
    248     int * mem1;
    249     int* mem2;
    250     int* mem3;
    251     const int initialSize = 100;
     246psS32 TPrealloc( void )
     247{
     248    psS32 * mem1;
     249    psS32* mem2;
     250    psS32* mem3;
     251    const psS32 initialSize = 100;
    252252
    253253    psLogMsg( __func__, PS_LOG_INFO, "psRealloc shall increase/decrease memory buffer while "
     
    255255
    256256    // allocate buffer with known values.
    257     mem1 = ( int* ) psAlloc( initialSize * sizeof( int ) );
    258     mem2 = ( int* ) psAlloc( initialSize * sizeof( int ) );
    259     mem3 = ( int* ) psAlloc( initialSize * sizeof( int ) );
    260     for ( int lcv = 0;lcv < initialSize;lcv++ ) {
     257    mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     258    mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     259    mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     260    for ( psS32 lcv = 0;lcv < initialSize;lcv++ ) {
    261261        mem1[ lcv ] = mem2[ lcv ] = mem3[ lcv ] = lcv;
    262262    }
     
    266266
    267267    // realloc to 2x
    268     mem1 = ( int* ) psRealloc( mem1, 2 * initialSize * sizeof( int ) );
    269     mem2 = ( int* ) psRealloc( mem2, 2 * initialSize * sizeof( int ) );
    270     mem3 = ( int* ) psRealloc( mem3, 2 * initialSize * sizeof( int ) );
     268    mem1 = ( psS32* ) psRealloc( mem1, 2 * initialSize * sizeof( psS32 ) );
     269    mem2 = ( psS32* ) psRealloc( mem2, 2 * initialSize * sizeof( psS32 ) );
     270    mem3 = ( psS32* ) psRealloc( mem3, 2 * initialSize * sizeof( psS32 ) );
    271271
    272272    // check values of initial block
    273     for ( int i = 0;i < initialSize;i++ ) {
     273    for ( psS32 i = 0;i < initialSize;i++ ) {
    274274        if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) {
    275275            psError( __FILE__, "Realloc didn't preserve the contents with expanding buffer in %s.",
     
    283283
    284284    // realloc to 1/2 initial value.
    285     mem1 = ( int* ) psRealloc( mem1, ( initialSize / 2 ) * sizeof( int ) );
    286     mem2 = ( int* ) psRealloc( mem2, ( initialSize / 2 ) * sizeof( int ) );
    287     mem3 = ( int* ) psRealloc( mem3, ( initialSize / 2 ) * sizeof( int ) );
     285    mem1 = ( psS32* ) psRealloc( mem1, ( initialSize / 2 ) * sizeof( psS32 ) );
     286    mem2 = ( psS32* ) psRealloc( mem2, ( initialSize / 2 ) * sizeof( psS32 ) );
     287    mem3 = ( psS32* ) psRealloc( mem3, ( initialSize / 2 ) * sizeof( psS32 ) );
    288288
    289289    // check values of initial block
    290     for ( int i = 0;i < initialSize / 2;i++ ) {
     290    for ( psS32 i = 0;i < initialSize / 2;i++ ) {
    291291        if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) {
    292292            psError( __FILE__, "Realloc didn't preserve the contents with shrinking buffer in %s.",
     
    303303}
    304304
    305 int TPallocCallback( void )
    306 {
    307     int * mem1;
    308     int* mem2;
    309     int* mem3;
    310     int currentId = psMemGetId();
    311     const int initialSize = 100;
    312     int mark;
     305psS32 TPallocCallback( void )
     306{
     307    psS32 * mem1;
     308    psS32* mem2;
     309    psS32* mem3;
     310    psS32 currentId = psMemGetId();
     311    const psS32 initialSize = 100;
     312    psS32 mark;
    313313
    314314    allocCallbackCalled = 0;
     
    324324
    325325    // allocate buffer with known values.
    326     mem1 = ( int* ) psAlloc( initialSize * sizeof( int ) );
    327     mem2 = ( int* ) psAlloc( initialSize * sizeof( int ) );
    328     mem3 = ( int* ) psAlloc( initialSize * sizeof( int ) );
     326    mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     327    mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
     328    mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    329329
    330330    psFree( mem1 );
     
    343343    mark = psMemGetId();
    344344
    345     mem1 = ( int* ) psAlloc( initialSize * sizeof( int ) );
     345    mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) );
    346346
    347347    psMemAllocateCallbackSetID( mark );
    348348
    349     mem1 = ( int* ) psRealloc( mem1, initialSize * 2 * sizeof( int ) );
     349    mem1 = ( psS32* ) psRealloc( mem1, initialSize * 2 * sizeof( psS32 ) );
    350350
    351351    psFree( mem1 );
     
    361361}
    362362
    363 int TPcheckLeaks( void )
    364 {
    365     const int numBuffers = 5;
    366     int* buffers[ 5 ];
    367     int lcv;
    368     int currentId = psMemGetId();
     363psS32 TPcheckLeaks( void )
     364{
     365    const psS32 numBuffers = 5;
     366    psS32* buffers[ 5 ];
     367    psS32 lcv;
     368    psS32 currentId = psMemGetId();
    369369    psMemBlock** blks;
    370     int nLeaks = 0;
    371     int lineMark = 0;
     370    psS32 nLeaks = 0;
     371    psS32 lineMark = 0;
    372372
    373373    psLogMsg( __func__, PS_LOG_INFO, "psMemCheckLeaks shall return the number of blocks above an ID "
     
    376376    for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    377377        lineMark = __LINE__ + 1;
    378         buffers[ lcv ] = psAlloc( sizeof( int ) );
     378        buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
    379379    }
    380380
     
    406406    for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    407407        lineMark = __LINE__ + 1;
    408         buffers[ lcv ] = psAlloc( sizeof( int ) );
     408        buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
    409409    }
    410410
     
    434434    for ( lcv = 0;lcv < numBuffers;lcv++ ) {
    435435        lineMark = __LINE__ + 1;
    436         buffers[ lcv ] = psAlloc( sizeof( int ) );
     436        buffers[ lcv ] = psAlloc( sizeof( psS32 ) );
    437437    }
    438438
     
    464464}
    465465
    466 int TPmemCorruption( void )
    467 {
    468     int * buffer = NULL;
    469     int oldValue = 0;
    470     int corruptions = 0;
     466psS32 TPmemCorruption( void )
     467{
     468    psS32 * buffer = NULL;
     469    psS32 oldValue = 0;
     470    psS32 corruptions = 0;
    471471    psMemProblemCallback cb;
    472472
    473473    psLogMsg( __func__, PS_LOG_INFO, "psMemCheckCorruption shall detect memory corruptions" );
    474474
    475     buffer = psAlloc( sizeof( int ) );
     475    buffer = psAlloc( sizeof( psS32 ) );
    476476
    477477    // cause memory corruption via buffer underflow
     
    514514}
    515515
    516 void memProblemCallback( const psMemBlock *ptr, const char *file, int lineno )
     516void memProblemCallback( const psMemBlock *ptr, const char *file, psS32 lineno )
    517517{
    518518    psLogMsg( __func__, PS_LOG_INFO, "memory callback called for id %d (%s:%d).",
     
    536536}
    537537
    538 void* TPOutOfMemoryExhaustedCallback( size_t size )
     538psPtr TPOutOfMemoryExhaustedCallback( size_t size )
    539539{
    540540    psLogMsg( __func__, PS_LOG_INFO, "Custom MemExhaustedCallback was invoked." );
     
    543543}
    544544
    545 int TPmultipleFree( void )
    546 {
    547 
    548     void * buffer = psAlloc( 1024 );
     545psS32 TPmultipleFree( void )
     546{
     547
     548    psPtr buffer = psAlloc( 1024 );
    549549
    550550    psFree( buffer );
  • trunk/psLib/test/sysUtils/tst_psString.c

    r1977 r2204  
    1717 *  @author  Eric Van Alst, MHPCC
    1818 *
    19  *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
    20  *  @date  $Date: 2004-10-06 01:59:08 $
     19 *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
     20 *  @date  $Date: 2004-10-27 00:57:33 $
    2121 *
    2222 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828#include "psTest.h"
    2929
    30 static int testStringCopy00(void);
    31 static int testStringCopy01(void);
    32 static int testStringCopy02(void);
    33 static int testStringCopy03(void);
    34 static int testStringCopy04(void);
    35 static int testStringCopy05(void);
    36 static int testStringCopy06(void);
     30static psS32 testStringCopy00(void);
     31static psS32 testStringCopy01(void);
     32static psS32 testStringCopy02(void);
     33static psS32 testStringCopy03(void);
     34static psS32 testStringCopy04(void);
     35static psS32 testStringCopy05(void);
     36static psS32 testStringCopy06(void);
    3737
    3838testDescription tests[] = {
     
    4747                          };
    4848
    49 int main( int argc, char* argv[] )
     49psS32 main( psS32 argc, char* argv[] )
    5050{
    5151    psLogSetLevel( PS_LOG_INFO );
     
    5555
    5656/*
    57 int main( int argc,
     57psS32 main( psS32 argc,
    5858          char * argv[] )
    5959{
    60     bool  tpResult = false;
     60    psBool  tpResult = false;
    6161    char  stringval[20] = "E R R O R";
    6262    char  stringval1[20] = "e r r o r";
    6363    char  *stringvalnocopy = "F A I L";
    6464    char  *substringval = "e r r";
    65     int   substringlen = 6;
     65    psS32   substringlen = 6;
    6666    char  *emptyval = "";
    67     int   tpFails = 0;
    68     char  *strResult;
    69     int   increaseSize = 5;
    70     int   negativeSize = -5;
    71     int   result = 0;
    72     int   result1 = 0;
    73     int   memBlockAllocated = 0;
     67    psS32   tpFails = 0;
     68    char  *strResult;
     69    psS32   increaseSize = 5;
     70    psS32   negativeSize = -5;
     71    psS32   result = 0;
     72    psS32   result1 = 0;
     73    psS32   memBlockAllocated = 0;
    7474    psMemBlock ***memBlockPtr = NULL;
    7575 
    7676*/
    7777
    78 static int testStringCopy00(void)
    79 {
    80     char  stringval[20] = "E R R O R";
    81     int   result = 0;
    82     int   result1 = 0;
     78static psS32 testStringCopy00(void)
     79{
     80    char  stringval[20] = "E R R O R";
     81    psS32   result = 0;
     82    psS32   result1 = 0;
    8383    char  *strResult;
    8484
     
    107107}
    108108
    109 static int testStringCopy01(void)
     109static psS32 testStringCopy01(void)
    110110{
    111111    char  *emptyval = "";
    112     int   result = 0;
     112    psS32   result = 0;
    113113    char  *strResult;
    114114
     
    130130}
    131131
    132 static int testStringCopy02(void)
    133 {
    134     int   result = 0;
    135     int   result1 = 0;
     132static psS32 testStringCopy02(void)
     133{
     134    psS32   result = 0;
     135    psS32   result1 = 0;
    136136    char  *strResult;
    137137    char  stringval1[20] = "e r r o r";
    138     int   substringlen = 5;
     138    psS32   substringlen = 5;
    139139    char  *substringval = "e r r";
    140140
     
    161161}
    162162
    163 static int testStringCopy03(void)
    164 {
    165     int   result = 0;
    166     int   result1 = 0;
     163static psS32 testStringCopy03(void)
     164{
     165    psS32   result = 0;
     166    psS32   result1 = 0;
    167167    char  *strResult;
    168168    char  *stringvalnocopy = "F A I L";
     
    185185}
    186186
    187 static int testStringCopy04(void)
    188 {
    189     int   result = 0;
    190     int   result1 = 0;
    191     char  *strResult;
    192     char  stringval[20] = "E R R O R";
    193     int   increaseSize = 5;
     187static psS32 testStringCopy04(void)
     188{
     189    psS32   result = 0;
     190    psS32   result1 = 0;
     191    char  *strResult;
     192    char  stringval[20] = "E R R O R";
     193    psS32   increaseSize = 5;
    194194
    195195    // Test point #5 Copy string to larger string - psStringNCopy
     
    205205                strResult, stringval);
    206206        fprintf(stderr,"                     strlne result = %d expected %d\n",result1,
    207                 (int)strlen(stringval));
     207                (psS32)strlen(stringval));
    208208        return 1;
    209209    }
     
    214214}
    215215
    216 static int testStringCopy05(void)
    217 {
    218     char  *strResult;
    219     char  stringval[20] = "E R R O R";
    220     int   negativeSize = -5;
     216static psS32 testStringCopy05(void)
     217{
     218    char  *strResult;
     219    char  stringval[20] = "E R R O R";
     220    psS32   negativeSize = -5;
    221221
    222222    // Test point #6 Copy string with negative size - psStringNCopy
     
    224224    if ( strResult != NULL ) {
    225225        fprintf(stderr,"Failed test point #6 return value = %ld expected NULL\n",
    226                 (unsigned long)strResult);
     226                (psU64)strResult);
    227227        return 1;
    228228    }
     
    232232}
    233233
    234 static int testStringCopy06(void)
    235 {
    236     char  *strResult;
    237     char  stringval[20] = "E R R O R";
    238     int   result = 0;
     234static psS32 testStringCopy06(void)
     235{
     236    char  *strResult;
     237    char  stringval[20] = "E R R O R";
     238    psS32   result = 0;
    239239
    240240    // Test point #7 Verify creation of string literal - PS_STRING
  • trunk/psLib/test/sysUtils/tst_psStringCopy.c

    r1977 r2204  
    1717 *  @author  Eric Van Alst, MHPCC
    1818 *
    19  *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
    20  *  @date  $Date: 2004-10-06 01:59:08 $
     19 *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
     20 *  @date  $Date: 2004-10-27 00:57:33 $
    2121 *
    2222 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828#include "psTest.h"
    2929
    30 static int testStringCopy00(void);
    31 static int testStringCopy01(void);
    32 static int testStringCopy02(void);
    33 static int testStringCopy03(void);
    34 static int testStringCopy04(void);
    35 static int testStringCopy05(void);
    36 static int testStringCopy06(void);
     30static psS32 testStringCopy00(void);
     31static psS32 testStringCopy01(void);
     32static psS32 testStringCopy02(void);
     33static psS32 testStringCopy03(void);
     34static psS32 testStringCopy04(void);
     35static psS32 testStringCopy05(void);
     36static psS32 testStringCopy06(void);
    3737
    3838testDescription tests[] = {
     
    4747                          };
    4848
    49 int main( int argc, char* argv[] )
     49psS32 main( psS32 argc, char* argv[] )
    5050{
    5151    psLogSetLevel( PS_LOG_INFO );
     
    5555
    5656/*
    57 int main( int argc,
     57psS32 main( psS32 argc,
    5858          char * argv[] )
    5959{
    60     bool  tpResult = false;
     60    psBool  tpResult = false;
    6161    char  stringval[20] = "E R R O R";
    6262    char  stringval1[20] = "e r r o r";
    6363    char  *stringvalnocopy = "F A I L";
    6464    char  *substringval = "e r r";
    65     int   substringlen = 6;
     65    psS32   substringlen = 6;
    6666    char  *emptyval = "";
    67     int   tpFails = 0;
    68     char  *strResult;
    69     int   increaseSize = 5;
    70     int   negativeSize = -5;
    71     int   result = 0;
    72     int   result1 = 0;
    73     int   memBlockAllocated = 0;
     67    psS32   tpFails = 0;
     68    char  *strResult;
     69    psS32   increaseSize = 5;
     70    psS32   negativeSize = -5;
     71    psS32   result = 0;
     72    psS32   result1 = 0;
     73    psS32   memBlockAllocated = 0;
    7474    psMemBlock ***memBlockPtr = NULL;
    7575 
    7676*/
    7777
    78 static int testStringCopy00(void)
    79 {
    80     char  stringval[20] = "E R R O R";
    81     int   result = 0;
    82     int   result1 = 0;
     78static psS32 testStringCopy00(void)
     79{
     80    char  stringval[20] = "E R R O R";
     81    psS32   result = 0;
     82    psS32   result1 = 0;
    8383    char  *strResult;
    8484
     
    107107}
    108108
    109 static int testStringCopy01(void)
     109static psS32 testStringCopy01(void)
    110110{
    111111    char  *emptyval = "";
    112     int   result = 0;
     112    psS32   result = 0;
    113113    char  *strResult;
    114114
     
    130130}
    131131
    132 static int testStringCopy02(void)
    133 {
    134     int   result = 0;
    135     int   result1 = 0;
     132static psS32 testStringCopy02(void)
     133{
     134    psS32   result = 0;
     135    psS32   result1 = 0;
    136136    char  *strResult;
    137137    char  stringval1[20] = "e r r o r";
    138     int   substringlen = 5;
     138    psS32   substringlen = 5;
    139139    char  *substringval = "e r r";
    140140
     
    161161}
    162162
    163 static int testStringCopy03(void)
    164 {
    165     int   result = 0;
    166     int   result1 = 0;
     163static psS32 testStringCopy03(void)
     164{
     165    psS32   result = 0;
     166    psS32   result1 = 0;
    167167    char  *strResult;
    168168    char  *stringvalnocopy = "F A I L";
     
    185185}
    186186
    187 static int testStringCopy04(void)
    188 {
    189     int   result = 0;
    190     int   result1 = 0;
    191     char  *strResult;
    192     char  stringval[20] = "E R R O R";
    193     int   increaseSize = 5;
     187static psS32 testStringCopy04(void)
     188{
     189    psS32   result = 0;
     190    psS32   result1 = 0;
     191    char  *strResult;
     192    char  stringval[20] = "E R R O R";
     193    psS32   increaseSize = 5;
    194194
    195195    // Test point #5 Copy string to larger string - psStringNCopy
     
    205205                strResult, stringval);
    206206        fprintf(stderr,"                     strlne result = %d expected %d\n",result1,
    207                 (int)strlen(stringval));
     207                (psS32)strlen(stringval));
    208208        return 1;
    209209    }
     
    214214}
    215215
    216 static int testStringCopy05(void)
    217 {
    218     char  *strResult;
    219     char  stringval[20] = "E R R O R";
    220     int   negativeSize = -5;
     216static psS32 testStringCopy05(void)
     217{
     218    char  *strResult;
     219    char  stringval[20] = "E R R O R";
     220    psS32   negativeSize = -5;
    221221
    222222    // Test point #6 Copy string with negative size - psStringNCopy
     
    224224    if ( strResult != NULL ) {
    225225        fprintf(stderr,"Failed test point #6 return value = %ld expected NULL\n",
    226                 (unsigned long)strResult);
     226                (psU64)strResult);
    227227        return 1;
    228228    }
     
    232232}
    233233
    234 static int testStringCopy06(void)
    235 {
    236     char  *strResult;
    237     char  stringval[20] = "E R R O R";
    238     int   result = 0;
     234static psS32 testStringCopy06(void)
     235{
     236    char  *strResult;
     237    char  stringval[20] = "E R R O R";
     238    psS32   result = 0;
    239239
    240240    // Test point #7 Verify creation of string literal - PS_STRING
  • trunk/psLib/test/sysUtils/tst_psTrace.c

    r2202 r2204  
    1010
    1111
    12 static int testTrace00(void);
    13 static int testTrace01(void);
    14 static int testTrace02(void);
    15 static int testTrace03(void);
    16 static int testTrace04(void);
    17 static int testTrace05(void);
    18 static int testTrace05a(void);
    19 static int testTrace06(void);
    20 static int testTrace08(void);
     12static psS32 testTrace00(void);
     13static psS32 testTrace01(void);
     14static psS32 testTrace02(void);
     15static psS32 testTrace03(void);
     16static psS32 testTrace04(void);
     17static psS32 testTrace05(void);
     18static psS32 testTrace05a(void);
     19static psS32 testTrace06(void);
     20static psS32 testTrace08(void);
    2121
    2222testDescription tests[] = {
     
    3737                           };
    3838
    39 int main( int argc, char* argv[] )
     39psS32 main( psS32 argc, char* argv[] )
    4040{
    4141    psLogSetLevel( PS_LOG_INFO );
     
    4444}
    4545
    46 static int testTrace00(void)
    47 {
    48     int i;
    49     int lev = 0;
     46static psS32 testTrace00(void)
     47{
     48    psS32 i;
     49    psS32 lev = 0;
    5050
    5151    psTraceSetDestination(stderr);
     
    9494}
    9595
    96 static int testTrace01(void)
     96static psS32 testTrace01(void)
    9797{
    9898    psTraceSetDestination(stderr);
     
    104104}
    105105
    106 static int testTrace02(void)
     106static psS32 testTrace02(void)
    107107{
    108108    psTraceReset();
     
    133133}
    134134
    135 static int testTrace03(void)
    136 {
    137     int i = 0;
    138     int lev = 0;
     135static psS32 testTrace03(void)
     136{
     137    psS32 i = 0;
     138    psS32 lev = 0;
    139139
    140140    psTraceSetDestination(stderr);
     
    176176
    177177
    178 static int testTrace04(void)
     178static psS32 testTrace04(void)
    179179{
    180180    FILE *fp;
    181     int nb = 0;
     181    psS32 nb = 0;
    182182
    183183    fp = fopen("tst_psTrace02_OUT", "w");
     
    221221}
    222222
    223 static int testTrace05(void)
     223static psS32 testTrace05(void)
    224224{
    225225    psTraceSetDestination(stderr);
     
    247247}
    248248
    249 static int testTrace05a(void)
     249static psS32 testTrace05a(void)
    250250{
    251251    (void)psTraceSetLevel(".", 9);
     
    271271}
    272272
    273 static int testTrace06(void)
     273static psS32 testTrace06(void)
    274274{
    275275    psTraceSetDestination(stderr);
     
    311311
    312312// Ensure that the leading dot in the component names are optional.
    313 static int testTrace08(void)
     313static psS32 testTrace08(void)
    314314{
    315315    psTraceReset();
  • trunk/psLib/test/sysUtils/verified/tst_psTrace.stderr

    r2110 r2204  
    2525/***************************** TESTPOINT ******************************************\
    2626*             TestFile: tst_psTrace.c                                              *
    27 *            TestPoint: psTrace{psTraceSetLevel(): test static inheritance}        *
     27*            TestPoint: psTrace{psTraceSetLevel(): test static/dynamic inheritance} *
    2828*             TestType: Positive                                                   *
    2929\**********************************************************************************/
     
    4242     E               5
    4343
    44 ---> TESTPOINT PASSED (psTrace{psTraceSetLevel(): test static inheritance} | tst_psTrace.c)
     44---> TESTPOINT PASSED (psTrace{psTraceSetLevel(): test static/dynamic inheritance} | tst_psTrace.c)
    4545
    4646/***************************** TESTPOINT ******************************************\
  • trunk/psLib/test/tst_template.c

    r1364 r2204  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-08-02 18:30:10 $
     8*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-10-27 00:57:31 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#include "pslib.h"
    1616
    17 static int test1( void );
    18 static int test2( void );
    19 static int test3( void );
     17static psS32 test1( void );
     18static psS32 test2( void );
     19static psS32 test3( void );
    2020
    2121// test descrription consists of:
     
    4545                                  test3, 1114, "psFunctionFunk", 0, false
    4646                              },
    47                              
     47
    4848                              // testpoint #1112 handled by same test function as #1111
    4949                              {
    5050                                  test1, 1112, "psFunctionBang", 0, true
    5151                              },
    52                              
     52
    5353                              // A null terminates the testDescription list
    5454                              {
     
    5656                              }
    5757                          };
    58                          
    59 int main( int argc, char* argv[] )
     58
     59psS32 main( psS32 argc, char* argv[] )
    6060{
    6161    psLogSetLevel( PS_LOG_INFO );
    62    
     62
    6363    return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) );
    6464}
    6565
    66 int test1( void )
     66psS32 test1( void )
    6767{
    6868    // no need to check for memory leaks, as the runTestSuite does that for you.
    69    
     69
    7070    // here is where one implements the tests for generally a single testpoint.
    71    
     71
    7272    return 0;  // the value that indicates success is part of the testDescription
    7373}
    7474
    75 int test2( void )
     75psS32 test2( void )
    7676{
    7777    // no need to check for memory leaks, as the runTestSuite does that for you.
    78    
     78
    7979    // here is where one implements the tests for generally a single testpoint.
    80    
     80
    8181    return 0;  // the value that indicates success is part of the testDescription
    8282}
    8383
    84 int test3( void )
     84psS32 test3( void )
    8585{
    8686    // no need to check for memory leaks, as the runTestSuite does that for you.
    87    
     87
    8888    // here is where one implements the tests for generally a single testpoint.
    89    
     89
    9090    return 0;  // the value that indicates success is part of the testDescription
    9191}
Note: See TracChangeset for help on using the changeset viewer.