CMR
1.3.0
|
Basic functionality of the software library. More...
#include <cmr/config.h>
#include <cmr/export.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | CMR_UNUSED(x) (void)(x) |
#define | CMR_CALL(call) |
Call wrapper for calls returning a CMR_ERROR. More... | |
#define | CMRallocBlock(cmr, ptr) _CMRallocBlock(cmr, (void**) ptr, sizeof(**ptr)) |
Allocates block memory for *ptr . More... | |
#define | CMRfreeBlock(cmr, ptr) _CMRfreeBlock(cmr, (void**) ptr, sizeof(**ptr)) |
Frees a block memory chunk allocated with CMRallocBlock. More... | |
#define | CMRallocBlockArray(cmr, ptr, length) _CMRallocBlockArray(cmr, (void**) ptr, sizeof(**ptr), length) |
Allocates block memory for an array of chunks. More... | |
#define | CMRreallocBlockArray(cmr, ptr, length) _CMRreallocBlockArray(cmr, (void**) ptr, sizeof(**ptr), length) |
Reallocates block memory of an array of chunks. More... | |
#define | CMRduplicateBlockArray(cmr, ptr, length, source) _CMRduplicateBlockArray(cmr, (void**) ptr, sizeof(**ptr), length, source) |
Allocates block memory for an array of chunks and copies it from source . More... | |
#define | CMRfreeBlockArray(cmr, ptr) _CMRfreeBlockArray(cmr, (void**) ptr) |
Carries out the deallocation for CMRfreeBlockArray. More... | |
Typedefs | |
typedef struct CMR_ENVIRONMENT | CMR |
Environment for computations. More... | |
Enumerations | |
enum | CMR_ERROR { CMR_OKAY = 0 , CMR_ERROR_INPUT = 1 , CMR_ERROR_OUTPUT = 2 , CMR_ERROR_MEMORY = 3 , CMR_ERROR_INVALID = 4 , CMR_ERROR_OVERFLOW = 5 , CMR_ERROR_TIMEOUT = 6 , CMR_ERROR_STRUCTURE = 7 } |
Type for return codes of library functions. More... | |
Functions | |
CMR_EXPORT CMR_ERROR | CMRcreateEnvironment (CMR **pcmr) |
Allocates and initializes a default CMR environment. More... | |
CMR_EXPORT CMR_ERROR | CMRfreeEnvironment (CMR **pcmr) |
Frees a CMR environment. More... | |
CMR_EXPORT CMR_ERROR | _CMRallocBlock (CMR *cmr, void **ptr, size_t size) |
Carries out the allocation for CMRallocBlock. More... | |
CMR_EXPORT CMR_ERROR | _CMRfreeBlock (CMR *cmr, void **ptr, size_t size) |
Carries out the deallocation for CMRfreeBlock. More... | |
CMR_EXPORT CMR_ERROR | _CMRallocBlockArray (CMR *cmr, void **ptr, size_t size, size_t length) |
Carries out the allocation for CMRallocBlockArray. More... | |
CMR_EXPORT CMR_ERROR | _CMRreallocBlockArray (CMR *cmr, void **ptr, size_t size, size_t length) |
Carries out the reallocation for CMRreallocBlockArray. More... | |
CMR_EXPORT CMR_ERROR | _CMRduplicateBlockArray (CMR *cmr, void **ptr, size_t size, size_t length, void *source) |
Carries out the duplication for CMRduplicateBlockArray. More... | |
CMR_EXPORT CMR_ERROR | _CMRfreeBlockArray (CMR *cmr, void **ptr) |
CMR_EXPORT char * | CMRgetErrorMessage (CMR *cmr) |
Returns the error message (or NULL if no error with a message occured). More... | |
CMR_EXPORT void | CMRclearErrorMessage (CMR *cmr) |
Clears the error message. More... | |
Basic functionality of the software library.
#define CMR_CALL | ( | call | ) |
Call wrapper for calls returning a CMR_ERROR.
#define CMR_UNUSED | ( | x | ) | (void)(x) |
#define CMRallocBlock | ( | cmr, | |
ptr | |||
) | _CMRallocBlock(cmr, (void**) ptr, sizeof(**ptr)) |
Allocates block memory for *ptr
.
Block memory shall be freed with CMRfreeBlock. The size is determined automatically.
#define CMRallocBlockArray | ( | cmr, | |
ptr, | |||
length | |||
) | _CMRallocBlockArray(cmr, (void**) ptr, sizeof(**ptr), length) |
Allocates block memory for an array of chunks.
The block memory shall be freed with CMRfreeBlockArray. Its size can be changed via CMRreallocBlockArray. The size of each chunk is determined automatically.
#define CMRduplicateBlockArray | ( | cmr, | |
ptr, | |||
length, | |||
source | |||
) | _CMRduplicateBlockArray(cmr, (void**) ptr, sizeof(**ptr), length, source) |
Allocates block memory for an array of chunks and copies it from source
.
The block memory shall be freed with CMRfreeBlockArray. Its size can be changed via CMRreallocBlockArray. The size of each chunk is determined automatically.
#define CMRfreeBlock | ( | cmr, | |
ptr | |||
) | _CMRfreeBlock(cmr, (void**) ptr, sizeof(**ptr)) |
Frees a block memory chunk allocated with CMRallocBlock.
#define CMRfreeBlockArray | ( | cmr, | |
ptr | |||
) | _CMRfreeBlockArray(cmr, (void**) ptr) |
Carries out the deallocation for CMRfreeBlockArray.
#define CMRreallocBlockArray | ( | cmr, | |
ptr, | |||
length | |||
) | _CMRreallocBlockArray(cmr, (void**) ptr, sizeof(**ptr), length) |
Reallocates block memory of an array of chunks.
The block memory shall be freed with CMRfreeBlockArray. The size of each chunk is determined automatically.
typedef struct CMR_ENVIRONMENT CMR |
Environment for computations.
Manages memory, threading, output and parameters.
enum CMR_ERROR |
Type for return codes of library functions.
Carries out the allocation for CMRallocBlock.
Carries out the allocation for CMRallocBlockArray.
CMR_EXPORT CMR_ERROR _CMRduplicateBlockArray | ( | CMR * | cmr, |
void ** | ptr, | ||
size_t | size, | ||
size_t | length, | ||
void * | source | ||
) |
Carries out the duplication for CMRduplicateBlockArray.
Carries out the deallocation for CMRfreeBlock.
Carries out the reallocation for CMRreallocBlockArray.
CMR_EXPORT void CMRclearErrorMessage | ( | CMR * | cmr | ) |
Clears the error message.
cmr | CMR environment. |