1 #ifndef DYNAMITEwisememmanHEADERFILE 2 #define DYNAMITEwisememmanHEADERFILE 3 #ifdef _cplusplus 4 extern "C" { 5 #endif 6 7 #define CKALLOC_GUARD 8 #include "wisebase.h" 9 #undef CKALLOC_GUARD 10 11 #define WISE_MEMORY_WATCH_MAX 4096 12 13 14 15 /***************************************************/ 16 /* Callable functions */ 17 /* These are the functions you are expected to use */ 18 /***************************************************/ 19 20 21 22 /* Function: display_allocated_memory(tag,ofp) 23 * 24 * Descrip: Displays to filehandle all non freed memory 25 * 26 * 27 * Arg: tag [UNKN ] Undocumented argument [char *] 28 * Arg: ofp [UNKN ] Undocumented argument [FILE *] 29 * 30 */ 31 void Wise2_display_allocated_memory(char * tag,FILE * ofp); 32 #define display_allocated_memory Wise2_display_allocated_memory 33 34 35 /* Function: allocate_watched_memory_file(file,lineno,no_bytes) 36 * 37 * Descrip: Only if compiled with WISE_MEMORY_WATCH 38 * 39 * Allocates memory and watches the usage of it, 40 * knowing the file and line number 41 * 42 * 43 * Arg: file [UNKN ] Undocumented argument [char *] 44 * Arg: lineno [UNKN ] Undocumented argument [int] 45 * Arg: no_bytes [UNKN ] Undocumented argument [int] 46 * 47 * Return [UNKN ] Undocumented return value [void *] 48 * 49 */ 50 void * Wise2_allocate_watched_memory_file(char * file,int lineno,int no_bytes); 51 #define allocate_watched_memory_file Wise2_allocate_watched_memory_file 52 53 54 /* Function: allocate_watched_memory(no_bytes) 55 * 56 * Descrip: Only if compiled with WISE_MEMORY_WATCH 57 * 58 * Allocates memory and watches the usage of it 59 * 60 * 61 * Arg: no_bytes [UNKN ] Undocumented argument [int] 62 * 63 * Return [UNKN ] Undocumented return value [void *] 64 * 65 */ 66 void * Wise2_allocate_watched_memory(int no_bytes); 67 #define allocate_watched_memory Wise2_allocate_watched_memory 68 69 70 /* Function: free_watched_memory(mem) 71 * 72 * Descrip: Only if compiled with WISE_MEMORY_WATCH 73 * 74 * frees memory that has been watched 75 * 76 * 77 * Arg: mem [UNKN ] Undocumented argument [void *] 78 * 79 * Return [UNKN ] Undocumented return value [void *] 80 * 81 */ 82 void * Wise2_free_watched_memory(void * mem); 83 #define free_watched_memory Wise2_free_watched_memory 84 85 86 /* Function: ckalloc(bytes) 87 * 88 * Descrip: Tries to alloc bytes of memory. Posts 89 * to warn if it fails 90 * 91 * 92 * Arg: bytes [UNKN ] Undocumented argument [size_t] 93 * 94 * Return [UNKN ] Undocumented return value [void *] 95 * 96 */ 97 void * Wise2_ckalloc(size_t bytes); 98 #define ckalloc Wise2_ckalloc 99 100 101 /* Function: ckcalloc(len,bytes) 102 * 103 * Descrip: calloc equivalent 104 * 105 * 106 * Arg: len [UNKN ] Undocumented argument [int] 107 * Arg: bytes [UNKN ] Undocumented argument [size_t] 108 * 109 * Return [UNKN ] Undocumented return value [void *] 110 * 111 */ 112 void * Wise2_ckcalloc(int len,size_t bytes); 113 #define ckcalloc Wise2_ckcalloc 114 115 116 /* Function: ckrealloc(*ptr,bytes) 117 * 118 * Descrip: realloc equivalent 119 * 120 * 121 * Arg: *ptr [UNKN ] Undocumented argument [void] 122 * Arg: bytes [UNKN ] Undocumented argument [size_t] 123 * 124 * Return [UNKN ] Undocumented return value [void *] 125 * 126 */ 127 void * Wise2_ckrealloc(void *ptr, size_t bytes); 128 #define ckrealloc Wise2_ckrealloc 129 130 131 /* Function: ckfree(*ptr) 132 * 133 * Descrip: free equivalent 134 * 135 * 136 * Arg: *ptr [UNKN ] Undocumented argument [void] 137 * 138 * Return [UNKN ] Undocumented return value [void *] 139 * 140 */ 141 void * Wise2_ckfree(void *ptr); 142 #define ckfree Wise2_ckfree 143 144 145 /* Unplaced functions */ 146 /* There has been no indication of the use of these functions */ 147 148 149 /***************************************************/ 150 /* Internal functions */ 151 /* you are not expected to have to call these */ 152 /***************************************************/ 153 154 #ifdef _cplusplus 155 } 156 #endif 157 158 #endif 159