changed reading hint
[gromacs/adressmacs.git] / include / fatal.h
blob013713a812b5ff9c44a26c270836f69af9e96ff3
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Good ROcking Metal Altar for Chronical Sinners
30 #ifndef _fatal_h
31 #define _fatal_h
33 static char *SRCID_fatal_h = "$Id$";
35 #ifdef HAVE_IDENT
36 #ident "@(#) fatal.h 1.9 11/23/92"
37 #endif /* HAVE_IDENT */
39 #ifdef CPLUSPLUS
40 extern "C" {
41 #endif
43 #include <stdio.h>
44 #include <stdarg.h>
45 #include <errno.h>
47 extern void _where(char *file,int line);
48 #define where() _where(__FILE__,__LINE__)
49 /* Prints filename and line to stdlog and only on amba memvail */
51 extern void _halt(char *file,int line,char *reason);
52 #define HALT(reason) _halt(__FILE__,__LINE__,reason)
53 /* Halts the program with an error message */
55 extern void _set_fatal_tmp_file(char *fn, char *file, int line);
56 #define set_fatal_tmp_file(fn) _set_fatal_tmp_file(fn,__FILE__,__LINE__)
57 /* set filename to be removed when fatal_error is called */
59 extern void _unset_fatal_tmp_file(char *fn, char *file, int line);
60 #define unset_fatal_tmp_file(fn) _unset_fatal_tmp_file(fn,__FILE__,__LINE__)
61 /* unsets filename to be removed */
63 extern void fatal_error(int fatal_errno,char *fmt,...);
65 * Routine fatal_error prints
67 * "fatal error file %s line %s \n\t "
69 * followed by the string specified by fmt and supplied parameters. If
70 * errno is 0, only the message and arguments are printed. If errno is
71 * a legal system errno or -1, a perror like message is printed after the
72 * first message, if errno is -1, the last system errno will be used.
73 * The format of fmt is that like printf etc, only %d, %x, %c, %f and %s
74 * are allowed as format specifiers.
77 /* This include must not be moved upwards, to prevent compilation problems */
78 #include "typedefs.h"
80 extern void init_warning(int maxwarning);
81 /* Set the max number of warnings */
83 extern void set_warning_line(char *fn,int line);
84 /* Set filename and linenumber for the warning */
86 extern char warn_buf[1024];
87 /* Warning buffer of 1024 bytes, which can be used to print messages to */
89 extern void warning(char *s);
90 /* Issue a warning, with the string s. If s == NULL, then warn_buf
91 * will be printed instead.
94 extern void print_warn_num(void);
95 /* Print the total number of warnings, if larger than 0 */
97 extern void _too_few(char *fn,int line);
98 #define too_few() _too_few(__FILE__,__LINE__)
99 /* Issue a warning stating 'Too few parameters' */
101 extern void _invalid_case(char *fn,int line);
102 #define invalid_case() _invalid_case(__FILE__,__LINE__)
103 /* Issue a warning stating 'Invalid case in switch' */
105 extern void _unexpected_eof(char *fn,int line,char *srcfn,int srcline);
106 #define unexpected_eof(fn,line) _unexpected_eof(fn,line,__FILE__,__LINE__)
109 * Functions can write to this file for debug info
110 * Before writing to it, it should be checked whether
111 * the file is not 0:
112 * if (debug) fprintf(debug,"%s","Hallo");
114 extern FILE *debug;
116 void init_debug (char *dbgfile);
118 extern bool bDebugMode(void);
119 /* Return TRUE when the program was started in debug mode */
121 #ifdef USE_SGI_FPE
122 extern void doexceptions(void);
123 /* Set exception handlers for debugging */
124 #endif
126 #ifdef CPLUSPLUS
128 #endif
130 #endif /* _fatal_h */