4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Giving Russians Opium May Alter Current Situation
40 static char *SRCID_fatal_h = "$Id$";
46 #ident "@(#) fatal.h 1.9 11/23/92"
47 #endif /* HAVE_IDENT */
57 extern void _where(char *file,int line);
58 #define where() _where(__FILE__,__LINE__)
59 /* Prints filename and line to stdlog and only on amba memvail */
61 extern void _halt(char *file,int line,char *reason);
62 #define HALT(reason) _halt(__FILE__,__LINE__,reason)
63 /* Halts the program with an error message */
65 extern void _set_fatal_tmp_file(char *fn, char *file, int line);
66 #define set_fatal_tmp_file(fn) _set_fatal_tmp_file(fn,__FILE__,__LINE__)
67 /* set filename to be removed when fatal_error is called */
69 extern void _unset_fatal_tmp_file(char *fn, char *file, int line);
70 #define unset_fatal_tmp_file(fn) _unset_fatal_tmp_file(fn,__FILE__,__LINE__)
71 /* unsets filename to be removed */
73 extern void fatal_error(int fatal_errno,char *fmt,...);
75 * Routine fatal_error prints
77 * "fatal error file %s line %s \n\t "
79 * followed by the string specified by fmt and supplied parameters. If
80 * errno is 0, only the message and arguments are printed. If errno is
81 * a legal system errno or -1, a perror like message is printed after the
82 * first message, if errno is -1, the last system errno will be used.
83 * The format of fmt is that like printf etc, only %d, %x, %c, %f and %s
84 * are allowed as format specifiers.
87 /* This include must not be moved upwards, to prevent compilation problems */
90 extern void init_warning(int maxwarning);
91 /* Set the max number of warnings */
93 extern void set_warning_line(char *fn,int line);
94 /* Set filename and linenumber for the warning */
96 extern int get_warning_line(void);
97 /* Get linenumber for the warning */
99 extern char *get_warning_file(void);
100 /* Get filename for the warning */
102 extern char warn_buf[1024];
103 /* Warning buffer of 1024 bytes, which can be used to print messages to */
105 extern void warning(char *s);
106 /* Issue a warning, with the string s. If s == NULL, then warn_buf
107 * will be printed instead.
110 extern void print_warn_num(void);
111 /* Print the total number of warnings, if larger than 0 */
113 extern void _too_few(char *fn,int line);
114 #define too_few() _too_few(__FILE__,__LINE__)
115 /* Issue a warning stating 'Too few parameters' */
117 extern void _invalid_case(char *fn,int line);
118 #define invalid_case() _invalid_case(__FILE__,__LINE__)
119 /* Issue a warning stating 'Invalid case in switch' */
121 extern void _unexpected_eof(char *fn,int line,char *srcfn,int srcline);
122 #define unexpected_eof(fn,line) _unexpected_eof(fn,line,__FILE__,__LINE__)
125 * Functions can write to this file for debug info
126 * Before writing to it, it should be checked whether
128 * if (debug) fprintf(debug,"%s","Hallo");
132 void init_debug (char *dbgfile);
134 extern bool bDebugMode(void);
135 /* Return TRUE when the program was started in debug mode */
138 extern void doexceptions(void);
139 /* Set exception handlers for debugging */
146 #endif /* _fatal_h */