Changeset 7901 for trunk/psLib/src/sys
- Timestamp:
- Jul 13, 2006, 4:26:25 PM (20 years ago)
- Location:
- trunk/psLib/src/sys
- Files:
-
- 7 edited
-
psLine.c (modified) (2 diffs)
-
psLine.h (modified) (3 diffs)
-
psMemory.c (modified) (6 diffs)
-
psMemory.h (modified) (2 diffs)
-
psString.c (modified) (3 diffs)
-
psString.h (modified) (3 diffs)
-
psType.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psLine.c
r7380 r7901 39 39 } 40 40 41 bool psLineAdd(psLine *line, const char *format, ...) 41 bool psLineAdd(psLine *line, 42 const char *format, 43 ...) 42 44 { 43 45 if (!line) { … … 58 60 return true; 59 61 } 62 63 bool psMemCheckLine(psPtr ptr) 64 { 65 if (!is_psType(ptr)) { 66 return false; 67 } 68 return ( psMemGetDeallocator(ptr) == (psFreeFunc)lineFree ); 69 } 70 -
trunk/psLib/src/sys/psLine.h
r7847 r7901 1 1 /** @file psLine.h 2 2 * 3 * the psLine functions allow manipulation of fixed-length lines 3 * 4 * @brief Contains the declarations of line utility functions 5 * 6 * @ingroup SysUtils 7 * 8 * The psLine functions allow manipulation of fixed-length lines. 9 * 10 * @author Paul Price, IFA 11 * @author David Robbins, MHPCC 12 * 13 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-07-14 02:26:25 $ 15 * 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 4 17 */ 5 18 6 19 #ifndef PS_LINE_H 7 20 #define PS_LINE_H 21 22 /** @addtogroup SysUtils 23 * @{ 24 */ 8 25 9 26 /** Structure to carry a dynamic string */ … … 16 33 psLine; 17 34 18 /** Allocates a line object of length Nline 35 /** Allocates a line object of length Nline. 19 36 * 20 37 * @return psLine*: the newly allocated line object. 21 38 */ 22 39 psLine *psLineAlloc( 23 long Nline ///< 40 long Nline ///< length of line object to allocate 41 ); 42 43 /** Checks the type of a particular pointer. 44 * 45 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 46 * 47 * @return bool: True if the pointer matches a psLine structure, false otherwise. 48 */ 49 bool psMemCheckLine( 50 psPtr ptr ///< the pointer whose type to check 24 51 ); 25 52 … … 32 59 */ 33 60 bool psLineInit( 34 psLine *line ///< 61 psLine *line ///< line to (re-)initialize 35 62 ); 36 63 -
trunk/psLib/src/sys/psMemory.c
r7617 r7901 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.7 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-0 6-21 21:40:12$10 * @version $Revision: 1.74 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-07-14 02:26:25 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 24 24 #include "psAbort.h" 25 25 #include "psLogMsg.h" 26 27 26 #include "psBitSet.h" 28 //#include "psArray.h"29 //#include "psImage.h"30 //#include "psList.h"31 //#include "psLookupTable.h"32 //#include "psHash.h"33 34 //#include "psMetadata.h"35 27 #include "psFits.h" 36 28 #include "psPixels.h" 37 //#include "psScalar.h"38 //#include "psVector.h"39 //#include "psTime.h"40 //#include "psCoord.h"41 29 #include "psSphereOps.h" 42 //#include "psStats.h"43 30 #include "psMinimizeLMM.h" 44 31 #include "psImageConvolve.h" 45 32 #include "psTime.h" 46 33 #include "psLine.h" 34 #include "psRegion.h" 47 35 #include "psErrorText.h" 48 36 … … 837 825 } 838 826 827 bool is_psType(psPtr ptr) 828 { 829 if (ptr == NULL) { 830 return false; 831 } 832 psMemBlock* m = ((psMemBlock* ) ptr) - 1; 833 if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) { 834 return false; //Probably not a psAllocated-Type 835 } else { 836 return true; 837 } 838 } 839 839 840 bool psMemCheckType(psDataType type, 840 841 psPtr ptr) 841 842 { 843 if (!is_psType(ptr)) { 844 return false; 845 } 846 842 847 switch(type) { 843 848 case PS_DATA_ARRAY: … … 905 910 break; 906 911 } 912 case PS_DATA_LINE: 913 if ( psMemCheckLine(ptr) ) 914 return true; 915 else { 916 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 917 "Incorrect pointer. Datatypes do not match.\n"); 918 break; 919 } 907 920 case PS_DATA_LIST: 908 921 if ( psMemCheckList(ptr) ) … … 1017 1030 break; 1018 1031 } 1032 case PS_DATA_REGION: 1033 if ( psMemCheckRegion(ptr) ) 1034 return true; 1035 else { 1036 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 1037 "Incorrect pointer. Datatypes do not match.\n"); 1038 break; 1039 } 1019 1040 case PS_DATA_SCALAR: 1020 1041 if ( psMemCheckScalar(ptr) ) … … 1051 1072 case PS_DATA_STATS: 1052 1073 if ( psMemCheckStats(ptr) ) 1074 return true; 1075 else { 1076 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 1077 "Incorrect pointer. Datatypes do not match.\n"); 1078 break; 1079 } 1080 case PS_DATA_STRING: 1081 if ( psMemCheckString(ptr) ) 1053 1082 return true; 1054 1083 else { -
trunk/psLib/src/sys/psMemory.h
r7617 r7901 12 12 * @ingroup MemoryManagement 13 13 * 14 * @version $Revision: 1.5 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-0 6-21 21:40:12$14 * @version $Revision: 1.57 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-07-14 02:26:25 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 172 172 ); 173 173 174 bool is_psType( 175 psPtr ptr 176 ); 177 174 178 /** Checks the deallocator to see if the pointer matches the desired datatype. 175 179 * -
trunk/psLib/src/sys/psString.c
r7879 r7901 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $16 * @date $Date: 2006-07-1 2 21:17:51$15 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-07-14 02:26:25 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 30 30 #include "psErrorText.h" 31 31 32 static void stringFree(psString string) 33 { 34 // There is non dynamic allocated item 35 } 36 37 psString psStringAlloc(long nChar) 38 { 39 if (nChar < 1) { 40 return NULL; 41 } 42 psString string = psAlloc(nChar + 1); 43 psMemSetDeallocator(string, (psFreeFunc)stringFree); 44 return string; 45 } 46 47 bool psMemCheckString(psPtr ptr) 48 { 49 if (!is_psType(ptr)) { 50 return false; 51 } 52 return ( psMemGetDeallocator(ptr) == (psFreeFunc)stringFree ); 53 } 54 32 55 psString psStringCopy(const char *string) 33 56 { … … 231 254 return input; 232 255 } 256 if (!psMemCheckString(input)) { 257 return input; 258 } 259 233 260 234 261 // replace == NULL is valid: it just means that we strip out the key -
trunk/psLib/src/sys/psString.h
r7853 r7901 14 14 * @author David Robbins, MHPCC 15 15 * 16 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2006-07-1 0 20:15:43$16 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2006-07-14 02:26:25 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 39 39 * @{ 40 40 */ 41 42 /** Allocates a new psString. 43 * 44 * @return psString: Newly allocated string of length n. 45 */ 46 psString psStringAlloc( 47 long nChar ///< Size of psString to allocate. 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 psString structure, false otherwise. 55 */ 56 bool psMemCheckString( 57 psPtr ptr ///< the pointer whose type to check 58 ); 41 59 42 60 /** Copies the input string … … 145 163 ); 146 164 147 148 165 /** @} */// Doxygen - End of SystemGroup Functions 149 166 -
trunk/psLib/src/sys/psType.h
r7472 r7901 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 6-10 02:28:17$12 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-07-14 02:26:25 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 118 118 PS_DATA_IMAGE, ///< psImage 119 119 PS_DATA_KERNEL, ///< psKernel 120 PS_DATA_LINE, ///< psLine 120 121 PS_DATA_LIST, ///< psList 121 122 PS_DATA_LOOKUPTABLE, ///< psLookupTable
Note:
See TracChangeset
for help on using the changeset viewer.
