IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5530


Ignore:
Timestamp:
Nov 16, 2005, 1:07:10 PM (20 years ago)
Author:
desonia
Message:

removed *(type*)& syntax for setting const values of struts.

Location:
trunk/psLib
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImagePixelExtract.c

    r5511 r5530  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-11-14 22:18:33 $
     10 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-11-16 23:06:14 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222
    2323#include "psErrorText.h"
    24 
    2524
    2625#define FUNC_MACRO_VECTOR_STORE_ROW(TYPE) \
     
    407406        imgVec = psAlloc(sizeof(psVector));
    408407        imgVec->type = input->type;
    409         imgVec->n = *(int*)&imgVec->nalloc = numCols;
     408
     409        P_PSVECTOR_SET_NALLOC(imgVec,numCols);
     410        imgVec->n = numCols;
    410411        if (mask != NULL) {
    411412            maskVec = psAlloc(sizeof(psVector));
    412413            maskVec->type = mask->type;
    413             maskVec->n = *(int*)&maskVec->nalloc = numCols;
     414            P_PSVECTOR_SET_NALLOC(maskVec,numCols);
     415            maskVec->n = numCols;
    414416        }
    415417        // recycle output to make a proper sized/type output structure
  • trunk/psLib/src/imageops/psImageStats.c

    r5294 r5530  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.83 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-10-12 21:02:20 $
     11 *  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-11-16 23:06:14 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464        junkData = (psVector *) psAlloc(sizeof(psVector));
    6565        junkData->type = in->type;
    66         *(int*)&junkData->nalloc = in->numRows * in->numCols;
     66        P_PSVECTOR_SET_NALLOC(junkData,in->numRows * in->numCols);
    6767        junkData->n = junkData->nalloc;
    6868        junkData->data.U8 = in->data.V[0];      // since psImage data is contiguous...
     
    8888            junkMask = psAlloc(sizeof(psVector));
    8989            junkMask->type = mask->type;
    90             *(int*)&junkMask->nalloc = mask->numRows * mask->numCols;
     90            P_PSVECTOR_SET_NALLOC(junkMask,mask->numRows * mask->numCols);
    9191            junkMask->n = junkMask->nalloc;
    9292            junkMask->data.U8 = mask->data.V[0];
     
    137137        junkData = (psVector *) psAlloc(sizeof(psVector));
    138138        junkData->type = in->type;
    139         *(int*)&junkData->nalloc = in->numRows * in->numCols;
     139        P_PSVECTOR_SET_NALLOC(junkData,in->numRows * in->numCols);
    140140        junkData->n = junkData->nalloc;
    141141        junkData->data.U8 = in->data.V[0];      // since psImage data is contiguous...
     
    161161            junkMask = psAlloc(sizeof(psVector));
    162162            junkMask->type = mask->type;
    163             *(int*)&junkMask->nalloc = mask->numRows * mask->numCols;
     163            P_PSVECTOR_SET_NALLOC(junkMask,mask->numRows * mask->numCols);
    164164            junkMask->n = junkMask->nalloc;
    165165            junkMask->data.U8 = mask->data.V[0];
  • trunk/psLib/src/math/psMinimize.c

    r5453 r5530  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.144 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-10-28 19:15:04 $
     12 *  @version $Revision: 1.145 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-11-16 23:06:19 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1717 *  XXX: must follow coding name standards on local functions.
    1818 *  XXX: put local functions in front.
    19  * 
     19 *
    2020 */
    2121/*****************************************************************************/
     
    596596    psMinimization *min = psAlloc(sizeof(psMinimization));
    597597    psMemSetDeallocator(min, (psFreeFunc)minimizationFree);
    598     *(int*)&min->maxIter = maxIter;
    599     *(float*)&min->tol = tol;
     598    P_PSMINIMIZATION_SET_MAXITER(min,maxIter);
     599    P_PSMINIMIZATION_SET_TOL(min,tol);
    600600    min->value = 0.0;
    601601    min->iter = 0;
     
    11641164        for (i=0;i<numDims;i++) {
    11651165            if (myParamMask->data.U8[i] == 0) {
    1166                 *(int*)&dummyMin.maxIter = PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS;
     1166                P_PSMINIMIZATION_SET_MAXITER((&dummyMin),PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS);
    11671167                *(float*)&dummyMin.tol = PS_MINIMIZE_POWELL_LINEMIN_ERROR_TOLERANCE;
    11681168                mul = p_psLineMin(&dummyMin,
  • trunk/psLib/src/math/psMinimize.h

    r5176 r5530  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-09-29 02:16:19 $
     10 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-11-16 23:06:19 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5252psMinimization;
    5353
    54 /** Allocates a psMinimization structure.
    55  *
    56  *  @return psMinimization* :   a new psMinimization struct
    57 */
    58 psMinimization *psMinimizationAlloc(
    59     int maxIter,                       ///< Number of minimization iterations to perform.
    60     float tol                          ///< Requested error tolerance
    61 );
     54#define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
     55        #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
     56
     57
     58                /** Allocates a psMinimization structure.
     59                 *
     60                 *  @return psMinimization* :   a new psMinimization struct
     61                */
     62                psMinimization *psMinimizationAlloc(
     63                    int maxIter,                       ///< Number of minimization iterations to perform.
     64                    float tol                          ///< Requested error tolerance
     65                );
    6266
    6367/** Checks the type of a particular pointer.
  • trunk/psLib/src/math/psStats.c

    r5517 r5530  
    1717*
    1818*
    19 *  @version $Revision: 1.150 $ $Name: not supported by cvs2svn $
    20 *  @date $Date: 2005-11-15 20:10:32 $
     19*  @version $Revision: 1.151 $ $Name: not supported by cvs2svn $
     20*  @date $Date: 2005-11-16 23:06:19 $
    2121*
    2222*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    23342334    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    23352335    psMemSetDeallocator(newHist, (psFreeFunc) histogramFree);
    2336     newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
    2337     *(int *)&newHist->bounds->n = newHist->bounds->nalloc;
     2336    psVector* newBounds = psVectorAlloc(n + 1, PS_TYPE_F32);
     2337    newHist->bounds = newBounds;
     2338    newBounds->n = newHist->bounds->nalloc;
    23382339
    23392340    // Calculate the bounds for each bin.
     
    23432344    binSize += FLT_EPSILON;
    23442345    for (i = 0; i < n + 1; i++) {
    2345         newHist->bounds->data.F32[i] = lower + (binSize * (psF32)i);
     2346        newBounds->data.F32[i] = lower + (binSize * (psF32)i);
    23462347    }
    23472348
     
    23832384    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
    23842385    psMemSetDeallocator(newHist, (psFreeFunc) histogramFree);
    2385     newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
    2386     *(int *)&newHist->bounds->n = newHist->bounds->nalloc;
     2386    psVector* newBounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     2387    newHist->bounds = newBounds;
     2388    newBounds->n = newHist->bounds->nalloc;
    23872389    for (i = 0; i < bounds->n; i++) {
    2388         newHist->bounds->data.F32[i] = bounds->data.F32[i];
     2390        newBounds->data.F32[i] = bounds->data.F32[i];
    23892391    }
    23902392
  • trunk/psLib/src/mathtypes/psImage.h

    r5137 r5530  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-26 22:35:53 $
     13 *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-11-16 23:06:21 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8080psImage;
    8181
    82 /** Basic image region structure.
    83  *
    84  * Struct for specifying a rectangular area in an image.
    85  *
    86  */
    87 typedef struct
    88 {
    89     float x0;                         ///< the first column of the region.
    90     float x1;                         ///< the last column of the region.
    91     float y0;                         ///< the first row of the region.
    92     float y1;                         ///< the last row of the region.
    93 }
    94 psRegion;
     82#define P_PSIMAGE_SET_NUMCOLS(img,nc) *(int*)&img->numCols = nc
     83        #define P_PSIMAGE_SET_NUMROWS(img,nr) *(int*)&img->numCols = nr
     84                #define P_PSIMAGE_SET_TYPE(img,t) *(psMathType*)&img->type = t
     85
     86                        /** Basic image region structure.
     87                         *
     88                         * Struct for specifying a rectangular area in an image.
     89                         *
     90                         */
     91                        typedef struct
     92                        {
     93                            float x0;                         ///< the first column of the region.
     94                            float x1;                         ///< the last column of the region.
     95                            float y0;                         ///< the first row of the region.
     96                            float y1;                         ///< the last row of the region.
     97                        }
     98                        psRegion;
    9599
    96100/** Create an image of the specified size and type.
  • trunk/psLib/src/mathtypes/psVector.c

    r5222 r5530  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-10-04 01:31:40 $
     11*  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-11-16 23:06:21 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8787    psVec->type.dimen = PS_DIMEN_VECTOR;
    8888    psVec->type.type = type;
    89     *(long*)&psVec->nalloc = nalloc;
     89    P_PSVECTOR_SET_NALLOC(psVec,nalloc);
    9090    psVec->n = nalloc;
    9191
     
    114114        // Realloc after decrementation to avoid accessing freed array elements
    115115        vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
    116         *(long*)&vector->nalloc = nalloc;
     116        P_PSVECTOR_SET_NALLOC(vector,nalloc);
    117117    }
    118118
     
    143143    if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) {
    144144        vector->data.U8 = psRealloc(vector->data.U8, byteSize);
    145         *(long*)&vector->nalloc = nalloc;
     145        P_PSVECTOR_SET_NALLOC(vector,nalloc);
    146146    }
    147147
  • trunk/psLib/src/mathtypes/psVector.h

    r5137 r5530  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-26 22:35:53 $
     13 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-11-16 23:06:21 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5555psVector;
    5656
    57 /*****************************************************************************/
    58 
    59 /* FUNCTION PROTOTYPES                                                       */
    60 
    61 /*****************************************************************************/
    62 
    63 /** Checks the type of a particular pointer.
    64  *
    65  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
    66  *
    67  *  @return bool:       True if the pointer matches a psVector structure, false otherwise.
    68  */
    69 bool psMemCheckVector(
    70     psPtr ptr                          ///< the pointer whose type to check
    71 )
    72 ;
     57#define P_PSVECTOR_SET_NALLOC(vec,n) *(long*)&(vec->nalloc) = n
     58
     59        /*****************************************************************************/
     60
     61        /* FUNCTION PROTOTYPES                                                       */
     62
     63        /*****************************************************************************/
     64
     65        /** Checks the type of a particular pointer.
     66         *
     67         *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     68         *
     69         *  @return bool:       True if the pointer matches a psVector structure, false otherwise.
     70         */
     71        bool psMemCheckVector(
     72            psPtr ptr                          ///< the pointer whose type to check
     73        )
     74        ;
    7375
    7476/** Allocate a vector.
  • trunk/psLib/src/types/psArray.c

    r5216 r5530  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-10-01 02:22:15 $
     11 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-11-16 23:06:35 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6363    psMemSetDeallocator(psArr, (psFreeFunc) arrayFree);
    6464
    65     *(long*)&psArr->nalloc = nalloc;
     65    P_PSARRAY_SET_NALLOC(psArr,nalloc);
    6666    psArr->n = nalloc;
    6767
     
    8787        // Realloc after decrementation to avoid accessing freed array elements
    8888        in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
    89         *(long*)&in->nalloc = nalloc;
     89        P_PSARRAY_SET_NALLOC(in,nalloc);
    9090    }
    9191
  • trunk/psLib/src/types/psArray.h

    r5454 r5530  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-10-29 00:05:53 $
     13 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-11-16 23:06:35 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4040psArray;
    4141
    42 /*****************************************************************************/
     42#define P_PSARRAY_SET_NALLOC(vec,n) *(long*)&vec->nalloc = n
    4343
    44 /* FUNCTION PROTOTYPES                                                       */
     44        /*****************************************************************************/
    4545
    46 /*****************************************************************************/
     46        /* FUNCTION PROTOTYPES                                                       */
    4747
    48 /** Checks the type of a particular pointer.
    49  *
    50  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
    51  *
    52  *  @return bool:       True if the pointer matches a psArray structure, false otherwise.
    53  */
    54 bool psMemCheckArray(
    55     psPtr ptr                          ///< the pointer whose type to check
    56 )
    57 ;
     48        /*****************************************************************************/
     49
     50        /** Checks the type of a particular pointer.
     51         *
     52         *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     53         *
     54         *  @return bool:       True if the pointer matches a psArray structure, false otherwise.
     55         */
     56        bool psMemCheckArray(
     57            psPtr ptr                          ///< the pointer whose type to check
     58        )
     59        ;
    5860
    5961
  • trunk/psLib/src/types/psPixels.c

    r5214 r5530  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-10-01 00:14:17 $
     9 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-11-16 23:06:35 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6666    }
    6767    out->n = nalloc;
    68     *(long*)&out->nalloc = nalloc;
     68    P_PSPIXELS_SET_NALLOC(out,nalloc);
    6969
    7070    psMemSetDeallocator(out, (psFreeFunc)pixelsFree);
     
    9494    }
    9595
    96     *(long*)&pixels->nalloc = nalloc;
     96    P_PSPIXELS_SET_NALLOC(pixels,nalloc);
    9797
    9898    if (pixels->n > pixels->nalloc) {
  • trunk/psLib/src/types/psPixels.h

    r5214 r5530  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-10-01 00:14:17 $
     9 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-11-16 23:06:35 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4848psPixels;
    4949
     50#define P_PSPIXELS_SET_NALLOC(pix,n) *(long*)&pix->nalloc = n
    5051
    51 /** Allocates a new psPixels structure
    52  *
    53  *  @return psPixels*   new psPixels
    54  */
    55 psPixels* psPixelsAlloc(
    56     long nalloc                       ///< the size of the coordinate vectors
    57 )
    58 ;
     52        /** Allocates a new psPixels structure
     53         *
     54         *  @return psPixels*   new psPixels
     55         */
     56        psPixels* psPixelsAlloc(
     57            long nalloc                       ///< the size of the coordinate vectors
     58        )
     59        ;
    5960
    6061/** Checks the type of a particular pointer.
  • trunk/psLib/test/types/tst_psMetadata_04.c

    r5522 r5530  
    1 
    21/** @file  tst_psMetadata_04.c
    3 *
    4 *  @brief Test driver for psMetadata functions
    5 *
    6 *  This test driver contains the following tests for psMetadata:
    7 *     Test A - Allocate metadata and items
    8 *     Test B - Lookup metadata item by name
    9 *     Test C - Attempt to use null metadata
    10 *     Test D - Attempt to use null key
    11 *     Test E - Attempt to lookup non-existant metadata item
    12 *     Test F - Lookup metadata item by index
    13 *     Test G - Lookup metadata item and return psS32 value
    14 *     Test H - Lookup metadata item and return psF64 value
    15 *     Test I - Lookup metadata item and return psVector pointer
    16 *     Test J - Lookup metadata item and return psMetadata pointer
    17 *     Test K - Lookup metadata item and return psString value
    18 *     Test L - Attempt to use null metadata
    19 *     Test M - Attempt to get non-existant metadata item
    20 *     Test N - Attempt to look up with an invalid metadata object
    21 *     Test O - Attempt get item  with an invalid metadata object
    22 *     Test P - Attempt get value of non-existant metadata item
    23 *     Test Q - Free psMetadata
    24 *
    25 *  @author  Ross Harman, MHPCC
    26 *
    27 *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
    28 *  @date  $Date: 2005-11-16 02:40:13 $
    29 *
    30 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    31 *
    32 */
     2 *
     3 *  @brief Test driver for psMetadata functions
     4 *
     5 *  This test driver contains the following tests for psMetadata:
     6 *     Test A - Allocate metadata and items
     7 *     Test B - Lookup metadata item by name
     8 *     Test C - Attempt to use null metadata
     9 *     Test D - Attempt to use null key
     10 *     Test E - Attempt to lookup non-existant metadata item
     11 *     Test F - Lookup metadata item by index
     12 *     Test G - Lookup metadata item and return psS32 value
     13 *     Test H - Lookup metadata item and return psF64 value
     14 *     Test I - Lookup metadata item and return psVector pointer
     15 *     Test J - Lookup metadata item and return psMetadata pointer
     16 *     Test K - Lookup metadata item and return psString value
     17 *     Test L - Attempt to use null metadata
     18 *     Test M - Attempt to get non-existant metadata item
     19 *     Test N - Attempt to look up with an invalid metadata object
     20 *     Test O - Attempt get item  with an invalid metadata object
     21 *     Test P - Attempt get value of non-existant metadata item
     22 *     Test Q - Free psMetadata
     23 *
     24 *  @author  Ross Harman, MHPCC
     25 *
     26 *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
     27 *  @date  $Date: 2005-11-16 23:07:10 $
     28 *
     29 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     30 *
     31 */
    3332
    3433#include <string.h>
Note: See TracChangeset for help on using the changeset viewer.