Changeset 1441 for trunk/psLib/src/sysUtils
- Timestamp:
- Aug 9, 2004, 1:40:55 PM (22 years ago)
- Location:
- trunk/psLib/src/sysUtils
- Files:
-
- 9 edited
-
psAbort.h (modified) (2 diffs)
-
psError.h (modified) (2 diffs)
-
psLogMsg.c (modified) (2 diffs)
-
psLogMsg.h (modified) (1 diff)
-
psMemory.h (modified) (9 diffs)
-
psString.h (modified) (3 diffs)
-
psTrace.c (modified) (2 diffs)
-
psTrace.h (modified) (4 diffs)
-
psType.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sysUtils/psAbort.h
r1426 r1441 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25 $14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:40:55 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 20 20 #ifndef PS_ABORT_H 21 # define PS_ABORT_H21 #define PS_ABORT_H 22 22 23 23 // Doxygen grouping tags -
trunk/psLib/src/sysUtils/psError.h
r1426 r1441 13 13 * @author Eric Van Alst, MHPCC 14 14 * 15 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08-09 2 2:44:25 $15 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-09 23:40:55 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 21 21 #ifndef PS_ERROR_H 22 # define PS_ERROR_H22 #define PS_ERROR_H 23 23 24 24 /** @addtogroup ErrorHandling -
trunk/psLib/src/sysUtils/psLogMsg.c
r1407 r1441 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-0 7 00:06:06$14 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:40:55 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 216 216 217 217 #if !defined(HOST_NAME_MAX) // should be in limits.h 218 # define HOST_NAME_MAX 256218 #define HOST_NAME_MAX 256 219 219 #endif 220 220 -
trunk/psLib/src/sysUtils/psLogMsg.h
r1426 r1441 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-09 2 2:44:25 $14 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 23:40:55 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 18 18 */ 19 19 #if !defined(PS_LOG_MSG_H) 20 # define PS_LOG_MSG_H21 # include <stdarg.h>20 #define PS_LOG_MSG_H 21 #include <stdarg.h> 22 22 23 23 /** @addtogroup LogTrace -
trunk/psLib/src/sysUtils/psMemory.h
r1440 r1441 1 1 #if !defined(PS_MEMORY_H) 2 # define PS_MEMORY_H2 #define PS_MEMORY_H 3 3 4 4 /** @file psMemory.h … … 15 15 * @ingroup MemoryManagement 16 16 * 17 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $18 * @date $Date: 2004-08-09 23: 34:58$17 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2004-08-09 23:40:55 $ 19 19 * 20 20 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 21 21 */ 22 22 23 # include <stdio.h> // needed for FILE24 # include <stdbool.h>25 # include <pthread.h> // we need a mutex to make this stuff thread safe.23 #include <stdio.h> // needed for FILE 24 #include <stdbool.h> 25 #include <pthread.h> // we need a mutex to make this stuff thread safe. 26 26 27 27 /** @addtogroup MemoryManagement … … 122 122 * @see psFree 123 123 */ 124 # ifdef DOXYGEN124 #ifdef DOXYGEN 125 125 void *psAlloc(size_t size ///< Size required 126 126 ); 127 # else128 129 void *p_psAlloc(size_t size, ///< Size required130 const char *file, ///< File of call131 int lineno ///< Line number of call132 );127 #else 128 129 void *p_psAlloc(size_t size, ///< Size required 130 const char *file, ///< File of call 131 int lineno ///< Line number of call 132 ); 133 133 134 134 void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn); … … 136 136 137 137 /// Memory allocation. psAlloc sends file and line number to p_psAlloc. 138 # define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)139 # endif138 #define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__) 139 #endif 140 140 141 141 /** Memory re-allocation. This operates much like realloc(), but is guaranteed to return a non-NULL value. … … 144 144 * @see psAlloc, psFree 145 145 */ 146 # ifdef DOXYGEN146 #ifdef DOXYGEN 147 147 void *psRealloc(void *ptr ///< Pointer to re-allocate 148 148 size_t size, ///< Size required 149 149 ); 150 # else151 152 void *p_psRealloc(void *ptr, ///< Pointer to re-allocate153 size_t size, ///< Size required154 const char *file, ///< File of call155 int lineno ///< Line number of call156 );150 #else 151 152 void *p_psRealloc(void *ptr, ///< Pointer to re-allocate 153 size_t size, ///< Size required 154 const char *file, ///< File of call 155 int lineno ///< Line number of call 156 ); 157 157 158 158 /// Memory re-allocation. psRealloc sends file and line number to p_psRealloc. 159 # define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)160 161 # endif159 #define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__) 160 161 #endif 162 162 163 163 /** Free memory. This operates much like free(). … … 165 165 * @see psAlloc, psRealloc 166 166 */ 167 # ifdef DOXYGEN167 #ifdef DOXYGEN 168 168 void psFree(void *ptr, ///< Pointer to free, if NULL, function returns immediately. 169 169 ); 170 # else171 172 void p_psFree(void *ptr, ///< Pointer to free173 const char *file, ///< File of call174 int lineno ///< Line number of call175 );170 #else 171 172 void p_psFree(void *ptr, ///< Pointer to free 173 const char *file, ///< File of call 174 int lineno ///< Line number of call 175 ); 176 176 177 177 /// Free memory. psFree sends file and line number to p_psFree. 178 # define psFree(size) p_psFree(size, __FILE__, __LINE__)179 180 # endif178 #define psFree(size) p_psFree(size, __FILE__, __LINE__) 179 180 #endif 181 181 182 182 /** Check for memory leaks. This scans for allocated memory buffers not freed with an ID not less than id0. … … 218 218 * @ingroup memRefCount 219 219 */ 220 # ifdef DOXYGEN220 #ifdef DOXYGEN 221 221 void *psMemIncrRefCounter(void *vptr ///< Pointer to increment refCounter, and return 222 222 ); 223 # else224 225 void *p_psMemIncrRefCounter(void *vptr, ///< Pointer to increment refCounter, and return226 const char *file, ///< File of call227 int lineno ///< Line number of call228 );229 230 # define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)231 # endif223 #else 224 225 void *p_psMemIncrRefCounter(void *vptr, ///< Pointer to increment refCounter, and return 226 const char *file, ///< File of call 227 int lineno ///< Line number of call 228 ); 229 230 #define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__) 231 #endif 232 232 233 233 /** Decrement reference counter and return the pointer … … 235 235 * @ingroup memRefCount 236 236 */ 237 # ifdef DOXYGEN237 #ifdef DOXYGEN 238 238 void *psMemDecrRefCounter(void *vptr ///< Pointer to decrement refCounter, and return 239 239 ); 240 # else241 242 void *p_psMemDecrRefCounter(void *vptr, ///< Pointer to decrement refCounter, and return243 const char *file, ///< File of call244 int lineno ///< Line number of call245 );246 247 # define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)248 # endif240 #else 241 242 void *p_psMemDecrRefCounter(void *vptr, ///< Pointer to decrement refCounter, and return 243 const char *file, ///< File of call 244 int lineno ///< Line number of call 245 ); 246 247 #define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__) 248 #endif 249 249 250 250 /** Set callback for problems … … 297 297 //@} End of Memory Management Functions 298 298 299 # ifndef DOXYGEN299 #ifndef DOXYGEN 300 300 301 301 /* 302 302 * Ensure that any program using malloc/realloc/free will fail to compile 303 303 */ 304 # ifndef PS_ALLOW_MALLOC305 # ifdef __GNUC__306 # pragma GCC poison malloc realloc calloc free307 # else308 # define malloc(S) _Pragma("error Use of malloc is not allowed. Use psAlloc instead.")309 # define realloc(P,S) _Pragma("error Use of realloc is not allowed. Use psRealloc instead.")310 # define calloc(S) _Pragma("error Use of calloc is not allowed. Use psAlloc instead.")311 # define free(P) _Pragma("error Use of free is not allowed. Use psFree instead.")312 # endif313 # endif314 315 # endif316 // doxygen skip317 318 #endif // end of header file304 #ifndef PS_ALLOW_MALLOC 305 #ifdef __GNUC__ 306 #pragma GCC poison malloc realloc calloc free 307 #else 308 # define malloc(S) _Pragma("error Use of malloc is not allowed. Use psAlloc instead.") 309 # define realloc(P,S) _Pragma("error Use of realloc is not allowed. Use psRealloc instead.") 310 # define calloc(S) _Pragma("error Use of calloc is not allowed. Use psAlloc instead.") 311 # define free(P) _Pragma("error Use of free is not allowed. Use psFree instead.") 312 # endif 313 # endif 314 315 # endif 316 // doxygen skip 317 318 #endif // end of header file -
trunk/psLib/src/sysUtils/psString.h
r1407 r1441 11 11 * @author Eric Van Alst, MHPCC 12 12 * 13 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:40:55 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 #ifndef PS_STRING_H 20 # define PS_STRING_H20 #define PS_STRING_H 21 21 22 22 /******************************************************************************/ … … 27 27 28 28 /** This macro will convert the arguement to a quoted string */ 29 # define PS_STRING(S) #S29 #define PS_STRING(S) #S 30 30 31 31 /******************************************************************************/ -
trunk/psLib/src/sysUtils/psTrace.c
r1440 r1441 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 23: 34:58$12 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:40:55 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 36 36 #ifndef PS_NO_TRACE 37 37 38 # include <stdlib.h>39 # include <stdio.h>40 # include <string.h>41 # include <stdarg.h>42 # include "psMemory.h"43 # include "psTrace.h"44 # include "psString.h"45 # include "psError.h"38 #include <stdlib.h> 39 #include <stdio.h> 40 #include <string.h> 41 #include <stdarg.h> 42 #include "psMemory.h" 43 #include "psTrace.h" 44 #include "psString.h" 45 #include "psError.h" 46 46 47 47 static p_psComponent* p_psCroot = NULL; // The root of the trace component -
trunk/psLib/src/sysUtils/psTrace.h
r1440 r1441 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-09 23: 34:58$12 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 23:40:55 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 16 */ 17 17 #if !defined(PS_TRACE_H) 18 # define PS_TRACE_H 118 #define PS_TRACE_H 1 19 19 20 # define PS_UNKNOWN_TRACE_LEVEL -9999 // we don't know this name's level21 # define PS_DEFAULT_TRACE_LEVEL 020 #define PS_UNKNOWN_TRACE_LEVEL -9999 // we don't know this name's level 21 #define PS_DEFAULT_TRACE_LEVEL 0 22 22 23 23 /** \addtogroup LogTrace … … 29 29 //#define PS_NO_TRACE 1 ///< to turn off all tracing 30 30 31 # if defined(PS_NO_TRACE)32 # define psTrace(facil, level, ...) (void)033 /* do nothing */34 # define p_psTrace(facil, level, ...) (void)035 /* do nothing */36 # define psTraceSetLevel(facil,level) 037 # define psTraceGetLevel(facil) 038 # define psTraceReset() (void)0 /* do nothing */39 # define psTraceFree() (void)0 /* do nothing */40 # define psTracePrintLevels() (void)041 /* do nothing */42 # define psTraceSetDestination(fp) (void)043 /* do nothing */44 # else31 #if defined(PS_NO_TRACE) 32 # define psTrace(facil, level, ...) (void)0 33 /* do nothing */ 34 # define p_psTrace(facil, level, ...) (void)0 35 /* do nothing */ 36 # define psTraceSetLevel(facil,level) 0 37 # define psTraceGetLevel(facil) 0 38 # define psTraceReset() (void)0 /* do nothing */ 39 # define psTraceFree() (void)0 /* do nothing */ 40 # define psTracePrintLevels() (void)0 41 /* do nothing */ 42 # define psTraceSetDestination(fp) (void)0 43 /* do nothing */ 44 # else 45 45 46 /** Basic structure for the component tree. A component is a string of the47 form aaa.bbb.ccc, and may itself contain further subcomponents. The48 Component structure doesn't in fact contain it's full name, but only the49 last part. */50 typedef struct p_psComponent51 {52 const char *name; // last part of name of component53 int level; // trace level for this component54 int n; // number of subcomponents55 struct p_psComponent* *subcomp; // next level of subcomponents56 }46 /** Basic structure for the component tree. A component is a string of the 47 form aaa.bbb.ccc, and may itself contain further subcomponents. The 48 Component structure doesn't in fact contain it's full name, but only the 49 last part. */ 50 typedef struct p_psComponent 51 { 52 const char *name; // last part of name of component 53 int level; // trace level for this component 54 int n; // number of subcomponents 55 struct p_psComponent* *subcomp; // next level of subcomponents 56 } 57 57 p_psComponent; 58 58 59 # ifndef DOXYGEN59 #ifndef DOXYGEN 60 60 /// Send a trace message 61 61 void p_psTrace(const char *facil, ///< facilty of interest … … 63 63 ...) ///< trace message arguments 64 64 ; 65 # endif65 #endif 66 66 67 67 /// Set trace level … … 88 88 /* \} */// End of SystemGroup Functions 89 89 90 # define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)91 # endif90 #define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__) 91 #endif 92 92 93 93 #endif -
trunk/psLib/src/sysUtils/psType.h
r1426 r1441 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-09 2 2:44:25 $13 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 23:40:55 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 #ifndef PS_TYPE_H 20 # define PS_TYPE_H20 #define PS_TYPE_H 21 21 22 # include <complex.h>23 # include <stdint.h>24 # include <float.h>22 #include <complex.h> 23 #include <stdint.h> 24 #include <float.h> 25 25 26 26 /// @addtogroup DataContainer … … 72 72 } psElemType; 73 73 74 # define PS_TYPE_MASK PS_TYPE_U8 ///< the psElemType to use for mask image75 # define PS_TYPE_MASK_DATA U8 ///< the data member to use for mask image76 # define PS_TYPE_MASK_NAME "psU8"74 #define PS_TYPE_MASK PS_TYPE_U8 ///< the psElemType to use for mask image 75 #define PS_TYPE_MASK_DATA U8 ///< the data member to use for mask image 76 #define PS_TYPE_MASK_NAME "psU8" 77 77 typedef psU8 psMaskType; ///< the C datatype for a mask image 78 78 79 # define PS_MIN_S8 INT8_MIN80 # define PS_MIN_S16 INT16_MIN81 # define PS_MIN_S32 INT32_MIN82 # define PS_MIN_S64 INT64_MIN83 # define PS_MIN_U8 084 # define PS_MIN_U16 085 # define PS_MIN_U32 086 # define PS_MIN_U64 087 # define PS_MIN_F32 -FLT_MAX88 # define PS_MIN_F64 -DBL_MAX89 # define PS_MIN_C32 -FLT_MAX90 # define PS_MIN_C64 -DBL_MAX79 #define PS_MIN_S8 INT8_MIN 80 #define PS_MIN_S16 INT16_MIN 81 #define PS_MIN_S32 INT32_MIN 82 #define PS_MIN_S64 INT64_MIN 83 #define PS_MIN_U8 0 84 #define PS_MIN_U16 0 85 #define PS_MIN_U32 0 86 #define PS_MIN_U64 0 87 #define PS_MIN_F32 -FLT_MAX 88 #define PS_MIN_F64 -DBL_MAX 89 #define PS_MIN_C32 -FLT_MAX 90 #define PS_MIN_C64 -DBL_MAX 91 91 92 # define PS_MAX_S8 INT8_MAX93 # define PS_MAX_S16 INT16_MAX94 # define PS_MAX_S32 INT32_MAX95 # define PS_MAX_S64 INT64_MAX96 # define PS_MAX_U8 UINT8_MAX97 # define PS_MAX_U16 UINT16_MAX98 # define PS_MAX_U32 UINT32_MAX99 # define PS_MAX_U64 UINT64_MAX100 # define PS_MAX_F32 FLT_MAX101 # define PS_MAX_F64 DBL_MAX102 # define PS_MAX_C32 FLT_MAX103 # define PS_MAX_C64 DBL_MAX92 #define PS_MAX_S8 INT8_MAX 93 #define PS_MAX_S16 INT16_MAX 94 #define PS_MAX_S32 INT32_MAX 95 #define PS_MAX_S64 INT64_MAX 96 #define PS_MAX_U8 UINT8_MAX 97 #define PS_MAX_U16 UINT16_MAX 98 #define PS_MAX_U32 UINT32_MAX 99 #define PS_MAX_U64 UINT64_MAX 100 #define PS_MAX_F32 FLT_MAX 101 #define PS_MAX_F64 DBL_MAX 102 #define PS_MAX_C32 FLT_MAX 103 #define PS_MAX_C64 DBL_MAX 104 104 105 105 /// Macro to get the bad pixel reason code (stored as part of mask value) 106 # define PS_BADPIXEL_BITMASK 0x0f107 # define PS_GET_BADPIXEL(maskValue) (maskValue & PS_BADPIXEL_BITMASK)106 #define PS_BADPIXEL_BITMASK 0x0f 107 #define PS_GET_BADPIXEL(maskValue) (maskValue & PS_BADPIXEL_BITMASK) 108 108 109 # define PS_IS_BADPIXEL(maskValue) (PS_GET_BADPIXEL(maskValue) != 0)109 #define PS_IS_BADPIXEL(maskValue) (PS_GET_BADPIXEL(maskValue) != 0) 110 110 111 111 /// Macro to apply a bad pixel reason code to mask image 112 # define PS_SET_BADPIXEL(maskValue, reasonCode) \112 #define PS_SET_BADPIXEL(maskValue, reasonCode) \ 113 113 { \ 114 114 maskValue = (psMaskType)((reasonCode & PS_BADPIXEL_BITMASK) | (maskValue & ~PS_BADPIXEL_BITMASK)); \ … … 116 116 117 117 /// Macro to determine if the psElemType is an integer. 118 # define PS_IS_PSELEMTYPE_INT(x) ((x & 0x100) == 0x100)118 #define PS_IS_PSELEMTYPE_INT(x) ((x & 0x100) == 0x100) 119 119 /// Macro to determine if the psElemType is unsigned. 120 # define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200)120 #define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200) 121 121 /// Macro to determine if the psElemType is a real (non-complex) floating-point type. 122 # define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400)122 #define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400) 123 123 /// Macro to determine if the psElemType is complex number type. 124 # define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)124 #define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800) 125 125 /// Macro to determine the storage size, in bytes, of the psElemType. 126 # define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )126 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) ) 127 127 128 128 /** Dimensions of a data type.
Note:
See TracChangeset
for help on using the changeset viewer.
