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) \
101 ple_mem_free(_ptr, #_ptr, __FILE__, __LINE__), _ptr = NULL
105 #define PLE_FREE(_ptr) \
106 _ptr = ple_mem_free(_ptr, #_ptr, __FILE__, __LINE__)
126 #if defined(__STDC_VERSION__)
127 # if (__STDC_VERSION__ >= 199901L)
143 #if defined(PLE_HAVE_LONG_LNUM)
155 #if defined(PLE_HAVE_MPI)
157 #define PLE_MPI_TAG (int)('P'+'L'+'E')
159 #if defined(PLE_HAVE_LONG_LNUM)
160 # define PLE_MPI_LNUM MPI_LONG
162 # define PLE_MPI_LNUM MPI_INT
165 #define PLE_MPI_COORD MPI_DOUBLE
176 #define PLE_UNUSED(x) (void)(x)
182 #undef PLE_BEGIN_C_DECLS
183 #undef PLE_END_C_DECLS
185 #if defined(__cplusplus)
186 # define PLE_BEGIN_C_DECLS extern "C" {
187 # define PLE_END_C_DECLS }
189 # define PLE_BEGIN_C_DECLS
190 # define PLE_END_C_DECLS
197 #undef PLE_BEGIN_EXAMPLE_SCOPE
198 #undef PLE_END_EXAMPLE_SCOPE
200 #define PLE_BEGIN_EXAMPLE_SCOPE {
201 #define PLE_END_EXAMPLE_SCOPE }
214 const int sys_error_code,
221 const char *var_name,
222 const char *file_name,
229 const char *var_name,
230 const char *file_name,
235 const char *var_name,
236 const char *file_name,
297 const int sys_error_code,
342 const char *var_name,
343 const char *file_name,
370 const char *var_name,
371 const char *file_name,
395 const char *var_name,
396 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:212
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:226
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:557
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:219
int ple_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: ple_defs.c:367
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:583
double ple_timer_wtime(void)
Return Wall clock time.
Definition: ple_defs.c:605
int ple_lnum_t
Definition: ple_defs.h:146
void ple_printf_function_set(ple_printf_t *f)
Associates a vprintf() type function with the ple_printf() function.
Definition: ple_defs.c:401
void ple_error_handler_set(ple_error_handler_t *handler)
Associates an error handler with the ple_error() function.
Definition: ple_defs.c:457
void * ple_mem_free(void *ptr, const char *var_name, const char *file_name, int line_num)
Free allocated memory.
Definition: ple_defs.c:535
double ple_coord_t
Definition: ple_defs.h:149
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:479
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:507
void *() ple_mem_free_t(void *ptr, const char *var_name, const char *file_name, int line_num)
Definition: ple_defs.h:234
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:423
ple_error_handler_t * ple_error_handler_get(void)
Returns the error handler associated with the ple_error() function.
Definition: ple_defs.c:445
ple_printf_t * ple_printf_function_get(void)
Returns function associated with the ple_printf() function.
Definition: ple_defs.c:389
double ple_timer_cpu_time(void)
Return CPU time.
Definition: ple_defs.c:673
int() ple_printf_t(const char *const format, va_list arg_ptr)
Definition: ple_defs.h:208