1 | #ifndef errors_h
|
---|
2 | #define errors_h
|
---|
3 |
|
---|
4 | /** \file errors.h
|
---|
5 | * Header file for \ref errors.c
|
---|
6 | *
|
---|
7 | * Contains declarations of the functions implemented in \ref errors.c and
|
---|
8 | * the enumeration of the error class Errors.
|
---|
9 | *
|
---|
10 | Project: ParallelCarParrinello
|
---|
11 | Jan Hamaekers
|
---|
12 | 2000
|
---|
13 |
|
---|
14 | File: errors.h
|
---|
15 | $Id: errors.h,v 1.7 2006/03/30 22:19:52 foo Exp $
|
---|
16 | */
|
---|
17 |
|
---|
18 | // taken out of TREMOLO
|
---|
19 | /*@-namechecks@*/
|
---|
20 | #ifndef __GNUC__
|
---|
21 | # undef __attribute__
|
---|
22 | # define __attribute__(x)
|
---|
23 | #endif
|
---|
24 | /*@=namechecks@*/
|
---|
25 |
|
---|
26 | /* Verschiedene Fehlertypen */
|
---|
27 | enum Errors { SomeError, //!< some unclassified error
|
---|
28 | FileOpenParams, //!< Error opening parameter file
|
---|
29 | InitReading, //!< Error parsing parameter file
|
---|
30 | MallocError //!< Error while allocating memory
|
---|
31 | };
|
---|
32 | /* SomeError: Falls man noch zu faul ist */
|
---|
33 |
|
---|
34 |
|
---|
35 | /* Behandelt aufgetretene Fehler. error ist der Fehlertyp(enum Errors)
|
---|
36 | void *SpecialData ist ein untypisierter Zeiger auf Spezielle Daten zur Fehlerbehandlung.
|
---|
37 | Man koennte auch noch einen Zeiger auf eine Funktion uebergeben */
|
---|
38 | extern void /*@exits@*/ Error(enum Errors error, /*@null@*/ const void *SpecialData)
|
---|
39 | __attribute__ ((__noreturn__));
|
---|
40 | #define Error(err, data) Error_in((err), (data), __FILE__, __LINE__)
|
---|
41 |
|
---|
42 | extern void /*@exits@*/ Error_in(enum Errors error, /*@null@*/ const void *SpecialData,
|
---|
43 | const char *file, const int line)
|
---|
44 | __attribute__ ((__noreturn__));
|
---|
45 |
|
---|
46 | #endif
|
---|
47 |
|
---|