source: pcp/src/errors.c@ f70c2a

Last change on this file since f70c2a was e08f45, checked in by Frederik Heber <heber@…>, 17 years ago

Merge branch 'ConcaveHull' of ../espack2 into ConcaveHull

Conflicts:

molecuilder/src/boundary.cpp
molecuilder/src/boundary.hpp
molecuilder/src/builder.cpp
molecuilder/src/linkedcell.cpp
molecuilder/src/linkedcell.hpp
molecuilder/src/vector.cpp
molecuilder/src/vector.hpp
util/src/NanoCreator.c

Basically, this resulted from a lot of conversions two from spaces to one tab, which is my standard indentation. The mess was caused by eclipse auto-indenting. And in espack2:ConcaveHull was the new stuff, so all from ConcaveHull was replaced in case of doubt.
Additionally, vector had ofstream << operator instead ostream << ...

  • Property mode set to 100755
File size: 1.7 KB
Line 
1/** \file errors.c
2 * Error reporting.
3 * Contains just one function Error() which prints out a certain error message
4 * class and starts the debugger.
5 *
6 * Project: ParallelCarParrinello
7 * \author Jan Hamaekers
8 * \date 2000
9 *
10 * File: errors.c
11 * $Id: errors.c,v 1.11 2006/03/31 10:38:04 foo Exp $
12 *
13*/
14
15#ifdef HAVE_CONFIG_H
16#include <config.h>
17#endif
18
19#include<stdlib.h>
20#include<stdio.h>
21#include"data.h"
22#include"opt.h"
23#include"errors.h"
24
25
26/** Deals with occuring errors.
27 * Prints process id followed by error according to \ref Errors.
28 * In the case of MallocError \a *SpecialData contains additional text.
29 * Launches debugger, does afterwards MPI_abort and exit
30 *
31 * \note One could add another pointer to a function
32 *
33 * \sa StartDebugger()
34 * \param error is the type of error(enum Errors) on error_msg array
35 * \param *SpecialData is a typeless pointer on special data for error treatment, here detailed error message.
36*/
37void Error_in(enum Errors error, const void *SpecialData,
38 const char *file, const int line)
39{
40 const char *const error_msg[] = {
41 "SomeError",
42 "FileOpenParams\nUnable to open parameter file\n",
43 "InitReading\n",
44 "MallocError\nUnable to allocate memory!\n",
45 };
46 int mytid;
47 MPI_Comm_rank(MPI_COMM_WORLD, &mytid);
48 fprintf(stderr, "\nProcess %i: ", mytid);
49 fprintf(stderr, "Error in file %s, line %d (%i): %s - ",
50 file, line, (int)error, error_msg[error]);
51 switch (error) {
52 case InitReading:
53 case SomeError:
54 case MallocError:
55 if (SpecialData) fprintf(stderr, "%s\n", (const char*)SpecialData);
56 break;
57 default:
58 break;
59 }
60
61 StartDebugger();
62 MPI_Abort(MPI_COMM_WORLD, (int)error);
63 exit(EXIT_FAILURE); /* exit schreibt sowieso alle Dateipuffer aus */
64}
Note: See TracBrowser for help on using the repository browser.