1 #ifndef CMR_ENV_INTERNAL_H
2 #define CMR_ENV_INTERNAL_H
10 #if defined(CMR_DEBUG)
13 void CMRdbgMsg(
int indent,
const char* format, ...)
17 for (
int i = 0; i < indent; ++i)
19 va_start(args, format);
20 vprintf(format, args);
68 #define CMRallocStack(cmr, ptr) \
69 _CMRallocStack(cmr, (void**) ptr, sizeof(**ptr))
88 #define CMRfreeStack(cmr, ptr) \
89 _CMRfreeStack(cmr, (void**) ptr, sizeof(**ptr))
107 #define CMRallocStackArray(cmr, ptr, length) \
108 _CMRallocStack(cmr, (void**) ptr, sizeof(**ptr) * (length))
114 #define CMRfreeStackArray(cmr, ptr) \
115 _CMRfreeStack(cmr, (void**) ptr)
154 #if defined(CMR_DEBUG)
166 #define CMRdbgConsistencyAssert( call ) \
169 char* __message = call; \
173 fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, __message); \
176 assert(!"Consistency assertion raised!"); \
183 #define CMRdbgConsistencyAssert( call )
Basic functionality of the software library.
#define CMR_UNUSED(x)
Definition: env.h:24
CMR_ERROR
Type for return codes of library functions.
Definition: env.h:32
size_t CMRgetStackUsage(CMR *cmr)
Definition: env.c:366
char * CMRconsistencyMessage(const char *format,...)
Definition: env.c:411
void CMRassertStackConsistency(CMR *cmr)
Checks stack protection fields for corruption.
Definition: env.c:339
CMR_EXPORT CMR_ERROR _CMRfreeStack(CMR *cmr, void **ptr)
Carries out the deallocation for CMRfreeStack.
Definition: env.c:284
CMR_EXPORT CMR_ERROR _CMRallocStack(CMR *cmr, void **ptr, size_t size)
Carries out the allocation for CMRallocStack.
Definition: env.c:209
static void CMRdbgMsg(int indent, const char *format,...)
Definition: env_internal.h:28
void CMRraiseErrorMessage(CMR *cmr, const char *format,...)
Definition: env.c:378
Definition: env_internal.h:45
size_t numStacks
Number of allocated stacks in stack array.
Definition: env_internal.h:53
size_t memStacks
Memory for stack array.
Definition: env_internal.h:54
CMR_STACK * stacks
Array of stacks.
Definition: env_internal.h:56
int numThreads
Number of threads to use.
Definition: env_internal.h:51
char * errorMessage
Error message.
Definition: env_internal.h:46
int verbosity
Verbosity level.
Definition: env_internal.h:50
bool closeOutput
Whether to close the output stream at the end.
Definition: env_internal.h:49
size_t currentStack
Index of last used stack.
Definition: env_internal.h:55
FILE * output
Output stream or NULL if silent.
Definition: env_internal.h:48
Definition: env_internal.h:39
size_t top
First used byte.
Definition: env_internal.h:41
char * memory
Raw memory.
Definition: env_internal.h:40