31#include "ple_config.h"
50#define PLE_ABS(a) ((a) < 0 ? -(a) : (a))
51#define PLE_MIN(a,b) ((a) > (b) ? (b) : (a))
52#define PLE_MAX(a,b) ((a) < (b) ? (b) : (a))
66#define PLE_MALLOC(_ptr, _ni, _type) \
67_ptr = (_type *) ple_mem_malloc(_ni, sizeof(_type), \
68 #_ptr, __FILE__, __LINE__)
82#define PLE_REALLOC(_ptr, _ni, _type) \
83_ptr = (_type *) ple_mem_realloc(_ptr, _ni, sizeof(_type), \
84 #_ptr, __FILE__, __LINE__)
100#define PLE_FREE(_ptr) \
101ple_mem_free(_ptr, #_ptr, __FILE__, __LINE__), _ptr = NULL
105#define PLE_FREE(_ptr) \
106_ptr = ple_mem_free(_ptr, #_ptr, __FILE__, __LINE__)
129#if defined(PLE_HAVE_LONG_LNUM)
141#if defined(PLE_HAVE_MPI)
143#define PLE_MPI_TAG (int)('P'+'L'+'E')
145#if defined(PLE_HAVE_LONG_LNUM)
146# define PLE_MPI_LNUM MPI_LONG
148# define PLE_MPI_LNUM MPI_INT
151#define PLE_MPI_COORD MPI_DOUBLE
162#define PLE_UNUSED(x) (void)(x)
168#undef PLE_BEGIN_C_DECLS
169#undef PLE_END_C_DECLS
171#if defined(__cplusplus)
172# define PLE_BEGIN_C_DECLS extern "C" {
173# define PLE_END_C_DECLS }
175# define PLE_BEGIN_C_DECLS
176# define PLE_END_C_DECLS
183#undef PLE_BEGIN_EXAMPLE_SCOPE
184#undef PLE_END_EXAMPLE_SCOPE
186#define PLE_BEGIN_EXAMPLE_SCOPE {
187#define PLE_END_EXAMPLE_SCOPE }
200 const int sys_error_code,
207 const char *var_name,
208 const char *file_name,
215 const char *var_name,
216 const char *file_name,
221 const char *var_name,
222 const char *file_name,
283 const int sys_error_code,
328 const char *var_name,
329 const char *file_name,
356 const char *var_name,
357 const char *file_name,
381 const char *var_name,
382 const char *file_name,
void() ple_error_handler_t(const char *file_name, const int line_num, const int sys_error_code, const char *format, va_list arg_ptr)
Definition: ple_defs.h:198
void *() ple_mem_malloc_t(size_t ni, size_t size, const char *var_name, const char *file_name, int line_num)
Definition: ple_defs.h:205
void ple_mem_functions_get(ple_mem_malloc_t **malloc_func, ple_mem_realloc_t **realloc_func, ple_mem_free_t **free_func)
Return the function pointers associated with PLE's memory management.
Definition: ple_defs.c:561
void *() ple_mem_free_t(void *ptr, const char *var_name, const char *file_name, int line_num)
Definition: ple_defs.h:220
int ple_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: ple_defs.c:371
void ple_mem_functions_set(ple_mem_malloc_t *malloc_func, ple_mem_realloc_t *realloc_func, ple_mem_free_t *free_func)
Associate functions to modifiy PLE's memory management.
Definition: ple_defs.c:587
void * ple_mem_free(void *ptr, const char *var_name, const char *file_name, int line_num)
Free allocated memory.
Definition: ple_defs.c:539
double ple_timer_wtime(void)
Return Wall clock time.
Definition: ple_defs.c:609
int ple_lnum_t
Definition: ple_defs.h:132
void ple_printf_function_set(ple_printf_t *f)
Associates a vprintf() type function with the ple_printf() function.
Definition: ple_defs.c:405
void ple_error_handler_set(ple_error_handler_t *handler)
Associates an error handler with the ple_error() function.
Definition: ple_defs.c:461
void * ple_mem_malloc(size_t ni, size_t size, const char *var_name, const char *file_name, int line_num)
Allocate memory for ni elements of size bytes.
Definition: ple_defs.c:483
double ple_coord_t
Definition: ple_defs.h:135
ple_printf_t * ple_printf_function_get(void)
Returns function associated with the ple_printf() function.
Definition: ple_defs.c:393
void * ple_mem_realloc(void *ptr, size_t ni, size_t size, const char *var_name, const char *file_name, int line_num)
Reallocate memory for ni elements of size bytes.
Definition: ple_defs.c:511
ple_error_handler_t * ple_error_handler_get(void)
Returns the error handler associated with the ple_error() function.
Definition: ple_defs.c:449
void ple_error(const char *file_name, const int line_num, const int sys_error_code, const char *format,...)
Calls the error handler (set by ple_error_handler_set() or default).
Definition: ple_defs.c:427
double ple_timer_cpu_time(void)
Return CPU time.
Definition: ple_defs.c:677
int() ple_printf_t(const char *const format, va_list arg_ptr)
Definition: ple_defs.h:194
void *() ple_mem_realloc_t(void *ptr, size_t ni, size_t size, const char *var_name, const char *file_name, int line_num)
Definition: ple_defs.h:212