HiRep 0.1
Loading...
Searching...
No Matches
error_handling.h
Go to the documentation of this file.
1/***************************************************************************\
2* Copyright (c) 2008, Claudio Pica *
3* All rights reserved. *
4\***************************************************************************/
8
14#ifndef ERROR_HANDLING_H
15#define ERROR_HANDLING_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdio.h>
22
23//error.c
37void error(int test, int no, const char *name, const char *text, ...);
38
39//print_trace.c
40void print_trace(void);
41void register_sighandlers(void);
42
43//TODO: should we keep this here?
44#ifdef WITH_MPI
50#define CHECK_MPI(call) \
51 do { \
52 const int mpireturn = call; \
53 if (mpireturn != MPI_SUCCESS) { \
54 char message[MPI_MAX_ERROR_STRING]; \
55 int message_length; \
56 MPI_Error_string(mpireturn, message, &message_length); \
57 char errmsg[500]; \
58 sprintf(errmsg, "Error in: %s:%d, function: %s\n \
59 Communications call exited with code %d: %s\n", \
60 __FILE__, __LINE__, __func__, mpireturn, message); \
61 error(1, 1, __func__, errmsg); \
62 } \
63 } while (0)
64#endif
65
66#ifdef __cplusplus
67}
68#endif
69#endif
void error(int test, int no, const char *name, const char *text,...)
Print message to error file defined on startup.
Definition error.c:33