3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Gromacs Runs On Most of All Computer Systems
38 #include "visibility.h"
46 /* Abstract type for warning bookkeeping */
47 typedef struct warninp *warninp_t;
52 init_warning(gmx_bool bAllowWarnings,int maxwarning);
53 /* Initialize the warning data structure.
54 * If bAllowWarnings=FALSE, all warnings (calls to warning()) will be
55 * transformed into errors, calls to warning_note still produce notes.
56 * maxwarning determines the maximum number of warnings that are allowed
57 * for proceeding. When this number is exceeded check_warning_error
58 * and done_warning will generate a fatal error.
59 * bAllowWarnings=TRUE should only be used by programs that have
60 * a -maxwarn command line option.
65 set_warning_line(warninp_t wi,const char *fn,int line);
66 /* Set filename and linenumber for the warning */
70 get_warning_line(warninp_t wi);
71 /* Get linenumber for the warning */
76 get_warning_file(warninp_t wi);
77 /* Get filename for the warning */
81 warning(warninp_t wi,const char *s);
82 /* Issue a warning, with the string s. If s == NULL, then warn_buf
83 * will be printed instead. The file and line set by set_warning_line
84 * are printed, nwarn_warn (local) is incremented.
85 * A fatal error will be generated after processing the input
86 * when nwarn_warn is larger than maxwarning passed to init_warning.
87 * So warning should only be called for issues that should be resolved,
88 * otherwise warning_note should be called.
93 warning_note(warninp_t wi,const char *s);
94 /* Issue a note, with the string s. If s == NULL, then warn_buf
95 * will be printed instead. The file and line set by set_warning_line
96 * are printed, nwarn_note (local) is incremented.
97 * This is for issues which could be a problem for some systems,
98 * but 100% ok for other systems.
103 warning_error(warninp_t wi,const char *s);
104 /* Issue an error, with the string s. If s == NULL, then warn_buf
105 * will be printed instead. The file and line set by set_warning_line
106 * are printed, nwarn_error (local) is incremented.
111 check_warning_error(warninp_t wi,int f_errno,const char *file,int line);
112 /* When warning_error has been called at least once gmx_fatal is called,
113 * otherwise does nothing.
118 done_warning(warninp_t wi,int f_errno,const char *file,int line);
119 /* Should be called when finished processing the input file.
120 * Prints the number of notes and warnings
121 * and generates a fatal error when errors were found or too many
122 * warnings were generatesd.
123 * Frees the data structure pointed to by wi.
128 _too_few(warninp_t wi,const char *fn,int line);
129 #define too_few(wi) _too_few(wi,__FILE__,__LINE__)
130 /* Issue a warning stating 'Too few parameters' */
134 _incorrect_n_param(warninp_t wi,const char *fn,int line);
135 #define incorrect_n_param(wi) _incorrect_n_param(wi,__FILE__,__LINE__)
136 /* Issue a warning stating 'Incorrect number of parameters' */
142 #endif /* _warninp_h */