2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2010,2014, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
41 #include "gromacs/utility/basedefinitions.h"
48 /* Abstract type for warning bookkeeping */
49 typedef struct warninp *warninp_t;
53 init_warning(gmx_bool bAllowWarnings, int maxwarning);
54 /* Initialize the warning data structure.
55 * If bAllowWarnings=FALSE, all warnings (calls to warning()) will be
56 * transformed into errors, calls to warning_note still produce notes.
57 * maxwarning determines the maximum number of warnings that are allowed
58 * for proceeding. When this number is exceeded check_warning_error
59 * and done_warning will generate a fatal error.
60 * bAllowWarnings=TRUE should only be used by programs that have
61 * 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 */
69 get_warning_line(warninp_t wi);
70 /* Get linenumber for the warning */
74 get_warning_file(warninp_t wi);
75 /* Get filename for the warning */
78 warning(warninp_t wi, const char *s);
79 /* Issue a warning, with the string s. If s == NULL, then warn_buf
80 * will be printed instead. The file and line set by set_warning_line
81 * are printed, nwarn_warn (local) is incremented.
82 * A fatal error will be generated after processing the input
83 * when nwarn_warn is larger than maxwarning passed to init_warning.
84 * So warning should only be called for issues that should be resolved,
85 * otherwise warning_note should be called.
89 warning_note(warninp_t wi, const char *s);
90 /* Issue a note, with the string s. If s == NULL, then warn_buf
91 * will be printed instead. The file and line set by set_warning_line
92 * are printed, nwarn_note (local) is incremented.
93 * This is for issues which could be a problem for some systems,
94 * but 100% ok for other systems.
98 warning_error(warninp_t wi, const char *s);
99 /* Issue an error, with the string s. If s == NULL, then warn_buf
100 * will be printed instead. The file and line set by set_warning_line
101 * are printed, nwarn_error (local) is incremented.
105 check_warning_error(warninp_t wi, int f_errno, const char *file, int line);
106 /* When warning_error has been called at least once gmx_fatal is called,
107 * otherwise does nothing.
111 done_warning(warninp_t wi, int f_errno, const char *file, int line);
112 /* Should be called when finished processing the input file.
113 * Prints the number of notes and warnings
114 * and generates a fatal error when errors were found or too many
115 * warnings were generatesd.
116 * Frees the data structure pointed to by wi.
120 _too_few(warninp_t wi, const char *fn, int line);
121 #define too_few(wi) _too_few(wi, __FILE__, __LINE__)
122 /* Issue a warning stating 'Too few parameters' */
125 _incorrect_n_param(warninp_t wi, const char *fn, int line);
126 #define incorrect_n_param(wi) _incorrect_n_param(wi, __FILE__, __LINE__)
127 /* Issue a warning stating 'Incorrect number of parameters' */
133 #endif /* _warninp_h */