- Timestamp:
- Apr 21, 2008, 2:19:24 PM (17 years ago)
- Children:
- f2ce71c
- Parents:
- 36f85c
- git-author:
- Frederik Heber <heber@…> (04/18/08 15:25:05)
- git-committer:
- Frederik Heber <heber@…> (04/21/08 14:19:24)
- Location:
- pcp/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/errors.c
r36f85c re6a122 31 31 * \param *SpecialData is a typeless pointer on special data for error treatment, here detailed error message. 32 32 */ 33 void Error(enum Errors error, const void *SpecialData) 33 void Error_in(enum Errors error, const void *SpecialData, 34 const char *file, const int line) 34 35 { 35 36 const char *const error_msg[] = { 36 37 "SomeError", 37 "FileOpenParams\nUnable to open parameter file ",38 "FileOpenParams\nUnable to open parameter file\n", 38 39 "InitReading\n", 39 "MallocError\nUnable to allocate memory! ",40 "MallocError\nUnable to allocate memory!\n", 40 41 }; 41 42 int mytid; 42 43 MPI_Comm_rank(MPI_COMM_WORLD, &mytid); 43 44 fprintf(stderr, "\nProcess %i: ", mytid); 44 fprintf(stderr, "It has occured an error (%i): %s\n", error, error_msg[error]); 45 fprintf(stderr, "Error in file %s, line %d (%i): %s - ", 46 file, line, (int)error, error_msg[error]); 45 47 switch (error) { 46 48 case InitReading: -
pcp/src/errors.h
r36f85c re6a122 16 16 */ 17 17 18 // taken out of TREMOLO 19 /*@-namechecks@*/ 20 #ifndef __GNUC__ 21 # undef __attribute__ 22 # define __attribute__(x) 23 #endif 24 /*@=namechecks@*/ 18 25 19 26 /* Verschiedene Fehlertypen */ … … 25 32 /* SomeError: Falls man noch zu faul ist */ 26 33 34 27 35 /* Behandelt aufgetretene Fehler. error ist der Fehlertyp(enum Errors) 28 36 void *SpecialData ist ein untypisierter Zeiger auf Spezielle Daten zur Fehlerbehandlung. 29 37 Man koennte auch noch einen Zeiger auf eine Funktion uebergeben */ 30 void Error(enum Errors error, const void *SpecialData); 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__)); 31 45 32 46 #endif
Note:
See TracChangeset
for help on using the changeset viewer.