31 #include "ple_config.h"
60 #define PLE_MALLOC(_ptr, _ni, _type) \
61 _ptr = (_type *) ple_mem_malloc(_ni, sizeof(_type), \
62 #_ptr, __FILE__, __LINE__)
76 #define PLE_REALLOC(_ptr, _ni, _type) \
77 _ptr = (_type *) ple_mem_realloc(_ptr, _ni, sizeof(_type), \
78 #_ptr, __FILE__, __LINE__)
94 #define PLE_FREE(_ptr) \
95 ple_mem_free(_ptr, #_ptr, __FILE__, __LINE__), _ptr = NULL
99 #define PLE_FREE(_ptr) \
100 _ptr = ple_mem_free(_ptr, #_ptr, __FILE__, __LINE__)
123 #if defined(PLE_HAVE_LONG_LNUM)
135 #if defined(PLE_HAVE_MPI)
137 #define PLE_MPI_TAG (int)('P'+'L'+'E')
139 #if defined(PLE_HAVE_LONG_LNUM)
140 # define PLE_MPI_LNUM MPI_LONG
142 # define PLE_MPI_LNUM MPI_INT
145 #define PLE_MPI_COORD MPI_DOUBLE
156 #define PLE_UNUSED(x) (void)(x)
162 #undef PLE_BEGIN_C_DECLS
163 #undef PLE_END_C_DECLS
165 #if defined(__cplusplus)
166 # define PLE_BEGIN_C_DECLS extern "C" {
167 # define PLE_END_C_DECLS }
169 # define PLE_BEGIN_C_DECLS
170 # define PLE_END_C_DECLS
177 #undef PLE_BEGIN_EXAMPLE_SCOPE
178 #undef PLE_END_EXAMPLE_SCOPE
180 #define PLE_BEGIN_EXAMPLE_SCOPE {
181 #define PLE_END_EXAMPLE_SCOPE }
194 const int sys_error_code,
201 const char *var_name,
202 const char *file_name,
209 const char *var_name,
210 const char *file_name,
215 const char *var_name,
216 const char *file_name,
277 const int sys_error_code,
322 const char *var_name,
323 const char *file_name,
350 const char *var_name,
351 const char *file_name,
375 const char *var_name,
376 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:192
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:206
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_malloc_t(size_t ni, size_t size, const char *var_name, const char *file_name, int line_num)
Definition: ple_defs.h:199
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
double ple_timer_wtime(void)
Return Wall clock time.
Definition: ple_defs.c:609
int ple_lnum_t
Definition: ple_defs.h:126
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_free(void *ptr, const char *var_name, const char *file_name, int line_num)
Free allocated memory.
Definition: ple_defs.c:539
double ple_coord_t
Definition: ple_defs.h:129
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
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
void *() ple_mem_free_t(void *ptr, const char *var_name, const char *file_name, int line_num)
Definition: ple_defs.h:214
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
ple_error_handler_t * ple_error_handler_get(void)
Returns the error handler associated with the ple_error() function.
Definition: ple_defs.c:449
ple_printf_t * ple_printf_function_get(void)
Returns function associated with the ple_printf() function.
Definition: ple_defs.c:393
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:188