IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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/src/mathtypes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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.
Note: See TracChangeset for help on using the changeset viewer.